compilation fixes in WXWIN_COMPATIBILITY_2_2==0 mode
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -299,7 +299,7 @@ bool wxDocument::OnSaveDocument(const wxString& file)
|
|||||||
if (store.fail() || store.bad())
|
if (store.fail() || store.bad())
|
||||||
#else
|
#else
|
||||||
wxFileOutputStream store( file );
|
wxFileOutputStream store( file );
|
||||||
if (store.LastError() != wxSTREAM_NOERROR)
|
if (store.GetLastError() != wxSTREAM_NO_ERROR)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
(void)wxMessageBox(_("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION,
|
(void)wxMessageBox(_("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION,
|
||||||
@@ -336,7 +336,7 @@ bool wxDocument::OnOpenDocument(const wxString& file)
|
|||||||
if (store.fail() || store.bad())
|
if (store.fail() || store.bad())
|
||||||
#else
|
#else
|
||||||
wxFileInputStream store( file );
|
wxFileInputStream store( file );
|
||||||
if (store.LastError() != wxSTREAM_NOERROR)
|
if (store.GetLastError() != wxSTREAM_NO_ERROR)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
(void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION,
|
(void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION,
|
||||||
@@ -347,8 +347,8 @@ bool wxDocument::OnOpenDocument(const wxString& file)
|
|||||||
LoadObject(store);
|
LoadObject(store);
|
||||||
if ( !store && !store.eof() )
|
if ( !store && !store.eof() )
|
||||||
#else
|
#else
|
||||||
int res = LoadObject(store).LastError();
|
int res = LoadObject(store).GetLastError();
|
||||||
if ((res != wxSTREAM_NOERROR) &&
|
if ((res != wxSTREAM_NO_ERROR) &&
|
||||||
(res != wxSTREAM_EOF))
|
(res != wxSTREAM_EOF))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -2215,7 +2215,7 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = stream.StreamSize();
|
int len = stream.GetSize();
|
||||||
// TODO: is this the correct test for EOF?
|
// TODO: is this the correct test for EOF?
|
||||||
while (stream.TellI() < (len - 1))
|
while (stream.TellI() < (len - 1))
|
||||||
{
|
{
|
||||||
|
@@ -90,7 +90,7 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l
|
|||||||
if (right.GetChar(0) == wxT('/')) right = right.Mid(1);
|
if (right.GetChar(0) == wxT('/')) right = right.Mid(1);
|
||||||
|
|
||||||
s = new wxZipInputStream(left, right);
|
s = new wxZipInputStream(left, right);
|
||||||
if (s && (s->LastError() == wxStream_NOERROR))
|
if (s && s->IsOk() )
|
||||||
{
|
{
|
||||||
return new wxFSFile(s,
|
return new wxFSFile(s,
|
||||||
left + wxT("#zip:") + right,
|
left + wxT("#zip:") + right,
|
||||||
|
@@ -507,7 +507,7 @@ public:
|
|||||||
{
|
{
|
||||||
delete m_i_socket;
|
delete m_i_socket;
|
||||||
|
|
||||||
if ( LastError() == wxStream_NOERROR )
|
if ( IsOk() )
|
||||||
{
|
{
|
||||||
// wait for "226 transfer completed"
|
// wait for "226 transfer completed"
|
||||||
m_ftp->CheckResult('2');
|
m_ftp->CheckResult('2');
|
||||||
|
@@ -634,12 +634,12 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
wxUint8 first;
|
wxUint8 first;
|
||||||
first = aByte;
|
first = aByte;
|
||||||
aByte = stream.GetC();
|
aByte = stream.GetC();
|
||||||
if ( first == 0 )
|
if ( first == 0 )
|
||||||
{
|
{
|
||||||
if ( aByte == 0 )
|
if ( aByte == 0 )
|
||||||
{
|
{
|
||||||
if ( column > 0 )
|
if ( column > 0 )
|
||||||
column = width;
|
column = width;
|
||||||
}
|
}
|
||||||
else if ( aByte == 1 )
|
else if ( aByte == 1 )
|
||||||
{
|
{
|
||||||
@@ -656,34 +656,34 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int absolute = aByte;
|
int absolute = aByte;
|
||||||
wxUint8 nibble[2] ;
|
wxUint8 nibble[2] ;
|
||||||
int readBytes = 0 ;
|
int readBytes = 0 ;
|
||||||
for (int k = 0; k < absolute; k++)
|
for (int k = 0; k < absolute; k++)
|
||||||
{
|
{
|
||||||
if ( !(k % 2 ) )
|
if ( !(k % 2 ) )
|
||||||
{
|
{
|
||||||
++readBytes ;
|
++readBytes ;
|
||||||
aByte = stream.GetC();
|
aByte = stream.GetC();
|
||||||
nibble[0] = ( (aByte & 0xF0) >> 4 ) ;
|
nibble[0] = ( (aByte & 0xF0) >> 4 ) ;
|
||||||
nibble[1] = ( aByte & 0x0F ) ;
|
nibble[1] = ( aByte & 0x0F ) ;
|
||||||
}
|
}
|
||||||
ptr[poffset ] = cmap[nibble[k%2]].r;
|
ptr[poffset ] = cmap[nibble[k%2]].r;
|
||||||
ptr[poffset + 1] = cmap[nibble[k%2]].g;
|
ptr[poffset + 1] = cmap[nibble[k%2]].g;
|
||||||
ptr[poffset + 2] = cmap[nibble[k%2]].b;
|
ptr[poffset + 2] = cmap[nibble[k%2]].b;
|
||||||
column++;
|
column++;
|
||||||
if ( k % 2 )
|
if ( k % 2 )
|
||||||
linepos++;
|
linepos++;
|
||||||
}
|
}
|
||||||
if ( readBytes & 0x01 )
|
if ( readBytes & 0x01 )
|
||||||
aByte = stream.GetC();
|
aByte = stream.GetC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxUint8 nibble[2] ;
|
wxUint8 nibble[2] ;
|
||||||
nibble[0] = ( (aByte & 0xF0) >> 4 ) ;
|
nibble[0] = ( (aByte & 0xF0) >> 4 ) ;
|
||||||
nibble[1] = ( aByte & 0x0F ) ;
|
nibble[1] = ( aByte & 0x0F ) ;
|
||||||
|
|
||||||
for ( int l = 0; l < first && column < width; l++ )
|
for ( int l = 0; l < first && column < width; l++ )
|
||||||
{
|
{
|
||||||
@@ -691,9 +691,9 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
ptr[poffset + 1] = cmap[nibble[l%2]].g;
|
ptr[poffset + 1] = cmap[nibble[l%2]].g;
|
||||||
ptr[poffset + 2] = cmap[nibble[l%2]].b;
|
ptr[poffset + 2] = cmap[nibble[l%2]].b;
|
||||||
column++;
|
column++;
|
||||||
if ( l % 2 )
|
if ( l % 2 )
|
||||||
linepos++;
|
linepos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -774,63 +774,64 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
// linepos += size; seems to be wrong, RR
|
// linepos += size; seems to be wrong, RR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( bpp == 24 )
|
else if ( bpp == 24 )
|
||||||
{
|
{
|
||||||
stream.Read(bbuf, 3);
|
stream.Read(bbuf, 3);
|
||||||
linepos += 3;
|
linepos += 3;
|
||||||
ptr[poffset ] = (unsigned char)bbuf[2];
|
ptr[poffset ] = (unsigned char)bbuf[2];
|
||||||
ptr[poffset + 1] = (unsigned char)bbuf[1];
|
ptr[poffset + 1] = (unsigned char)bbuf[1];
|
||||||
ptr[poffset + 2] = (unsigned char)bbuf[0];
|
ptr[poffset + 2] = (unsigned char)bbuf[0];
|
||||||
column++;
|
column++;
|
||||||
}
|
}
|
||||||
else if ( bpp == 16 )
|
else if ( bpp == 16 )
|
||||||
{
|
{
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
stream.Read(&aWord, 2);
|
stream.Read(&aWord, 2);
|
||||||
aWord = wxUINT16_SWAP_ON_BE(aWord);
|
aWord = wxUINT16_SWAP_ON_BE(aWord);
|
||||||
linepos += 2;
|
linepos += 2;
|
||||||
/* use the masks and calculated amonut of shift
|
/* use the masks and calculated amonut of shift
|
||||||
to retrieve the color data out of the word. Then
|
to retrieve the color data out of the word. Then
|
||||||
shift it left by (8 - number of bits) such that
|
shift it left by (8 - number of bits) such that
|
||||||
the image has the proper dynamic range */
|
the image has the proper dynamic range */
|
||||||
temp = (aWord & rmask) >> rshift << (8-rbits);
|
temp = (aWord & rmask) >> rshift << (8-rbits);
|
||||||
ptr[poffset] = temp;
|
ptr[poffset] = temp;
|
||||||
temp = (aWord & gmask) >> gshift << (8-gbits);
|
temp = (aWord & gmask) >> gshift << (8-gbits);
|
||||||
ptr[poffset + 1] = temp;
|
ptr[poffset + 1] = temp;
|
||||||
temp = (aWord & bmask) >> bshift << (8-bbits);
|
temp = (aWord & bmask) >> bshift << (8-bbits);
|
||||||
ptr[poffset + 2] = temp;
|
ptr[poffset + 2] = temp;
|
||||||
column++;
|
column++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
stream.Read(&aDword, 4);
|
stream.Read(&aDword, 4);
|
||||||
aDword = wxINT32_SWAP_ON_BE(aDword);
|
aDword = wxINT32_SWAP_ON_BE(aDword);
|
||||||
linepos += 4;
|
linepos += 4;
|
||||||
temp = (aDword & rmask) >> rshift;
|
temp = (aDword & rmask) >> rshift;
|
||||||
ptr[poffset] = temp;
|
ptr[poffset] = temp;
|
||||||
temp = (aDword & gmask) >> gshift;
|
temp = (aDword & gmask) >> gshift;
|
||||||
ptr[poffset + 1] = temp;
|
ptr[poffset + 1] = temp;
|
||||||
temp = (aDword & bmask) >> bshift;
|
temp = (aDword & bmask) >> bshift;
|
||||||
ptr[poffset + 2] = temp;
|
ptr[poffset + 2] = temp;
|
||||||
column++;
|
column++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( (linepos < linesize) && (comp != 1) && (comp != 2) )
|
while ( (linepos < linesize) && (comp != 1) && (comp != 2) )
|
||||||
{
|
{
|
||||||
stream.Read(&aByte, 1);
|
stream.Read(&aByte, 1);
|
||||||
linepos += 1;
|
linepos += 1;
|
||||||
if ( stream.LastError() != wxStream_NOERROR )
|
if ( !stream )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmap)
|
|
||||||
delete[] cmap;
|
|
||||||
|
|
||||||
image->SetMask(FALSE);
|
delete[] cmap;
|
||||||
|
|
||||||
return ( stream.LastError() == wxSTREAM_NO_ERROR || stream.LastError() == wxSTREAM_EOF );
|
image->SetMask(FALSE);
|
||||||
|
|
||||||
|
const wxStreamError err = stream.GetLastError();
|
||||||
|
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
|
bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
|
||||||
@@ -1278,7 +1279,7 @@ int wxICOHandler::GetImageCount(wxInputStream& stream)
|
|||||||
|
|
||||||
bool wxICOHandler::DoCanRead(wxInputStream& stream)
|
bool wxICOHandler::DoCanRead(wxInputStream& stream)
|
||||||
{
|
{
|
||||||
stream.SeekI(0);
|
stream.SeekI(0);
|
||||||
unsigned char hdr[4];
|
unsigned char hdr[4];
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@@ -964,7 +964,7 @@ bool wxImage::SaveFile( const wxString& filename, int type ) const
|
|||||||
|
|
||||||
wxFileOutputStream stream(filename);
|
wxFileOutputStream stream(filename);
|
||||||
|
|
||||||
if ( stream.LastError() == wxStream_NOERROR )
|
if ( stream.IsOk() )
|
||||||
{
|
{
|
||||||
wxBufferedOutputStream bstream( stream );
|
wxBufferedOutputStream bstream( stream );
|
||||||
return SaveFile(bstream, type);
|
return SaveFile(bstream, type);
|
||||||
@@ -981,7 +981,7 @@ bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) con
|
|||||||
|
|
||||||
wxFileOutputStream stream(filename);
|
wxFileOutputStream stream(filename);
|
||||||
|
|
||||||
if ( stream.LastError() == wxStream_NOERROR )
|
if ( stream.IsOk() )
|
||||||
{
|
{
|
||||||
wxBufferedOutputStream bstream( stream );
|
wxBufferedOutputStream bstream( stream );
|
||||||
return SaveFile(bstream, mimetype);
|
return SaveFile(bstream, mimetype);
|
||||||
|
@@ -107,7 +107,7 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
value=text_stream.Read32();
|
value=text_stream.Read32();
|
||||||
*ptr++=(unsigned char)value;
|
*ptr++=(unsigned char)value;
|
||||||
|
|
||||||
if (buf_stream.LastError()!=wxSTREAM_NOERROR)
|
if ( !buf_stream )
|
||||||
{
|
{
|
||||||
if (verbose) wxLogError(_("PNM: File seems truncated."));
|
if (verbose) wxLogError(_("PNM: File seems truncated."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -119,7 +119,8 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
|
|
||||||
image->SetMask( FALSE );
|
image->SetMask( FALSE );
|
||||||
|
|
||||||
return (buf_stream.LastError()==wxStream_NOERROR || buf_stream.LastError()==wxStream_EOF);
|
const wxStreamError err = buf_stream.GetLastError();
|
||||||
|
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPNMHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool WXUNUSED(verbose) )
|
bool wxPNMHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool WXUNUSED(verbose) )
|
||||||
@@ -132,7 +133,7 @@ bool wxPNMHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool WXUNUS
|
|||||||
text_stream << wxT("P6\n") << image->GetWidth() << wxT(" ") << image->GetHeight() << wxT("\n255\n");
|
text_stream << wxT("P6\n") << image->GetWidth() << wxT(" ") << image->GetHeight() << wxT("\n255\n");
|
||||||
stream.Write(image->GetData(),3*image->GetWidth()*image->GetHeight());
|
stream.Write(image->GetData(),3*image->GetWidth()*image->GetHeight());
|
||||||
|
|
||||||
return (stream.LastError()==wxStream_NOERROR);
|
return stream.IsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPNMHandler::DoCanRead( wxInputStream& stream )
|
bool wxPNMHandler::DoCanRead( wxInputStream& stream )
|
||||||
|
@@ -80,7 +80,7 @@ size_t wxMemoryInputStream::OnSysRead(void *buffer, size_t nbytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_i_streambuf->Read(buffer, nbytes);
|
m_i_streambuf->Read(buffer, nbytes);
|
||||||
m_lasterror = wxSTREAM_NOERROR;
|
m_lasterror = wxSTREAM_NO_ERROR;
|
||||||
|
|
||||||
return m_i_streambuf->GetIntPosition() - pos;
|
return m_i_streambuf->GetIntPosition() - pos;
|
||||||
}
|
}
|
||||||
|
@@ -216,7 +216,7 @@ bool wxResourceTable::DeleteResource(const wxString& name)
|
|||||||
bool wxResourceTable::ParseResourceFile( wxInputStream *is )
|
bool wxResourceTable::ParseResourceFile( wxInputStream *is )
|
||||||
{
|
{
|
||||||
wxExprDatabase db;
|
wxExprDatabase db;
|
||||||
int len = is->StreamSize() ;
|
int len = is->GetSize() ;
|
||||||
|
|
||||||
bool eof = FALSE;
|
bool eof = FALSE;
|
||||||
while ( is->TellI() + 10 < len) // it's a hack because the streams dont support EOF
|
while ( is->TellI() + 10 < len) // it's a hack because the streams dont support EOF
|
||||||
|
@@ -44,17 +44,11 @@ wxSocketOutputStream::~wxSocketOutputStream()
|
|||||||
|
|
||||||
size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size)
|
size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret = m_o_socket->Write((const char *)buffer, size).LastCount();
|
||||||
|
|
||||||
ret = m_o_socket->Write((const char *)buffer, size).LastCount();
|
m_lasterror = m_o_socket->Error() ? wxSTREAM_WRITE_ERROR : wxSTREAM_NO_ERROR;
|
||||||
|
|
||||||
if (m_o_socket->Error())
|
|
||||||
m_lasterror = wxStream_WRITE_ERR;
|
|
||||||
else
|
|
||||||
m_lasterror = wxStream_NOERROR;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -72,14 +66,9 @@ wxSocketInputStream::~wxSocketInputStream()
|
|||||||
|
|
||||||
size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
|
size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret = m_i_socket->Read((char *)buffer, size).LastCount();
|
||||||
|
|
||||||
ret = m_i_socket->Read((char *)buffer, size).LastCount();
|
m_lasterror = m_i_socket->Error() ? wxSTREAM_READ_ERROR : wxSTREAM_NO_ERROR;
|
||||||
|
|
||||||
if (m_i_socket->Error())
|
|
||||||
m_lasterror = wxStream_READ_ERR;
|
|
||||||
else
|
|
||||||
m_lasterror = wxStream_NOERROR;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
void wxStreamBuffer::SetError(wxStreamError err)
|
void wxStreamBuffer::SetError(wxStreamError err)
|
||||||
{
|
{
|
||||||
if ( m_stream->m_lasterror == wxStream_NOERROR )
|
if ( m_stream->m_lasterror == wxSTREAM_NO_ERROR )
|
||||||
m_stream->m_lasterror = err;
|
m_stream->m_lasterror = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ void wxStreamBuffer::ResetBuffer()
|
|||||||
{
|
{
|
||||||
if ( m_stream )
|
if ( m_stream )
|
||||||
{
|
{
|
||||||
m_stream->m_lasterror = wxStream_NOERROR;
|
m_stream->Reset();
|
||||||
m_stream->m_lastcount = 0;
|
m_stream->m_lastcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ void wxStreamBuffer::PutChar(char c)
|
|||||||
if ( !GetDataLeft() && !FlushBuffer() )
|
if ( !GetDataLeft() && !FlushBuffer() )
|
||||||
{
|
{
|
||||||
// we don't
|
// we don't
|
||||||
SetError(wxStream_WRITE_ERR);
|
SetError(wxSTREAM_WRITE_ERROR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -328,7 +328,7 @@ char wxStreamBuffer::Peek()
|
|||||||
|
|
||||||
if ( !GetDataLeft() )
|
if ( !GetDataLeft() )
|
||||||
{
|
{
|
||||||
SetError(wxStream_READ_ERR);
|
SetError(wxSTREAM_READ_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,7 +354,7 @@ char wxStreamBuffer::GetChar()
|
|||||||
{
|
{
|
||||||
if ( !GetDataLeft() )
|
if ( !GetDataLeft() )
|
||||||
{
|
{
|
||||||
SetError(wxStream_READ_ERR);
|
SetError(wxSTREAM_READ_ERROR);
|
||||||
c = 0;
|
c = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -371,7 +371,7 @@ size_t wxStreamBuffer::Read(void *buffer, size_t size)
|
|||||||
{
|
{
|
||||||
// lasterror is reset before all new IO calls
|
// lasterror is reset before all new IO calls
|
||||||
if ( m_stream )
|
if ( m_stream )
|
||||||
m_stream->m_lasterror = wxStream_NOERROR;
|
m_stream->Reset();
|
||||||
|
|
||||||
size_t read;
|
size_t read;
|
||||||
if ( !HasBuffer() )
|
if ( !HasBuffer() )
|
||||||
@@ -400,7 +400,7 @@ size_t wxStreamBuffer::Read(void *buffer, size_t size)
|
|||||||
|
|
||||||
if ( !FillBuffer() )
|
if ( !FillBuffer() )
|
||||||
{
|
{
|
||||||
SetError(wxStream_EOF);
|
SetError(wxSTREAM_EOF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ size_t wxStreamBuffer::Write(const void *buffer, size_t size)
|
|||||||
wxCHECK_MSG( outStream, 0, _T("should have a stream in wxStreamBuffer") );
|
wxCHECK_MSG( outStream, 0, _T("should have a stream in wxStreamBuffer") );
|
||||||
|
|
||||||
// lasterror is reset before all new IO calls
|
// lasterror is reset before all new IO calls
|
||||||
m_stream->m_lasterror = wxStream_NOERROR;
|
m_stream->Reset();
|
||||||
|
|
||||||
if ( !HasBuffer() && m_fixed )
|
if ( !HasBuffer() && m_fixed )
|
||||||
{
|
{
|
||||||
@@ -481,7 +481,7 @@ size_t wxStreamBuffer::Write(const void *buffer, size_t size)
|
|||||||
|
|
||||||
if ( !FlushBuffer() )
|
if ( !FlushBuffer() )
|
||||||
{
|
{
|
||||||
SetError(wxStream_WRITE_ERR);
|
SetError(wxSTREAM_WRITE_ERROR);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -634,7 +634,7 @@ off_t wxStreamBuffer::Tell() const
|
|||||||
|
|
||||||
wxStreamBase::wxStreamBase()
|
wxStreamBase::wxStreamBase()
|
||||||
{
|
{
|
||||||
m_lasterror = wxStream_NOERROR;
|
m_lasterror = wxSTREAM_NO_ERROR;
|
||||||
m_lastcount = 0;
|
m_lastcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -812,7 +812,7 @@ char wxInputStream::Peek()
|
|||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
Read(&c, sizeof(c));
|
Read(&c, sizeof(c));
|
||||||
if (m_lasterror == wxStream_NOERROR)
|
if (m_lasterror == wxSTREAM_NO_ERROR)
|
||||||
{
|
{
|
||||||
Ungetch(c);
|
Ungetch(c);
|
||||||
return c;
|
return c;
|
||||||
@@ -847,7 +847,7 @@ off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
|
|||||||
|
|
||||||
// I don't know whether it should be put as well in wxFileInputStream::OnSysSeek
|
// I don't know whether it should be put as well in wxFileInputStream::OnSysSeek
|
||||||
if (m_lasterror==wxSTREAM_EOF)
|
if (m_lasterror==wxSTREAM_EOF)
|
||||||
m_lasterror=wxSTREAM_NOERROR;
|
m_lasterror=wxSTREAM_NO_ERROR;
|
||||||
|
|
||||||
/* RR: A call to SeekI() will automatically invalidate any previous
|
/* RR: A call to SeekI() will automatically invalidate any previous
|
||||||
call to Ungetch(), otherwise it would be possible to SeekI() to
|
call to Ungetch(), otherwise it would be possible to SeekI() to
|
||||||
@@ -1062,7 +1062,7 @@ char wxBufferedInputStream::Peek()
|
|||||||
wxInputStream& wxBufferedInputStream::Read(void *buf, size_t size)
|
wxInputStream& wxBufferedInputStream::Read(void *buf, size_t size)
|
||||||
{
|
{
|
||||||
// reset the error flag
|
// reset the error flag
|
||||||
m_lasterror = wxStream_NOERROR;
|
Reset();
|
||||||
|
|
||||||
// first read from the already cached data
|
// first read from the already cached data
|
||||||
m_lastcount = GetWBack(buf, size);
|
m_lastcount = GetWBack(buf, size);
|
||||||
@@ -1090,7 +1090,7 @@ off_t wxBufferedInputStream::SeekI(off_t pos, wxSeekMode mode)
|
|||||||
// RR: Look at wxInputStream for comments.
|
// RR: Look at wxInputStream for comments.
|
||||||
|
|
||||||
if (m_lasterror==wxSTREAM_EOF)
|
if (m_lasterror==wxSTREAM_EOF)
|
||||||
m_lasterror=wxSTREAM_NOERROR;
|
Reset();
|
||||||
|
|
||||||
if (m_wback)
|
if (m_wback)
|
||||||
{
|
{
|
||||||
|
@@ -1106,7 +1106,7 @@ static long wxDoExecuteWithCapture(const wxString& command,
|
|||||||
if ( !is->Eof() && is->IsOk() )
|
if ( !is->Eof() && is->IsOk() )
|
||||||
{
|
{
|
||||||
wxString line = tis.ReadLine();
|
wxString line = tis.ReadLine();
|
||||||
if ( is->LastError() )
|
if ( !*is )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cont = TRUE;
|
cont = TRUE;
|
||||||
@@ -1117,7 +1117,7 @@ static long wxDoExecuteWithCapture(const wxString& command,
|
|||||||
if ( error && !es->Eof() && es->IsOk() )
|
if ( error && !es->Eof() && es->IsOk() )
|
||||||
{
|
{
|
||||||
wxString line = tes->ReadLine();
|
wxString line = tes->ReadLine();
|
||||||
if ( es->LastError() )
|
if ( !*es )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cont = TRUE;
|
cont = TRUE;
|
||||||
|
@@ -235,10 +235,10 @@ size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size)
|
|||||||
ret = m_file->Read(buffer, size);
|
ret = m_file->Read(buffer, size);
|
||||||
|
|
||||||
if (m_file->Eof())
|
if (m_file->Eof())
|
||||||
m_lasterror = wxStream_EOF;
|
m_lasterror = wxSTREAM_EOF;
|
||||||
if (ret == wxInvalidOffset)
|
if (ret == wxInvalidOffset)
|
||||||
{
|
{
|
||||||
m_lasterror = wxStream_READ_ERR;
|
m_lasterror = wxSTREAM_READ_ERROR;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,9 +307,9 @@ size_t wxFFileOutputStream::OnSysWrite(const void *buffer, size_t size)
|
|||||||
{
|
{
|
||||||
size_t ret = m_file->Write(buffer, size);
|
size_t ret = m_file->Write(buffer, size);
|
||||||
if (m_file->Error())
|
if (m_file->Error())
|
||||||
m_lasterror = wxStream_WRITE_ERR;
|
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||||
else
|
else
|
||||||
m_lasterror = wxStream_NOERROR;
|
m_lasterror = wxSTREAM_NO_ERROR;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -143,7 +143,7 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream)
|
|||||||
wxCharBuffer buffer(length);
|
wxCharBuffer buffer(length);
|
||||||
|
|
||||||
char *xpm_buffer = (char *)buffer.data();
|
char *xpm_buffer = (char *)buffer.data();
|
||||||
if ( stream.Read(xpm_buffer, length).LastError() == wxSTREAM_READ_ERROR )
|
if ( stream.Read(xpm_buffer, length).GetLastError() == wxSTREAM_READ_ERROR )
|
||||||
return wxNullImage;
|
return wxNullImage;
|
||||||
xpm_buffer[length] = '\0';
|
xpm_buffer[length] = '\0';
|
||||||
|
|
||||||
|
@@ -43,12 +43,12 @@ wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file
|
|||||||
m_Archive = (void*) unzOpen(archive.mb_str());
|
m_Archive = (void*) unzOpen(archive.mb_str());
|
||||||
if (m_Archive == NULL)
|
if (m_Archive == NULL)
|
||||||
{
|
{
|
||||||
m_lasterror = wxStream_READ_ERR;
|
m_lasterror = wxSTREAM_READ_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (unzLocateFile((unzFile)m_Archive, file.mb_str(), 0) != UNZ_OK)
|
if (unzLocateFile((unzFile)m_Archive, file.mb_str(), 0) != UNZ_OK)
|
||||||
{
|
{
|
||||||
m_lasterror = wxStream_READ_ERR;
|
m_lasterror = wxSTREAM_READ_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file
|
|||||||
|
|
||||||
if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK)
|
if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
m_lasterror = wxStream_READ_ERR;
|
m_lasterror = wxSTREAM_READ_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_Size = (size_t)zinfo.uncompressed_size;
|
m_Size = (size_t)zinfo.uncompressed_size;
|
||||||
@@ -90,7 +90,7 @@ size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize)
|
|||||||
|
|
||||||
if ( m_Pos >= (off_t)m_Size )
|
if ( m_Pos >= (off_t)m_Size )
|
||||||
{
|
{
|
||||||
m_lasterror = wxStream_EOF;
|
m_lasterror = wxSTREAM_EOF;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ off_t wxZipInputStream::OnSysSeek(off_t seek, wxSeekMode mode)
|
|||||||
unzCloseCurrentFile((unzFile)m_Archive);
|
unzCloseCurrentFile((unzFile)m_Archive);
|
||||||
if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK)
|
if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK)
|
||||||
{
|
{
|
||||||
m_lasterror = wxStream_READ_ERR;
|
m_lasterror = wxSTREAM_READ_ERROR;
|
||||||
return m_Pos;
|
return m_Pos;
|
||||||
}
|
}
|
||||||
toskip = nextpos;
|
toskip = nextpos;
|
||||||
|
@@ -89,17 +89,17 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size)
|
|||||||
m_inflate->next_in = m_z_buffer;
|
m_inflate->next_in = m_z_buffer;
|
||||||
m_inflate->avail_in = m_parent_i_stream->LastRead();
|
m_inflate->avail_in = m_parent_i_stream->LastRead();
|
||||||
|
|
||||||
if (m_parent_i_stream->LastError() != wxStream_NOERROR &&
|
wxStreamError err = m_parent_i_stream->GetLastError();
|
||||||
m_parent_i_stream->LastError() != wxStream_EOF)
|
if ( err != wxSTREAM_NO_ERROR && err != wxSTREAM_EOF)
|
||||||
{
|
{
|
||||||
m_lasterror = m_parent_i_stream->LastError();
|
m_lasterror = err;
|
||||||
return 0; // failed to read anything
|
return 0; // failed to read anything
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_inflate->avail_in == 0 )
|
if ( m_inflate->avail_in == 0 )
|
||||||
{
|
{
|
||||||
// EOF
|
// EOF
|
||||||
m_lasterror = wxStream_EOF;
|
m_lasterror = wxSTREAM_EOF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size)
|
|||||||
|
|
||||||
if (m_deflate->avail_out == 0) {
|
if (m_deflate->avail_out == 0) {
|
||||||
m_parent_o_stream->Write(m_z_buffer, m_z_size);
|
m_parent_o_stream->Write(m_z_buffer, m_z_size);
|
||||||
if (m_parent_o_stream->LastError() != wxStream_NOERROR)
|
if ( !*m_parent_o_stream )
|
||||||
return (size - m_deflate->avail_in);
|
return (size - m_deflate->avail_in);
|
||||||
|
|
||||||
m_deflate->next_out = m_z_buffer;
|
m_deflate->next_out = m_z_buffer;
|
||||||
|
@@ -418,7 +418,7 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len)
|
|||||||
{
|
{
|
||||||
DWORD bytesWritten;
|
DWORD bytesWritten;
|
||||||
|
|
||||||
m_lasterror = wxSTREAM_NOERROR;
|
m_lasterror = wxSTREAM_NO_ERROR;
|
||||||
if ( !::WriteFile(m_hOutput, buffer, len, &bytesWritten, NULL) )
|
if ( !::WriteFile(m_hOutput, buffer, len, &bytesWritten, NULL) )
|
||||||
{
|
{
|
||||||
m_lasterror = ::GetLastError() == ERROR_BROKEN_PIPE
|
m_lasterror = ::GetLastError() == ERROR_BROKEN_PIPE
|
||||||
|
Reference in New Issue
Block a user