1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

Fix integer conversion warnings in xmlstring.c

Use an int to avoid an integer conversion warning with UBSan when
left-shifting a char.
This commit is contained in:
Nick Wellnhofer
2022-01-25 01:46:59 +01:00
parent 0596d67ddc
commit 6f95273e44

View File

@@ -835,7 +835,7 @@ xmlCheckUTF8(const unsigned char *utf)
int int
xmlUTF8Strsize(const xmlChar *utf, int len) { xmlUTF8Strsize(const xmlChar *utf, int len) {
const xmlChar *ptr=utf; const xmlChar *ptr=utf;
xmlChar ch; int ch;
if (utf == NULL) if (utf == NULL)
return(0); return(0);
@@ -896,7 +896,7 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
*/ */
const xmlChar * const xmlChar *
xmlUTF8Strpos(const xmlChar *utf, int pos) { xmlUTF8Strpos(const xmlChar *utf, int pos) {
xmlChar ch; int ch;
if (utf == NULL) return(NULL); if (utf == NULL) return(NULL);
if (pos < 0) if (pos < 0)
@@ -929,7 +929,7 @@ xmlUTF8Strpos(const xmlChar *utf, int pos) {
int int
xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) { xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) {
int i, size; int i, size;
xmlChar ch; int ch;
if (utf==NULL || utfchar==NULL) return -1; if (utf==NULL || utfchar==NULL) return -1;
size = xmlUTF8Strsize(utfchar, 1); size = xmlUTF8Strsize(utfchar, 1);
@@ -966,7 +966,7 @@ xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) {
xmlChar * xmlChar *
xmlUTF8Strsub(const xmlChar *utf, int start, int len) { xmlUTF8Strsub(const xmlChar *utf, int start, int len) {
int i; int i;
xmlChar ch; int ch;
if (utf == NULL) return(NULL); if (utf == NULL) return(NULL);
if (start < 0) return(NULL); if (start < 0) return(NULL);