summaryrefslogtreecommitdiff
path: root/basic/source/classes/image.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/classes/image.cxx')
-rwxr-xr-x[-rw-r--r--]basic/source/classes/image.cxx150
1 files changed, 75 insertions, 75 deletions
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 716cbe0497d7..d9e7bc521af1 100644..100755
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -48,8 +48,8 @@ SbiImage::SbiImage()
nLegacyCodeSize =
nDimBase = 0;
bInit =
- bError = FALSE;
- bFirstInit = TRUE;
+ bError = sal_False;
+ bFirstInit = sal_True;
eCharSet = gsl_getSystemTextEncoding();
}
@@ -74,7 +74,7 @@ void SbiImage::Clear()
nCodeSize = 0;
eCharSet = gsl_getSystemTextEncoding();
nDimBase = 0;
- bError = FALSE;
+ bError = sal_False;
}
/**************************************************************************
@@ -83,25 +83,25 @@ void SbiImage::Clear()
*
**************************************************************************/
-BOOL SbiGood( SvStream& r )
+sal_Bool SbiGood( SvStream& r )
{
- return BOOL( !r.IsEof() && r.GetError() == SVSTREAM_OK );
+ return sal_Bool( !r.IsEof() && r.GetError() == SVSTREAM_OK );
}
// Open Record
-ULONG SbiOpenRecord( SvStream& r, UINT16 nSignature, UINT16 nElem )
+sal_uIntPtr SbiOpenRecord( SvStream& r, sal_uInt16 nSignature, sal_uInt16 nElem )
{
- ULONG nPos = r.Tell();
- r << nSignature << (INT32) 0 << nElem;
+ sal_uIntPtr nPos = r.Tell();
+ r << nSignature << (sal_Int32) 0 << nElem;
return nPos;
}
// Close Record
-void SbiCloseRecord( SvStream& r, ULONG nOff )
+void SbiCloseRecord( SvStream& r, sal_uIntPtr nOff )
{
- ULONG nPos = r.Tell();
+ sal_uIntPtr nPos = r.Tell();
r.Seek( nOff + 2 );
- r << (INT32) ( nPos - nOff - 8 );
+ r << (sal_Int32) ( nPos - nOff - 8 );
r.Seek( nPos );
}
@@ -113,40 +113,40 @@ void SbiCloseRecord( SvStream& r, ULONG nOff )
// If the version number does not find, binary parts are omitted, but not
// source, comments and name
-BOOL SbiImage::Load( SvStream& r )
+sal_Bool SbiImage::Load( SvStream& r )
{
- UINT32 nVersion = 0; // Versionsnumber
+ sal_uInt32 nVersion = 0; // Versionsnumber
return Load( r, nVersion );
}
-BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
+sal_Bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
{
- UINT16 nSign, nCount;
- UINT32 nLen, nOff;
+ sal_uInt16 nSign, nCount;
+ sal_uInt32 nLen, nOff;
Clear();
// Read Master-Record
r >> nSign >> nLen >> nCount;
- ULONG nLast = r.Tell() + nLen;
- UINT32 nCharSet; // System charset
- UINT32 lDimBase;
- UINT16 nReserved1;
- UINT32 nReserved2;
- UINT32 nReserved3;
- BOOL bBadVer = FALSE;
+ sal_uIntPtr nLast = r.Tell() + nLen;
+ sal_uInt32 nCharSet; // System charset
+ sal_uInt32 lDimBase;
+ sal_uInt16 nReserved1;
+ sal_uInt32 nReserved2;
+ sal_uInt32 nReserved3;
+ sal_Bool bBadVer = sal_False;
if( nSign == B_MODULE )
{
r >> nVersion >> nCharSet >> lDimBase
>> nFlags >> nReserved1 >> nReserved2 >> nReserved3;
eCharSet = (CharSet) nCharSet;
eCharSet = GetSOLoadTextEncoding( eCharSet );
- bBadVer = BOOL( nVersion > B_CURVERSION );
- nDimBase = (USHORT) lDimBase;
+ bBadVer = sal_Bool( nVersion > B_CURVERSION );
+ nDimBase = (sal_uInt16) lDimBase;
}
bool bLegacy = ( nVersion < B_EXT_IMG_VERSION );
- ULONG nNext;
+ sal_uIntPtr nNext;
while( ( nNext = r.Tell() ) < nLast )
{
@@ -174,7 +174,7 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
#ifdef EXTENDED_BINARY_MODULES
case B_EXTSOURCE:
{
- for( UINT16 j = 0 ; j < nCount ; j++ )
+ for( sal_uInt16 j = 0 ; j < nCount ; j++ )
{
String aTmp;
r.ReadByteString( aTmp, eCharSet );
@@ -191,10 +191,10 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
if ( bLegacy )
{
ReleaseLegacyBuffer(); // release any previously held buffer
- nLegacyCodeSize = (UINT16) nCodeSize;
+ nLegacyCodeSize = (sal_uInt16) nCodeSize;
pLegacyPCode = pCode;
- PCodeBuffConvertor< UINT16, UINT32 > aLegacyToNew( (BYTE*)pLegacyPCode, nLegacyCodeSize );
+ PCodeBuffConvertor< sal_uInt16, sal_uInt32 > aLegacyToNew( (sal_uInt8*)pLegacyPCode, nLegacyCodeSize );
aLegacyToNew.convert();
pCode = (char*)aLegacyToNew.GetBuffer();
nCodeSize = aLegacyToNew.GetSize();
@@ -220,20 +220,20 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion )
for( i = 0; i < nStrings && SbiGood( r ); i++ )
{
r >> nOff;
- pStringOff[ i ] = (USHORT) nOff;
+ pStringOff[ i ] = (sal_uInt16) nOff;
}
r >> nLen;
if( SbiGood( r ) )
{
delete [] pStrings;
pStrings = new sal_Unicode[ nLen ];
- nStringSize = (USHORT) nLen;
+ nStringSize = (sal_uInt16) nLen;
char* pByteStrings = new char[ nLen ];
r.Read( pByteStrings, nStringSize );
for( short j = 0; j < nStrings; j++ )
{
- USHORT nOff2 = (USHORT) pStringOff[ j ];
+ sal_uInt16 nOff2 = (sal_uInt16) pStringOff[ j ];
String aStr( pByteStrings + nOff2, eCharSet );
memcpy( pStrings + nOff2, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( sal_Unicode ) );
}
@@ -253,11 +253,11 @@ done:
//if( eCharSet != ::GetSystemCharSet() )
//ConvertStrings();
if( !SbiGood( r ) )
- bError = TRUE;
- return BOOL( !bError );
+ bError = sal_True;
+ return sal_Bool( !bError );
}
-BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
+sal_Bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
{
bool bLegacy = ( nVer < B_EXT_IMG_VERSION );
@@ -268,23 +268,23 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
SbiImage aEmptyImg;
aEmptyImg.aName = aName;
aEmptyImg.Save( r, B_LEGACYVERSION );
- return TRUE;
+ return sal_True;
}
// First of all the header
- ULONG nStart = SbiOpenRecord( r, B_MODULE, 1 );
- ULONG nPos;
+ sal_uIntPtr nStart = SbiOpenRecord( r, B_MODULE, 1 );
+ sal_uIntPtr nPos;
eCharSet = GetSOStoreTextEncoding( eCharSet );
if ( bLegacy )
- r << (INT32) B_LEGACYVERSION;
+ r << (sal_Int32) B_LEGACYVERSION;
else
- r << (INT32) B_CURVERSION;
- r << (INT32) eCharSet
- << (INT32) nDimBase
- << (INT16) nFlags
- << (INT16) 0
- << (INT32) 0
- << (INT32) 0;
+ r << (sal_Int32) B_CURVERSION;
+ r << (sal_Int32) eCharSet
+ << (sal_Int32) nDimBase
+ << (sal_Int16) nFlags
+ << (sal_Int16) 0
+ << (sal_Int32) 0
+ << (sal_Int32) 0;
// Name?
if( aName.Len() && SbiGood( r ) )
@@ -321,9 +321,9 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
if( nLen > STRING_MAXLEN )
{
sal_Int32 nRemainingLen = nLen - nMaxUnitSize;
- UINT16 nUnitCount = UINT16( (nRemainingLen + nMaxUnitSize - 1) / nMaxUnitSize );
+ sal_uInt16 nUnitCount = sal_uInt16( (nRemainingLen + nMaxUnitSize - 1) / nMaxUnitSize );
nPos = SbiOpenRecord( r, B_EXTSOURCE, nUnitCount );
- for( UINT16 i = 0 ; i < nUnitCount ; i++ )
+ for( sal_uInt16 i = 0 ; i < nUnitCount ; i++ )
{
sal_Int32 nCopyLen =
(nRemainingLen > nMaxUnitSize) ? nMaxUnitSize : nRemainingLen;
@@ -342,7 +342,7 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
if ( bLegacy )
{
ReleaseLegacyBuffer(); // release any previously held buffer
- PCodeBuffConvertor< UINT32, UINT16 > aNewToLegacy( (BYTE*)pCode, nCodeSize );
+ PCodeBuffConvertor< sal_uInt32, sal_uInt16 > aNewToLegacy( (sal_uInt8*)pCode, nCodeSize );
aNewToLegacy.convert();
pLegacyPCode = (char*)aNewToLegacy.GetBuffer();
nLegacyCodeSize = aNewToLegacy.GetSize();
@@ -357,21 +357,21 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
{
nPos = SbiOpenRecord( r, B_STRINGPOOL, nStrings );
// For every String:
- // UINT32 Offset of the Strings in the Stringblock
+ // sal_uInt32 Offset of the Strings in the Stringblock
short i;
for( i = 0; i < nStrings && SbiGood( r ); i++ )
- r << (UINT32) pStringOff[ i ];
+ r << (sal_uInt32) pStringOff[ i ];
// Then the String-Block
char* pByteStrings = new char[ nStringSize ];
for( i = 0; i < nStrings; i++ )
{
- USHORT nOff = (USHORT) pStringOff[ i ];
+ sal_uInt16 nOff = (sal_uInt16) pStringOff[ i ];
ByteString aStr( pStrings + nOff, eCharSet );
memcpy( pByteStrings + nOff, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( char ) );
}
- r << (UINT32) nStringSize;
+ r << (sal_uInt32) nStringSize;
r.Write( pByteStrings, nStringSize );
delete[] pByteStrings;
@@ -380,8 +380,8 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer )
// Set overall length
SbiCloseRecord( r, nStart );
if( !SbiGood( r ) )
- bError = TRUE;
- return BOOL( !bError );
+ bError = sal_True;
+ return sal_Bool( !bError );
}
/**************************************************************************
@@ -397,15 +397,15 @@ void SbiImage::MakeStrings( short nSize )
nStringOff = 0;
nStringSize = 1024;
pStrings = new sal_Unicode[ nStringSize ];
- pStringOff = new UINT32[ nSize ];
+ pStringOff = new sal_uInt32[ nSize ];
if( pStrings && pStringOff )
{
nStrings = nSize;
- memset( pStringOff, 0, nSize * sizeof( UINT32 ) );
+ memset( pStringOff, 0, nSize * sizeof( sal_uInt32 ) );
memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) );
}
else
- bError = TRUE;
+ bError = sal_True;
}
// Add a string to StringPool. The String buffer is dynamically
@@ -413,16 +413,16 @@ void SbiImage::MakeStrings( short nSize )
void SbiImage::AddString( const String& r )
{
if( nStringIdx >= nStrings )
- bError = TRUE;
+ bError = sal_True;
if( !bError )
{
xub_StrLen len = r.Len() + 1;
- UINT32 needed = nStringOff + len;
+ sal_uInt32 needed = nStringOff + len;
if( needed > 0xFFFFFF00L )
- bError = TRUE; // out of mem!
+ bError = sal_True; // out of mem!
else if( needed > nStringSize )
{
- UINT32 nNewLen = needed + 1024;
+ sal_uInt32 nNewLen = needed + 1024;
nNewLen &= 0xFFFFFC00; // trim to 1K border
if( nNewLen > 0xFFFFFF00L )
nNewLen = 0xFFFFFF00L;
@@ -432,10 +432,10 @@ void SbiImage::AddString( const String& r )
memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) );
delete[] pStrings;
pStrings = p;
- nStringSize = sal::static_int_cast< UINT32 >(nNewLen);
+ nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen);
}
else
- bError = TRUE;
+ bError = sal_True;
}
if( !bError )
{
@@ -454,7 +454,7 @@ void SbiImage::AddString( const String& r )
// The block was fetched by the compiler from class SbBuffer and
// is already created with new. Additionally it contains all Integers
// in Big Endian format, so can be directly read/written.
-void SbiImage::AddCode( char* p, UINT32 s )
+void SbiImage::AddCode( char* p, sal_uInt32 s )
{
pCode = p;
nCodeSize = s;
@@ -488,14 +488,14 @@ String SbiImage::GetString( short nId ) const
{
if( nId && nId <= nStrings )
{
- UINT32 nOff = pStringOff[ nId - 1 ];
+ sal_uInt32 nOff = pStringOff[ nId - 1 ];
sal_Unicode* pStr = pStrings + nOff;
// #i42467: Special treatment for vbNullChar
if( *pStr == 0 )
{
- UINT32 nNextOff = (nId < nStrings) ? pStringOff[ nId ] : nStringOff;
- UINT32 nLen = nNextOff - nOff - 1;
+ sal_uInt32 nNextOff = (nId < nStrings) ? pStringOff[ nId ] : nStringOff;
+ sal_uInt32 nLen = nNextOff - nOff - 1;
if( nLen == 1 )
{
// Force length 1 and make char 0 afterwards
@@ -518,14 +518,14 @@ const SbxObject* SbiImage::FindType (String aTypeName) const
return rTypes.Is() ? (SbxObject*)rTypes->Find(aTypeName,SbxCLASS_OBJECT) : NULL;
}
-UINT16 SbiImage::CalcLegacyOffset( INT32 nOffset )
+sal_uInt16 SbiImage::CalcLegacyOffset( sal_Int32 nOffset )
{
- return SbiCodeGen::calcLegacyOffSet( (BYTE*)pCode, nOffset ) ;
+ return SbiCodeGen::calcLegacyOffSet( (sal_uInt8*)pCode, nOffset ) ;
}
-UINT32 SbiImage::CalcNewOffset( INT16 nOffset )
+sal_uInt32 SbiImage::CalcNewOffset( sal_Int16 nOffset )
{
- return SbiCodeGen::calcNewOffSet( (BYTE*)pLegacyPCode, nOffset ) ;
+ return SbiCodeGen::calcNewOffSet( (sal_uInt8*)pLegacyPCode, nOffset ) ;
}
void SbiImage::ReleaseLegacyBuffer()
@@ -535,11 +535,11 @@ void SbiImage::ReleaseLegacyBuffer()
nLegacyCodeSize = 0;
}
-BOOL SbiImage::ExceedsLegacyLimits()
+sal_Bool SbiImage::ExceedsLegacyLimits()
{
if ( ( nStringSize > 0xFF00L ) || ( CalcLegacyOffset( nCodeSize ) > 0xFF00L ) )
- return TRUE;
- return FALSE;
+ return sal_True;
+ return sal_False;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */