Kaydet (Commit) 48615e21 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

check stream status more often

Change-Id: I233c2fff9c06a81117f8114ccee83b53ea4026db
(cherry picked from commit b43e0335)
Reviewed-on: https://gerrit.libreoffice.org/18505Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 17fab948
...@@ -222,32 +222,44 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc) ...@@ -222,32 +222,44 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
case 1 : case 1 :
for (y = 0; y < mnHeight && mbStatus; ++y) for (y = 0; y < mnHeight && mbStatus; ++y)
{ {
for ( x = 0; x < mnWidth; x++ ) for (x = 0; x < mnWidth && mbStatus; ++x)
{ {
if (!(x & 7)) if (!(x & 7))
{
nDat = ImplGetByte(); nDat = ImplGetByte();
if (!m_rRAS.good())
mbStatus = false;
}
pAcc->SetPixelIndex( y, x, pAcc->SetPixelIndex( y, x,
sal::static_int_cast< sal_uInt8 >( sal::static_int_cast< sal_uInt8 >(
nDat >> ( ( x & 7 ) ^ 7 )) ); nDat >> ( ( x & 7 ) ^ 7 )) );
} }
if (!( ( x - 1 ) & 0x8 ) ) ImplGetByte(); // WORD ALIGNMENT ??? if (!( ( x - 1 ) & 0x8 ) )
{
ImplGetByte(); // WORD ALIGNMENT ???
if (!m_rRAS.good()) if (!m_rRAS.good())
mbStatus = false; mbStatus = false;
} }
}
break; break;
case 8 : case 8 :
for (y = 0; y < mnHeight && mbStatus; ++y) for (y = 0; y < mnHeight && mbStatus; ++y)
{ {
for ( x = 0; x < mnWidth; x++ ) for (x = 0; x < mnWidth && mbStatus; ++x)
{ {
nDat = ImplGetByte(); nDat = ImplGetByte();
pAcc->SetPixelIndex( y, x, nDat ); pAcc->SetPixelIndex( y, x, nDat );
if (!m_rRAS.good())
mbStatus = false;
} }
if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ??? if ( x & 1 )
{
ImplGetByte(); // WORD ALIGNMENT ???
if (!m_rRAS.good()) if (!m_rRAS.good())
mbStatus = false; mbStatus = false;
} }
}
break; break;
case 24 : case 24 :
...@@ -257,7 +269,7 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc) ...@@ -257,7 +269,7 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
case 24 : case 24 :
for (y = 0; y < mnHeight && mbStatus; ++y) for (y = 0; y < mnHeight && mbStatus; ++y)
{ {
for ( x = 0; x < mnWidth; x++ ) for (x = 0; x < mnWidth && mbStatus; ++x)
{ {
if ( mnType == RAS_TYPE_RGB_FORMAT ) if ( mnType == RAS_TYPE_RGB_FORMAT )
{ {
...@@ -272,17 +284,22 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc) ...@@ -272,17 +284,22 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
nRed = ImplGetByte(); nRed = ImplGetByte();
} }
pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) ); pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) );
if (!m_rRAS.good())
mbStatus = false;
} }
if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ??? if ( x & 1 )
{
ImplGetByte(); // WORD ALIGNMENT ???
if (!m_rRAS.good()) if (!m_rRAS.good())
mbStatus = false; mbStatus = false;
} }
}
break; break;
case 32 : case 32 :
for (y = 0; y < mnHeight && mbStatus; ++y) for (y = 0; y < mnHeight && mbStatus; ++y)
{ {
for ( x = 0; x < mnWidth; x++ ) for (x = 0; x < mnWidth && mbStatus; ++x)
{ {
nDat = ImplGetByte(); // pad byte > nil nDat = ImplGetByte(); // pad byte > nil
if ( mnType == RAS_TYPE_RGB_FORMAT ) if ( mnType == RAS_TYPE_RGB_FORMAT )
...@@ -298,10 +315,10 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc) ...@@ -298,10 +315,10 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
nRed = ImplGetByte(); nRed = ImplGetByte();
} }
pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) ); pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) );
}
if (!m_rRAS.good()) if (!m_rRAS.good())
mbStatus = false; mbStatus = false;
} }
}
break; break;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment