[libxml2] Fix integer conversion warnings in xmlstring.c



commit 6f95273e44f43a2782af8dc3f6f09b59eb665a21
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue Jan 25 01:46:59 2022 +0100

    Fix integer conversion warnings in xmlstring.c
    
    Use an int to avoid an integer conversion warning with UBSan when
    left-shifting a char.

 xmlstring.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/xmlstring.c b/xmlstring.c
index e8a1e45d..3f5a5a2c 100644
--- a/xmlstring.c
+++ b/xmlstring.c
@@ -834,8 +834,8 @@ xmlCheckUTF8(const unsigned char *utf)
 
 int
 xmlUTF8Strsize(const xmlChar *utf, int len) {
-    const xmlChar   *ptr=utf;
-    xmlChar         ch;
+    const xmlChar *ptr=utf;
+    int ch;
 
     if (utf == NULL)
         return(0);
@@ -896,7 +896,7 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
  */
 const xmlChar *
 xmlUTF8Strpos(const xmlChar *utf, int pos) {
-    xmlChar ch;
+    int ch;
 
     if (utf == NULL) return(NULL);
     if (pos < 0)
@@ -929,7 +929,7 @@ xmlUTF8Strpos(const xmlChar *utf, int pos) {
 int
 xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) {
     int i, size;
-    xmlChar ch;
+    int ch;
 
     if (utf==NULL || utfchar==NULL) return -1;
     size = xmlUTF8Strsize(utfchar, 1);
@@ -965,8 +965,8 @@ xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) {
 
 xmlChar *
 xmlUTF8Strsub(const xmlChar *utf, int start, int len) {
-    int            i;
-    xmlChar ch;
+    int i;
+    int ch;
 
     if (utf == NULL) return(NULL);
     if (start < 0) return(NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]