From 7a9c0eea7deb57f1045aa534607ede57876c633a Mon Sep 17 00:00:00 2001 From: David Cole <david.cole@kitware.com> Date: Fri, 16 Oct 2009 11:43:05 -0400 Subject: [PATCH] Fix crash on Windows. If input stream is no good, do not try to read a line from it. Return false and an empty line instead... --- SystemTools.cxx | 5 +++-- kwsysDateStamp.cmake | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 8ed6315..3c19018 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -3959,10 +3959,11 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, line = ""; 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(!haveNewline && + while(is && + !haveNewline && leftToRead != 0 && (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit), is.getline(buffer, bufferSize), is.gcount() > 0)) diff --git a/kwsysDateStamp.cmake b/kwsysDateStamp.cmake index c6af273..3135579 100644 --- a/kwsysDateStamp.cmake +++ b/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2009) SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 09) +SET(KWSYS_DATE_STAMP_DAY 16) -- GitLab