[Libreoffice-commits] core.git: tools/source

Stephan Bergmann sbergman at redhat.com
Tue Nov 17 01:43:03 PST 2015


 tools/source/stream/stream.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit e625a440a4d17826677608ac430660374d2b7d4f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Nov 17 10:42:37 2015 +0100

    Don't assume sal_Unicode is unsigned short
    
    Change-Id: Idcfa500c491fcedfff7d4c6e1bef25fd2d948d36

diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 6ad0a06..c019804 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -127,6 +127,8 @@ inline static void SwapDouble( double& r )
     }
 #endif
 
+static void SwapUnicode(sal_Unicode & r) { r = OSL_SWAPWORD(r); }
+
 //SDO
 
 #define READNUMBER_WITHOUT_SWAP(datatype,value) \
@@ -609,7 +611,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
         for( j = n = 0; j < nLen ; ++j )
         {
             if (m_isSwap)
-                SwapUShort( buf[n] );
+                SwapUnicode( buf[n] );
             c = buf[j];
             if ( c == '\n' || c == '\r' )
             {
@@ -651,7 +653,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
         sal_Unicode cTemp;
         Read( &cTemp, sizeof(cTemp) );
         if (m_isSwap)
-            SwapUShort( cTemp );
+            SwapUnicode( cTemp );
         if( cTemp == c || (cTemp != '\n' && cTemp != '\r') )
             Seek( nOldFilePos );
     }
@@ -729,7 +731,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr,
         const sal_Unicode* const pStop = pTmp + nLen;
         while ( p < pStop )
         {
-            SwapUShort( *p );
+            SwapUnicode( *p );
             p++;
         }
         nWritten = rStrm.Write( pTmp, nLen * sizeof(sal_Unicode) );


More information about the Libreoffice-commits mailing list