Hi

Bug 44981 - EasyHack: remove obsolete SWAPLONG macros
This patch converts uses of the SWAPSHORT and SWAPLONG macros to OSL_SWAPWORD and OSL_SWAPDWORD

Code is contributed under MPL+/LGPL+/GPL+

Patches passes a full build and make check.

Regards, Noel Grandin

Disclaimer: http://www.peralex.com/disclaimer.html


diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx
index 0434bf7..f22a0a4 100644
--- a/editeng/source/rtf/rtfgrf.cxx
+++ b/editeng/source/rtf/rtfgrf.cxx
@@ -173,7 +173,7 @@ inline long SwapLong( long n )
 inline short SwapShort( short n )
 {
 #ifndef OSL_LITENDIAN
-    return SWAPSHORT( n );
+    return OSL_SWAPWORD( n );
 #else
     return n;
 #endif
diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx
index ba266de..c969ad4 100644
--- a/rsc/inc/rsctools.hxx
+++ b/rsc/inc/rsctools.hxx
@@ -114,7 +114,7 @@ public:
                     char* pTo = (char*)&nVal;
                     *pTo++ = *pFrom++;
                     *pTo++ = *pFrom++;
-                    return bSwap ? SWAPSHORT( nVal ) : nVal;
+                    return bSwap ? OSL_SWAPWORD( nVal ) : nVal;
                 }
     sal_uInt32  GetLong( sal_uInt32 nPos )
                 {
@@ -125,7 +125,7 @@ public:
                     *pTo++ = *pFrom++;
                     *pTo++ = *pFrom++;
                     *pTo++ = *pFrom++;
-                    return bSwap ? SWAPLONG( nVal ) : nVal;
+                    return bSwap ? OSL_SWAPDWORD( nVal ) : nVal;
                 }
     char *      GetUTF8( sal_uInt32 nPos )
                 {
@@ -212,7 +212,7 @@ public:
     void        PutAt( sal_uInt32 nPos, sal_uInt16 nVal )
                 {
                     if( bSwap )
-                        nVal = SWAPSHORT( nVal );
+                        nVal = OSL_SWAPWORD( nVal );
                     char* pTo = GetPointer( nPos );
                     char* pFrom = (char*)&nVal;
                     *pTo++ = *pFrom++;
diff --git a/svl/unx/inc/convert.hxx b/svl/unx/inc/convert.hxx
index 751d25df..45251e4 100644
--- a/svl/unx/inc/convert.hxx
+++ b/svl/unx/inc/convert.hxx
@@ -28,22 +28,17 @@
 #ifndef _CONVERT_HXX
 #define _CONVERT_HXX
 
-/*
-#define _SWAPSHORT(x) ((((x) & 0xFF00)>>8) | (((x) & 0x00FF)<<8))
-#define _SWAPLONG(x)  ((((x) & 0xFF000000)>>24) | (((x) & 0x00FF0000)>>8) |  \
-                      (((x) & 0x0000FF00)<<8) | (((x) & 0x000000FF)<<24))
-*/
 class Convert
 {
 public:
     static void     Swap( long & nValue )
-                    { nValue = SWAPLONG( nValue ); }
+                    { nValue = OSL_SWAPDWORD( nValue ); }
     static void     Swap( ULONG & nValue )
-                    { nValue = SWAPLONG( nValue ); }
+                    { nValue = OSL_SWAPDWORD( nValue ); }
     static void     Swap( short & nValue )
-                    { nValue = SWAPSHORT( nValue ); }
+                    { nValue = OSL_SWAPWORD( nValue ); }
     static void     Swap( USHORT & nValue )
-                    { nValue = SWAPSHORT( nValue ); }
+                    { nValue = OSL_SWAPWORD( nValue ); }
     static void     Swap( Point & aPtr )
                     { Swap( aPtr.X() ); Swap( aPtr.Y() ); }
     static void     Swap( Size & aSize )
diff --git a/svtools/source/filter/sgfbram.cxx 
b/svtools/source/filter/sgfbram.cxx
index ea51f85..cdd2582 100644
--- a/svtools/source/filter/sgfbram.cxx
+++ b/svtools/source/filter/sgfbram.cxx
@@ -45,17 +45,17 @@ SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead)
 {
     rIStream.Read((char*)&rHead.Magic,SgfHeaderSize);
 #if defined OSL_BIGENDIAN
-    rHead.Magic  =SWAPSHORT(rHead.Magic  );
-    rHead.Version=SWAPSHORT(rHead.Version);
-    rHead.Typ    =SWAPSHORT(rHead.Typ    );
-    rHead.Xsize  =SWAPSHORT(rHead.Xsize  );
-    rHead.Ysize  =SWAPSHORT(rHead.Ysize  );
-    rHead.Xoffs  =SWAPSHORT(rHead.Xoffs  );
-    rHead.Yoffs  =SWAPSHORT(rHead.Yoffs  );
-    rHead.Planes =SWAPSHORT(rHead.Planes );
-    rHead.SwGrCol=SWAPSHORT(rHead.SwGrCol);
-    rHead.OfsLo  =SWAPSHORT(rHead.OfsLo  );
-    rHead.OfsHi  =SWAPSHORT(rHead.OfsHi  );
+    rHead.Magic  =OSL_SWAPWORD(rHead.Magic  );
+    rHead.Version=OSL_SWAPWORD(rHead.Version);
+    rHead.Typ    =OSL_SWAPWORD(rHead.Typ    );
+    rHead.Xsize  =OSL_SWAPWORD(rHead.Xsize  );
+    rHead.Ysize  =OSL_SWAPWORD(rHead.Ysize  );
+    rHead.Xoffs  =OSL_SWAPWORD(rHead.Xoffs  );
+    rHead.Yoffs  =OSL_SWAPWORD(rHead.Yoffs  );
+    rHead.Planes =OSL_SWAPWORD(rHead.Planes );
+    rHead.SwGrCol=OSL_SWAPWORD(rHead.SwGrCol);
+    rHead.OfsLo  =OSL_SWAPWORD(rHead.OfsLo  );
+    rHead.OfsHi  =OSL_SWAPWORD(rHead.OfsHi  );
 #endif
     return rIStream;
 }
@@ -82,12 +82,12 @@ SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr)
 {
     rIStream.Read((char*)&rEntr.Typ,SgfEntrySize);
 #if defined OSL_BIGENDIAN
-    rEntr.Typ  =SWAPSHORT(rEntr.Typ  );
-    rEntr.iFrei=SWAPSHORT(rEntr.iFrei);
-    rEntr.lFreiLo=SWAPSHORT (rEntr.lFreiLo);
-    rEntr.lFreiHi=SWAPSHORT (rEntr.lFreiHi);
-    rEntr.OfsLo=SWAPSHORT(rEntr.OfsLo);
-    rEntr.OfsHi=SWAPSHORT(rEntr.OfsHi);
+    rEntr.Typ  =OSL_SWAPWORD(rEntr.Typ  );
+    rEntr.iFrei=OSL_SWAPWORD(rEntr.iFrei);
+    rEntr.lFreiLo=OSL_SWAPWORD (rEntr.lFreiLo);
+    rEntr.lFreiHi=OSL_SWAPWORD (rEntr.lFreiHi);
+    rEntr.OfsLo=OSL_SWAPWORD(rEntr.OfsLo);
+    rEntr.OfsHi=OSL_SWAPWORD(rEntr.OfsHi);
 #endif
     return rIStream;
 }
@@ -105,11 +105,11 @@ SvStream& operator>>(SvStream& rIStream, SgfVector& rVect)
 {
     rIStream.Read((char*)&rVect,sizeof(rVect));
 #if defined OSL_BIGENDIAN
-    rVect.Flag =SWAPSHORT(rVect.Flag );
-    rVect.x    =SWAPSHORT(rVect.x    );
-    rVect.y    =SWAPSHORT(rVect.y    );
-    rVect.OfsLo=SWAPLONG (rVect.OfsLo);
-    rVect.OfsHi=SWAPLONG (rVect.OfsHi);
+    rVect.Flag =OSL_SWAPWORD(rVect.Flag );
+    rVect.x    =OSL_SWAPWORD(rVect.x    );
+    rVect.y    =OSL_SWAPWORD(rVect.y    );
+    rVect.OfsLo=OSL_SWAPDWORD (rVect.OfsLo);
+    rVect.OfsHi=OSL_SWAPDWORD (rVect.OfsHi);
 #endif
     return rIStream;
 }
@@ -123,23 +123,23 @@ SvStream& operator>>(SvStream& rIStream, SgfVector& rVect)
 SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead)
 {
 #if defined OSL_BIGENDIAN
-    rHead.Typ     =SWAPSHORT(rHead.Typ     );
-    rHead.SizeLo  =SWAPSHORT(rHead.SizeLo  );
-    rHead.SizeHi  =SWAPSHORT(rHead.SizeHi  );
-    rHead.Reserve1=SWAPSHORT(rHead.Reserve1);
-    rHead.Reserve2=SWAPSHORT(rHead.Reserve2);
-    rHead.OfsLo   =SWAPSHORT(rHead.OfsLo   );
-    rHead.OfsHi   =SWAPSHORT(rHead.OfsHi   );
+    rHead.Typ     =OSL_SWAPWORD(rHead.Typ     );
+    rHead.SizeLo  =OSL_SWAPWORD(rHead.SizeLo  );
+    rHead.SizeHi  =OSL_SWAPWORD(rHead.SizeHi  );
+    rHead.Reserve1=OSL_SWAPWORD(rHead.Reserve1);
+    rHead.Reserve2=OSL_SWAPWORD(rHead.Reserve2);
+    rHead.OfsLo   =OSL_SWAPWORD(rHead.OfsLo   );
+    rHead.OfsHi   =OSL_SWAPWORD(rHead.OfsHi   );
 #endif
     rOStream.Write((char*)&rHead,sizeof(rHead));
 #if defined OSL_BIGENDIAN
-    rHead.Typ     =SWAPSHORT(rHead.Typ     );
-    rHead.SizeLo  =SWAPSHORT(rHead.SizeLo  );
-    rHead.SizeHi  =SWAPSHORT(rHead.SizeHi  );
-    rHead.Reserve1=SWAPSHORT(rHead.Reserve1);
-    rHead.Reserve2=SWAPSHORT(rHead.Reserve2);
-    rHead.OfsLo   =SWAPSHORT(rHead.OfsLo   );
-    rHead.OfsHi   =SWAPSHORT(rHead.OfsHi   );
+    rHead.Typ     =OSL_SWAPWORD(rHead.Typ     );
+    rHead.SizeLo  =OSL_SWAPWORD(rHead.SizeLo  );
+    rHead.SizeHi  =OSL_SWAPWORD(rHead.SizeHi  );
+    rHead.Reserve1=OSL_SWAPWORD(rHead.Reserve1);
+    rHead.Reserve2=OSL_SWAPWORD(rHead.Reserve2);
+    rHead.OfsLo   =OSL_SWAPWORD(rHead.OfsLo   );
+    rHead.OfsHi   =OSL_SWAPWORD(rHead.OfsHi   );
 #endif
     return rOStream;
 }
@@ -169,31 +169,31 @@ sal_uInt32 BmpFileHeader::GetOfs()
 SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rInfo)
 {
 #if defined OSL_BIGENDIAN
-    rInfo.Size    =SWAPLONG (rInfo.Size    );
-    rInfo.Width   =SWAPLONG (rInfo.Width   );
-    rInfo.Hight   =SWAPLONG (rInfo.Hight   );
-    rInfo.Planes  =SWAPSHORT(rInfo.Planes  );
-    rInfo.PixBits =SWAPSHORT(rInfo.PixBits );
-    rInfo.Compress=SWAPLONG (rInfo.Compress);
-    rInfo.ImgSize =SWAPLONG (rInfo.ImgSize );
-    rInfo.xDpmm   =SWAPLONG (rInfo.xDpmm   );
-    rInfo.yDpmm   =SWAPLONG (rInfo.yDpmm   );
-    rInfo.ColUsed =SWAPLONG (rInfo.ColUsed );
-    rInfo.ColMust =SWAPLONG (rInfo.ColMust );
+    rInfo.Size    =OSL_SWAPDWORD (rInfo.Size    );
+    rInfo.Width   =OSL_SWAPDWORD (rInfo.Width   );
+    rInfo.Hight   =OSL_SWAPDWORD (rInfo.Hight   );
+    rInfo.Planes  =OSL_SWAPWORD(rInfo.Planes  );
+    rInfo.PixBits =OSL_SWAPWORD(rInfo.PixBits );
+    rInfo.Compress=OSL_SWAPDWORD (rInfo.Compress);
+    rInfo.ImgSize =OSL_SWAPDWORD (rInfo.ImgSize );
+    rInfo.xDpmm   =OSL_SWAPDWORD (rInfo.xDpmm   );
+    rInfo.yDpmm   =OSL_SWAPDWORD (rInfo.yDpmm   );
+    rInfo.ColUsed =OSL_SWAPDWORD (rInfo.ColUsed );
+    rInfo.ColMust =OSL_SWAPDWORD (rInfo.ColMust );
 #endif
     rOStream.Write((char*)&rInfo,sizeof(rInfo));
 #if defined OSL_BIGENDIAN
-    rInfo.Size    =SWAPLONG (rInfo.Size    );
-    rInfo.Width   =SWAPLONG (rInfo.Width   );
-    rInfo.Hight   =SWAPLONG (rInfo.Hight   );
-    rInfo.Planes  =SWAPSHORT(rInfo.Planes  );
-    rInfo.PixBits =SWAPSHORT(rInfo.PixBits );
-    rInfo.Compress=SWAPLONG (rInfo.Compress);
-    rInfo.ImgSize =SWAPLONG (rInfo.ImgSize );
-    rInfo.xDpmm   =SWAPLONG (rInfo.xDpmm   );
-    rInfo.yDpmm   =SWAPLONG (rInfo.yDpmm   );
-    rInfo.ColUsed =SWAPLONG (rInfo.ColUsed );
-    rInfo.ColMust =SWAPLONG (rInfo.ColMust );
+    rInfo.Size    =OSL_SWAPDWORD (rInfo.Size    );
+    rInfo.Width   =OSL_SWAPDWORD (rInfo.Width   );
+    rInfo.Hight   =OSL_SWAPDWORD (rInfo.Hight   );
+    rInfo.Planes  =OSL_SWAPWORD(rInfo.Planes  );
+    rInfo.PixBits =OSL_SWAPWORD(rInfo.PixBits );
+    rInfo.Compress=OSL_SWAPDWORD (rInfo.Compress);
+    rInfo.ImgSize =OSL_SWAPDWORD (rInfo.ImgSize );
+    rInfo.xDpmm   =OSL_SWAPDWORD (rInfo.xDpmm   );
+    rInfo.yDpmm   =OSL_SWAPDWORD (rInfo.yDpmm   );
+    rInfo.ColUsed =OSL_SWAPDWORD (rInfo.ColUsed );
+    rInfo.ColMust =OSL_SWAPDWORD (rInfo.ColMust );
 #endif
     return rOStream;
 }
diff --git a/svtools/source/filter/sgvmain.cxx 
b/svtools/source/filter/sgvmain.cxx
index a220a22..bbfda53 100644
--- a/svtools/source/filter/sgvmain.cxx
+++ b/svtools/source/filter/sgvmain.cxx
@@ -39,50 +39,50 @@
 #include <unotools/ucbstreamhelper.hxx>
 
 #define SWAPPOINT(p) {  \
-    p.x=SWAPSHORT(p.x); \
-    p.y=SWAPSHORT(p.y); }
+    p.x=OSL_SWAPWORD(p.x); \
+    p.y=OSL_SWAPWORD(p.y); }
 
 #define SWAPPAGE(p) {                         \
-    p.Next   =SWAPLONG (p.Next   );           \
-    p.nList  =SWAPLONG (p.nList  );           \
-    p.ListEnd=SWAPLONG (p.ListEnd);           \
-    p.Paper.Size.x=SWAPSHORT(p.Paper.Size.x); \
-    p.Paper.Size.y=SWAPSHORT(p.Paper.Size.y); \
-    p.Paper.RandL =SWAPSHORT(p.Paper.RandL ); \
-    p.Paper.RandR =SWAPSHORT(p.Paper.RandR ); \
-    p.Paper.RandO =SWAPSHORT(p.Paper.RandO ); \
-    p.Paper.RandU =SWAPSHORT(p.Paper.RandU ); \
+    p.Next   =OSL_SWAPDWORD (p.Next   );           \
+    p.nList  =OSL_SWAPDWORD (p.nList  );           \
+    p.ListEnd=OSL_SWAPDWORD (p.ListEnd);           \
+    p.Paper.Size.x=OSL_SWAPWORD(p.Paper.Size.x); \
+    p.Paper.Size.y=OSL_SWAPWORD(p.Paper.Size.y); \
+    p.Paper.RandL =OSL_SWAPWORD(p.Paper.RandL ); \
+    p.Paper.RandR =OSL_SWAPWORD(p.Paper.RandR ); \
+    p.Paper.RandO =OSL_SWAPWORD(p.Paper.RandO ); \
+    p.Paper.RandU =OSL_SWAPWORD(p.Paper.RandU ); \
     SWAPPOINT(p.U);                           \
     sal_uInt16 iTemp;                             \
     for (iTemp=0;iTemp<20;iTemp++) {          \
-        rPage.HlpLnH[iTemp]=SWAPSHORT(rPage.HlpLnH[iTemp]);       \
-        rPage.HlpLnV[iTemp]=SWAPSHORT(rPage.HlpLnV[iTemp]);      }}
+        rPage.HlpLnH[iTemp]=OSL_SWAPWORD(rPage.HlpLnH[iTemp]);       \
+        rPage.HlpLnV[iTemp]=OSL_SWAPWORD(rPage.HlpLnV[iTemp]);      }}
 
 #define SWAPOBJK(o) {                 \
-    o.Last    =SWAPLONG (o.Last    ); \
-    o.Next    =SWAPLONG (o.Next    ); \
-    o.MemSize =SWAPSHORT(o.MemSize ); \
+    o.Last    =OSL_SWAPDWORD (o.Last    ); \
+    o.Next    =OSL_SWAPDWORD (o.Next    ); \
+    o.MemSize =OSL_SWAPWORD(o.MemSize ); \
     SWAPPOINT(o.ObjMin);              \
     SWAPPOINT(o.ObjMax);              }
 
 #define SWAPLINE(l) {             \
-    l.LMSize=SWAPSHORT(l.LMSize); \
-    l.LDicke=SWAPSHORT(l.LDicke); }
+    l.LMSize=OSL_SWAPWORD(l.LMSize); \
+    l.LDicke=OSL_SWAPWORD(l.LDicke); }
 
 #define SWAPAREA(a) {               \
-    a.FDummy2=SWAPSHORT(a.FDummy2); \
-    a.FMuster=SWAPSHORT(a.FMuster); }
+    a.FDummy2=OSL_SWAPWORD(a.FDummy2); \
+    a.FMuster=OSL_SWAPWORD(a.FMuster); }
 
 #define SWAPTEXT(t) {               \
     SWAPLINE(t.L);                  \
     SWAPAREA(t.F);                  \
-    t.FontLo =SWAPSHORT(t.FontLo ); \
-    t.FontHi =SWAPSHORT(t.FontHi ); \
-    t.Grad   =SWAPSHORT(t.Grad   ); \
-    t.Breite =SWAPSHORT(t.Breite ); \
-    t.Schnitt=SWAPSHORT(t.Schnitt); \
-    t.LnFeed =SWAPSHORT(t.LnFeed ); \
-    t.Slant  =SWAPSHORT(t.Slant  ); \
+    t.FontLo =OSL_SWAPWORD(t.FontLo ); \
+    t.FontHi =OSL_SWAPWORD(t.FontHi ); \
+    t.Grad   =OSL_SWAPWORD(t.Grad   ); \
+    t.Breite =OSL_SWAPWORD(t.Breite ); \
+    t.Schnitt=OSL_SWAPWORD(t.Schnitt); \
+    t.LnFeed =OSL_SWAPWORD(t.LnFeed ); \
+    t.Slant  =OSL_SWAPWORD(t.Slant  ); \
     SWAPLINE(t.ShdL);               \
     SWAPAREA(t.ShdF);               \
     SWAPPOINT(t.ShdVers);           \
@@ -223,9 +223,9 @@ SvStream& operator>>(SvStream& rInp, RectType& rRect)
     SWAPAREA (rRect.F);
     SWAPPOINT(rRect.Pos1);
     SWAPPOINT(rRect.Pos2);
-    rRect.Radius  =SWAPSHORT(rRect.Radius  );
-    rRect.DrehWink=SWAPSHORT(rRect.DrehWink);
-    rRect.Slant   =SWAPSHORT(rRect.Slant   );
+    rRect.Radius  =OSL_SWAPWORD(rRect.Radius  );
+    rRect.DrehWink=OSL_SWAPWORD(rRect.DrehWink);
+    rRect.Slant   =OSL_SWAPWORD(rRect.Slant   );
 #endif
     return rInp;
 }
@@ -236,7 +236,7 @@ SvStream& operator>>(SvStream& rInp, PolyType& rPoly)
     SWAPOBJK (rPoly);
     SWAPLINE (rPoly.L);
     SWAPAREA (rPoly.F);
-    // rPoly.EckP=SWAPLONG(rPoly.EckP);
+    // rPoly.EckP=OSL_SWAPDWORD(rPoly.EckP);
 #endif
     return rInp;
 }
@@ -247,7 +247,7 @@ SvStream& operator>>(SvStream& rInp, SplnType& rSpln)
     SWAPOBJK (rSpln);
     SWAPLINE (rSpln.L);
     SWAPAREA (rSpln.F);
-    // rSpln.EckP=SWAPLONG(rSpln.EckP);
+    // rSpln.EckP=OSL_SWAPDWORD(rSpln.EckP);
 #endif
     return rInp;
 }
@@ -260,9 +260,9 @@ SvStream& operator>>(SvStream& rInp, CircType& rCirc)
     SWAPAREA (rCirc.F);
     SWAPPOINT(rCirc.Radius);
     SWAPPOINT(rCirc.Center);
-    rCirc.DrehWink =SWAPSHORT(rCirc.DrehWink );
-    rCirc.StartWink=SWAPSHORT(rCirc.StartWink);
-    rCirc.RelWink  =SWAPSHORT(rCirc.RelWink  );
+    rCirc.DrehWink =OSL_SWAPWORD(rCirc.DrehWink );
+    rCirc.StartWink=OSL_SWAPWORD(rCirc.StartWink);
+    rCirc.RelWink  =OSL_SWAPWORD(rCirc.RelWink  );
 #endif
     return rInp;
 }
@@ -274,14 +274,14 @@ SvStream& operator>>(SvStream& rInp, TextType& rText)
     SWAPTEXT (rText.T);
     SWAPPOINT(rText.Pos1);
     SWAPPOINT(rText.Pos2);
-    rText.TopOfs  =SWAPSHORT(rText.TopOfs  );
-    rText.DrehWink=SWAPSHORT(rText.DrehWink);
-    rText.BoxSlant=SWAPSHORT(rText.BoxSlant);
-    rText.BufSize =SWAPSHORT(rText.BufSize );
-    //rText.Buf     =SWAPLONG (rText.Buf     );
-    //rText.Ext     =SWAPLONG (rText.Ext     );
+    rText.TopOfs  =OSL_SWAPWORD(rText.TopOfs  );
+    rText.DrehWink=OSL_SWAPWORD(rText.DrehWink);
+    rText.BoxSlant=OSL_SWAPWORD(rText.BoxSlant);
+    rText.BufSize =OSL_SWAPWORD(rText.BufSize );
+    //rText.Buf     =OSL_SWAPDWORD (rText.Buf     );
+    //rText.Ext     =OSL_SWAPDWORD (rText.Ext     );
     SWAPPOINT(rText.FitSize);
-    rText.FitBreit=SWAPSHORT(rText.FitBreit);
+    rText.FitBreit=OSL_SWAPWORD(rText.FitBreit);
 #endif
     rText.Buffer=NULL;
     return rInp;
@@ -294,8 +294,8 @@ SvStream& operator>>(SvStream& rInp, BmapType& rBmap)
     SWAPAREA (rBmap.F);
     SWAPPOINT(rBmap.Pos1);
     SWAPPOINT(rBmap.Pos2);
-    rBmap.DrehWink=SWAPSHORT(rBmap.DrehWink);
-    rBmap.Slant   =SWAPSHORT(rBmap.Slant   );
+    rBmap.DrehWink=OSL_SWAPWORD(rBmap.DrehWink);
+    rBmap.Slant   =OSL_SWAPWORD(rBmap.Slant   );
     SWAPPOINT(rBmap.PixSize);
 #endif
     return rInp;
@@ -305,12 +305,12 @@ SvStream& operator>>(SvStream& rInp, GrupType& rGrup)
     rInp.Read((char*)&rGrup.Last,GrupSize);
 #if defined OSL_BIGENDIAN
     SWAPOBJK (rGrup);
-    rGrup.SbLo     =SWAPSHORT(rGrup.SbLo     );
-    rGrup.SbHi     =SWAPSHORT(rGrup.SbHi     );
-    rGrup.UpLo     =SWAPSHORT(rGrup.UpLo     );
-    rGrup.UpHi     =SWAPSHORT(rGrup.UpHi     );
-    rGrup.ChartSize=SWAPSHORT(rGrup.ChartSize);
-    rGrup.ChartPtr =SWAPLONG (rGrup.ChartPtr );
+    rGrup.SbLo     =OSL_SWAPWORD(rGrup.SbLo     );
+    rGrup.SbHi     =OSL_SWAPWORD(rGrup.SbHi     );
+    rGrup.UpLo     =OSL_SWAPWORD(rGrup.UpLo     );
+    rGrup.UpHi     =OSL_SWAPWORD(rGrup.UpHi     );
+    rGrup.ChartSize=OSL_SWAPWORD(rGrup.ChartSize);
+    rGrup.ChartPtr =OSL_SWAPDWORD (rGrup.ChartPtr );
 #endif
     return rInp;
 }
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 96860bd..0e66f64 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1310,7 +1310,7 @@ SdrObject *SwWW8ImplReader::ReadGroup( WW8_DPHEAD* pHd, 
const WW8_DO* pDo,
         return 0;
 
 #ifdef OSL_BIGENDIAN
-    nGrouped = (sal_Int16)SWAPSHORT( nGrouped );
+    nGrouped = (sal_Int16)OSL_SWAPWORD( nGrouped );
 #endif
 
     nDrawXOfs = nDrawXOfs + (sal_Int16)SVBT16ToShort( pHd->xa );
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 748b515..0447a73 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -144,9 +144,9 @@ static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* 
pMfp,
         return false;
 
 #if defined  OSL_BIGENDIAN
-    pMfp->mm = SWAPSHORT( pMfp->mm );
-    pMfp->xExt = SWAPSHORT( pMfp->xExt );
-    pMfp->yExt = SWAPSHORT( pMfp->yExt );
+    pMfp->mm = OSL_SWAPWORD( pMfp->mm );
+    pMfp->xExt = OSL_SWAPWORD( pMfp->xExt );
+    pMfp->yExt = OSL_SWAPWORD( pMfp->yExt );
 #endif // OSL_BIGENDIAN
 
     if( pMfp->mm == 94 || pMfp->mm == 99 )
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index aadaa68..a069123 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -7434,7 +7434,7 @@ bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 
nLength)
 void swapEndian(sal_Unicode *pString)
 {
     for (sal_Unicode *pWork = pString; *pWork; ++pWork)
-        *pWork = SWAPSHORT(*pWork);
+        *pWork = OSL_SWAPWORD(*pWork);
 }
 #endif
 
diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
index 2f33ad1..0f0b123 100644
--- a/tools/inc/tools/solar.h
+++ b/tools/inc/tools/solar.h
@@ -144,10 +144,6 @@ inline void     DoubleToSVBT64( double n, SVBT64 p ) { 
p[0] = ((sal_uInt8*)&n)[7
 
 /*** standard macros *****************************************/
 
-#define SWAPSHORT(x) ((((x) >> 8) & 0x00FF) | (((x) & 0x00FF) << 8))
-#define SWAPLONG(x)  ((((x) >> 24) & 0x000000FF) | (((x) & 0x00FF0000) >> 8) | 
\
-                      (((x) & 0x0000FF00) <<  8) | (((x) & 0x000000FF) << 24))
-
 #ifndef __cplusplus
 #ifndef min
 #define min(a,b)    (((a) < (b)) ? (a) : (b))
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index fd5a579..78701aa 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -40,6 +40,7 @@
 #include "boost/static_assert.hpp"
 
 #include <tools/solar.h>
+#include <osl/endian.h>
 
 #include <comphelper/string.hxx>
 
@@ -62,17 +63,17 @@ DBG_NAME( Stream )
 
 // !!! Nicht inline, wenn Operatoren <<,>> inline sind
 inline static void SwapUShort( sal_uInt16& r )
-    {   r = SWAPSHORT(r);   }
+    {   r = OSL_SWAPWORD(r);   }
 inline static void SwapShort( short& r )
-    {   r = SWAPSHORT(r);   }
+    {   r = OSL_SWAPWORD(r);   }
 inline static void SwapLong( long& r )
-    {   r = SWAPLONG(r);   }
+    {   r = OSL_SWAPDWORD(r);   }
 inline static void SwapULong( sal_uInt32& r )
-    {   r = SWAPLONG(r);   }
+    {   r = OSL_SWAPDWORD(r);   }
 inline static void SwapLongInt( sal_Int32& r )
-    {   r = SWAPLONG(r);   }
+    {   r = OSL_SWAPDWORD(r);   }
 inline static void SwapLongUInt( unsigned int& r )
-    {   r = SWAPLONG(r);   }
+    {   r = OSL_SWAPDWORD(r);   }
 
 inline static void SwapUInt64( sal_uInt64& r )
     {
@@ -87,8 +88,8 @@ inline static void SwapUInt64( sal_uInt64& r )
         s.c[1] ^= s.c[0];
         s.c[0] ^= s.c[1];
         // swap the bytes in the words
-        s.c[0] = SWAPLONG(s.c[0]);
-        s.c[1] = SWAPLONG(s.c[1]);
+        s.c[0] = OSL_SWAPDWORD(s.c[0]);
+        s.c[1] = OSL_SWAPDWORD(s.c[1]);
         r = s.n;
     }
 
@@ -105,8 +106,8 @@ inline static void SwapInt64( sal_Int64& r )
         s.c[1] ^= s.c[0];
         s.c[0] ^= s.c[1];
         // swap the bytes in the words
-        s.c[0] = SWAPLONG(s.c[0]);
-        s.c[1] = SWAPLONG(s.c[1]);
+        s.c[0] = OSL_SWAPDWORD(s.c[0]);
+        s.c[1] = OSL_SWAPDWORD(s.c[1]);
         r = s.n;
     }
 
@@ -120,7 +121,7 @@ inline static void SwapFloat( float& r )
         } s;
 
         s.f = r;
-        s.c = SWAPLONG( s.c );
+        s.c = OSL_SWAPDWORD( s.c );
         r = s.f;
     }
 
@@ -142,8 +143,8 @@ inline static void SwapDouble( double& r )
             s.c[0] ^= s.c[1]; // zwei 32-Bit-Werte in situ vertauschen
             s.c[1] ^= s.c[0];
             s.c[0] ^= s.c[1];
-            s.c[0] = SWAPLONG(s.c[0]); // und die beiden 32-Bit-Werte selbst 
in situ drehen
-            s.c[1] = SWAPLONG(s.c[1]);
+            s.c[0] = OSL_SWAPDWORD(s.c[0]); // und die beiden 32-Bit-Werte 
selbst in situ drehen
+            s.c[1] = OSL_SWAPDWORD(s.c[1]);
             r = s.d;
         }
     }
@@ -2380,7 +2381,7 @@ rtl::OUString read_uInt16s_ToOUString(SvStream& rStrm, 
sal_Size nLen)
         if (rStrm.IsEndianSwap())
         {
             for (sal_Int32 i = 0; i < pStr->length; ++i)
-                pStr->buffer[i] = SWAPSHORT(pStr->buffer[i]);
+                pStr->buffer[i] = OSL_SWAPWORD(pStr->buffer[i]);
         }
     }
 
diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
index a3174e6..c4ce0e3 100644
--- a/vcl/source/gdi/bmpacc.cxx
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -289,7 +289,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits()
             sal_uInt8*      pLast4Bytes = (sal_uInt8*) GetBuffer() + ( 
nScanSize - 4 );
 
 #ifdef OSL_LITENDIAN
-            nMask = SWAPLONG( nMask );
+            nMask = OSL_SWAPDWORD( nMask );
 #endif
             for( sal_uInt32 i = 0; i < nHeight; i++, pLast4Bytes += nScanSize )
                 ( *(sal_uInt32*) pLast4Bytes ) &= nMask;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 6aaedd6..38261b9 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -991,17 +991,17 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, 
sal_Bool bSwap )
         // swapped
         if( nType > 100L )
         {
-            nType = SWAPLONG( nType );
-            nLen = SWAPLONG( nLen );
-            nWidth = SWAPLONG( nWidth );
-            nHeight = SWAPLONG( nHeight );
-            nMapMode = SWAPLONG( nMapMode );
-            nScaleNumX = SWAPLONG( nScaleNumX );
-            nScaleDenomX = SWAPLONG( nScaleDenomX );
-            nScaleNumY = SWAPLONG( nScaleNumY );
-            nScaleDenomY = SWAPLONG( nScaleDenomY );
-            nOffsX = SWAPLONG( nOffsX );
-            nOffsY = SWAPLONG( nOffsY );
+            nType = OSL_SWAPDWORD( nType );
+            nLen = OSL_SWAPDWORD( nLen );
+            nWidth = OSL_SWAPDWORD( nWidth );
+            nHeight = OSL_SWAPDWORD( nHeight );
+            nMapMode = OSL_SWAPDWORD( nMapMode );
+            nScaleNumX = OSL_SWAPDWORD( nScaleNumX );
+            nScaleDenomX = OSL_SWAPDWORD( nScaleDenomX );
+            nScaleNumY = OSL_SWAPDWORD( nScaleNumY );
+            nScaleDenomY = OSL_SWAPDWORD( nScaleDenomY );
+            nOffsX = OSL_SWAPDWORD( nOffsX );
+            nOffsY = OSL_SWAPDWORD( nOffsY );
         }
 
         aSize = Size( nWidth, nHeight );
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index cb4f72e..9837537 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -286,7 +286,7 @@ bool PNGReaderImpl::ReadNextChunk()
         // calculate chunktype CRC (swap it back to original byte order)
         sal_uInt32 nChunkType = mnChunkType;
         #if defined(__LITTLEENDIAN) || defined(OSL_LITENDIAN)
-        nChunkType = SWAPLONG( nChunkType );
+        nChunkType = OSL_SWAPDWORD( nChunkType );
         #endif
         sal_uInt32 nCRC32 = rtl_crc32( 0, &nChunkType, 4 );
 
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 04c4588..bc25105 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -281,7 +281,7 @@ sal_Bool PNGWriterImpl::Write( SvStream& rOStm )
     {
         sal_uInt32 nType = aBeg->nType;
     #if defined(__LITTLEENDIAN) || defined(OSL_LITENDIAN)
-        nType = SWAPLONG( nType );
+        nType = OSL_SWAPDWORD( nType );
     #endif
         sal_uInt32 nCRC = rtl_crc32( 0, &nType, 4 );
         sal_uInt32 nDataSize = aBeg->aData.size();
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to