1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-01 10:06:59 +03:00

small changes to syntax to get rid of compiler warnings. No changes to

* error.c HTMLparser.c testC14N.c testHTML.c testURI.c
  xmlcatalog.c xmlmemory.c xmlreader.c xmlschemastypes.c
  python/libxml.c include/libxml/xmlmemory.h: small changes
  to syntax to get rid of compiler warnings.  No changes
  to logic.
This commit is contained in:
William M. Brack
2003-08-05 15:52:22 +00:00
parent c758c229b4
commit c193956ee1
12 changed files with 43 additions and 49 deletions

View File

@ -1,3 +1,11 @@
Tue Aug 5 23:51:21 HKT 2003 William Brack <wbrack@mmm.com.hk>
* error.c HTMLparser.c testC14N.c testHTML.c testURI.c
xmlcatalog.c xmlmemory.c xmlreader.c xmlschemastypes.c
python/libxml.c include/libxml/xmlmemory.h: small changes
to syntax to get rid of compiler warnings. No changes
to logic.
Mon Aug 4 22:40:54 CEST 2003 Daniel Veillard <daniel@veillard.com> Mon Aug 4 22:40:54 CEST 2003 Daniel Veillard <daniel@veillard.com>
* doc/libxml2-api.xml doc/html/*: rebuilt the API and docs. * doc/libxml2-api.xml doc/html/*: rebuilt the API and docs.

View File

@ -4331,7 +4331,7 @@ htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) {
*/ */
static int static int
htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
xmlChar next, xmlChar third, int comment) { xmlChar next, xmlChar third, int iscomment) {
int base, len; int base, len;
htmlParserInputPtr in; htmlParserInputPtr in;
const xmlChar *buf; const xmlChar *buf;
@ -4354,7 +4354,7 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
if (third) len -= 2; if (third) len -= 2;
else if (next) len --; else if (next) len --;
for (;base < len;base++) { for (;base < len;base++) {
if (!incomment && (base + 4 < len) && !comment) { if (!incomment && (base + 4 < len) && !iscomment) {
if ((buf[base] == '<') && (buf[base + 1] == '!') && if ((buf[base] == '<') && (buf[base + 1] == '!') &&
(buf[base + 2] == '-') && (buf[base + 3] == '-')) { (buf[base + 2] == '-') && (buf[base + 3] == '-')) {
incomment = 1; incomment = 1;

17
error.c
View File

@ -11,6 +11,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/parserInternals.h> /* for char constants */
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/globals.h> #include <libxml/globals.h>
@ -149,7 +150,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
void void
xmlParserPrintFileContext(xmlParserInputPtr input) { xmlParserPrintFileContext(xmlParserInputPtr input) {
const xmlChar *cur, *base; const xmlChar *cur, *base;
int n, col; unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
xmlChar content[81]; /* space for 80 chars + line terminator */ xmlChar content[81]; /* space for 80 chars + line terminator */
xmlChar *ctnt; xmlChar *ctnt;
@ -157,21 +158,23 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
cur = input->cur; cur = input->cur;
base = input->base; base = input->base;
/* skip backwards over any end-of-lines */ /* skip backwards over any end-of-lines */
while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) { while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) {
cur--; cur--;
} }
n = 0; n = 0;
/* search backwards for beginning-of-line (to max buff size) */ /* search backwards for beginning-of-line (to max buff size) */
while ((n++ < sizeof(content)-1) && (cur > base) && (*cur != '\n') && (*cur != '\r')) while ((n++ < (sizeof(content)-1)) && (cur > base) &&
(*(cur) != '\n') && (*(cur) != '\r'))
cur--; cur--;
if ((*cur == '\n') || (*cur == '\r')) cur++; if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
/* calculate the error position in terms of the current position */ /* calculate the error position in terms of the current position */
col = input->cur - cur; col = input->cur - cur;
/* search forward for end-of-line (to max buff size) */ /* search forward for end-of-line (to max buff size) */
n = 0; n = 0;
ctnt = content; ctnt = content;
/* copy selected text to our buffer */ /* copy selected text to our buffer */
while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < sizeof(content)-1)) { while ((*cur != 0) && (*(cur) != '\n') &&
(*(cur) != '\r') && (n < sizeof(content)-1)) {
*ctnt++ = *cur++; *ctnt++ = *cur++;
n++; n++;
} }
@ -183,8 +186,8 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
ctnt = content; ctnt = content;
/* (leave buffer space for pointer + line terminator) */ /* (leave buffer space for pointer + line terminator) */
while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) { while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
if (*ctnt!='\t') if (*(ctnt) != '\t')
*ctnt = ' '; *(ctnt) = ' ';
*ctnt++; *ctnt++;
} }
*ctnt++ = '^'; *ctnt++ = '^';

View File

@ -121,7 +121,7 @@ int xmlGcMemGet (xmlFreeFunc *freeFunc,
int xmlInitMemory (void); int xmlInitMemory (void);
/* /*
* Those are specific to the XML debug memory wrapper. * These are specific to the XML debug memory wrapper.
*/ */
int xmlMemUsed (void); int xmlMemUsed (void);
void xmlMemDisplay (FILE *fp); void xmlMemDisplay (FILE *fp);
@ -131,6 +131,11 @@ void * xmlMemMalloc (size_t size);
void * xmlMemRealloc (void *ptr,size_t size); void * xmlMemRealloc (void *ptr,size_t size);
void xmlMemFree (void *ptr); void xmlMemFree (void *ptr);
char * xmlMemoryStrdup (const char *str); char * xmlMemoryStrdup (const char *str);
void * xmlMallocLoc (size_t size, const char *file, int line);
void * xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
void * xmlMallocAtomicLoc (size_t size, const char *file, int line);
char * xmlMemStrdupLoc (const char *str, const char *file, int line);
#ifdef DEBUG_MEMORY_LOCATION #ifdef DEBUG_MEMORY_LOCATION
/** /**

View File

@ -469,7 +469,7 @@ pythonExternalEntityLoader(const char *URL, const char *ID,
if (result == NULL) { if (result == NULL) {
Py_DECREF(ret); Py_DECREF(ret);
} else if (URL != NULL) { } else if (URL != NULL) {
result->filename = xmlStrdup((const xmlChar *)URL); result->filename = (char *) xmlStrdup((const xmlChar *)URL);
result->directory = xmlParserGetDirectory((const char *) URL); result->directory = xmlParserGetDirectory((const char *) URL);
} }
} }
@ -2690,7 +2690,7 @@ libxml_xmlRelaxNGSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * arg
#endif #endif
ctxt = PyrelaxNgValidCtxt_Get(pyobj_ctx); ctxt = PyrelaxNgValidCtxt_Get(pyobj_ctx);
if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, &pyCtxt) == -1) if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == -1)
{ {
py_retval = libxml_intWrap(-1); py_retval = libxml_intWrap(-1);
return(py_retval); return(py_retval);
@ -2736,7 +2736,7 @@ libxml_xmlRelaxNGFreeValidCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
return(NULL); return(NULL);
ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt); ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, &pyCtxt) == 0) if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == 0)
{ {
if (pyCtxt != NULL) if (pyCtxt != NULL)
{ {

View File

@ -46,7 +46,7 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename);
static xmlChar **parse_list(xmlChar *str); static xmlChar **parse_list(xmlChar *str);
static void print_xpath_nodes(xmlNodeSetPtr nodes); /* static void print_xpath_nodes(xmlNodeSetPtr nodes); */
static int static int
test_c14n(const char* xml_filename, int with_comments, int exclusive, test_c14n(const char* xml_filename, int with_comments, int exclusive,
@ -313,6 +313,7 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) {
return(xpath); return(xpath);
} }
/*
static void static void
print_xpath_nodes(xmlNodeSetPtr nodes) { print_xpath_nodes(xmlNodeSetPtr nodes) {
xmlNodePtr cur; xmlNodePtr cur;
@ -343,10 +344,7 @@ print_xpath_nodes(xmlNodeSetPtr nodes) {
} }
} }
} }
*/
#else #else
#include <stdio.h> #include <stdio.h>

View File

@ -376,7 +376,7 @@ startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar
outlen = sizeof output - 1; outlen = sizeof output - 1;
htmlEncodeEntities(output, &outlen, att, &attlen, '\''); htmlEncodeEntities(output, &outlen, att, &attlen, '\'');
output[outlen] = 0; output[outlen] = 0;
fprintf(stdout, "%s", output); fprintf(stdout, "%s", (char *) output);
att += attlen; att += attlen;
} }
fprintf(stdout, "'"); fprintf(stdout, "'");

View File

@ -35,7 +35,7 @@ static void handleURI(const char *str) {
if (escape != 0) { if (escape != 0) {
parsed = xmlSaveUri(uri); parsed = xmlSaveUri(uri);
res = xmlURIEscape(parsed); res = xmlURIEscape(parsed);
printf("%s\n", res); printf("%s\n", (char *) res);
} else { } else {
xmlPrintURI(stdout, uri); xmlPrintURI(stdout, uri);
@ -45,7 +45,7 @@ static void handleURI(const char *str) {
} else { } else {
res = xmlBuildURI((xmlChar *)str, (xmlChar *) base); res = xmlBuildURI((xmlChar *)str, (xmlChar *) base);
if (res != NULL) { if (res != NULL) {
printf("%s\n", res); printf("%s\n", (char *) res);
} }
else else
printf("::ERROR::\n"); printf("::ERROR::\n");

View File

@ -194,7 +194,7 @@ static void usershell(void) {
if (ans == NULL) { if (ans == NULL) {
printf("No entry for PUBLIC %s\n", argv[0]); printf("No entry for PUBLIC %s\n", argv[0]);
} else { } else {
printf("%s\n", ans); printf("%s\n", (char *) ans);
xmlFree(ans); xmlFree(ans);
} }
} }
@ -206,7 +206,7 @@ static void usershell(void) {
if (ans == NULL) { if (ans == NULL) {
printf("No entry for SYSTEM %s\n", argv[0]); printf("No entry for SYSTEM %s\n", argv[0]);
} else { } else {
printf("%s\n", ans); printf("%s\n", (char *) ans);
xmlFree(ans); xmlFree(ans);
} }
} }
@ -256,7 +256,7 @@ static void usershell(void) {
if (ans == NULL) { if (ans == NULL) {
printf("Resolver failed to find an answer\n"); printf("Resolver failed to find an answer\n");
} else { } else {
printf("%s\n", ans); printf("%s\n", (char *) ans);
xmlFree(ans); xmlFree(ans);
} }
} }
@ -539,7 +539,7 @@ int main(int argc, char **argv) {
printf("No entry for PUBLIC %s\n", argv[i]); printf("No entry for PUBLIC %s\n", argv[i]);
exit_value = 4; exit_value = 4;
} else { } else {
printf("%s\n", ans); printf("%s\n", (char *) ans);
xmlFree(ans); xmlFree(ans);
} }
} else { } else {
@ -549,7 +549,7 @@ int main(int argc, char **argv) {
printf("No entry for SYSTEM %s\n", argv[i]); printf("No entry for SYSTEM %s\n", argv[i]);
exit_value = 4; exit_value = 4;
} else { } else {
printf("%s\n", ans); printf("%s\n", (char *) ans);
xmlFree(ans); xmlFree(ans);
} }
} }

View File

@ -44,10 +44,6 @@
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
void xmlMallocBreakpoint(void); void xmlMallocBreakpoint(void);
void * xmlMemMalloc(size_t size);
void * xmlMemRealloc(void *ptr,size_t size);
void xmlMemFree(void *ptr);
char * xmlMemoryStrdup(const char *str);
/************************************************************************ /************************************************************************
* * * *

View File

@ -235,17 +235,12 @@ static void
xmlTextReaderStartElement(void *ctx, const xmlChar *fullname, xmlTextReaderStartElement(void *ctx, const xmlChar *fullname,
const xmlChar **atts) { const xmlChar **atts) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS #ifdef DEBUG_CALLBACKS
printf("xmlTextReaderStartElement(%s)\n", fullname); printf("xmlTextReaderStartElement(%s)\n", fullname);
#endif #endif
if ((reader != NULL) && (reader->startElement != NULL)) { if ((reader != NULL) && (reader->startElement != NULL)) {
/*
* when processing an entity, the context may have been changed
*/
origctxt = reader->ctxt;
reader->startElement(ctx, fullname, atts); reader->startElement(ctx, fullname, atts);
if ((ctxt->node != NULL) && (ctxt->input != NULL) && if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
(ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') && (ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') &&
@ -266,18 +261,12 @@ xmlTextReaderStartElement(void *ctx, const xmlChar *fullname,
static void static void
xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) { xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS #ifdef DEBUG_CALLBACKS
printf("xmlTextReaderEndElement(%s)\n", fullname); printf("xmlTextReaderEndElement(%s)\n", fullname);
#endif #endif
if ((reader != NULL) && (reader->endElement != NULL)) { if ((reader != NULL) && (reader->endElement != NULL)) {
/*
* when processing an entity, the context may have been changed
*/
origctxt = reader->ctxt;
reader->endElement(ctx, fullname); reader->endElement(ctx, fullname);
} }
} }
@ -294,7 +283,6 @@ static void
xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len) xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len)
{ {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private; xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS #ifdef DEBUG_CALLBACKS
@ -302,10 +290,6 @@ xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len)
#endif #endif
if ((reader != NULL) && (reader->characters != NULL)) { if ((reader != NULL) && (reader->characters != NULL)) {
reader->characters(ctx, ch, len); reader->characters(ctx, ch, len);
/*
* when processing an entity, the context may have been changed
*/
origctxt = reader->ctxt;
} }
} }

View File

@ -123,8 +123,8 @@ struct _xmlSchemaValDecimal {
unsigned long hi; unsigned long hi;
unsigned int extra; unsigned int extra;
unsigned int sign:1; unsigned int sign:1;
int frac:7; unsigned int frac:7;
int total:8; unsigned int total:8;
}; };
typedef struct _xmlSchemaValQName xmlSchemaValQName; typedef struct _xmlSchemaValQName xmlSchemaValQName;
@ -1413,7 +1413,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar *value,
goto return0; goto return0;
case XML_SCHEMAS_DECIMAL: { case XML_SCHEMAS_DECIMAL: {
const xmlChar *cur = value, *tmp; const xmlChar *cur = value, *tmp;
int frac = 0, len, neg = 0; unsigned int frac = 0, len, neg = 0;
unsigned long base = 0; unsigned long base = 0;
if (cur == NULL) if (cur == NULL)
goto return1; goto return1;