From: Guilhem Lavaux Date: Mon, 28 Jun 1999 18:22:04 +0000 (+0000) Subject: * wxStream fixes (integer/line parsing). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b6bff3019ee6a032d967ef75c48255613661dbee * wxStream fixes (integer/line parsing). * Typetest sample fixes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 0df7ed9d34..7acd762b4a 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -167,6 +167,8 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( tmp ); textCtrl.WriteText( "\nReading from wxFileInputStream:\n" ); + + file_output.OutputStreamBuffer()->FlushBuffer(); wxFileInputStream file_input( "test_wx.dat" ); diff --git a/src/common/datstrm.cpp b/src/common/datstrm.cpp index 4ccada0e88..d83f968795 100644 --- a/src/common/datstrm.cpp +++ b/src/common/datstrm.cpp @@ -90,6 +90,9 @@ wxString wxDataInputStream::ReadLine() while (!end_line) { c = GetC(); + if (LastError() != wxStream_NOERROR) + break; + switch (c) { case '\n': end_line = TRUE; @@ -201,4 +204,4 @@ void wxDataOutputStream::WriteDouble(double d) #endif // wxUSE_STREAMS - \ No newline at end of file + diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 7d0e543fdb..9750fef812 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -648,7 +648,7 @@ wxInputStream& wxInputStream::operator>>(signed long& i) } while (isdigit(c)) { - i = i*10 + c; + i = i*10 + (c - (int)'0'); c = GetC(); } @@ -690,7 +690,7 @@ wxInputStream& wxInputStream::operator>>(unsigned long& i) } while (isdigit(c)) { - i = i*10 + c; + i = i*10 + c - '0'; c = GetC(); }