sal_Bool to bool

Change-Id: I20c94b140547e1f8de0665c7287bf586fb91dede
This commit is contained in:
Takeshi Abe
2013-05-29 15:22:47 +09:00
parent 526fbddf69
commit b34e39bcc2
4 changed files with 72 additions and 72 deletions

View File

@@ -35,7 +35,7 @@ GIFLZWDecompressor::GIFLZWDecompressor( sal_uInt8 cDataSize ) :
nInputBitsBuf ( 0 ), nInputBitsBuf ( 0 ),
nOutBufDataLen ( 0 ), nOutBufDataLen ( 0 ),
nInputBitsBufSize ( 0 ), nInputBitsBufSize ( 0 ),
bEOIFound ( sal_False ), bEOIFound ( false ),
nDataSize ( cDataSize ) nDataSize ( cDataSize )
{ {
pOutBuf = new sal_uInt8[ 4096 ]; pOutBuf = new sal_uInt8[ 4096 ];
@@ -68,7 +68,7 @@ GIFLZWDecompressor::~GIFLZWDecompressor()
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize,
sal_uLong& rCount, sal_Bool& rEOI ) sal_uLong& rCount, bool& rEOI )
{ {
sal_uLong nTargetSize = 4096; sal_uLong nTargetSize = 4096;
sal_uLong nCount = 0; sal_uLong nCount = 0;
@@ -132,18 +132,18 @@ void GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 nCodeFirst
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
sal_Bool GIFLZWDecompressor::ProcessOneCode() bool GIFLZWDecompressor::ProcessOneCode()
{ {
GIFLZWTableEntry* pE; GIFLZWTableEntry* pE;
sal_uInt16 nCode; sal_uInt16 nCode;
sal_Bool bRet = sal_False; bool bRet = false;
sal_Bool bEndOfBlock = sal_False; bool bEndOfBlock = false;
while( nInputBitsBufSize < nCodeSize ) while( nInputBitsBufSize < nCodeSize )
{ {
if( nBlockBufPos >= nBlockBufSize ) if( nBlockBufPos >= nBlockBufSize )
{ {
bEndOfBlock = sal_True; bEndOfBlock = true;
break; break;
} }
@@ -181,9 +181,9 @@ sal_Bool GIFLZWDecompressor::ProcessOneCode()
nOutBufDataLen = 0; nOutBufDataLen = 0;
} }
else else
bEOIFound = sal_True; bEOIFound = true;
return sal_True; return true;
} }
nOldCode = nCode; nOldCode = nCode;
@@ -198,7 +198,7 @@ sal_Bool GIFLZWDecompressor::ProcessOneCode()
} }
while( pE ); while( pE );
bRet = sal_True; bRet = true;
} }
return bRet; return bRet;

View File

@@ -38,13 +38,13 @@ class GIFLZWDecompressor
sal_uInt16 nOldCode; sal_uInt16 nOldCode;
sal_uInt16 nOutBufDataLen; sal_uInt16 nOutBufDataLen;
sal_uInt16 nInputBitsBufSize; sal_uInt16 nInputBitsBufSize;
sal_Bool bEOIFound; bool bEOIFound;
sal_uInt8 nDataSize; sal_uInt8 nDataSize;
sal_uInt8 nBlockBufSize; sal_uInt8 nBlockBufSize;
sal_uInt8 nBlockBufPos; sal_uInt8 nBlockBufPos;
void AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData); void AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData);
sal_Bool ProcessOneCode(); bool ProcessOneCode();
public: public:
@@ -52,7 +52,7 @@ public:
GIFLZWDecompressor( sal_uInt8 cDataSize ); GIFLZWDecompressor( sal_uInt8 cDataSize );
~GIFLZWDecompressor(); ~GIFLZWDecompressor();
HPBYTE DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, sal_uLong& rCount, sal_Bool& rEOI ); HPBYTE DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, sal_uLong& rCount, bool& rEOI );
}; };
#endif #endif

View File

@@ -42,8 +42,8 @@ GIFReader::GIFReader( SvStream& rStm ) :
nImageHeight ( 0 ), nImageHeight ( 0 ),
nLoops ( 1 ), nLoops ( 1 ),
eActAction ( GLOBAL_HEADER_READING ), eActAction ( GLOBAL_HEADER_READING ),
bGCTransparent ( sal_False ), bGCTransparent ( false ),
bImGraphicReady ( sal_False ) bImGraphicReady ( false )
{ {
maUpperName = OUString("SVIGIF"); maUpperName = OUString("SVIGIF");
pSrcBuf = new sal_uInt8[ 256 ]; pSrcBuf = new sal_uInt8[ 256 ];
@@ -67,12 +67,12 @@ GIFReader::~GIFReader()
void GIFReader::ClearImageExtensions() void GIFReader::ClearImageExtensions()
{ {
nGCDisposalMethod = 0; nGCDisposalMethod = 0;
bGCTransparent = sal_False; bGCTransparent = false;
nTimer = 0; nTimer = 0;
} }
sal_Bool GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, bool GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal,
sal_Bool bWatchForBackgroundColor ) bool bWatchForBackgroundColor )
{ {
const Size aSize( nWidth, nHeight ); const Size aSize( nWidth, nHeight );
@@ -85,7 +85,7 @@ sal_Bool GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPa
// fails on 64-bit Linux, no idea. // fails on 64-bit Linux, no idea.
if (nWidth >= 64000 && nHeight >= 64000) if (nWidth >= 64000 && nHeight >= 64000)
{ {
bStatus = sal_False; bStatus = false;
return bStatus; return bStatus;
} }
#endif #endif
@@ -107,7 +107,7 @@ sal_Bool GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPa
cNonTransIndex1 = cTransIndex1 ? 0 : 1; cNonTransIndex1 = cTransIndex1 ? 0 : 1;
} }
else else
bStatus = sal_False; bStatus = false;
} }
if( bStatus ) if( bStatus )
@@ -126,12 +126,12 @@ sal_Bool GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPa
return bStatus; return bStatus;
} }
sal_Bool GIFReader::ReadGlobalHeader() bool GIFReader::ReadGlobalHeader()
{ {
char pBuf[ 7 ]; char pBuf[ 7 ];
sal_uInt8 nRF; sal_uInt8 nRF;
sal_uInt8 nAspect; sal_uInt8 nAspect;
sal_Bool bRet = sal_False; bool bRet = false;
rIStm.Read( pBuf, 6 ); rIStm.Read( pBuf, 6 );
if( NO_PENDING( rIStm ) ) if( NO_PENDING( rIStm ) )
@@ -151,7 +151,7 @@ sal_Bool GIFReader::ReadGlobalHeader()
aMemStm >> nBackgroundColor; aMemStm >> nBackgroundColor;
aMemStm >> nAspect; aMemStm >> nAspect;
bGlobalPalette = (sal_Bool) ( nRF & 0x80 ); bGlobalPalette = ( nRF & 0x80 );
if( bGlobalPalette ) if( bGlobalPalette )
ReadPaletteEntries( &aGPalette, 1 << ( ( nRF & 7 ) + 1 ) ); ReadPaletteEntries( &aGPalette, 1 << ( ( nRF & 7 ) + 1 ) );
@@ -159,11 +159,11 @@ sal_Bool GIFReader::ReadGlobalHeader()
nBackgroundColor = 0; nBackgroundColor = 0;
if( NO_PENDING( rIStm ) ) if( NO_PENDING( rIStm ) )
bRet = sal_True; bRet = true;
} }
} }
else else
bStatus = sal_False; bStatus = false;
} }
return bRet; return bRet;
@@ -201,13 +201,13 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount )
delete[] pBuf; delete[] pBuf;
} }
sal_Bool GIFReader::ReadExtension() bool GIFReader::ReadExtension()
{ {
sal_uInt8 cFunction; sal_uInt8 cFunction;
sal_uInt8 cSize; sal_uInt8 cSize;
sal_uInt8 cByte; sal_uInt8 cByte;
sal_Bool bRet = sal_False; bool bRet = false;
sal_Bool bOverreadDataBlocks = sal_False; bool bOverreadDataBlocks = false;
// Extension-Label // Extension-Label
rIStm >> cFunction; rIStm >> cFunction;
@@ -231,9 +231,9 @@ sal_Bool GIFReader::ReadExtension()
if ( NO_PENDING( rIStm ) ) if ( NO_PENDING( rIStm ) )
{ {
nGCDisposalMethod = ( cFlags >> 2) & 7; nGCDisposalMethod = ( cFlags >> 2) & 7;
bGCTransparent = ( cFlags & 1 ) ? sal_True : sal_False; bGCTransparent = ( cFlags & 1 );
bStatus = ( cSize == 4 ) && ( cByte == 0 ); bStatus = ( cSize == 4 ) && ( cByte == 0 );
bRet = sal_True; bRet = true;
} }
} }
break; break;
@@ -244,7 +244,7 @@ sal_Bool GIFReader::ReadExtension()
if ( NO_PENDING( rIStm ) ) if ( NO_PENDING( rIStm ) )
{ {
// default diese Extension ueberlesen // default diese Extension ueberlesen
bOverreadDataBlocks = sal_True; bOverreadDataBlocks = true;
// Appl.-Extension hat Laenge 11 // Appl.-Extension hat Laenge 11
if ( cSize == 0x0b ) if ( cSize == 0x0b )
@@ -269,7 +269,7 @@ sal_Bool GIFReader::ReadExtension()
bStatus = ( cByte == 0 ); bStatus = ( cByte == 0 );
bRet = NO_PENDING( rIStm ); bRet = NO_PENDING( rIStm );
bOverreadDataBlocks = sal_False; bOverreadDataBlocks = false;
// Netscape interpretiert den LoopCount // Netscape interpretiert den LoopCount
// als reine Anzahl der _Wiederholungen_; // als reine Anzahl der _Wiederholungen_;
@@ -292,7 +292,7 @@ sal_Bool GIFReader::ReadExtension()
rIStm >> cByte; rIStm >> cByte;
bStatus = ( cByte == 0 ); bStatus = ( cByte == 0 );
bRet = NO_PENDING( rIStm ); bRet = NO_PENDING( rIStm );
bOverreadDataBlocks = sal_False; bOverreadDataBlocks = false;
} }
else else
rIStm.SeekRel( -1 ); rIStm.SeekRel( -1 );
@@ -305,25 +305,25 @@ sal_Bool GIFReader::ReadExtension()
// alles andere ueberlesen // alles andere ueberlesen
default: default:
bOverreadDataBlocks = sal_True; bOverreadDataBlocks = true;
break; break;
} }
// Sub-Blocks ueberlesen // Sub-Blocks ueberlesen
if ( bOverreadDataBlocks ) if ( bOverreadDataBlocks )
{ {
bRet = sal_True; bRet = true;
while( cSize && bStatus && !rIStm.IsEof() ) while( cSize && bStatus && !rIStm.IsEof() )
{ {
sal_uInt16 nCount = (sal_uInt16) cSize + 1; sal_uInt16 nCount = (sal_uInt16) cSize + 1;
char* pBuffer = new char[ nCount ]; char* pBuffer = new char[ nCount ];
bRet = sal_False; bRet = false;
rIStm.Read( pBuffer, nCount ); rIStm.Read( pBuffer, nCount );
if( NO_PENDING( rIStm ) ) if( NO_PENDING( rIStm ) )
{ {
cSize = (sal_uInt8) pBuffer[ cSize ]; cSize = (sal_uInt8) pBuffer[ cSize ];
bRet = sal_True; bRet = true;
} }
else else
cSize = 0; cSize = 0;
@@ -336,10 +336,10 @@ sal_Bool GIFReader::ReadExtension()
return bRet; return bRet;
} }
sal_Bool GIFReader::ReadLocalHeader() bool GIFReader::ReadLocalHeader()
{ {
sal_uInt8 pBuf[ 9 ]; sal_uInt8 pBuf[ 9 ];
sal_Bool bRet = sal_False; bool bRet = false;
rIStm.Read( pBuf, 9 ); rIStm.Read( pBuf, 9 );
if( NO_PENDING( rIStm ) ) if( NO_PENDING( rIStm ) )
@@ -376,7 +376,7 @@ sal_Bool GIFReader::ReadLocalHeader()
if( NO_PENDING( rIStm ) ) if( NO_PENDING( rIStm ) )
{ {
CreateBitmaps( nImageWidth, nImageHeight, pPal, bGlobalPalette && ( pPal == &aGPalette ) ); CreateBitmaps( nImageWidth, nImageHeight, pPal, bGlobalPalette && ( pPal == &aGPalette ) );
bRet = sal_True; bRet = true;
} }
} }
@@ -407,7 +407,7 @@ sal_uLong GIFReader::ReadNextBlock()
nRet = 3UL; nRet = 3UL;
else else
{ {
sal_Bool bEOI; bool bEOI;
HPBYTE pTarget = pDecomp->DecompressBlock( pSrcBuf, cBlockSize, nRead, bEOI ); HPBYTE pTarget = pDecomp->DecompressBlock( pSrcBuf, cBlockSize, nRead, bEOI );
nRet = ( bEOI ? 3 : 1 ); nRet = ( bEOI ? 3 : 1 );
@@ -521,7 +521,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount )
} }
else else
{ {
bOverreadBlock = sal_True; bOverreadBlock = true;
break; break;
} }
} }
@@ -593,10 +593,10 @@ const Graphic& GIFReader::GetIntermediateGraphic()
return aImGraphic; return aImGraphic;
} }
sal_Bool GIFReader::ProcessGIF() bool GIFReader::ProcessGIF()
{ {
sal_Bool bRead = sal_False; bool bRead = false;
sal_Bool bEnd = sal_False; bool bEnd = false;
if ( !bStatus ) if ( !bStatus )
eActAction = ABORT_READING; eActAction = ABORT_READING;
@@ -617,7 +617,7 @@ sal_Bool GIFReader::ProcessGIF()
eActAction = END_READING; eActAction = END_READING;
else if( NO_PENDING( rIStm ) ) else if( NO_PENDING( rIStm ) )
{ {
bRead = sal_True; bRead = true;
if( cByte == '!' ) if( cByte == '!' )
eActAction = EXTENSION_READING; eActAction = EXTENSION_READING;
@@ -634,7 +634,7 @@ sal_Bool GIFReader::ProcessGIF()
// ScreenDescriptor lesen // ScreenDescriptor lesen
case( GLOBAL_HEADER_READING ): case( GLOBAL_HEADER_READING ):
{ {
if( ( bRead = ReadGlobalHeader() ) == sal_True ) if( ( bRead = ReadGlobalHeader() ) )
{ {
ClearImageExtensions(); ClearImageExtensions();
eActAction = MARKER_READING; eActAction = MARKER_READING;
@@ -646,7 +646,7 @@ sal_Bool GIFReader::ProcessGIF()
// Extension lesen // Extension lesen
case( EXTENSION_READING ): case( EXTENSION_READING ):
{ {
if( ( bRead = ReadExtension() ) == sal_True ) if( ( bRead = ReadExtension() ) )
eActAction = MARKER_READING; eActAction = MARKER_READING;
} }
break; break;
@@ -655,7 +655,7 @@ sal_Bool GIFReader::ProcessGIF()
// Image-Descriptor lesen // Image-Descriptor lesen
case( LOCAL_HEADER_READING ): case( LOCAL_HEADER_READING ):
{ {
if( ( bRead = ReadLocalHeader() ) == sal_True ) if( ( bRead = ReadLocalHeader() ) )
{ {
nYAcc = nImageX = nImageY = 0; nYAcc = nImageX = nImageY = 0;
eActAction = FIRST_BLOCK_READING; eActAction = FIRST_BLOCK_READING;
@@ -674,13 +674,13 @@ sal_Bool GIFReader::ProcessGIF()
if( rIStm.IsEof() ) if( rIStm.IsEof() )
eActAction = ABORT_READING; eActAction = ABORT_READING;
else if( cDataSize > 12 ) else if( cDataSize > 12 )
bStatus = sal_False; bStatus = false;
else if( NO_PENDING( rIStm ) ) else if( NO_PENDING( rIStm ) )
{ {
bRead = sal_True; bRead = true;
pDecomp = new GIFLZWDecompressor( cDataSize ); pDecomp = new GIFLZWDecompressor( cDataSize );
eActAction = NEXT_BLOCK_READING; eActAction = NEXT_BLOCK_READING;
bOverreadBlock = sal_False; bOverreadBlock = false;
} }
else else
eActAction = FIRST_BLOCK_READING; eActAction = FIRST_BLOCK_READING;
@@ -697,13 +697,13 @@ sal_Bool GIFReader::ProcessGIF()
// Return: 0:Pending / 1:OK; / 2:OK und letzter Block: / 3:EOI / 4:HardAbort // Return: 0:Pending / 1:OK; / 2:OK und letzter Block: / 3:EOI / 4:HardAbort
if( nRet ) if( nRet )
{ {
bRead = sal_True; bRead = true;
if ( nRet == 1UL ) if ( nRet == 1UL )
{ {
bImGraphicReady = sal_True; bImGraphicReady = true;
eActAction = NEXT_BLOCK_READING; eActAction = NEXT_BLOCK_READING;
bOverreadBlock = sal_False; bOverreadBlock = false;
} }
else else
{ {
@@ -717,7 +717,7 @@ sal_Bool GIFReader::ProcessGIF()
else if( nRet == 3UL ) else if( nRet == 3UL )
{ {
eActAction = NEXT_BLOCK_READING; eActAction = NEXT_BLOCK_READING;
bOverreadBlock = sal_True; bOverreadBlock = true;
} }
else else
{ {
@@ -739,7 +739,7 @@ sal_Bool GIFReader::ProcessGIF()
// ein Fehler trat auf // ein Fehler trat auf
case( ABORT_READING ): case( ABORT_READING ):
{ {
bEnd = sal_True; bEnd = true;
eActAction = END_READING; eActAction = END_READING;
} }
break; break;
@@ -761,7 +761,7 @@ ReadState GIFReader::ReadGIF( Graphic& rGraphic )
{ {
ReadState eReadState; ReadState eReadState;
bStatus = sal_True; bStatus = true;
while( ProcessGIF() && ( eActAction != END_READING ) ) {} while( ProcessGIF() && ( eActAction != END_READING ) ) {}
@@ -793,12 +793,12 @@ ReadState GIFReader::ReadGIF( Graphic& rGraphic )
return eReadState; return eReadState;
} }
sal_Bool ImportGIF( SvStream & rStm, Graphic& rGraphic ) bool ImportGIF( SvStream & rStm, Graphic& rGraphic )
{ {
GIFReader* pGIFReader = (GIFReader*) rGraphic.GetContext(); GIFReader* pGIFReader = (GIFReader*) rGraphic.GetContext();
sal_uInt16 nOldFormat = rStm.GetNumberFormatInt(); sal_uInt16 nOldFormat = rStm.GetNumberFormatInt();
ReadState eReadState; ReadState eReadState;
sal_Bool bRet = sal_True; bool bRet = true;
rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
@@ -810,7 +810,7 @@ sal_Bool ImportGIF( SvStream & rStm, Graphic& rGraphic )
if( eReadState == GIFREAD_ERROR ) if( eReadState == GIFREAD_ERROR )
{ {
bRet = sal_False; bRet = false;
delete pGIFReader; delete pGIFReader;
} }
else if( eReadState == GIFREAD_OK ) else if( eReadState == GIFREAD_OK )

View File

@@ -78,12 +78,12 @@ class GIFReader : public GraphicReader
sal_uInt16 nLastInterCount; sal_uInt16 nLastInterCount;
sal_uInt16 nLoops; sal_uInt16 nLoops;
GIFAction eActAction; GIFAction eActAction;
sal_Bool bStatus; bool bStatus;
sal_Bool bGCTransparent; // Ob das Bild Transparent ist, wenn ja: bool bGCTransparent; // Ob das Bild Transparent ist, wenn ja:
sal_Bool bInterlaced; bool bInterlaced;
sal_Bool bOverreadBlock; bool bOverreadBlock;
sal_Bool bImGraphicReady; bool bImGraphicReady;
sal_Bool bGlobalPalette; bool bGlobalPalette;
sal_uInt8 nBackgroundColor; // Hintergrundfarbe sal_uInt8 nBackgroundColor; // Hintergrundfarbe
sal_uInt8 nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig sal_uInt8 nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig
sal_uInt8 nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku) sal_uInt8 nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku)
@@ -92,14 +92,14 @@ class GIFReader : public GraphicReader
void ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount ); void ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount );
void ClearImageExtensions(); void ClearImageExtensions();
sal_Bool CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, sal_Bool bWatchForBackgroundColor ); bool CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, bool bWatchForBackgroundColor );
sal_Bool ReadGlobalHeader(); bool ReadGlobalHeader();
sal_Bool ReadExtension(); bool ReadExtension();
sal_Bool ReadLocalHeader(); bool ReadLocalHeader();
sal_uLong ReadNextBlock(); sal_uLong ReadNextBlock();
void FillImages( HPBYTE pBytes, sal_uLong nCount ); void FillImages( HPBYTE pBytes, sal_uLong nCount );
void CreateNewBitmaps(); void CreateNewBitmaps();
sal_Bool ProcessGIF(); bool ProcessGIF();
public: public:
@@ -112,7 +112,7 @@ public:
#endif // _GIFPRIVATE #endif // _GIFPRIVATE
sal_Bool ImportGIF( SvStream& rStream, Graphic& rGraphic ); bool ImportGIF( SvStream& rStream, Graphic& rGraphic );
#endif // _GIFREAD_HXX #endif // _GIFREAD_HXX