summaryrefslogtreecommitdiffstats
path: root/sal/rtl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:17:51 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:17:51 +0100
commit5a3bb76cd384fa3760fe8481ce008791258595ad (patch)
tree8544fecc06b73cb43000143339c06ad880b56db4 /sal/rtl
parentMore loplugin:cstylecast: sax (diff)
downloadcore-5a3bb76cd384fa3760fe8481ce008791258595ad.tar.gz
core-5a3bb76cd384fa3760fe8481ce008791258595ad.zip
More loplugin:cstylecast: sal
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I7d89b011464ba5d2dd12e04d5fc9f65cb4daebde
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/alloc_arena.cxx14
-rw-r--r--sal/rtl/alloc_arena.hxx8
-rw-r--r--sal/rtl/alloc_cache.cxx8
-rw-r--r--sal/rtl/alloc_impl.hxx6
-rw-r--r--sal/rtl/cipher.cxx58
-rw-r--r--sal/rtl/digest.cxx64
-rw-r--r--sal/rtl/hash.cxx4
-rw-r--r--sal/rtl/locale.cxx4
-rw-r--r--sal/rtl/random.cxx14
-rw-r--r--sal/rtl/string.cxx10
-rw-r--r--sal/rtl/strtmpl.cxx28
-rw-r--r--sal/rtl/ustrbuf.cxx8
-rw-r--r--sal/rtl/ustring.cxx56
-rw-r--r--sal/rtl/uuid.cxx24
14 files changed, 153 insertions, 153 deletions
diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx
index b8df460b4e88..ef8738fc170f 100644
--- a/sal/rtl/alloc_arena.cxx
+++ b/sal/rtl/alloc_arena.cxx
@@ -337,7 +337,7 @@ rtl_arena_segment_type * rtl_arena_hash_remove(
if (lookups > 1)
{
- sal_Size nseg = (sal_Size)(arena->m_stats.m_alloc - arena->m_stats.m_free);
+ sal_Size nseg = static_cast<sal_Size>(arena->m_stats.m_alloc - arena->m_stats.m_free);
if (nseg > 4 * arena->m_hash_size)
{
if (!(arena->m_flags & RTL_ARENA_FLAG_RESCALE))
@@ -396,7 +396,7 @@ bool rtl_arena_segment_alloc(
}
/* roundup to next power of 2 */
- size = (((sal_Size)1) << msb);
+ size = ((sal_Size(1)) << msb);
}
index = lowbit(RTL_MEMORY_P2ALIGN(arena->m_freelist_bitmap, size));
@@ -555,7 +555,7 @@ void rtl_arena_constructor(void * obj)
head = &(arena->m_freelist_head[i]);
rtl_arena_segment_constructor (head);
- head->m_size = (((sal_Size)1) << i);
+ head->m_size = ((sal_Size(1)) << i);
head->m_type = RTL_ARENA_SEGMENT_TYPE_HEAD;
}
@@ -590,7 +590,7 @@ void rtl_arena_destructor(void * obj)
{
head = &(arena->m_freelist_head[i]);
- assert(head->m_size == (((sal_Size)1) << i));
+ assert(head->m_size == ((sal_Size(1)) << i));
assert(head->m_type == RTL_ARENA_SEGMENT_TYPE_HEAD);
rtl_arena_segment_destructor (head);
@@ -623,7 +623,7 @@ rtl_arena_type * rtl_arena_activate(
if (!RTL_MEMORY_ISP2(quantum))
{
/* roundup to next power of 2 */
- quantum = (((sal_Size)1) << highbit(quantum));
+ quantum = ((sal_Size(1)) << highbit(quantum));
}
quantum_cache_max = RTL_MEMORY_P2ROUNDUP(quantum_cache_max, quantum);
@@ -1060,7 +1060,7 @@ void * rtl_machdep_alloc(
#endif
#if defined(SAL_UNX)
- addr = mmap (nullptr, (size_t)size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
+ addr = mmap (nullptr, static_cast<size_t>(size), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
#elif defined(SAL_W32)
addr = VirtualAlloc (nullptr, (SIZE_T)size, MEM_COMMIT, PAGE_READWRITE);
#endif /* (SAL_UNX || SAL_W32) */
@@ -1102,7 +1102,7 @@ sal_Size rtl_machdep_pagesize()
#if defined(FREEBSD) || defined(NETBSD) || defined(DRAGONFLY)
return (sal_Size)getpagesize();
#else /* POSIX */
- return (sal_Size)sysconf(_SC_PAGESIZE);
+ return static_cast<sal_Size>(sysconf(_SC_PAGESIZE));
#endif /* xBSD || POSIX */
#elif defined(SAL_W32)
SYSTEM_INFO info;
diff --git a/sal/rtl/alloc_arena.hxx b/sal/rtl/alloc_arena.hxx
index 0ac54d96e575..3c04173b4ab0 100644
--- a/sal/rtl/alloc_arena.hxx
+++ b/sal/rtl/alloc_arena.hxx
@@ -39,10 +39,10 @@ struct rtl_arena_stat_type
/** rtl_arena_segment_type
* @internal
*/
-#define RTL_ARENA_SEGMENT_TYPE_HEAD ((sal_Size)(0x01))
-#define RTL_ARENA_SEGMENT_TYPE_SPAN ((sal_Size)(0x02))
-#define RTL_ARENA_SEGMENT_TYPE_FREE ((sal_Size)(0x04))
-#define RTL_ARENA_SEGMENT_TYPE_USED ((sal_Size)(0x08))
+#define RTL_ARENA_SEGMENT_TYPE_HEAD (sal_Size(0x01))
+#define RTL_ARENA_SEGMENT_TYPE_SPAN (sal_Size(0x02))
+#define RTL_ARENA_SEGMENT_TYPE_FREE (sal_Size(0x04))
+#define RTL_ARENA_SEGMENT_TYPE_USED (sal_Size(0x08))
struct rtl_arena_segment_type
{
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index 1c24faaf9829..6a3eea86d6a0 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -181,7 +181,7 @@ rtl_cache_bufctl_type * rtl_cache_hash_remove(
if (lookups > 1)
{
- sal_Size nbuf = (sal_Size)(cache->m_slab_stats.m_alloc - cache->m_slab_stats.m_free);
+ sal_Size nbuf = static_cast<sal_Size>(cache->m_slab_stats.m_alloc - cache->m_slab_stats.m_free);
if (nbuf > 4 * cache->m_hash_size)
{
if (!(cache->m_features & RTL_CACHE_FEATURE_RESCALE))
@@ -744,9 +744,9 @@ rtl_cache_type * rtl_cache_activate(
if (flags & RTL_CACHE_FLAG_QUANTUMCACHE)
{
/* next power of 2 above 3 * qcache_max */
- if (slabsize < (((sal_Size)1) << highbit(3 * source->m_qcache_max)))
+ if (slabsize < ((sal_Size(1)) << highbit(3 * source->m_qcache_max)))
{
- slabsize = (((sal_Size)1) << highbit(3 * source->m_qcache_max));
+ slabsize = ((sal_Size(1)) << highbit(3 * source->m_qcache_max));
}
}
else
@@ -760,7 +760,7 @@ rtl_cache_type * rtl_cache_activate(
slabsize = RTL_MEMORY_P2ROUNDUP(slabsize, source->m_quantum);
if (!RTL_MEMORY_ISP2(slabsize))
- slabsize = (((sal_Size)1) << highbit(slabsize));
+ slabsize = ((sal_Size(1)) << highbit(slabsize));
cache->m_slab_size = slabsize;
if (cache->m_slab_size > source->m_quantum)
diff --git a/sal/rtl/alloc_impl.hxx b/sal/rtl/alloc_impl.hxx
index 89b9b7c9fa67..bdf4e7b6eb81 100644
--- a/sal/rtl/alloc_impl.hxx
+++ b/sal/rtl/alloc_impl.hxx
@@ -44,12 +44,12 @@
#define RTL_MEMORY_ALIGN(value, align) (((value) + ((align) - 1)) & ~((align) - 1))
#define RTL_MEMORY_ISP2(value) (((value) & ((value) - 1)) == 0)
-#define RTL_MEMORY_P2ALIGN(value, align) ((value) & -(sal_IntPtr)(align))
+#define RTL_MEMORY_P2ALIGN(value, align) ((value) & -static_cast<sal_IntPtr>(align))
#define RTL_MEMORY_P2ROUNDUP(value, align) \
- (-(-(sal_IntPtr)(value) & -(sal_IntPtr)(align)))
+ (-(-static_cast<sal_IntPtr>(value) & -static_cast<sal_IntPtr>(align)))
#define RTL_MEMORY_P2END(value, align) \
- (-(~(sal_IntPtr)(value) & -(sal_IntPtr)(align)))
+ (-(~static_cast<sal_IntPtr>(value) & -static_cast<sal_IntPtr>(align)))
/** highbit(): log2() + 1
(complexity O(1))
diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx
index 735b2eb0d1c0..9a64ac4364b0 100644
--- a/sal/rtl/cipher.cxx
+++ b/sal/rtl/cipher.cxx
@@ -24,16 +24,16 @@
#include <rtl/cipher.h>
#define RTL_CIPHER_NTOHL(c, l) \
- ((l) = ((sal_uInt32)(*((c)++))) << 24, \
- (l) |= ((sal_uInt32)(*((c)++))) << 16, \
- (l) |= ((sal_uInt32)(*((c)++))) << 8, \
- (l) |= ((sal_uInt32)(*((c)++))))
+ ((l) = (static_cast<sal_uInt32>(*((c)++))) << 24, \
+ (l) |= (static_cast<sal_uInt32>(*((c)++))) << 16, \
+ (l) |= (static_cast<sal_uInt32>(*((c)++))) << 8, \
+ (l) |= (static_cast<sal_uInt32>(*((c)++))))
#define RTL_CIPHER_HTONL(l, c) \
- (*((c)++) = (sal_uInt8)(((l) >> 24) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) >> 16) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) >> 8) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) ) & 0xff))
+ (*((c)++) = static_cast<sal_uInt8>(((l) >> 24) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) >> 16) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) >> 8) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) ) & 0xff))
#define RTL_CIPHER_NTOHL64(c, xl, xr, n) \
{ \
@@ -41,21 +41,21 @@
(c) += (n); \
switch ((n)) \
{ \
- case 8: (xr) = ((sal_uInt32)(*(--(c)))); \
+ case 8: (xr) = (static_cast<sal_uInt32>(*(--(c)))); \
SAL_FALLTHROUGH; \
- case 7: (xr) |= ((sal_uInt32)(*(--(c)))) << 8; \
+ case 7: (xr) |= (static_cast<sal_uInt32>(*(--(c)))) << 8; \
SAL_FALLTHROUGH; \
- case 6: (xr) |= ((sal_uInt32)(*(--(c)))) << 16; \
+ case 6: (xr) |= (static_cast<sal_uInt32>(*(--(c)))) << 16; \
SAL_FALLTHROUGH; \
- case 5: (xr) |= ((sal_uInt32)(*(--(c)))) << 24; \
+ case 5: (xr) |= (static_cast<sal_uInt32>(*(--(c)))) << 24; \
SAL_FALLTHROUGH; \
- case 4: (xl) = ((sal_uInt32)(*(--(c)))); \
+ case 4: (xl) = (static_cast<sal_uInt32>(*(--(c)))); \
SAL_FALLTHROUGH; \
- case 3: (xl) |= ((sal_uInt32)(*(--(c)))) << 8; \
+ case 3: (xl) |= (static_cast<sal_uInt32>(*(--(c)))) << 8; \
SAL_FALLTHROUGH; \
- case 2: (xl) |= ((sal_uInt32)(*(--(c)))) << 16; \
+ case 2: (xl) |= (static_cast<sal_uInt32>(*(--(c)))) << 16; \
SAL_FALLTHROUGH; \
- case 1: (xl) |= ((sal_uInt32)(*(--(c)))) << 24; \
+ case 1: (xl) |= (static_cast<sal_uInt32>(*(--(c)))) << 24; \
} \
}
@@ -64,21 +64,21 @@
(c) += (n); \
switch ((n)) \
{ \
- case 8: *(--(c)) = (sal_uInt8)(((xr) ) & 0xff); \
+ case 8: *(--(c)) = static_cast<sal_uInt8>(((xr) ) & 0xff); \
SAL_FALLTHROUGH; \
- case 7: *(--(c)) = (sal_uInt8)(((xr) >> 8) & 0xff); \
+ case 7: *(--(c)) = static_cast<sal_uInt8>(((xr) >> 8) & 0xff); \
SAL_FALLTHROUGH; \
- case 6: *(--(c)) = (sal_uInt8)(((xr) >> 16) & 0xff); \
+ case 6: *(--(c)) = static_cast<sal_uInt8>(((xr) >> 16) & 0xff); \
SAL_FALLTHROUGH; \
- case 5: *(--(c)) = (sal_uInt8)(((xr) >> 24) & 0xff); \
+ case 5: *(--(c)) = static_cast<sal_uInt8>(((xr) >> 24) & 0xff); \
SAL_FALLTHROUGH; \
- case 4: *(--(c)) = (sal_uInt8)(((xl) ) & 0xff); \
+ case 4: *(--(c)) = static_cast<sal_uInt8>(((xl) ) & 0xff); \
SAL_FALLTHROUGH; \
- case 3: *(--(c)) = (sal_uInt8)(((xl) >> 8) & 0xff); \
+ case 3: *(--(c)) = static_cast<sal_uInt8>(((xl) >> 8) & 0xff); \
SAL_FALLTHROUGH; \
- case 2: *(--(c)) = (sal_uInt8)(((xl) >> 16) & 0xff); \
+ case 2: *(--(c)) = static_cast<sal_uInt8>(((xl) >> 16) & 0xff); \
SAL_FALLTHROUGH; \
- case 1: *(--(c)) = (sal_uInt8)(((xl) >> 24) & 0xff); \
+ case 1: *(--(c)) = static_cast<sal_uInt8>(((xl) >> 24) & 0xff); \
} \
}
@@ -916,13 +916,13 @@ static sal_uInt32 BF(CipherKeyBF *key, sal_uInt32 x)
sal_uInt16 a, b, c, d;
sal_uInt32 y;
- d = (sal_uInt16)(x & 0x00ff);
+ d = static_cast<sal_uInt16>(x & 0x00ff);
x >>= 8;
- c = (sal_uInt16)(x & 0x00ff);
+ c = static_cast<sal_uInt16>(x & 0x00ff);
x >>= 8;
- b = (sal_uInt16)(x & 0x00ff);
+ b = static_cast<sal_uInt16>(x & 0x00ff);
x >>= 8;
- a = (sal_uInt16)(x & 0x00ff);
+ a = static_cast<sal_uInt16>(x & 0x00ff);
y = key->m_S[0][a];
y += key->m_S[1][b];
@@ -1145,7 +1145,7 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl(
/* Evaluate next key byte S[t]. */
t = (S[x] + S[y]) % CIPHER_CBLOCK_ARCFOUR;
- pBuffer[k] = pData[k] ^ ((sal_uInt8)(S[t] & 0xff));
+ pBuffer[k] = pData[k] ^ static_cast<sal_uInt8>(S[t] & 0xff);
}
return rtl_Cipher_E_None;
diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx
index 4d4fb59ce3f4..f296fa5fbef8 100644
--- a/sal/rtl/digest.cxx
+++ b/sal/rtl/digest.cxx
@@ -29,16 +29,16 @@
#define RTL_DIGEST_ROTL(a,n) (((a) << (n)) | ((a) >> (32 - (n))))
#define RTL_DIGEST_HTONL(l,c) \
- (*((c)++) = (sal_uInt8)(((l) >> 24) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) >> 16) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) >> 8) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) ) & 0xff))
+ (*((c)++) = static_cast<sal_uInt8>(((l) >> 24) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) >> 16) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) >> 8) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) ) & 0xff))
#define RTL_DIGEST_LTOC(l,c) \
- (*((c)++) = (sal_uInt8)(((l) ) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) >> 8) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) >> 16) & 0xff), \
- *((c)++) = (sal_uInt8)(((l) >> 24) & 0xff))
+ (*((c)++) = static_cast<sal_uInt8>(((l) ) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) >> 8) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) >> 16) & 0xff), \
+ *((c)++) = static_cast<sal_uInt8>(((l) >> 24) & 0xff))
typedef rtlDigestError (Digest_init_t) (
void *ctx, const sal_uInt8 *Data, sal_uInt32 DatLen);
@@ -296,12 +296,12 @@ static void endMD2(DigestContextMD2 *ctx)
n = DIGEST_CBLOCK_MD2 - ctx->m_nDatLen;
for (i = ctx->m_nDatLen; i < DIGEST_CBLOCK_MD2; i++)
- X[i] = (sal_uInt8)(n & 0xff);
+ X[i] = static_cast<sal_uInt8>(n & 0xff);
updateMD2(ctx);
for (i = 0; i < DIGEST_CBLOCK_MD2; i++)
- X[i] = (sal_uInt8)(C[i] & 0xff);
+ X[i] = static_cast<sal_uInt8>(C[i] & 0xff);
updateMD2(ctx);
}
@@ -414,7 +414,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD2(
endMD2(ctx);
for (i = 0; i < DIGEST_CBLOCK_MD2; i++)
{
- pBuffer[i] = (sal_uInt8)(ctx->m_state[i] & 0xff);
+ pBuffer[i] = static_cast<sal_uInt8>(ctx->m_state[i] & 0xff);
}
initMD2(ctx);
@@ -494,10 +494,10 @@ static void initMD5(DigestContextMD5 *ctx)
{
memset(ctx, 0, sizeof(DigestContextMD5));
- ctx->m_nA = (sal_uInt32)0x67452301L;
- ctx->m_nB = (sal_uInt32)0xefcdab89L;
- ctx->m_nC = (sal_uInt32)0x98badcfeL;
- ctx->m_nD = (sal_uInt32)0x10325476L;
+ ctx->m_nA = sal_uInt32(0x67452301L);
+ ctx->m_nB = sal_uInt32(0xefcdab89L);
+ ctx->m_nC = sal_uInt32(0x98badcfeL);
+ ctx->m_nD = sal_uInt32(0x10325476L);
}
static void updateMD5(DigestContextMD5 *ctx)
@@ -612,13 +612,13 @@ static void endMD5(DigestContextMD5 *ctx)
switch (ctx->m_nDatLen & 0x03)
{
- case 0: X[i] = ((sal_uInt32)(*(p++))) << 0;
+ case 0: X[i] = static_cast<sal_uInt32>(*(p++)) << 0;
SAL_FALLTHROUGH;
- case 1: X[i] |= ((sal_uInt32)(*(p++))) << 8;
+ case 1: X[i] |= static_cast<sal_uInt32>(*(p++)) << 8;
SAL_FALLTHROUGH;
- case 2: X[i] |= ((sal_uInt32)(*(p++))) << 16;
+ case 2: X[i] |= static_cast<sal_uInt32>(*(p++)) << 16;
SAL_FALLTHROUGH;
- case 3: X[i] |= ((sal_uInt32)(*p)) << 24;
+ case 3: X[i] |= static_cast<sal_uInt32>(*p) << 24;
}
i += 1;
@@ -846,10 +846,10 @@ static void initSHA(
static void updateSHA(DigestContextSHA *ctx);
static void endSHA(DigestContextSHA *ctx);
-#define K_00_19 (sal_uInt32)0x5a827999L
-#define K_20_39 (sal_uInt32)0x6ed9eba1L
-#define K_40_59 (sal_uInt32)0x8f1bbcdcL
-#define K_60_79 (sal_uInt32)0xca62c1d6L
+#define K_00_19 sal_uInt32(0x5a827999L)
+#define K_20_39 sal_uInt32(0x6ed9eba1L)
+#define K_40_59 sal_uInt32(0x8f1bbcdcL)
+#define K_60_79 sal_uInt32(0xca62c1d6L)
#define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d))
#define F_20_39(b,c,d) ((b) ^ (c) ^ (d))
@@ -894,11 +894,11 @@ static void initSHA(
memset(ctx, 0, sizeof(DigestContextSHA));
ctx->m_update = fct;
- ctx->m_nA = (sal_uInt32)0x67452301L;
- ctx->m_nB = (sal_uInt32)0xefcdab89L;
- ctx->m_nC = (sal_uInt32)0x98badcfeL;
- ctx->m_nD = (sal_uInt32)0x10325476L;
- ctx->m_nE = (sal_uInt32)0xc3d2e1f0L;
+ ctx->m_nA = sal_uInt32(0x67452301L);
+ ctx->m_nB = sal_uInt32(0xefcdab89L);
+ ctx->m_nC = sal_uInt32(0x98badcfeL);
+ ctx->m_nD = sal_uInt32(0x10325476L);
+ ctx->m_nE = sal_uInt32(0xc3d2e1f0L);
}
static void updateSHA(DigestContextSHA *ctx)
@@ -1034,13 +1034,13 @@ static void endSHA(DigestContextSHA *ctx)
switch (ctx->m_nDatLen & 0x03)
{
- case 0: X[i] = ((sal_uInt32)(*(p++))) << 0;
+ case 0: X[i] = static_cast<sal_uInt32>(*(p++)) << 0;
SAL_FALLTHROUGH;
- case 1: X[i] |= ((sal_uInt32)(*(p++))) << 8;
+ case 1: X[i] |= static_cast<sal_uInt32>(*(p++)) << 8;
SAL_FALLTHROUGH;
- case 2: X[i] |= ((sal_uInt32)(*(p++))) << 16;
+ case 2: X[i] |= static_cast<sal_uInt32>(*(p++)) << 16;
SAL_FALLTHROUGH;
- case 3: X[i] |= ((sal_uInt32)(*(p++))) << 24;
+ case 3: X[i] |= static_cast<sal_uInt32>(*(p++)) << 24;
}
swapLong(X, i + 1);
diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx
index dd5db5c34739..0dc36a4cffff 100644
--- a/sal/rtl/hash.cxx
+++ b/sal/rtl/hash.cxx
@@ -67,8 +67,8 @@ static sal_uInt32 getNextSize(sal_uInt32 nSize)
static sal_uInt32 hashString(rtl_uString *pString)
{
- return (sal_uInt32) rtl_ustr_hashCode_WithLength(pString->buffer,
- pString->length);
+ return static_cast<sal_uInt32>(rtl_ustr_hashCode_WithLength(pString->buffer,
+ pString->length));
}
static StringHashTable * rtl_str_hash_new(sal_uInt32 nSize)
diff --git a/sal/rtl/locale.cxx b/sal/rtl/locale.cxx
index e7ef4223b0ca..b6b5ee499141 100644
--- a/sal/rtl/locale.cxx
+++ b/sal/rtl/locale.cxx
@@ -104,7 +104,7 @@ extern "C" void rtl_hashtable_init(RTL_HASHTABLE** table, sal_Int8 sizeIndex)
extern "C" sal_Int32 rtl_hashfunc(RTL_HASHTABLE* table, sal_Int32 key)
{
- return ((sal_uInt32) key % table->Size);
+ return (static_cast<sal_uInt32>(key) % table->Size);
}
extern "C" sal_Bool rtl_hashtable_grow(RTL_HASHTABLE** table);
@@ -143,7 +143,7 @@ sal_Bool rtl_hashtable_grow(RTL_HASHTABLE** table)
RTL_HASHTABLE* pNewTable = nullptr;
sal_Int32 i = 0;
- rtl_hashtable_init(&pNewTable, (sal_Int8)((*table)->iSize + 1));
+ rtl_hashtable_init(&pNewTable, static_cast<sal_Int8>((*table)->iSize + 1));
while (i < (*table)->Size)
{
diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx
index 1c28c47db43b..1046b7000069 100644
--- a/sal/rtl/random.cxx
+++ b/sal/rtl/random.cxx
@@ -77,11 +77,11 @@ static double data(RandomData_Impl *pImpl)
double random;
RTL_RANDOM_RNG (pImpl->m_nX, pImpl->m_nY, pImpl->m_nZ);
- random = (((double)(pImpl->m_nX) / 30328.0) +
- ((double)(pImpl->m_nY) / 30269.0) +
- ((double)(pImpl->m_nZ) / 30307.0) );
+ random = ((static_cast<double>(pImpl->m_nX) / 30328.0) +
+ (static_cast<double>(pImpl->m_nY) / 30269.0) +
+ (static_cast<double>(pImpl->m_nZ) / 30307.0) );
- random -= ((double)((sal_uInt32)random));
+ random -= static_cast<double>(static_cast<sal_uInt32>(random));
return random;
}
@@ -115,9 +115,9 @@ static bool initPool(RandomPool_Impl *pImpl)
tv.Nanosec = RTL_RANDOM_RNG_2(tv.Nanosec);
seedPool (pImpl, reinterpret_cast< sal_uInt8* >(&tv), sizeof(tv));
- rd.m_nX = (sal_Int16)(((tid >> 1) << 1) + 1);
- rd.m_nY = (sal_Int16)(((tv.Seconds >> 1) << 1) + 1);
- rd.m_nZ = (sal_Int16)(((tv.Nanosec >> 1) << 1) + 1);
+ rd.m_nX = static_cast<sal_Int16>(((tid >> 1) << 1) + 1);
+ rd.m_nY = static_cast<sal_Int16>(((tv.Seconds >> 1) << 1) + 1);
+ rd.m_nZ = static_cast<sal_Int16>(((tv.Nanosec >> 1) << 1) + 1);
seedPool (pImpl, reinterpret_cast< sal_uInt8* >(&rd), sizeof(rd));
while (pImpl->m_nData < RTL_RANDOM_SIZE_POOL)
diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx
index 20a2cda499c4..b9047b987fde 100644
--- a/sal/rtl/string.cxx
+++ b/sal/rtl/string.cxx
@@ -59,7 +59,7 @@ static rtl_String const aImplEmpty_rtl_String =
#define IMPL_RTL_IS_USTRING 0
#define IMPL_RTL_STRCODE sal_Char
-#define IMPL_RTL_USTRCODE( c ) ((unsigned char)c)
+#define IMPL_RTL_USTRCODE( c ) (static_cast<unsigned char>(c))
#define IMPL_RTL_STRNAME( n ) rtl_str_ ## n
#define IMPL_RTL_STRINGNAME( n ) rtl_string_ ## n
@@ -122,8 +122,8 @@ sal_Int32 SAL_CALL rtl_str_valueOfDouble(sal_Char * pStr, double d)
float SAL_CALL rtl_str_toFloat(sal_Char const * pStr) SAL_THROW_EXTERN_C()
{
assert(pStr);
- return (float) rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr),
- '.', 0, nullptr, nullptr);
+ return static_cast<float>(rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr),
+ '.', 0, nullptr, nullptr));
}
double SAL_CALL rtl_str_toDouble(sal_Char const * pStr) SAL_THROW_EXTERN_C()
@@ -221,7 +221,7 @@ bool rtl_impl_convertUStringToString(rtl_String ** pTarget,
nNewLen = rtl_ImplGetFastUTF8ByteLen( pSource, nLength );
/* Includes the string only ASCII, then we could copy
the buffer faster */
- if ( nNewLen == (sal_Size)nLength )
+ if ( nNewLen == static_cast<sal_Size>(nLength) )
{
sal_Char* pBuffer;
if ( *pTarget )
@@ -235,7 +235,7 @@ bool rtl_impl_convertUStringToString(rtl_String ** pTarget,
OSL_ENSURE( *pSource <= 127,
"rtl_uString2String() - UTF8 test is encoding is wrong" );
- *pBuffer = (sal_Char)(unsigned char)*pSource;
+ *pBuffer = static_cast<sal_Char>(static_cast<unsigned char>(*pSource));
pBuffer++;
pSource++;
nLength--;
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 5fdab82f8b43..929e5ce5c60e 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -101,8 +101,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare )( const IMPL_RTL_STRCODE* pStr1,
else
{
sal_Int32 nRet;
- while ( ((nRet = ((sal_Int32)IMPL_RTL_USTRCODE(*pStr1))-
- ((sal_Int32)IMPL_RTL_USTRCODE(*pStr2))) == 0) &&
+ while ( ((nRet = static_cast<sal_Int32>(IMPL_RTL_USTRCODE(*pStr1))-
+ static_cast<sal_Int32>(IMPL_RTL_USTRCODE(*pStr2))) == 0) &&
*pStr2 )
{
pStr1++;
@@ -148,8 +148,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare_WithLength )( const IMPL_RTL_STRCOD
while( (--nCount >= 0) && (*++pStr1 == *++pStr2) ) ;
if( nCount >= 0 )
- nRet = ((sal_Int32)IMPL_RTL_USTRCODE( *pStr1 ))
- - ((sal_Int32)IMPL_RTL_USTRCODE( *pStr2 ));
+ nRet = static_cast<sal_Int32>(IMPL_RTL_USTRCODE( *pStr1 ))
+ - static_cast<sal_Int32>(IMPL_RTL_USTRCODE( *pStr2 ));
return nRet;
}
@@ -193,8 +193,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompare_WithLength )( const IMPL_R
while ( (nShortenedLength > 0) &&
(pStr1 < pStr1End) && (pStr2 < pStr2End) )
{
- nRet = ((sal_Int32)IMPL_RTL_USTRCODE( *pStr1 ))-
- ((sal_Int32)IMPL_RTL_USTRCODE( *pStr2 ));
+ nRet = static_cast<sal_Int32>(IMPL_RTL_USTRCODE( *pStr1 ))-
+ static_cast<sal_Int32>(IMPL_RTL_USTRCODE( *pStr2 ));
if ( nRet )
return nRet;
@@ -227,8 +227,8 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( reverseCompare_WithLength )( const IMPL_RTL
{
pStr1Run--;
pStr2Run--;
- nRet = ((sal_Int32)IMPL_RTL_USTRCODE( *pStr1Run ))-
- ((sal_Int32)IMPL_RTL_USTRCODE( *pStr2Run ));
+ nRet = static_cast<sal_Int32>(IMPL_RTL_USTRCODE( *pStr1Run ))-
+ static_cast<sal_Int32>(IMPL_RTL_USTRCODE( *pStr2Run ));
if ( nRet )
return nRet;
}
@@ -359,7 +359,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar )( const IMPL_RTL_STRCODE* pStr
if (sizeof(IMPL_RTL_STRCODE) == sizeof(wchar_t))
{
// take advantage of builtin optimisations
- wchar_t const * p = wcschr(reinterpret_cast<wchar_t const *>(pStr), (wchar_t)c);
+ wchar_t const * p = wcschr(reinterpret_cast<wchar_t const *>(pStr), static_cast<wchar_t>(c));
return p ? p - reinterpret_cast<wchar_t const *>(pStr) : -1;
}
else
@@ -420,7 +420,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar )( const IMPL_RTL_STRCODE*
if (sizeof(IMPL_RTL_STRCODE) == sizeof(wchar_t))
{
// take advantage of builtin optimisations
- wchar_t const * p = wcsrchr(reinterpret_cast<wchar_t const *>(pStr), (wchar_t)c);
+ wchar_t const * p = wcsrchr(reinterpret_cast<wchar_t const *>(pStr), static_cast<wchar_t>(c));
return p ? p - reinterpret_cast<wchar_t const *>(pStr) : -1;
}
else
@@ -841,7 +841,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt32 )( IMPL_RTL_STRCODE* pStr,
/* create a recursive buffer with all values, except the last one */
do
{
- sal_Char nDigit = (sal_Char)(nValue % nRadix);
+ sal_Char nDigit = static_cast<sal_Char>(nValue % nRadix);
nValue /= nRadix;
if ( nDigit > 9 )
*pBuf = (nDigit-10) + 'a';
@@ -896,7 +896,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt64 )( IMPL_RTL_STRCODE* pStr,
/* create a recursive buffer with all values, except the last one */
do
{
- sal_Char nDigit = (sal_Char)(nValue % nRadix);
+ sal_Char nDigit = static_cast<sal_Char>(nValue % nRadix);
nValue /= nRadix;
if ( nDigit > 9 )
*pBuf = (nDigit-10) + 'a';
@@ -942,7 +942,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfUInt64 )( IMPL_RTL_STRCODE* pStr,
/* create a recursive buffer with all values, except the last one */
do
{
- sal_Char nDigit = (sal_Char)(nValue % nRadix);
+ sal_Char nDigit = static_cast<sal_Char>(nValue % nRadix);
nValue /= nRadix;
if ( nDigit > 9 )
*pBuf = (nDigit-10) + 'a';
@@ -1437,7 +1437,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral )( IMPL_RTL_STRINGDATA** ppThi
#if IMPL_RTL_IS_USTRING
assert(static_cast<unsigned char>(*pCharStr) < 0x80); // ASCII range
#endif
- SAL_WARN_IF( ((unsigned char)*pCharStr) == '\0', "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pCharStr)) == '\0', "rtl.string",
"rtl_uString_newFromLiteral - Found embedded \\0 character" );
*pBuffer = *pCharStr;
diff --git a/sal/rtl/ustrbuf.cxx b/sal/rtl/ustrbuf.cxx
index dfb2c1a06a30..4ebfbbbc994c 100644
--- a/sal/rtl/ustrbuf.cxx
+++ b/sal/rtl/ustrbuf.cxx
@@ -170,12 +170,12 @@ void rtl_uStringbuffer_insertUtf32(
sal_Int32 len;
OSL_ASSERT(rtl::isUnicodeScalarValue(c));
if (c <= 0xFFFF) {
- buf[0] = (sal_Unicode) c;
+ buf[0] = static_cast<sal_Unicode>(c);
len = 1;
} else {
c -= 0x10000;
- buf[0] = (sal_Unicode) ((c >> 10) | 0xD800);
- buf[1] = (sal_Unicode) ((c & 0x3FF) | 0xDC00);
+ buf[0] = static_cast<sal_Unicode>((c >> 10) | 0xD800);
+ buf[1] = static_cast<sal_Unicode>((c & 0x3FF) | 0xDC00);
len = 2;
}
rtl_uStringbuffer_insert(pThis, capacity, offset, buf, len);
@@ -217,7 +217,7 @@ void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This,
/* Check ASCII range */
OSL_ENSURE( (*str & 0x80) == 0, "Found ASCII char > 127");
- pBuf[offset + n] = (sal_Unicode)*(str++);
+ pBuf[offset + n] = static_cast<sal_Unicode>(*(str++));
}
(*This)->length = nOldLen + len;
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index 31e0cf10d363..d562c7c736a1 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -53,7 +53,7 @@
*/
static rtl_uString const aImplEmpty_rtl_uString =
{
- (sal_Int32) (SAL_STRING_INTERN_FLAG|SAL_STRING_STATIC_FLAG|1), /*sal_Int32 refCount; */
+ sal_Int32(SAL_STRING_INTERN_FLAG|SAL_STRING_STATIC_FLAG|1), /*sal_Int32 refCount; */
0, /*sal_Int32 length; */
{ 0 } /*sal_Unicode buffer[1];*/
};
@@ -217,12 +217,12 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compare( const sal_Unicode* pStr1,
assert(pStr1);
assert(pStr2);
sal_Int32 nRet;
- while ( ((nRet = ((sal_Int32)(*pStr1))-
- ((sal_Int32)((unsigned char)(*pStr2)))) == 0) &&
+ while ( ((nRet = static_cast<sal_Int32>(*pStr1)-
+ static_cast<sal_Int32>(static_cast<unsigned char>(*pStr2))) == 0) &&
*pStr2 )
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_ascii_compare - Found char > 127" );
pStr1++;
pStr2++;
@@ -242,12 +242,12 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compare_WithLength( const sal_Unicode* pStr1,
assert(nStr1Len >= 0);
assert(pStr2);
sal_Int32 nRet = 0;
- while( ((nRet = (nStr1Len ? (sal_Int32)(*pStr1) : 0)-
- ((sal_Int32)((unsigned char)(*pStr2)))) == 0) &&
+ while( ((nRet = (nStr1Len ? static_cast<sal_Int32>(*pStr1) : 0)-
+ static_cast<sal_Int32>(static_cast<unsigned char>(*pStr2))) == 0) &&
nStr1Len && *pStr2 )
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_ascii_compare_WithLength - Found char > 127" );
pStr1++;
pStr2++;
@@ -273,11 +273,11 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompare_WithLength( const sal_Unicode
(pStr1 < pStr1End) && *pStr2 )
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_ascii_shortenedCompare_WithLength - Found char > 127" );
- nRet = ((sal_Int32)*pStr1)-
- ((sal_Int32)(unsigned char)*pStr2);
+ nRet = static_cast<sal_Int32>(*pStr1)-
+ static_cast<sal_Int32>(static_cast<unsigned char>(*pStr2));
if ( nRet != 0 )
return nRet;
@@ -319,11 +319,11 @@ sal_Int32 SAL_CALL rtl_ustr_asciil_reverseCompare_WithLength( const sal_Unicode*
while ( (pStr1 < pStr1Run) && (pStr2 < pStr2Run) )
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_asciil_reverseCompare_WithLength - Found char > 127" );
pStr1Run--;
pStr2Run--;
- nRet = ((sal_Int32)*pStr1Run)-((sal_Int32)*pStr2Run);
+ nRet = static_cast<sal_Int32>(*pStr1Run)- static_cast<sal_Int32>(*pStr2Run);
if ( nRet )
return nRet;
}
@@ -344,11 +344,11 @@ sal_Bool SAL_CALL rtl_ustr_asciil_reverseEquals_WithLength( const sal_Unicode* p
while ( pStr1 < pStr1Run )
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_asciil_reverseEquals_WithLength - Found char > 127" );
pStr1Run--;
pStr2Run--;
- if( *pStr1Run != (sal_Unicode)*pStr2Run )
+ if( *pStr1Run != static_cast<sal_Unicode>(*pStr2Run) )
return false;
}
@@ -369,11 +369,11 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase( const sal_Unicode* pSt
do
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_ascii_compareIgnoreAsciiCase - Found char > 127" );
/* If character between 'A' and 'Z', than convert it to lowercase */
- c1 = (sal_Int32)*pStr1;
- c2 = (sal_Int32)((unsigned char)*pStr2);
+ c1 = static_cast<sal_Int32>(*pStr1);
+ c2 = static_cast<sal_Int32>(static_cast<unsigned char>(*pStr2));
if ( (c1 >= 65) && (c1 <= 90) )
c1 += 32;
if ( (c2 >= 65) && (c2 <= 90) )
@@ -405,14 +405,14 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( const sal_U
do
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength - Found char > 127" );
if ( !nStr1Len )
return *pStr2 == '\0' ? 0 : -1;
/* If character between 'A' and 'Z', than convert it to lowercase */
- c1 = (sal_Int32)*pStr1;
- c2 = (sal_Int32)((unsigned char)*pStr2);
+ c1 = static_cast<sal_Int32>(*pStr1);
+ c2 = static_cast<sal_Int32>(static_cast<unsigned char>(*pStr2));
if ( (c1 >= 65) && (c1 <= 90) )
c1 += 32;
if ( (c2 >= 65) && (c2 <= 90) )
@@ -439,10 +439,10 @@ sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
sal_Int32 len = firstLen < secondLen ? firstLen : secondLen;
for (i = 0; i < len; ++i) {
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*second) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*second)) > 127, "rtl.string",
"rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths - Found char > 127" );
sal_Int32 c1 = *first++;
- sal_Int32 c2 = (unsigned char) *second++;
+ sal_Int32 c2 = static_cast<unsigned char>(*second++);
sal_Int32 d;
if (c1 >= 65 && c1 <= 90) {
c1 += 32;
@@ -476,12 +476,12 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( co
(pStr1 < pStr1End) && *pStr2 )
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)*pStr2) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(*pStr2)) > 127, "rtl.string",
"rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength - Found char > 127" );
/* If character between 'A' and 'Z', than convert it to lowercase */
- c1 = (sal_Int32)*pStr1;
- c2 = (sal_Int32)((unsigned char)*pStr2);
+ c1 = static_cast<sal_Int32>(*pStr1);
+ c2 = static_cast<sal_Int32>(static_cast<unsigned char>(*pStr2));
if ( (c1 >= 65) && (c1 <= 90) )
c1 += 32;
if ( (c2 >= 65) && (c2 <= 90) )
@@ -669,7 +669,7 @@ static int rtl_ImplGetFastUTF8UnicodeLen( const sal_Char* pStr, sal_Int32 nLen,
pEndStr = pStr+nLen;
while ( pStr < pEndStr )
{
- unsigned char c = (unsigned char)*pStr;
+ unsigned char c = static_cast<unsigned char>(*pStr);
if ( !(c & 0x80) )
pStr++;
@@ -790,7 +790,7 @@ retry:
pBuffer = (*ppThis)->buffer;
do
{
- assert(((unsigned char)*pStr) <= 127);
+ assert((static_cast<unsigned char>(*pStr)) <= 127);
*pBuffer = *pStr;
pBuffer++;
pStr++;
@@ -1003,7 +1003,7 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
for (i = 0; i < len; i++)
{
/* Check ASCII range */
- SAL_WARN_IF( ((unsigned char)str[i]) > 127, "rtl.string",
+ SAL_WARN_IF( (static_cast<unsigned char>(str[i])) > 127, "rtl.string",
"rtl_ustring_internConvert() - Found char > 127 and RTL_TEXTENCODING_ASCII_US is specified" );
pScratch->buffer[i] = str[i];
}
diff --git a/sal/rtl/uuid.cxx b/sal/rtl/uuid.cxx
index 9ffbff7ff2cc..632b842f6391 100644
--- a/sal/rtl/uuid.cxx
+++ b/sal/rtl/uuid.cxx
@@ -28,31 +28,31 @@
#define SWAP_INT32_TO_NETWORK(x)\
{ sal_uInt32 y = x;\
sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(x)); \
- p[0] = (sal_uInt8) ( ( y >> 24 ) & 0xff );\
- p[1] = (sal_uInt8) ( ( y >> 16 ) & 0xff );\
- p[2] = (sal_uInt8) ( ( y >> 8 ) & 0xff );\
- p[3] = (sal_uInt8) ( ( y ) & 0xff);\
+ p[0] = static_cast<sal_uInt8>( ( y >> 24 ) & 0xff );\
+ p[1] = static_cast<sal_uInt8>( ( y >> 16 ) & 0xff );\
+ p[2] = static_cast<sal_uInt8>( ( y >> 8 ) & 0xff );\
+ p[3] = static_cast<sal_uInt8>( ( y ) & 0xff);\
}
#define SWAP_INT16_TO_NETWORK(x)\
{ sal_uInt16 y = x;\
sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(x)); \
- p[0] = (sal_uInt8) ( ( y >> 8 ) & 0xff );\
- p[1] = (sal_uInt8) ( ( y ) & 0xff);\
+ p[0] = static_cast<sal_uInt8>( ( y >> 8 ) & 0xff );\
+ p[1] = static_cast<sal_uInt8>( ( y ) & 0xff);\
}
#define SWAP_NETWORK_TO_INT16(x)\
{ sal_uInt16 y = x;\
sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(y));\
- x = ( ( ((sal_uInt16)p[0]) & 0xff) << 8 ) |\
- ( ( (sal_uInt16)p[1]) & 0xff);\
+ x = ( ( (static_cast<sal_uInt16>(p[0])) & 0xff) << 8 ) |\
+ ( ( static_cast<sal_uInt16>(p[1])) & 0xff);\
}
#define SWAP_NETWORK_TO_INT32(x)\
{ sal_uInt32 y = x;\
sal_uInt8 *p = reinterpret_cast<sal_uInt8 *>(&(y)); \
- x = ( ( ((sal_uInt32)p[0]) & 0xff) << 24 ) |\
- ( ( ((sal_uInt32)p[1]) & 0xff) << 16 ) |\
- ( ( ((sal_uInt32)p[2]) & 0xff) << 8 ) |\
- ( ( (sal_uInt32)p[3]) & 0xff);\
+ x = ( ( (static_cast<sal_uInt32>(p[0])) & 0xff) << 24 ) |\
+ ( ( (static_cast<sal_uInt32>(p[1])) & 0xff) << 16 ) |\
+ ( ( (static_cast<sal_uInt32>(p[2])) & 0xff) << 8 ) |\
+ ( ( static_cast<sal_uInt32>(p[3])) & 0xff);\
}
struct UUID