diff -r 594d59766373 -r 7d48bed6ce0c satengine/SatServer/Engine/src/CSatSIconSubSession.cpp --- a/satengine/SatServer/Engine/src/CSatSIconSubSession.cpp Thu Aug 19 10:28:14 2010 +0300 +++ b/satengine/SatServer/Engine/src/CSatSIconSubSession.cpp Tue Aug 31 15:45:17 2010 +0300 @@ -219,27 +219,44 @@ LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL calling" ) - if ( iInfo.iLength == iIconData->Length() ) + LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \ + infoLength: %x", iInfo.iLength ) + + LOG2( NORMAL, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \ + dataLength: %x", iIconData->Length() ) + + // Get the CLUT and convert the icon data to bitmap. + + // basic icon has empty CLUT + if ( RSat::KBasic == iInfo.iCoding ) { - LOG( SIMPLE, "SATENGINE: CSatSIconSubSession::NotifyGetIconInstanceL \ - length equal" ) - // Get the clut and convert the icon data to bitmap. - if ( RSat::KBasic == iInfo.iCoding ) + // For the basi icon the length from the icon info and icon data + // body should have the same length but for the clore icon the + // length not always same. + if ( iInfo.iLength == iIconData->Length() ) { LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ - get the clut" ) + get the basic clut" ) // Basic icon does not have CLUT. iClut = KNullDesC8().AllocL(); - // Complete icon. NotifyGetClutL(); } else { LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ - others" ) - TPtr8 iconDataPtr( iIconData->Des() ); + notify failure basic" ) + NotifyFailure( KErrCorrupt ); + } + } + else // color icon + { + LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ + others" ) + TPtr8 iconDataPtr( iIconData->Des() ); + if ( iconDataPtr.Length() >= KNumberOfCLUTByte + 1 ) + { // Create buffer for clut. Each clut entry contains // intensity of red, green and blue. The value of 0 is // interpreted as 256 clut entries. (ETSI TS 131 102 V4.10.0). @@ -250,12 +267,17 @@ { numberOfClutEntries = KDefaultNumberOfClutEntries; } - + // Start getting the icon color lookup table from SIM. - iClut = HBufC8::NewL( numberOfClutEntries * KClutEntrySize ); - - if ( iconDataPtr.Length() >= KNumberOfCLUTByte + 1 ) + TInt length = numberOfClutEntries * KClutEntrySize; + // In some situation the length we get from the icon information + // includes the length of the CLUT and some time it doesn't + // Both situation a valid. + if ( ( iInfo.iLength == iIconData->Length() ) + || ( iInfo.iLength == iIconData->Length() + length ) ) { + iClut = HBufC8::NewL( length ); + LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ get clut" ) const TUint offset( iconDataPtr[KColourDepthByte] << 8 | @@ -271,12 +293,12 @@ NotifyFailure( KErrCorrupt ); } } - } - else - { - LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ - notify failure" ) - NotifyFailure( KErrCorrupt ); + else + { + LOG( SIMPLE, "CSatSIconSubSession::NotifyGetIconInstanceL \ + others notify failure" ) + NotifyFailure( KErrCorrupt ); + } } LOG( SIMPLE,