mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
Remove or annotate char casts
This commit is contained in:
@ -326,7 +326,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
|
|||||||
#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
|
#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
|
||||||
|
|
||||||
#define COPY_BUF(l,b,i,v) \
|
#define COPY_BUF(l,b,i,v) \
|
||||||
if (l == 1) b[i++] = (xmlChar) v; \
|
if (l == 1) b[i++] = v; \
|
||||||
else i += xmlCopyChar(l,&b[i],v)
|
else i += xmlCopyChar(l,&b[i],v)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5924,7 +5924,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
* Handle preparsed entities and charRef
|
* Handle preparsed entities and charRef
|
||||||
*/
|
*/
|
||||||
if (ctxt->token != 0) {
|
if (ctxt->token != 0) {
|
||||||
chr[0] = (xmlChar) ctxt->token;
|
chr[0] = ctxt->token;
|
||||||
htmlCheckParagraph(ctxt);
|
htmlCheckParagraph(ctxt);
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
|
||||||
ctxt->sax->characters(ctxt->userData, chr, 1);
|
ctxt->sax->characters(ctxt->userData, chr, 1);
|
||||||
|
2
parser.c
2
parser.c
@ -2169,7 +2169,7 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
|
|||||||
#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
|
#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
|
||||||
|
|
||||||
#define COPY_BUF(l,b,i,v) \
|
#define COPY_BUF(l,b,i,v) \
|
||||||
if (l == 1) b[i++] = (xmlChar) v; \
|
if (l == 1) b[i++] = v; \
|
||||||
else i += xmlCopyCharMultiByte(&b[i],v)
|
else i += xmlCopyCharMultiByte(&b[i],v)
|
||||||
|
|
||||||
#define CUR_CONSUMED \
|
#define CUR_CONSUMED \
|
||||||
|
@ -812,7 +812,7 @@ encoding_error:
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xmlCopyCharMultiByte(xmlChar *out, int val) {
|
xmlCopyCharMultiByte(xmlChar *out, int val) {
|
||||||
if (out == NULL) return(0);
|
if ((out == NULL) || (val < 0)) return(0);
|
||||||
/*
|
/*
|
||||||
* We are supposed to handle UTF8, check it's valid
|
* We are supposed to handle UTF8, check it's valid
|
||||||
* From rfc2044: encoding of the Unicode values on UTF-8:
|
* From rfc2044: encoding of the Unicode values on UTF-8:
|
||||||
@ -838,7 +838,7 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
|
|||||||
*out++= ((val >> bits) & 0x3F) | 0x80 ;
|
*out++= ((val >> bits) & 0x3F) | 0x80 ;
|
||||||
return (out - savedout);
|
return (out - savedout);
|
||||||
}
|
}
|
||||||
*out = (xmlChar) val;
|
*out = val;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,12 +855,12 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
|
xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
|
||||||
if (out == NULL) return(0);
|
if ((out == NULL) || (val < 0)) return(0);
|
||||||
/* the len parameter is ignored */
|
/* the len parameter is ignored */
|
||||||
if (val >= 0x80) {
|
if (val >= 0x80) {
|
||||||
return(xmlCopyCharMultiByte (out, val));
|
return(xmlCopyCharMultiByte (out, val));
|
||||||
}
|
}
|
||||||
*out = (xmlChar) val;
|
*out = val;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
uri.c
1
uri.c
@ -1657,6 +1657,7 @@ xmlURIUnescapeString(const char *str, int len, char *target) {
|
|||||||
c = c * 16 + (*in - 'A') + 10;
|
c = c * 16 + (*in - 'A') + 10;
|
||||||
in++;
|
in++;
|
||||||
len -= 3;
|
len -= 3;
|
||||||
|
/* Explicit sign change */
|
||||||
*out++ = (char) c;
|
*out++ = (char) c;
|
||||||
} else {
|
} else {
|
||||||
*out++ = *in++;
|
*out++ = *in++;
|
||||||
|
@ -1714,7 +1714,7 @@ loaded:
|
|||||||
"trying to build relative URI from %s\n", URL);
|
"trying to build relative URI from %s\n", URL);
|
||||||
} else {
|
} else {
|
||||||
/* If the URI doesn't contain a slash, it's not relative */
|
/* If the URI doesn't contain a slash, it's not relative */
|
||||||
if (!xmlStrchr(curBase, (xmlChar) '/'))
|
if (!xmlStrchr(curBase, '/'))
|
||||||
xmlFree(curBase);
|
xmlFree(curBase);
|
||||||
else
|
else
|
||||||
base = curBase;
|
base = curBase;
|
||||||
|
@ -97,6 +97,7 @@ xmlCharStrndup(const char *cur, int len) {
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
for (i = 0;i < len;i++) {
|
for (i = 0;i < len;i++) {
|
||||||
|
/* Explicit sign change */
|
||||||
ret[i] = (xmlChar) cur[i];
|
ret[i] = (xmlChar) cur[i];
|
||||||
if (ret[i] == 0) return(ret);
|
if (ret[i] == 0) return(ret);
|
||||||
}
|
}
|
||||||
|
2
xpath.c
2
xpath.c
@ -3098,7 +3098,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) {
|
|||||||
#define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l)
|
#define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l)
|
||||||
|
|
||||||
#define COPY_BUF(l,b,i,v) \
|
#define COPY_BUF(l,b,i,v) \
|
||||||
if (l == 1) b[i++] = (xmlChar) v; \
|
if (l == 1) b[i++] = v; \
|
||||||
else i += xmlCopyChar(l,&b[i],v)
|
else i += xmlCopyChar(l,&b[i],v)
|
||||||
|
|
||||||
#define NEXTL(l) ctxt->cur += l
|
#define NEXTL(l) ctxt->cur += l
|
||||||
|
Reference in New Issue
Block a user