fixes for big endiand machines (Chris Elliott, patch 520879)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-02-21 15:19:25 +00:00
parent 40e7f56c71
commit 1af5934b54

View File

@@ -1255,7 +1255,7 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
{ {
// we always have a data size // we always have a data size
stream.Read(&datalen, 4); stream.Read(&datalen, 4);
datalen = wxINT32_SWAP_ON_BE(datalen) ;
//now either data or a FCC //now either data or a FCC
if ( (FCC1 == *riff32) || (FCC1 == *list32) ) if ( (FCC1 == *riff32) || (FCC1 == *list32) )
{ {
@@ -1301,11 +1301,11 @@ bool wxANIHandler::DoCanRead(wxInputStream& stream)
// we have a riff file: // we have a riff file:
while ( stream.IsOk() ) while ( stream.IsOk() )
{ {
if ( FCC1 != *anih32 ) if ( FCC1 == *anih32 )
return TRUE; return TRUE;
// we always have a data size: // we always have a data size:
stream.Read(&datalen, 4); stream.Read(&datalen, 4);
datalen = wxINT32_SWAP_ON_BE(datalen) ;
// now either data or a FCC: // now either data or a FCC:
if ( (FCC1 == *riff32) || (FCC1 == *list32) ) if ( (FCC1 == *riff32) || (FCC1 == *list32) )
{ {
@@ -1345,7 +1345,7 @@ int wxANIHandler::GetImageCount(wxInputStream& stream)
{ {
// we always have a data size: // we always have a data size:
stream.Read(&datalen, 4); stream.Read(&datalen, 4);
datalen = wxINT32_SWAP_ON_BE(datalen) ;
// now either data or a FCC: // now either data or a FCC:
if ( (FCC1 == *riff32) || (FCC1 == *list32) ) if ( (FCC1 == *riff32) || (FCC1 == *list32) )
{ {
@@ -1357,7 +1357,7 @@ int wxANIHandler::GetImageCount(wxInputStream& stream)
{ {
wxUint32 *pData = new wxUint32[datalen/4]; wxUint32 *pData = new wxUint32[datalen/4];
stream.Read(pData, datalen); stream.Read(pData, datalen);
int nIcons = *(pData + 1); int nIcons = wxINT32_SWAP_ON_BE(*(pData + 1));
delete[] pData; delete[] pData;
return nIcons; return nIcons;
} }