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

List:       kde-core-devel
Subject:    [PATCH] dcopidl - accepting '\r' characters
From:       Jarosław_Staniek <js () iidea ! pl>
Date:       2005-02-11 10:54:44
Message-ID: 420C8EF4.70903 () iidea ! pl
[Download RAW message or body]

qFatal() was raised because of unrecognizable character '\r'.
These characters may usually come from macosx or win32 environments.
Since macosx and win32 KDE developemnt became something real, there may exist 
  (at least by accident) source files with '\r' character. My patch accepts 
them by removing before parsing, as C/C++ preprocessors do.

Ok to commit?

dcopidl2cpp tool is not affected by this defect because it uses Qt DOM parser.

-- 
regards / pozdrawiam,
  Jaroslaw Staniek / OpenOffice Polska / Kexi Team
  Developers Wanted! Kexi 0.1 Beta 5 Released: http://www.kexi-project.org
  KDElibs/Windows: http://wiki.kde.org/tiki-index.php?page=KDElibs+for+win32


["dcopidl.patch" (text/plain)]

Index: main.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopidl/main.cpp,v
retrieving revision 1.10
diff -u -r1.10 main.cpp
--- main.cpp	10 Mar 2002 21:17:42 -0000	1.10
+++ main.cpp	11 Feb 2005 10:42:16 -0000
@@ -48,7 +48,16 @@
     }
 
     QByteArray arr = file.readAll();
-    int len = arr.size();
+    uint len = arr.size();
+    /* eat all \r characters so the parser won't be fooled */
+    for (uint i=0, j=0; i<len; i++) {
+        if (arr[ i ] != '\r') {
+            if (i!=j)
+                arr[ j ] = arr[ i ];
+            j++;
+        }
+    }
+    len = j;
     arr.resize( len + 1 );
     arr[ len ] = 0;
 


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

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