]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed wxBufferedInputStream support ...
authorSylvain Bougnoux <bougnoux@imra-europe.com>
Sun, 29 Aug 1999 13:32:50 +0000 (13:32 +0000)
committerSylvain Bougnoux <bougnoux@imra-europe.com>
Sun, 29 Aug 1999 13:32:50 +0000 (13:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/imagpnm.cpp

index 75a0b49d79c3eaca2a8eecd85fbc1a7945c6a14d..e7de922c9cdf50ee2bd1694793188ac1fd2e7a1a 100644 (file)
@@ -37,7 +37,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNMHandler,wxImageHandler)
 
 #if wxUSE_STREAMS
 
-  //#include <stream.h> // for cout
+//#include <stream.h> // for cout
 
 void Skip_Comment(wxInputStream &stream)
 {
@@ -64,11 +64,10 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
      * Read the PNM header
      */
 
-    wxBufferedInputStream buf_stream(stream);
-    wxTextInputStream text_stream(buf_stream);
+    wxTextInputStream text_stream(stream);
 
-    Skip_Comment(buf_stream);
-    if (buf_stream.GetC()==_T('P')) c=buf_stream.GetC();
+    Skip_Comment(stream);
+    if (stream.GetC()==_T('P')) c=stream.GetC();
 
     switch (c)
       {
@@ -85,12 +84,12 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
       }
 
     text_stream >> line; // for the \n
-    Skip_Comment(buf_stream);
+    Skip_Comment(stream);
     text_stream >> width >> height ;
-    Skip_Comment(buf_stream); 
+    Skip_Comment(stream); 
     text_stream >> maxval;
 
-    //cout << width << " " << height << " " << maxval << endl;
+    //cout << line << " " << width << " " << height << " " << maxval << endl;
     image->Create( width, height );
     unsigned char *ptr = image->GetData();
     if (!ptr)
@@ -99,7 +98,9 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool WXUNUSE
        return FALSE;
     }
 
-    if (c=='3') // Ascii RBG
+    wxBufferedInputStream buf_stream(stream);
+
+   if (c=='3') // Ascii RBG
       { 
        wxUint32 value, size=3*width*height;
        for (wxUint32 i=0; i<size; ++i)