]> git.saurik.com Git - wxWidgets.git/commitdiff
* wxStream fixes (integer/line parsing).
authorGuilhem Lavaux <lavaux@easynet.fr>
Mon, 28 Jun 1999 18:22:04 +0000 (18:22 +0000)
committerGuilhem Lavaux <lavaux@easynet.fr>
Mon, 28 Jun 1999 18:22:04 +0000 (18:22 +0000)
* Typetest sample fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/typetest/typetest.cpp
src/common/datstrm.cpp
src/common/stream.cpp

index 0df7ed9d343c6a41aafd9e1d0fd1cd9e1d96a29e..7acd762b4a73278c623314eef44b65287567e2ff 100644 (file)
@@ -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" );
     
index 4ccada0e8829c266f1cc2d3b2d813c73fe0503d1..d83f968795578e4d6d070a71fe207ef8d7ddd325 100644 (file)
@@ -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
+  
index 7d0e543fdb3343ff53edc3dc6ae1c992b2b7ac0e..9750fef812d9aebf254c8a85196076dcc8dcd90d 100644 (file)
@@ -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();
   }