[Cmake-commits] [cmake-commits] david.cole committed SystemTools.cxx 1.254 1.255
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Oct 16 13:23:54 EDT 2009
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv13937/Source/kwsys
Modified Files:
SystemTools.cxx
Log Message:
Better fix for crash on Windows. This time it will even work on Linux, too. That GetLineFromStream method while loop sure is fussy.
Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.254
retrieving revision 1.255
diff -C 2 -d -r1.254 -r1.255
*** SystemTools.cxx 16 Oct 2009 15:43:05 -0000 1.254
--- SystemTools.cxx 16 Oct 2009 17:23:52 -0000 1.255
***************
*** 3961,3968 ****
long leftToRead = sizeLimit;
// If no characters are read from the stream, the end of file has
// been reached. Clear the fail bit just before reading.
! while(is &&
! !haveNewline &&
leftToRead != 0 &&
(is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
--- 3961,3980 ----
long leftToRead = sizeLimit;
+ // Early short circuit return if stream is no good. Just return
+ // false and the empty line. (Probably means caller tried to
+ // create a file stream with a non-existent file name...)
+ //
+ if(!is)
+ {
+ if(has_newline)
+ {
+ *has_newline = false;
+ }
+ return false;
+ }
+
// If no characters are read from the stream, the end of file has
// been reached. Clear the fail bit just before reading.
! while(!haveNewline &&
leftToRead != 0 &&
(is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
More information about the Cmake-commits
mailing list