summaryrefslogtreecommitdiffstats
path: root/libemailfunctions
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-16 01:50:36 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-16 01:50:36 +0000
commitd4b702756e673463c9fc008bc6e5931aac6a9011 (patch)
tree56d925d93b2b1468fdcf6b55fbdd5bad008f74c6 /libemailfunctions
parent460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (diff)
downloadtdepim-d4b702756e673463c9fc008bc6e5931aac6a9011.tar.gz
tdepim-d4b702756e673463c9fc008bc6e5931aac6a9011.zip
* 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
Diffstat (limited to 'libemailfunctions')
-rw-r--r--libemailfunctions/email.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/libemailfunctions/email.cpp b/libemailfunctions/email.cpp
index acbfa2679..ec14800aa 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() )