equal
deleted
inserted
replaced
1515 { |
1515 { |
1516 // MMS encapsulation version is 1.3 or later |
1516 // MMS encapsulation version is 1.3 or later |
1517 // Using non-ascii characters in filename parameter is allowed |
1517 // Using non-ascii characters in filename parameter is allowed |
1518 // The filename must be encoded either using base64 or quoted printable |
1518 // The filename must be encoded either using base64 or quoted printable |
1519 HBufC8* temp = NULL; |
1519 HBufC8* temp = NULL; |
|
1520 // coverity[size_error][buffer_alloc] |
1520 temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L( originalName ); |
1521 temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L( originalName ); |
1521 CleanupStack::PushL( temp ); |
1522 CleanupStack::PushL( temp ); |
1522 // Now we have the filename in utf-8. |
1523 // Now we have the filename in utf-8. |
1523 // We must check if it contains non-ascii, and if it does, |
1524 // We must check if it contains non-ascii, and if it does, |
1524 // we must use base64 or quoted-printable encoding. |
1525 // we must use base64 or quoted-printable encoding. |
3330 // if our length is 0, we are safe, no need to check the |
3331 // if our length is 0, we are safe, no need to check the |
3331 // length here anymore |
3332 // length here anymore |
3332 // we must convert to utf-8 |
3333 // we must convert to utf-8 |
3333 |
3334 |
3334 //one ucs-2 character should never produce more than 4 bytes when converted to utf-8 |
3335 //one ucs-2 character should never produce more than 4 bytes when converted to utf-8 |
3335 HBufC8* buffer = HBufC8::NewL( aString.Length() * KMms4 ); // paranoid. |
3336 // coverity[incorrect_multiplication][buffer_alloc] |
|
3337 HBufC8* buffer = HBufC8::NewL( aString.Length() * KMms4 ); // paranoid. |
3336 // we don't leave while we need buffer |
3338 // we don't leave while we need buffer |
3337 TPtr8 buf8 = buffer->Des(); |
3339 TPtr8 buf8 = buffer->Des(); |
3338 |
3340 |
3339 // if conversion fails, something is really seriously wrong |
3341 // if conversion fails, something is really seriously wrong |
3340 iError = CnvUtfConverter::ConvertFromUnicodeToUtf8( buf8, aString ); |
3342 iError = CnvUtfConverter::ConvertFromUnicodeToUtf8( buf8, aString ); |
3543 // worst case scenario. |
3545 // worst case scenario. |
3544 // must be encoded as UTF-8, value length and character set |
3546 // must be encoded as UTF-8, value length and character set |
3545 // must be added |
3547 // must be added |
3546 |
3548 |
3547 // one ucs-2 character will not produce more than 4 bytes when converted to utf-8 |
3549 // one ucs-2 character will not produce more than 4 bytes when converted to utf-8 |
|
3550 // coverity[incorrect_multiplication][buffer_alloc] |
3548 HBufC8* buffer = HBufC8::NewL( aSender.Length() * KMms4 ); // paranoid. |
3551 HBufC8* buffer = HBufC8::NewL( aSender.Length() * KMms4 ); // paranoid. |
3549 // we don't need to push buffer onto cleanup stack, as we don't |
3552 // we don't need to push buffer onto cleanup stack, as we don't |
3550 // leave while we are using it |
3553 // leave while we are using it |
3551 TPtr8 buf8 = buffer->Des(); |
3554 TPtr8 buf8 = buffer->Des(); |
3552 |
3555 |
4894 #endif /* _NO_MMSS_LOGGING_ */ |
4897 #endif /* _NO_MMSS_LOGGING_ */ |
4895 attachFile.Close(); |
4898 attachFile.Close(); |
4896 return EFalse; |
4899 return EFalse; |
4897 } |
4900 } |
4898 |
4901 |
4899 TInt maxLength; |
4902 TInt maxLength=0; |
4900 error = attachFile.Size(maxLength); |
4903 error = attachFile.Size(maxLength); |
4901 if( error != KErrNone || maxLength == 0 ) |
4904 if( error != KErrNone || maxLength == 0 ) |
4902 { |
4905 { |
4903 #ifndef _NO_MMSS_LOGGING_ |
4906 #ifndef _NO_MMSS_LOGGING_ |
4904 TMmsLogger::Log( _L("CMmsEncode::ProcessAndConvertAttachmentData:: file size: %d, error: %d"), maxLength, error ); |
4907 TMmsLogger::Log( _L("CMmsEncode::ProcessAndConvertAttachmentData:: file size: %d, error: %d"), maxLength, error ); |