summaryrefslogtreecommitdiff
path: root/basic/source/classes/image.cxx
diff options
context:
space:
mode:
authorbaltasarq <baltasarq@gmail.com>2016-02-24 14:43:38 +0100
committerNoel Grandin <noelgrandin@gmail.com>2016-02-26 07:18:25 +0000
commit2d162b1c70c1bc16d682b74ee1d0b13a9a80717d (patch)
tree64389d1eef8a090804348864364cc52f3ed13503 /basic/source/classes/image.cxx
parent393f11f88648e1c7cace6224aa7afcbf9d68ddd6 (diff)
tdf#84938 Eliminate B_xxx defines in filefmt.hxx for FileOffset scoped enum.
Second step: Make SbiOpenRecord() accept a FileOffset as second parameter This is a [partial] patch The objective is to substitute all apparitions of #defined constants for enum class. The victim here is the series of constants B_xxx that were located in filefmt.hxx and were changed for a FileOffset enum class. Obviously some other files where the type is used must be changed too. Change-Id: I7406bdc8e780ee89802ab6823f9c91c4c9b765c0 Reviewed-on: https://gerrit.libreoffice.org/22697 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic/source/classes/image.cxx')
-rw-r--r--basic/source/classes/image.cxx47
1 files changed, 24 insertions, 23 deletions
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index d79c21c21306..00d5456710df 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -83,10 +83,11 @@ bool SbiGood( SvStream& r )
}
// Open Record
-sal_uInt64 SbiOpenRecord( SvStream& r, sal_uInt16 nSignature, sal_uInt16 nElem )
+sal_uInt64 SbiOpenRecord( SvStream& r, FileOffset nSignature, sal_uInt16 nElem )
{
sal_uInt64 nPos = r.Tell();
- r.WriteUInt16( nSignature ).WriteInt32( 0 ).WriteUInt16( nElem );
+ r.WriteUInt16( static_cast<sal_uInt16>( nSignature ) )
+ .WriteInt32( 0 ).WriteUInt16( nElem );
return nPos;
}
@@ -121,7 +122,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
sal_uInt32 nReserved2;
sal_uInt32 nReserved3;
bool bBadVer = false;
- if( nSign == B_MODULE )
+ if( nSign == static_cast<sal_uInt16>( FileOffset::Module ) )
{
sal_uInt16 nTmpFlags;
r.ReadUInt32( nVersion ).ReadUInt32( nCharSet ).ReadUInt32( lDimBase )
@@ -143,20 +144,20 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
nNext += nLen + 8;
if( r.GetError() == SVSTREAM_OK )
{
- switch( nSign )
+ switch( static_cast<FileOffset>( nSign ) )
{
- case B_NAME:
+ case FileOffset::Name:
aName = r.ReadUniOrByteString(eCharSet);
break;
- case B_COMMENT:
+ case FileOffset::Comment:
aComment = r.ReadUniOrByteString(eCharSet );
break;
- case B_SOURCE:
+ case FileOffset::Source:
{
aOUSource = r.ReadUniOrByteString(eCharSet);
break;
}
- case B_EXTSOURCE:
+ case FileOffset::ExtSource:
{
//assuming an empty string with just the lead 32bit/16bit len indicator
const size_t nMinStringSize = (eCharSet == RTL_TEXTENCODING_UNICODE) ? 4 : 2;
@@ -173,7 +174,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
}
break;
}
- case B_PCODE:
+ case FileOffset::PCode:
if( bBadVer ) break;
pCode = new char[ nLen ];
nCodeSize = nLen;
@@ -198,12 +199,12 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
// release of the buffer.
}
break;
- case B_PUBLICS:
- case B_POOLDIR:
- case B_SYMPOOL:
- case B_LINERANGES:
+ case FileOffset::Publics:
+ case FileOffset::PoolDir:
+ case FileOffset::SymPool:
+ case FileOffset::LineRanges:
break;
- case B_STRINGPOOL:
+ case FileOffset::StringPool:
{
if( bBadVer ) break;
//assuming an empty string with just the lead 32bit len indicator
@@ -240,7 +241,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
}
break;
}
- case B_USERTYPES:
+ case FileOffset::UserTypes:
{
//assuming an empty string with just the lead 32bit/16bit len indicator
const size_t nMinStringSize = (eCharSet == RTL_TEXTENCODING_UNICODE) ? 4 : 2;
@@ -340,7 +341,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
}
break;
}
- case B_MODEND:
+ case FileOffset::ModEnd:
goto done;
default:
break;
@@ -375,7 +376,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
return true;
}
// First of all the header
- sal_uInt64 nStart = SbiOpenRecord( r, B_MODULE, 1 );
+ sal_uInt64 nStart = SbiOpenRecord( r, FileOffset::Module, 1 );
sal_uInt64 nPos;
eCharSet = GetSOStoreTextEncoding( eCharSet );
@@ -397,28 +398,28 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
// Name?
if( !aName.isEmpty() && SbiGood( r ) )
{
- nPos = SbiOpenRecord( r, B_NAME, 1 );
+ nPos = SbiOpenRecord( r, FileOffset::Name, 1 );
r.WriteUniOrByteString( aName, eCharSet );
SbiCloseRecord( r, nPos );
}
// Comment?
if( !aComment.isEmpty() && SbiGood( r ) )
{
- nPos = SbiOpenRecord( r, B_COMMENT, 1 );
+ nPos = SbiOpenRecord( r, FileOffset::Comment, 1 );
r.WriteUniOrByteString( aComment, eCharSet );
SbiCloseRecord( r, nPos );
}
// Source?
if( !aOUSource.isEmpty() && SbiGood( r ) )
{
- nPos = SbiOpenRecord( r, B_SOURCE, 1 );
+ nPos = SbiOpenRecord( r, FileOffset::Source, 1 );
r.WriteUniOrByteString( aOUSource, eCharSet );
SbiCloseRecord( r, nPos );
}
// Binary data?
if( pCode && SbiGood( r ) )
{
- nPos = SbiOpenRecord( r, B_PCODE, 1 );
+ nPos = SbiOpenRecord( r, FileOffset::PCode, 1 );
if ( bLegacy )
{
ReleaseLegacyBuffer(); // release any previously held buffer
@@ -437,7 +438,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
// String-Pool?
if( nStrings )
{
- nPos = SbiOpenRecord( r, B_STRINGPOOL, nStrings );
+ nPos = SbiOpenRecord( r, FileOffset::StringPool, nStrings );
// For every String:
// sal_uInt32 Offset of the Strings in the Stringblock
short i;
@@ -466,7 +467,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
sal_uInt16 nTypes = rTypes->Count();
if (nTypes > 0 )
{
- nPos = SbiOpenRecord( r, B_USERTYPES, nTypes );
+ nPos = SbiOpenRecord( r, FileOffset::UserTypes, nTypes );
for (sal_uInt16 i = 0; i < nTypes; i++)
{