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

List:       kde-bugs-dist
Subject:    Bug#16072: patch for trailing garbage in kmreaderwin
From:       Wolfgang Rohdewald <wr () poboxes ! com>
Date:       2000-11-26 14:05:14
[Download RAW message or body]

Package: kmail
Version: 1.2 (KDE 2.0 >= 20001117)
Severity: normal
Compiler: gcc version 2.95.2 19991024 (release)
OS: Linux 2.2.16 i686 (compiled sources)

when displaying messages, I often have garbage characters at the end of the message.
They change randomly when reloading the message. True for text and html view.

This patch fixes it.

However I don't like it at all. I think QCString KMMessage::bodyDecoded(void) const
and its usage should be fixed. Either it can return NUL, so it should return QByteArray,
or it cannot, so kmreaderwin.cpp should copy it into QCString and not QBytearray.
If both is possible, and the caller knows which one is correct, maybe bodyDecoded
should be overloaded: one version returning QByteArray and one returning QCString.
But I'd rather not do such a patch unless encouraged. I am not even sure if overloading
is possible here, or if two separate function names are needed. I'd first have to dig
out my C++ books.

/u2/src/cvs/kde/kdenetwork/kmail$ diff -u kmreaderwin.cpp /tmp/x2
--- kmreaderwin.cpp     Fri Nov 17 21:49:51 2000
+++ /tmp/x2     Sun Nov 26 14:37:59 2000
@@ -589,6 +589,8 @@
         if (htmlMail() && stricmp(subtype, "html")==0)    // is it html?
         {                                   // yes...
           str = msgPart.bodyDecoded();      // decode it...
+         str.resize( str.count() + 1 );
+         str.at( str.count() - 1 ) = '\0';
           mViewer->write(str.data());              // write it...
           return;                           // return, finshed.
         }
@@ -596,6 +598,8 @@
                                            // wasn't html show only if
        {                                   // support for html is turned off
           str = msgPart.bodyDecoded();      // decode it...
+         str.resize( str.count() + 1 );
+         str.at( str.count() - 1 ) = '\0';
           writeBodyStr(str.data());
           return;
        }                                                                       

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

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