Add SvStream::ReadCharAsBool
Change-Id: I9dc0525e04de5ae79205872b779dcd0115a9cc14
This commit is contained in:
@@ -308,6 +308,7 @@ public:
|
|||||||
SvStream& ReadSChar( signed char& rChar );
|
SvStream& ReadSChar( signed char& rChar );
|
||||||
SvStream& ReadChar( char& rChar );
|
SvStream& ReadChar( char& rChar );
|
||||||
SvStream& ReadUChar( unsigned char& rChar );
|
SvStream& ReadUChar( unsigned char& rChar );
|
||||||
|
SvStream& ReadCharAsBool( bool& rBool );
|
||||||
SvStream& ReadFloat( float& rFloat );
|
SvStream& ReadFloat( float& rFloat );
|
||||||
SvStream& ReadDouble( double& rDouble );
|
SvStream& ReadDouble( double& rDouble );
|
||||||
SvStream& ReadStream( SvStream& rStream );
|
SvStream& ReadStream( SvStream& rStream );
|
||||||
|
@@ -169,8 +169,8 @@ TYPEINIT1_AUTOFACTORY(SfxBoolItem, SfxPoolItem);
|
|||||||
SfxBoolItem::SfxBoolItem(sal_uInt16 const nWhich, SvStream & rStream)
|
SfxBoolItem::SfxBoolItem(sal_uInt16 const nWhich, SvStream & rStream)
|
||||||
: SfxPoolItem(nWhich)
|
: SfxPoolItem(nWhich)
|
||||||
{
|
{
|
||||||
unsigned char tmp = 0;
|
bool tmp = false;
|
||||||
rStream.ReadUChar( tmp );
|
rStream.ReadCharAsBool( tmp );
|
||||||
m_bValue = tmp;
|
m_bValue = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,8 +71,8 @@ SfxPoolItem* CntContentTypeItem::Create( SvStream& rStream,
|
|||||||
rStream.ReadUInt32( nMagic );
|
rStream.ReadUInt32( nMagic );
|
||||||
if (nMagic == CNTSTRINGITEM_STREAM_MAGIC)
|
if (nMagic == CNTSTRINGITEM_STREAM_MAGIC)
|
||||||
{
|
{
|
||||||
unsigned char bEncrypted = sal_False;
|
bool bEncrypted = false;
|
||||||
rStream.ReadUChar( bEncrypted );
|
rStream.ReadCharAsBool( bEncrypted );
|
||||||
DBG_ASSERT(!bEncrypted,
|
DBG_ASSERT(!bEncrypted,
|
||||||
"CntContentTypeItem::Create() reads encrypted data");
|
"CntContentTypeItem::Create() reads encrypted data");
|
||||||
}
|
}
|
||||||
|
@@ -33,8 +33,8 @@ SfxVisibilityItem::SfxVisibilityItem(sal_uInt16 which, SvStream & rStream):
|
|||||||
SfxPoolItem(which)
|
SfxPoolItem(which)
|
||||||
{
|
{
|
||||||
DBG_CTOR(SfxVisibilityItem, 0);
|
DBG_CTOR(SfxVisibilityItem, 0);
|
||||||
unsigned char bValue = 0;
|
bool bValue = false;
|
||||||
rStream.ReadUChar( bValue );
|
rStream.ReadCharAsBool( bValue );
|
||||||
m_nValue.bVisible = bValue;
|
m_nValue.bVisible = bValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -184,8 +184,8 @@ void ImpSvNumberformatInfo::Load(SvStream& rStream, sal_uInt16 nAnz)
|
|||||||
sStrArray[i] = SvNumberformat::LoadString( rStream );
|
sStrArray[i] = SvNumberformat::LoadString( rStream );
|
||||||
rStream.ReadInt16( nTypeArray[i] );
|
rStream.ReadInt16( nTypeArray[i] );
|
||||||
}
|
}
|
||||||
unsigned char bStreamThousand;
|
bool bStreamThousand;
|
||||||
rStream.ReadInt16( eScannedType ).ReadUChar( bStreamThousand ).ReadUInt16( nThousand )
|
rStream.ReadInt16( eScannedType ).ReadCharAsBool( bStreamThousand ).ReadUInt16( nThousand )
|
||||||
.ReadUInt16( nCntPre ).ReadUInt16( nCntPost ).ReadUInt16( nCntExp );
|
.ReadUInt16( nCntPre ).ReadUInt16( nCntPost ).ReadUInt16( nCntExp );
|
||||||
bThousand = bStreamThousand;
|
bThousand = bStreamThousand;
|
||||||
}
|
}
|
||||||
@@ -1702,9 +1702,9 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream,
|
|||||||
rHdr.StartEntry();
|
rHdr.StartEntry();
|
||||||
sal_uInt16 nOp1, nOp2;
|
sal_uInt16 nOp1, nOp2;
|
||||||
sFormatstring = SvNumberformat::LoadString( rStream );
|
sFormatstring = SvNumberformat::LoadString( rStream );
|
||||||
unsigned char bStreamStandard, bStreamUsed;
|
bool bStreamStandard, bStreamUsed;
|
||||||
rStream.ReadInt16( eType ).ReadDouble( fLimit1 ).ReadDouble( fLimit2 )
|
rStream.ReadInt16( eType ).ReadDouble( fLimit1 ).ReadDouble( fLimit2 )
|
||||||
.ReadUInt16( nOp1 ).ReadUInt16( nOp2 ).ReadUChar( bStreamStandard ).ReadUChar( bStreamUsed );
|
.ReadUInt16( nOp1 ).ReadUInt16( nOp2 ).ReadCharAsBool( bStreamStandard ).ReadCharAsBool( bStreamUsed );
|
||||||
bStandard = bStreamStandard;
|
bStandard = bStreamStandard;
|
||||||
bIsUsed = bStreamUsed;
|
bIsUsed = bStreamUsed;
|
||||||
NfHackConversion eHackConversion = NF_CONVERT_NONE;
|
NfHackConversion eHackConversion = NF_CONVERT_NONE;
|
||||||
@@ -1795,7 +1795,7 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nNewStandardFlagVersionId :
|
case nNewStandardFlagVersionId :
|
||||||
rStream.ReadUChar( bStreamStandard ); // the real standard flag
|
rStream.ReadCharAsBool( bStreamStandard ); // the real standard flag
|
||||||
bStandard = bStreamStandard;
|
bStandard = bStreamStandard;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -1004,6 +1004,30 @@ SvStream& SvStream::ReadUChar( unsigned char& r )
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SvStream& SvStream::ReadCharAsBool( bool& r )
|
||||||
|
{
|
||||||
|
if( (bIoRead || !bIsConsistent) &&
|
||||||
|
sizeof(char) <= nBufFree )
|
||||||
|
{
|
||||||
|
SAL_WARN_IF(
|
||||||
|
*pBufPos > 1, "tools.stream", unsigned(*pBufPos) << " not 0/1");
|
||||||
|
r = *pBufPos != 0;
|
||||||
|
nBufActualPos += sizeof(char);
|
||||||
|
pBufPos += sizeof(char);
|
||||||
|
nBufFree -= sizeof(char);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned char c;
|
||||||
|
if (Read(&c, 1) == 1)
|
||||||
|
{
|
||||||
|
SAL_WARN_IF(c > 1, "tools.stream", unsigned(c) << " not 0/1");
|
||||||
|
r = c != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
SvStream& SvStream::ReadFloat(float& r)
|
SvStream& SvStream::ReadFloat(float& r)
|
||||||
{
|
{
|
||||||
float n = 0;
|
float n = 0;
|
||||||
|
Reference in New Issue
Block a user