Commit d4a65441 authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Use QVarLengthArray<QByteArray> instead of QList<QByteArray>

svn path=/trunk/KDE/kdepim/runtime/; revision=1186574
parent cd778de6
......@@ -32,14 +32,15 @@
using namespace Akonadi;
using namespace KMime;
template <typename T> static void parseAddrList( const QList<QByteArray> &addrList, T *hdr )
template <typename T> static void parseAddrList( const QVarLengthArray<QByteArray, 16> &addrList, T *hdr )
{
hdr->clear();
for ( QList<QByteArray>::ConstIterator it = addrList.constBegin(); it != addrList.constEnd(); ++it ) {
QList<QByteArray> addr;
ImapParser::parseParenthesizedList( *it, addr );
const int count = addrList.count();
QVarLengthArray<QByteArray, 16> addr;
for ( int i = 0; i < count; ++i ) {
ImapParser::parseParenthesizedList( addrList[ i ], addr );
if ( addr.count() != 4 ) {
kWarning( 5264 ) << "Error parsing envelope address field: " << addr;
kWarning( 5264 ) << "Error parsing envelope address field: " << addrList[ i ];
continue;
}
KMime::Types::Mailbox addrField;
......@@ -78,10 +79,10 @@ bool SerializerPluginMail::deserialize( Item& item, const QByteArray& label, QIO
msg->parse();
}
} else if ( label == MessagePart::Envelope ) {
QList<QByteArray> env;
QVarLengthArray<QByteArray, 16> env;
ImapParser::parseParenthesizedList( buffer, env );
if ( env.count() < 10 ) {
kWarning( 5264 ) << "Akonadi KMime Deserializer: Got invalid envelope: " << env;
kWarning( 5264 ) << "Akonadi KMime Deserializer: Got invalid envelope: " << buffer;
return false;
}
Q_ASSERT( env.count() >= 10 );
......@@ -90,7 +91,7 @@ bool SerializerPluginMail::deserialize( Item& item, const QByteArray& label, QIO
// subject
msg->subject()->from7BitString( env[1] );
// from
QList<QByteArray> addrList;
QVarLengthArray<QByteArray, 16> addrList;
ImapParser::parseParenthesizedList( env[2], addrList );
if ( !addrList.isEmpty() )
parseAddrList( addrList, msg->from() );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment