simplify and shrink this to used methods

This commit is contained in:
Caolán McNamara 2011-06-13 11:34:47 +01:00
parent 02b78432d0
commit adb752b347
2 changed files with 16 additions and 39 deletions

View file

@ -407,11 +407,8 @@ public:
{ nJustification = nJus; CreateFormatString(); }
sal_uInt8 GetJustification() const { return nJustification; }
SvStream& WriteNumber( short nShort );
SvStream& WriteNumber( sal_uInt16 nUInt16 );
SvStream& WriteNumber( long nLong );
SvStream& WriteNumber( sal_uInt32 nUInt32 );
SvStream& WriteNumber( int nInt );
SvStream& WriteNumber( sal_Int32 nInt32 );
sal_Size Read( void* pData, sal_Size nSize );
sal_Size Write( const void* pData, sal_Size nSize );
@ -561,24 +558,6 @@ inline SvStream& operator<<( SvStream& rStr, SvStrPtr f )
return rStr;
}
inline SvStream& SvStream::WriteNumber( short nShort )
{
WriteNumber( (long)nShort );
return *this;
}
inline SvStream& SvStream::WriteNumber( sal_uInt16 nUShort )
{
WriteNumber( (sal_uInt32)nUShort );
return *this;
}
inline SvStream& SvStream::WriteNumber( int nInt )
{
WriteNumber( (long)nInt );
return *this;
}
inline void SvStream::SetEndianSwap( sal_Bool bVal )
{
#ifdef OSL_BIGENDIAN

View file

@ -1992,53 +1992,51 @@ void SvStream::CreateFormatString()
|*
*************************************************************************/
SvStream& SvStream::WriteNumber( long nLong )
SvStream& SvStream::WriteNumber( sal_Int32 nInt32 )
{
char buffer[256+12];
char pType[] = "ld"; // Nicht static!
ByteString aFStr( aFormatString);
aFStr += pType;
int nLen;
aFStr += SAL_PRIdINT32;
sal_Size nLen;
switch ( nPrintfParams )
{
case SPECIAL_PARAM_NONE :
nLen = sprintf( buffer, aFStr.GetBuffer(), nLong );
nLen = sprintf(buffer, aFStr.GetBuffer(), nInt32);
break;
case SPECIAL_PARAM_WIDTH :
nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nLong );
nLen = sprintf(buffer, aFStr.GetBuffer(), nWidth, nInt32);
break;
case SPECIAL_PARAM_PRECISION :
nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision,nLong);
nLen = sprintf(buffer, aFStr.GetBuffer(), nPrecision, nInt32);
break;
default:
nLen=sprintf(buffer, aFStr.GetBuffer(),nWidth,nPrecision,nLong);
nLen = sprintf(buffer, aFStr.GetBuffer(), nWidth, nPrecision, nInt32);
}
Write( buffer, (long)nLen );
Write( buffer, nLen );
return *this;
}
SvStream& SvStream::WriteNumber( sal_uInt32 nUInt32 )
{
char buffer[256+12];
char pType[] = "lu"; // Nicht static!
ByteString aFStr( aFormatString);
aFStr += pType;
int nLen;
aFStr += SAL_PRIuUINT32;
sal_Size nLen;
switch ( nPrintfParams )
{
case SPECIAL_PARAM_NONE :
nLen = sprintf( buffer, aFStr.GetBuffer(), nUInt32 );
nLen = sprintf(buffer, aFStr.GetBuffer(), nUInt32);
break;
case SPECIAL_PARAM_WIDTH :
nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nUInt32 );
nLen = sprintf(buffer, aFStr.GetBuffer(), nWidth, nUInt32);
break;
case SPECIAL_PARAM_PRECISION :
nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision, nUInt32 );
nLen = sprintf(buffer, aFStr.GetBuffer(), nPrecision, nUInt32);
break;
default:
nLen=sprintf(buffer,aFStr.GetBuffer(),nWidth,nPrecision,nUInt32 );
nLen = sprintf(buffer,aFStr.GetBuffer(), nWidth, nPrecision, nUInt32);
}
Write( buffer, (long)nLen );
Write( buffer, nLen );
return *this;
}