summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-17 10:36:13 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-17 10:36:13 +0100
commit61f168d98750549107a65e846fbe5c49f277295e (patch)
tree0748b88eefa9bb49285270ac5a7bbce3d10b4ef6
parent4f76e46290b26deeb4f9660c580a5ffef58a557e (diff)
Add SvStream::ReadUtf16 (don't assume sal_Unicode is unsigned short)
Change-Id: I74f34e3389582617fa83f8f4a3d6867cf87189e1
-rw-r--r--cppcanvas/source/mtfrenderer/emfplus.cxx2
-rw-r--r--editeng/source/items/textitem.cxx2
-rw-r--r--filter/source/msfilter/svdfppt.cxx2
-rw-r--r--include/tools/stream.hxx1
-rw-r--r--sd/source/filter/ppt/pptin.cxx2
-rw-r--r--sd/source/filter/ppt/propread.cxx6
-rw-r--r--sot/source/sdstor/stgelem.cxx2
-rw-r--r--sot/source/sdstor/stgelem.hxx2
-rw-r--r--starmath/source/mathtype.cxx2
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx2
-rw-r--r--tools/source/stream/stream.cxx13
11 files changed, 25 insertions, 11 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 1438c18c50ed..56370f11ba04 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 69a6ca799af2..1ab854c4a474 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 4ceacdbe19e6..dadaad780949 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 6e0ecb8d073c..9b7182c5170f 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 820408c7fcee..5a1084afc691 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 2a3c09265131..6bf66d5f3329 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 ec5439e017a7..356edc5393e9 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 3972f80f3985..790fadd6625c 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 804de7278daf..9cc65c08500c 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 350d9abc9d49..7a82746fae6e 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 c6d8b2a0cce6..6ad0a06e0bcf 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) &&