From a2b8bd55375cde48319475e174f6eb86e4dcdd33 Mon Sep 17 00:00:00 2001 From: Sylvain Bougnoux Date: Sun, 29 Aug 1999 13:32:50 +0000 Subject: [PATCH] Fixed wxBufferedInputStream support ... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagpnm.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/common/imagpnm.cpp b/src/common/imagpnm.cpp index 75a0b49d79..e7de922c9c 100644 --- a/src/common/imagpnm.cpp +++ b/src/common/imagpnm.cpp @@ -37,7 +37,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNMHandler,wxImageHandler) #if wxUSE_STREAMS - //#include // for cout +//#include // 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