[libxml2] Add explicit casts in runtest.c



commit 21217dd94cdc3726ee981c332ed61012a1438fce
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue Jan 25 02:34:40 2022 +0100

    Add explicit casts in runtest.c
    
    Avoids integer conversion warnings with UBSan.

 runtest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/runtest.c b/runtest.c
index 463bdbdd..62b362d4 100644
--- a/runtest.c
+++ b/runtest.c
@@ -1231,7 +1231,7 @@ charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
     if (quiet)
        return;
     for (i = 0;(i<len) && (i < 30);i++)
-       output[i] = ch[i];
+       output[i] = (char) ch[i];
     output[i] = 0;
 
     fprintf(SAXdebug, "SAX.characters(%s, %d)\n", output, len);
@@ -1273,7 +1273,7 @@ ignorableWhitespaceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len)
     if (quiet)
        return;
     for (i = 0;(i<len) && (i < 30);i++)
-       output[i] = ch[i];
+       output[i] = (char) ch[i];
     output[i] = 0;
     fprintf(SAXdebug, "SAX.ignorableWhitespace(%s, %d)\n", output, len);
 }


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