From d4b702756e673463c9fc008bc6e5931aac6a9011 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 16 Dec 2009 01:50:36 +0000 Subject: * gcc4.4 compilation fixes * kmail crash issues resolved * automake updates git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1062791 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libemailfunctions/email.cpp | 52 ++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'libemailfunctions') diff --git a/libemailfunctions/email.cpp b/libemailfunctions/email.cpp index acbfa267..ec14800a 100644 --- a/libemailfunctions/email.cpp +++ b/libemailfunctions/email.cpp @@ -112,7 +112,14 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address, displayName = ""; addrSpec = ""; comment = ""; - + + // these strings are later copied to displayName resp. addrSpec resp. comment + // we don't operate directly on those variables, since as ByteArray deriverates + // they have a miserable performance on operator+ + QString dName; + QString aSpec; + QString cmmt; + if ( address.isEmpty() ) return KPIM::AddressEmpty; @@ -130,26 +137,26 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address, case TopLevel : { switch ( *p ) { case '"' : inQuotedString = !inQuotedString; - displayName += *p; + dName += *p; break; case '(' : if ( !inQuotedString ) { context = InComment; commentLevel = 1; } else - displayName += *p; + dName += *p; break; case '<' : if ( !inQuotedString ) { context = InAngleAddress; } else - displayName += *p; + dName += *p; break; case '\\' : // quoted character - displayName += *p; + dName += *p; ++p; // skip the '\' if ( *p ) - displayName += *p; + dName += *p; else return KPIM::UnexpectedEnd; break; @@ -161,57 +168,57 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address, return KPIM::UnexpectedComma; } else - displayName += *p; + dName += *p; break; - default : displayName += *p; + default : dName += *p; } break; } case InComment : { switch ( *p ) { case '(' : ++commentLevel; - comment += *p; + cmmt += *p; break; case ')' : --commentLevel; if ( commentLevel == 0 ) { context = TopLevel; - comment += ' '; // separate the text of several comments + cmmt += ' '; // separate the text of several comments } else - comment += *p; + cmmt += *p; break; case '\\' : // quoted character - comment += *p; + cmmt += *p; ++p; // skip the '\' if ( *p ) - comment += *p; + cmmt += *p; else return KPIM::UnexpectedEnd; break; - default : comment += *p; + default : cmmt += *p; } break; } case InAngleAddress : { switch ( *p ) { case '"' : inQuotedString = !inQuotedString; - addrSpec += *p; + aSpec += *p; break; case '>' : if ( !inQuotedString ) { context = TopLevel; } else - addrSpec += *p; + aSpec += *p; break; case '\\' : // quoted character - addrSpec += *p; + aSpec += *p; ++p; // skip the '\' if ( *p ) - addrSpec += *p; + aSpec += *p; else return KPIM::UnexpectedEnd; break; - default : addrSpec += *p; + default : aSpec += *p; } break; } @@ -225,9 +232,10 @@ KPIM::EmailParseResult splitAddressInternal( const QCString& address, if ( context == InAngleAddress ) return KPIM::UnclosedAngleAddr; - displayName = displayName.stripWhiteSpace(); - comment = comment.stripWhiteSpace(); - addrSpec = addrSpec.stripWhiteSpace(); + + displayName = dName.stripWhiteSpace().latin1(); + comment = cmmt.stripWhiteSpace().latin1(); + addrSpec = aSpec.stripWhiteSpace().latin1(); if ( addrSpec.isEmpty() ) { if ( displayName.isEmpty() ) -- cgit v1.2.3