[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: branches/kdepim/enterprise/kdepim/kmail
From:       Volker Krause <vkrause () kde ! org>
Date:       2008-03-07 11:41:54
Message-ID: 200803071241.55059.vkrause () kde ! org
[Download RAW message or body]


On Friday 07 March 2008 12:13:40 Andreas Hartmetz wrote:
> Am Donnerstag 06 März 2008 18:32:00 schrieb Volker Krause:
> > SVN commit 782964 by vkrause:
> >
> > Fix corruption of binary attachments introduced in revision 771698.
> >
> > The actual problem here is that EncodingDetector::decode(_const_
> > QByteArray &data) replaces all 0x00 bytes in data with 0x20 although
> > being const.
>
> Crazy, just crazy. Thanks for fixing it.

While the problem is fixed, I don't consider my hack the solution. The current 
code makes at least two additional copies of the attachment and converts the 
data to unicode just to discard the returnd value. Given that attachments 
tend to be rather large, this is a problem. I just had a quick look into 
EncodingDetector, I guess we want to call analyze() directly instead of 
decode(), but since that's your code you probably know better how to really 
fix this.

> > CCMAIL: ahartmetz@gmail.com
> >
> >
> >  M  +4 -1      kmcomposewin.cpp
> >
> >
> > --- branches/kdepim/enterprise/kdepim/kmail/kmcomposewin.cpp
> > #782963:782964 @@ -2758,7 +2758,10 @@
> >      EncodingDetector ed;
> >      KLocale *loc = KGlobal::locale();
> >      ed.setAutoDetectLanguage( EncodingDetector::scriptForLanguageCode (
> > loc->language() ) ); -    ed.decode( ( *it ).data );
> > +    // ### FIXME decode(_const_ QByteArray &) replaces 0x00 bytes by
> > 0x20 in the parameter +    // despite being const, which obviously breaks
> > binary attachments. +    QByteArray copy = (*it).data.copy();
> > +    ed.decode( copy );
> >      partCharset = ed.encoding();
> >      if (partCharset.isEmpty()) //shouldn't happen
> >        partCharset = mCharset;



["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic