Kaydet (Commit) e625a440 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Don't assume sal_Unicode is unsigned short

Change-Id: Idcfa500c491fcedfff7d4c6e1bef25fd2d948d36
üst 34c254f6
...@@ -127,6 +127,8 @@ inline static void SwapDouble( double& r ) ...@@ -127,6 +127,8 @@ inline static void SwapDouble( double& r )
} }
#endif #endif
static void SwapUnicode(sal_Unicode & r) { r = OSL_SWAPWORD(r); }
//SDO //SDO
#define READNUMBER_WITHOUT_SWAP(datatype,value) \ #define READNUMBER_WITHOUT_SWAP(datatype,value) \
...@@ -609,7 +611,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead ...@@ -609,7 +611,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
for( j = n = 0; j < nLen ; ++j ) for( j = n = 0; j < nLen ; ++j )
{ {
if (m_isSwap) if (m_isSwap)
SwapUShort( buf[n] ); SwapUnicode( buf[n] );
c = buf[j]; c = buf[j];
if ( c == '\n' || c == '\r' ) if ( c == '\n' || c == '\r' )
{ {
...@@ -651,7 +653,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead ...@@ -651,7 +653,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
sal_Unicode cTemp; sal_Unicode cTemp;
Read( &cTemp, sizeof(cTemp) ); Read( &cTemp, sizeof(cTemp) );
if (m_isSwap) if (m_isSwap)
SwapUShort( cTemp ); SwapUnicode( cTemp );
if( cTemp == c || (cTemp != '\n' && cTemp != '\r') ) if( cTemp == c || (cTemp != '\n' && cTemp != '\r') )
Seek( nOldFilePos ); Seek( nOldFilePos );
} }
...@@ -729,7 +731,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr, ...@@ -729,7 +731,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr,
const sal_Unicode* const pStop = pTmp + nLen; const sal_Unicode* const pStop = pTmp + nLen;
while ( p < pStop ) while ( p < pStop )
{ {
SwapUShort( *p ); SwapUnicode( *p );
p++; p++;
} }
nWritten = rStrm.Write( pTmp, nLen * sizeof(sal_Unicode) ); nWritten = rStrm.Write( pTmp, nLen * sizeof(sal_Unicode) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment