[Libreoffice-commits] core.git: cppcanvas/source editeng/source filter/source include/tools sd/source sot/source starmath/source sw/source tools/source
Stephan Bergmann
sbergman at redhat.com
Tue Nov 17 01:36:41 PST 2015
cppcanvas/source/mtfrenderer/emfplus.cxx | 2 +-
editeng/source/items/textitem.cxx | 2 +-
filter/source/msfilter/svdfppt.cxx | 2 +-
include/tools/stream.hxx | 1 +
sd/source/filter/ppt/pptin.cxx | 2 +-
sd/source/filter/ppt/propread.cxx | 6 +++---
sot/source/sdstor/stgelem.cxx | 2 +-
sot/source/sdstor/stgelem.hxx | 2 +-
starmath/source/mathtype.cxx | 2 +-
sw/source/filter/ww8/ww8scan.cxx | 2 +-
tools/source/stream/stream.cxx | 13 +++++++++++++
11 files changed, 25 insertions(+), 11 deletions(-)
New commits:
commit 61f168d98750549107a65e846fbe5c49f277295e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 17 10:36:13 2015 +0100
Add SvStream::ReadUtf16 (don't assume sal_Unicode is unsigned short)
Change-Id: I74f34e3389582617fa83f8f4a3d6867cf87189e1
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 1438c18..56370f1 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1185,7 +1185,7 @@ namespace cppcanvas
sal_Unicode *chars = static_cast<sal_Unicode *>(alloca( sizeof( sal_Unicode ) * length ));
for( sal_uInt32 i = 0; i < length; i++ )
- s.ReadUInt16( chars[ i ] );
+ s.ReadUtf16( chars[ i ] );
family = OUString( chars, length );
SAL_INFO("cppcanvas.emf", "EMF+\tfamily: " << OUStringToOString( family, RTL_TEXTENCODING_UTF8).getStr()); // TODO: can we just use family?
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 69a6ca7..1ab854c 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -3001,7 +3001,7 @@ SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/) con
{
bool _bOn;
sal_Unicode cStart, cEnd;
- rStrm.ReadCharAsBool( _bOn ).ReadUInt16( cStart ).ReadUInt16( cEnd );
+ rStrm.ReadCharAsBool( _bOn ).ReadUtf16( cStart ).ReadUtf16( cEnd );
return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() );
}
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 4ceacdb..dadaad7 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -6749,7 +6749,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
for (int nLen = 0; nLen < 64; ++nLen)
{
sal_Unicode n(0);
- rIn.ReadUInt16( n );
+ rIn.ReadUtf16( n );
// Collect quoted characters into aStr
if ( n == '\'')
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 6e0ecb8..9b7182c 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -283,6 +283,7 @@ public:
SvStream& ReadSChar( signed char& rChar );
SvStream& ReadChar( char& rChar );
SvStream& ReadUChar( unsigned char& rChar );
+ SvStream& ReadUtf16( sal_Unicode& rUtf16 );
SvStream& ReadCharAsBool( bool& rBool );
SvStream& ReadFloat( float& rFloat );
SvStream& ReadDouble( double& rDouble );
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 820408c..5a1084a 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1353,7 +1353,7 @@ bool ImplSdPPTImport::Import()
sal_Unicode nChar;
for ( sal_uInt32 i2 = 0; i2 < 32; i2++ )
{
- rStCtrl.ReadUInt16( nChar );
+ rStCtrl.ReadUtf16( nChar );
if ( nChar )
aCustomShow.append( nChar );
else
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 2a3c092..6bf66d5 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -116,7 +116,7 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
{
sal_Unicode* pWString = reinterpret_cast<sal_Unicode*>(pString);
for (sal_uInt32 i = 0; i < nItemSize; ++i)
- ReadUInt16( pWString[ i ] );
+ ReadUtf16( pWString[ i ] );
rString = OUString(pWString, lcl_getMaxSafeStrLen(nItemSize));
}
else
@@ -165,7 +165,7 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
{
sal_Unicode* pString = new sal_Unicode[ nItemSize ];
for (sal_uInt32 i = 0; i < nItemSize; ++i)
- ReadUInt16( pString[ i ] );
+ ReadUtf16( pString[ i ] );
if ( pString[ nItemSize - 1 ] == 0 )
{
if ( (sal_uInt16)nItemSize > 1 )
@@ -304,7 +304,7 @@ void Section::GetDictionary(Dictionary& rDict)
{
sal_Unicode* pWString = new sal_Unicode[nSize];
for (sal_uInt32 j = 0; j < nSize; ++j)
- aStream.ReadUInt16(pWString[j]);
+ aStream.ReadUtf16(pWString[j]);
aString = OUString(pWString, lcl_getMaxSafeStrLen(nSize));
delete[] pWString;
}
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index ec5439e..356edc5 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -368,7 +368,7 @@ bool StgEntry::Load(const void* pFrom, sal_uInt32 nBufSize, sal_uInt64 nUnderlyi
SvMemoryStream r( const_cast<void *>(pFrom), nBufSize, StreamMode::READ );
for( short i = 0; i < 32; i++ )
- r.ReadUInt16( m_nName[ i ] ); // 00 name as WCHAR
+ r.ReadUtf16( m_nName[ i ] ); // 00 name as WCHAR
r.ReadUInt16( m_nNameLen ) // 40 size of name in bytes including 00H
.ReadUChar( m_cType ) // 42 entry type
.ReadUChar( m_cFlags ) // 43 0 or 1 (tree balance?)
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
index 3972f80..790fadd 100644
--- a/sot/source/sdstor/stgelem.hxx
+++ b/sot/source/sdstor/stgelem.hxx
@@ -108,7 +108,7 @@ enum StgEntryTime { // time codes:
//StructuredStorageDirectoryEntry
class StgEntry
{ // directory entry
- sal_uInt16 m_nName[ 32 ]; // 00 name as WCHAR
+ sal_Unicode m_nName[ 32 ]; // 00 name as WCHAR
sal_uInt16 m_nNameLen; // 40 size of name in bytes including 00H
sal_uInt8 m_cType; // 42 entry type
sal_uInt8 m_cFlags; // 43 0 or 1 (tree balance?)
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 804de72..9cc65c0 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -2867,7 +2867,7 @@ int MathType::HandleChar(sal_Int32 &rTextStart,int &rSetSize,int nLevel,
nChar = nChar8;
}
else
- pS->ReadUInt16( nChar );
+ pS->ReadUtf16( nChar );
/*
bad character, old mathtype < 3 has these
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 350d9ab..7a82746 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -89,7 +89,7 @@ namespace
if (rStrm.good())
{
sal_Unicode cBraces(0);
- rStrm.ReadUInt16( cBraces );
+ rStrm.ReadUtf16( cBraces );
if (rStrm.good() && cBraces == 0)
bRet = true;
}
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index c6d8b2a..6ad0a06 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -989,6 +989,19 @@ SvStream& SvStream::ReadUChar( unsigned char& r )
return *this;
}
+SvStream& SvStream::ReadUtf16(sal_Unicode& r)
+{
+ sal_uInt16 n = 0;
+ READNUMBER_WITHOUT_SWAP(sal_uInt16, n)
+ if (good())
+ {
+ if (m_isSwap)
+ SwapUShort(n);
+ r = sal_Unicode(n);
+ }
+ return *this;
+}
+
SvStream& SvStream::ReadCharAsBool( bool& r )
{
if ((m_isIoRead || !m_isConsistent) &&
More information about the Libreoffice-commits
mailing list