From 97ebc98f0e956712d242e13f15531742f844a738 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 5 Nov 2018 12:24:35 +0200 Subject: convert some macros to local functions Change-Id: If2c89f0f53615f6200b6cd1fb6267cc9b47df927 Reviewed-on: https://gerrit.libreoffice.org/62884 Tested-by: Jenkins Reviewed-by: Noel Grandin --- tools/source/stream/stream.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index e7d21d950e39..818726b2a619 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -34,11 +34,13 @@ #include -#define SWAPNIBBLES(c) \ -unsigned char nSwapTmp=c; \ -nSwapTmp <<= 4; \ -c >>= 4; \ -c |= nSwapTmp; +static void swapNibbles(unsigned char &c) +{ + unsigned char nSwapTmp=c; + nSwapTmp <<= 4; + c >>= 4; + c |= nSwapTmp; +} #include #include @@ -1488,7 +1490,7 @@ std::size_t SvStream::CryptAndWriteBuffer( const void* pStart, std::size_t nLen) { unsigned char aCh = rn; aCh ^= nMask; - SWAPNIBBLES(aCh) + swapNibbles(aCh); rn = aCh; } // ************************* @@ -1507,7 +1509,7 @@ void SvStream::EncryptBuffer(void* pStart, std::size_t nLen) const for ( std::size_t n=0; n < nLen; n++, pTemp++ ) { unsigned char aCh = *pTemp; - SWAPNIBBLES(aCh) + swapNibbles(aCh); aCh ^= nMask; *pTemp = aCh; } -- cgit