problem in porting QString::at(index)

Andreas Gungl a.gungl at gmx.de
Tue Oct 11 14:48:13 BST 2005


FYI, I managed to get KMail in trunk to receive mail from a local account   
(w/o lock file) into maildir folders. If you manage to bring KMail up on a  

KDE 4 desktop, you can at least read local mail. :)   
   
I've found a problem in a changed semantic of QString::at(0) which seemed   
to return '\0' in Qt3 for an empty string. Now we run into an assertion   
for 0 <= i < size() although the Qt4 docu says about QString::size(), that  

at position size() of a QString there is ever placed a '\0'. So you could   
access it zero-terminated by data() etc. etc.   
We just can't access that zero-termination by at() any longer.   
   
We can of course work around that by checking the size before the index   
access. But this makes the code a bit longer. The question if whether the   
new sematic is intended by Qt.  
  
See

http://websvn.kde.org/trunk/KDE/kdepim/kmail/kmacctlocal.cpp?rev=469481&sortby=date&r2=469481&r1=467348

for the critcal code. 
 
Regards, 
Andreas 




More information about the kde-core-devel mailing list