diff -r 84d9eb65b26f -r 2981cb3aa489 mmsengine/mmscodec/src/mmsencode.cpp --- a/mmsengine/mmscodec/src/mmsencode.cpp Mon May 03 12:29:07 2010 +0300 +++ b/mmsengine/mmscodec/src/mmsencode.cpp Wed Nov 03 09:52:46 2010 +0530 @@ -853,7 +853,7 @@ User::LeaveIfError( iEntryWrapper->SetCurrentEntry( iCurrentMessageId ) ); /* Korean req: 415-5434 - * Get the target encoding MIB enum from cenrep and encode MMS text objects using corresponding conversion plugins + * Get the target encoding MIB enum from cenrep and encode MMS text objects using coresponding conversion plugins */ TInt temp; iTargetEncodingType = 0; @@ -869,9 +869,8 @@ if( iTargetEncodingType != 0 ) { +#ifndef _NO_MMSS_LOGGING_ TRAPD( err, PreProcessAttachmentDataL() ); - -#ifndef _NO_MMSS_LOGGING_ /* if any error, korean specific encoding failed, But this should not stop from sending MMS using * existing default encoding. Hence just log the error and continue in any case */ @@ -879,6 +878,8 @@ { TMmsLogger::Log( _L("CMmsEncode::EncodeHeadersChunkedL:: PreProcessAttachmentDataL error: %d"), err ); } +#else + TRAP_IGNORE( PreProcessAttachmentDataL() ); #endif /* _NO_MMSS_LOGGING_ */ } @@ -941,7 +942,7 @@ #ifndef _NO_MMSS_LOGGING_ TMmsLogger::Log( _L("CMmsEncode::EncodeHeadersChunkedL:: only one chunk") ); #endif /* _NO_MMSS_LOGGING_ */ // The message is small enough to be sent as one chunk - for ( i = 0; ( i < iNumberOfAttachments ) && ( iError == KErrNone ); ++i ) + for ( i = 0; ( i < iNumberOfAttachments ) && ( iError == KErrNone ); i++ ) { iCurrentAttachment = i; // encode attachments, too, as we have decided that our message @@ -963,7 +964,7 @@ // chunked sending - but it should be possible to calculate data size iOverallDataSize = iPosition; // This is the amount taken by headers // The message is small enough to be sent as one chunk - for ( i = 0; ( i < iNumberOfAttachments ) && ( iError == KErrNone ); ++i ) + for ( i = 0; ( i < iNumberOfAttachments ) && ( iError == KErrNone ); i++ ) { iCurrentAttachment = i; // encode attachments, too, as we have decided that our message @@ -1259,7 +1260,7 @@ } TInt8 i; - for ( i = 0; i < KNumberContentTypes && aContentType < 0; ++i ) + for ( i = 0; i < KNumberContentTypes && aContentType < 0; i++ ) { if ( aContentTypeString.CompareF( TPtrC8( KContentTypeTable[i] ) ) == 0 ) @@ -1294,7 +1295,7 @@ aHeaderLength += 1; // terminating zero } - // If we have parameters, we must calculate their length. + // If we have paramters, we must calculate their length. if ( iMimeHeaders->MimeCharset() != 0 ) { // charset has well-known encoding @@ -1382,7 +1383,7 @@ } if ( ( iMimeHeaders->ContentTypeParams().MdcaCount() % 2 ) == 1 ) { - // Odd number. Obviously last parameter has no value. + // Odd number. Obviously last paramter has no value. // Add the "no value" token aHeaderLength++; } @@ -1499,7 +1500,7 @@ // replace all illegal characters by underscore buf8 = HBufC8::NewL( nameLength ); CleanupStack::PushL( buf8 ); - for ( j = 0; j < nameLength; ++j ) + for ( j = 0; j < nameLength; j++ ) { oneCharacter.Copy( originalName.Mid( j, 1 ) ); if ( !IsStringSafe( oneCharacter ) ) @@ -1622,7 +1623,7 @@ // X-parameter[i] = parameter name // X-parameter[i+1] = parameter value - for ( i = 0; i < iMimeHeaders->XTypeParams().MdcaCount(); ++i ) + for ( i = 0; i < iMimeHeaders->XTypeParams().MdcaCount(); i++ ) { // If we have corrupted parameters (length of name is zero) // we skip the name/value pair. @@ -1644,7 +1645,7 @@ } if ( ( iMimeHeaders->XTypeParams().MdcaCount() % 2 ) == 1 ) { - // Odd number. Obviously last parameter has no value. + // Odd number. Obviously last paramter has no value. // Add the "no value" token aHeaderLength++; } @@ -1738,7 +1739,7 @@ temp = KWspCharset | KMms0x80; // encode as short integer EncodeOptionalInteger( temp, iMimeHeaders->MimeCharset() ); - // if we didn't find "Name" parameter among our parameters, we + // if we didn't find "Name" parameter among our paramters, we // put it first. // we need the name later anyway... @@ -1753,7 +1754,7 @@ TInt i = 0; - for ( i = 0; i < iMimeHeaders->ContentTypeParams().MdcaCount(); ++i ) + for ( i = 0; i < iMimeHeaders->ContentTypeParams().MdcaCount(); i++ ) { // If we have corrupted parameters (length of name is zero) // we skip the name/value pair. @@ -1796,7 +1797,7 @@ } if ( ( iMimeHeaders->ContentTypeParams().MdcaCount() % 2 ) == 1 ) { - // Odd number. Obviously last parameter has no value. + // Odd number. Obviously last paramter has no value. // Add the "no value" token iEncodeBuffer->Write( iPosition, &KMmsNull, 1 ); iPosition++; @@ -1843,7 +1844,7 @@ #endif // x-type parameters - for ( i = 0; i < iMimeHeaders->XTypeParams().MdcaCount(); ++i ) + for ( i = 0; i < iMimeHeaders->XTypeParams().MdcaCount(); i++ ) { // If we have corrupted parameters (length of name is zero) // we skip the name/value pair. @@ -1870,7 +1871,7 @@ } if ( ( iMimeHeaders->XTypeParams().MdcaCount() % 2 ) == 1 ) { - // Odd number. Obviously last parameter has no value. + // Odd number. Obviously last paramter has no value. // Add the "no value" token iEncodeBuffer->Write( iPosition, &KMmsNull, 1 ); iPosition++; @@ -2312,7 +2313,7 @@ TInt i; TUint oldPosition; TUint length; - for ( i = 0; i < iMmsHeaders->PreviouslySentList().Count(); ++i ) + for ( i = 0; i < iMmsHeaders->PreviouslySentList().Count(); i++ ) { oldPosition = iPosition; length = 0; @@ -3201,7 +3202,7 @@ TInt i; TUint oldPosition; TUint length; - for ( i = 0; i < iMmsHeaders->PreviouslySentList().Count(); ++i ) + for ( i = 0; i < iMmsHeaders->PreviouslySentList().Count(); i++ ) { oldPosition = iPosition; length = 0; @@ -3315,7 +3316,7 @@ // No need to check if we need a quote - if we are safe, we have // no characters >= 128. - for ( i = 0; i < aString.Length(); ++i ) + for ( i = 0; i < aString.Length(); i++ ) { character = TUint8( aString[i] & KMms0xFF ); iEncodeBuffer->Write( iPosition, &character, 1 ); @@ -3411,7 +3412,7 @@ TInt i = 0; TInt64 reminder = 0; - for ( i = 7; i >= 0; --i ) + for ( i = 7; i >= 0; i-- ) { reminder = temp % 0x100; temp = temp / 0x100; @@ -3484,7 +3485,7 @@ } TUint i = 0; - for ( i = 0; i < length; ++i ) + for ( i = 0; i < length; i++ ) { array[i] = TInt8( ( temp >> ( KMms8 * ( KMms3 - i ) ) ) & KMms0xFF ); } @@ -3642,7 +3643,7 @@ TInt i = 0; TUint8 character = 0; realAddressPointer = realAddress->Des(); - for ( i = 0; i < realAddress->Length(); ++i ) + for ( i = 0; i < realAddress->Length(); i++ ) { // The array index is safe because i is always < realAddress->Length(). character = TUint8( realAddressPointer[i] & KMms0xFF ); @@ -3698,7 +3699,7 @@ TUint temp = aInteger; TInt i; - for ( i = 0; i < KMms5; ++i ) + for ( i = 0; i < KMms5; i++ ) { buffer[KMms4 - i] = TUint8( temp & KMms0x7F ); temp >>= KMms7; @@ -3713,7 +3714,7 @@ TInt j; - for ( j = i; j < KMms4; ++j ) + for ( j = i; j < KMms4; j++ ) { // buffer indexes are safe because the buffer has been defined long enough. buffer[j] |= KMms0x80; // set Continue bit, but never to last @@ -3740,7 +3741,7 @@ TUint temp = aInteger; TInt i; - for (i = 0; i < KMms5; ++i ) + for (i = 0; i < KMms5; i++ ) { buffer[KMms4 - i] = TUint8( temp & KMms0x7F ); temp >>= KMms7; @@ -3789,7 +3790,7 @@ break; } - for ( i = 0; i < size; ++i ) + for ( i = 0; i < size; i++ ) { // check for fakes if ( aRecipientList[i].Length() > 0 ) @@ -3994,7 +3995,7 @@ TInt i; TBool safe = ETrue; - for ( i = 0; i < aString.Length() && safe; ++i ) + for ( i = 0; i < aString.Length() && safe; i++ ) { if ( aString[i] < KMmsLowestAscii || aString[i] >= KMmsHighestAscii ) { @@ -4024,7 +4025,7 @@ aNumNonSafe = 0; TBool safe = ETrue; - for ( i = 0; i < aString.Length()/* && safe*/; ++i ) + for ( i = 0; i < aString.Length()/* && safe*/; i++ ) { if ( aString[i] < KMmsLowestAscii || aString[i] >= KMmsHighestAscii ) { @@ -4152,7 +4153,7 @@ TInt8 rootContentType = -1; TInt8 i = 0; - for ( i = 0; i < KNumberContentTypes && rootContentType < 0; ++i ) + for ( i = 0; i < KNumberContentTypes && rootContentType < 0; i++ ) { if ( contentTypeString.CompareF( TPtrC8( KContentTypeTable[i] ) ) == 0 ) { @@ -4320,7 +4321,7 @@ // caller must check that iMmsHeaders->ReadOnlyMMBoxMessageHeaders() is not NULL CMmsMMBoxMessageHeaders& temp = iMmsHeaders->MMBoxMessageHeadersL(); - for ( i = 0; i < temp.KeywordArray().Count(); ++i ) + for ( i = 0; i < temp.KeywordArray().Count(); i++ ) { length = temp.KeywordArray()[i]->Keyword().Length(); if ( length > 0 ) @@ -4375,7 +4376,7 @@ { TInt i; - for ( i = 0; i < aAttributeArray.Count(); ++i ) + for ( i = 0; i < aAttributeArray.Count(); i++ ) { EncodeMandatoryByte( KMmsAssignedAttributes, aAttributeArray[i] ); } @@ -4389,7 +4390,7 @@ { TInt i; - for ( i = 0; i < aStateArray.Count(); ++i ) + for ( i = 0; i < aStateArray.Count(); i++ ) { EncodeMandatoryByte( KMmsAssignedMMState, aStateArray[i] ); } @@ -4726,12 +4727,9 @@ if( retVal ) { - TRAPD( - err, - attachManagerSync.ModifyAttachmentInfoL(attachmentInfo); - editStore->CommitL(); - ); #ifndef _NO_MMSS_LOGGING_ + TRAPD( err,attachManagerSync.ModifyAttachmentInfoL(attachmentInfo); + editStore->CommitL();); if(err != KErrNone) { TMmsLogger::Log( _L("CMmsEncode::PreProcessAttachmentData:: store commit error: %d"), err ); @@ -4740,8 +4738,11 @@ { TMmsLogger::Log( _L("CMmsEncode::PreProcessAttachmentData:: store commit success") ); } +#else + TRAP_IGNORE( attachManagerSync.ModifyAttachmentInfoL(attachmentInfo); + editStore->CommitL();); #endif /* _NO_MMSS_LOGGING_ */ - /* attachmentInfo ownership is transferred to attachment manager + /* attachmentInfo ownership is transfered to attachment manager * Hence, JUST pop attachmentInfo, DO NOT Destroy. */ CleanupStack::Pop( attachmentInfo ); @@ -4848,7 +4849,7 @@ // --------------------------------------------------------- // CMmsEncode::ProcessAndConvertAttachmentDataL // converts of attachment data from source to target encoding type. -// |src charset buffer| --->converted to ---> |unicode buffer| ---> converted to ---> |target charset| +// |src charset buffer| --->coverted to ---> |unicode buffer| ---> converted to ---> |target charset| // Returns false if data is already int target format, or plugins are missing, or file operation issues. // --------------------------------------------------------- TBool CMmsEncode::ProcessAndConvertAttachmentDataL( TUint aSrcCharSetMIBEnum,