summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-01-30 13:17:45 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-30 13:18:38 +0000
commit61451fec9b4ece2d2ef9d1d337dfc9e78c422d93 (patch)
tree7db6906da867d6af5a765579e9338b0838e34daf /tools
parentbbc94edb9a91b27910d43610db9994df10dd99e1 (diff)
fdo#44981 - remove obsolete SWAPLONG macros
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/solar.h4
-rw-r--r--tools/source/stream/stream.cxx29
2 files changed, 15 insertions, 18 deletions
diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
index 2f33ad1064b6..0f0b123d8b06 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 902f17876d3a..ee7803c2b58e 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]);
}
}