From e19daf4ecf334a77bc35bcf3dd70dadb25444f53 Mon Sep 17 00:00:00 2001
From: Kristof Szabados <Kristof.Szabados@ericsson.com>
Date: Sun, 29 Jan 2017 14:17:53 +0100
Subject: [PATCH] when the string is of unsigned char lets & its elements with
 unsigned chars

Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com>
---
 compiler2/PredefFunc.cc | 6 +++---
 core/Addfunc.cc         | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/compiler2/PredefFunc.cc b/compiler2/PredefFunc.cc
index de4ca2c70..f01c9aa83 100644
--- a/compiler2/PredefFunc.cc
+++ b/compiler2/PredefFunc.cc
@@ -794,12 +794,12 @@ static CharCoding::CharCodingType is_ascii (size_t length, const unsigned char*
 
 static CharCoding::CharCodingType is_utf8(size_t length, const unsigned char* strptr)
 {
-  const char MSB = 1 << 7; // MSB is 1 in case of non ASCII character  
-  const char MSBmin1 = 1 << 6; // 0100 0000   
+  const unsigned char MSB = 1 << 7; // MSB is 1 in case of non ASCII character  
+  const unsigned char MSBmin1 = 1 << 6; // 0100 0000   
   size_t i = 0;
   while (length > i) {
     if ( strptr[i] & MSB) { // non ASCII char
-    char maskUTF8 = 1 << 6; // 111x xxxx shows how many additional bytes are there
+    unsigned char maskUTF8 = 1 << 6; // 111x xxxx shows how many additional bytes are there
       if (!(strptr[i] & maskUTF8)) return CharCoding::UNKNOWN; // accepted 11xxx xxxx but received 10xx xxxx
       unsigned int noofUTF8 = 0; // 11xx xxxxx -> 2 bytes, 111x xxxxx -> 3 bytes , 1111 xxxxx -> 4 bytes in UTF-8
       while (strptr[i] & maskUTF8) {
diff --git a/core/Addfunc.cc b/core/Addfunc.cc
index d3ad9e218..716cf8be5 100644
--- a/core/Addfunc.cc
+++ b/core/Addfunc.cc
@@ -214,15 +214,15 @@ static CharCoding::CharCodingType is_ascii ( const OCTETSTRING& ostr )
 
 static CharCoding::CharCodingType is_utf8 ( const OCTETSTRING& ostr )
 {
-  const char MSB = 1 << 7; // MSB is 1 in case of non ASCII character  
-  const char MSBmin1 = 1 << 6; // 0100 0000   
+  const unsigned char MSB = 1 << 7; // MSB is 1 in case of non ASCII character  
+  const unsigned char MSBmin1 = 1 << 6; // 0100 0000   
   int i = 0;
   const unsigned char* strptr = (const unsigned char*)ostr;
   //  std::cout << "UTF-8 strptr" << strptr << std::endl;  
   while (ostr.lengthof() > i) {
     if ( strptr[i] & MSB) { // non ASCII char
   // std::cout << "UTF-8 strptr[" << i << "]: " << std::hex << (int)strptr[i] << std::endl;
-    char maskUTF8 = 1 << 6; // 111x xxxx shows how many additional bytes are there
+    unsigned char maskUTF8 = 1 << 6; // 111x xxxx shows how many additional bytes are there
       if (!(strptr[i] & maskUTF8)) return CharCoding::UNKNOWN; // accepted 11xxx xxxx but received 10xx xxxx
       unsigned int noofUTF8 = 0; // 11xx xxxxx -> 2 bytes, 111x xxxxx -> 3 bytes , 1111 xxxxx -> 4 bytes in UTF-8
       while (strptr[i] & maskUTF8) {
-- 
GitLab