From 505aa5eac2d0825ce323dce2abf5982394c0bb23 Mon Sep 17 00:00:00 2001 From: Erik Hendriks Date: Mon, 30 Sep 2024 14:10:16 +0200 Subject: [PATCH] Fix compilation error on RedHat when compiling with -Werror=sign-conversion Signed-off-by: Erik Hendriks --- src/ddscxx/tests/QosProvider.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ddscxx/tests/QosProvider.cpp b/src/ddscxx/tests/QosProvider.cpp index fbeaf0d5..6a2ed07a 100644 --- a/src/ddscxx/tests/QosProvider.cpp +++ b/src/ddscxx/tests/QosProvider.cpp @@ -183,10 +183,10 @@ static uint32_t b64_encode (const unsigned char *text, const uint32_t sz, unsign unsigned char chunk[4] = {0x00, 0x00, 0x00, 0x00}; size_t cp_sz = (sz - j); unsigned char tmp[3] = {text[j], static_cast(((cp_sz > 1)? text[j+1]: 0x00)), static_cast((cp_sz > 2)? text[j+2]: 0x00)}; - chunk[3] = base64_etable[tmp[2] & 0x3FU]; - chunk[2] = base64_etable[((tmp[1] & 0x0FU) << 0x02U) | (tmp[2] & 0xC0U) >> 0x06U]; - chunk[1] = base64_etable[((tmp[0] & 0x03U) << 0x04U) | (tmp[1] >> 0x04U)]; - chunk[0] = base64_etable[(tmp[0] >> 0x02U)]; + chunk[3] = base64_etable[tmp[2] & 0x3F]; + chunk[2] = base64_etable[((tmp[1] & 0x0F) << 0x02) | (tmp[2] & 0xC0) >> 0x06]; + chunk[1] = base64_etable[((tmp[0] & 0x03) << 0x04) | (tmp[1] >> 0x04)]; + chunk[0] = base64_etable[(tmp[0] >> 0x02)]; (void) memcpy(*(buff)+i, chunk, cp_sz < 3? cp_sz + 1: 4U); }