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

List:       kde-commits
Subject:    kdesupport/strigi/src/streams/tests
From:       Holger Freyther <freyther () gmx ! net>
Date:       2007-03-21 22:29:35
Message-ID: 1174516175.386430.11828.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 645211 by zecke:

strigi: Check return values, do not segfault on failures
    On ade's BSD p1 is NULL and nread -2 and the memcmp
    segfaults, at least stop the segfault of the test but
    it is still failing.


 M  +6 -1      InputStreamReaderTest.cpp  


--- trunk/kdesupport/strigi/src/streams/tests/InputStreamReaderTest.cpp #645210:645211
@@ -56,6 +56,8 @@
         FileInputStream file(filename.c_str());
         InputStreamReader isr(&file, "UCS-2");
         int32_t nread1 = isr.read(p1, 200000, 200000);
+	VERIFY(nread1 > 0 );
+	VERIFY(p1 != 0);
 
         filename = "unichtm/utf8/";
         filename += testfiles[i];
@@ -63,9 +65,12 @@
         FileInputStream file2(filename.c_str());
         InputStreamReader isr2(&file2, "UTF-8");
         int32_t nread2 = isr2.read(p2, 200000, 200000);
+	VERIFY(nread2 > 0 );
+	VERIFY(p2 != 0);
 
         VERIFY(nread1 == nread2);
-        VERIFY(memcmp(p1, p2, nread1*sizeof(wchar_t))==0);
+	if ( p1 && p2 && nread1 >= 0 && nread2 >= 0 )
+        	VERIFY(memcmp(p1, p2, nread1*sizeof(wchar_t))==0);
     }
     return founderrors;
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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