From 7abe976be5166845c5f43b70a0dfb38608d31356 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 6 Jun 2014 16:48:27 +0200 Subject: Avoid undefined mis-aligned memory access (assuming this shall always be little endian, given "Intel" in the function names) Change-Id: Iff7e1305108dd0f8d9fae762c1f715e2e7b481b3 --- lotuswordpro/source/filter/ut.hxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lotuswordpro') diff --git a/lotuswordpro/source/filter/ut.hxx b/lotuswordpro/source/filter/ut.hxx index 3f3080160c93..478336075648 100644 --- a/lotuswordpro/source/filter/ut.hxx +++ b/lotuswordpro/source/filter/ut.hxx @@ -76,16 +76,16 @@ namespace OpenStormBento typedef const Name * pConst##Name inline UtWord UtGetIntelWord(UtByte * pData) -{ return * (UtWord *) pData; } +{ return pData[0] | pData[1] << 8; } inline UtDWord UtGetIntelDWord(UtByte * pData) -{ return * (UtDWord *) pData; } +{ return pData[0] | pData[1] << 8 | pData[2] << 16 | pData[3] << 24; } inline void UtPutIntelWord(UtByte * pData, UtWord Val) -{ * (UtWord *) pData = Val; } +{ pData[0] = Val; pData[1] = Val >> 8; } inline void UtPutIntelDWord(UtByte * pData, UtDWord Val) -{ * (UtDWord *) pData = Val; } +{ pData[0] = Val; pData[1] = Val >> 8; pData[2] = Val >> 16; pData[3] = Val >> 24; } inline UtByte UtGetIntelByte(UtByte * pData) { return * pData; } -- cgit