1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +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>
* 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
htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
xmlChar next, xmlChar third, int comment) {
xmlChar next, xmlChar third, int iscomment) {
int base, len;
htmlParserInputPtr in;
const xmlChar *buf;
@ -4354,7 +4354,7 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
if (third) len -= 2;
else if (next) len --;
for (;base < len;base++) {
if (!incomment && (base + 4 < len) && !comment) {
if (!incomment && (base + 4 < len) && !iscomment) {
if ((buf[base] == '<') && (buf[base + 1] == '!') &&
(buf[base + 2] == '-') && (buf[base + 3] == '-')) {
incomment = 1;

17
error.c
View File

@ -11,6 +11,7 @@
#include <stdarg.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h> /* for char constants */
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
@ -149,7 +150,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
void
xmlParserPrintFileContext(xmlParserInputPtr input) {
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 *ctnt;
@ -157,21 +158,23 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
cur = input->cur;
base = input->base;
/* skip backwards over any end-of-lines */
while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) {
cur--;
}
n = 0;
/* 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--;
if ((*cur == '\n') || (*cur == '\r')) cur++;
if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
/* calculate the error position in terms of the current position */
col = input->cur - cur;
/* search forward for end-of-line (to max buff size) */
n = 0;
ctnt = content;
/* 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++;
n++;
}
@ -183,8 +186,8 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
ctnt = content;
/* (leave buffer space for pointer + line terminator) */
while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
if (*ctnt!='\t')
*ctnt = ' ';
if (*(ctnt) != '\t')
*(ctnt) = ' ';
*ctnt++;
}
*ctnt++ = '^';

View File

@ -121,7 +121,7 @@ int xmlGcMemGet (xmlFreeFunc *freeFunc,
int xmlInitMemory (void);
/*
* Those are specific to the XML debug memory wrapper.
* These are specific to the XML debug memory wrapper.
*/
int xmlMemUsed (void);
void xmlMemDisplay (FILE *fp);
@ -131,6 +131,11 @@ void * xmlMemMalloc (size_t size);
void * xmlMemRealloc (void *ptr,size_t size);
void xmlMemFree (void *ptr);
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
/**

View File

@ -469,7 +469,7 @@ pythonExternalEntityLoader(const char *URL, const char *ID,
if (result == NULL) {
Py_DECREF(ret);
} else if (URL != NULL) {
result->filename = xmlStrdup((const xmlChar *)URL);
result->filename = (char *) xmlStrdup((const xmlChar *)URL);
result->directory = xmlParserGetDirectory((const char *) URL);
}
}
@ -2690,7 +2690,7 @@ libxml_xmlRelaxNGSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * arg
#endif
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);
return(py_retval);
@ -2736,7 +2736,7 @@ libxml_xmlRelaxNGFreeValidCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
return(NULL);
ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, &pyCtxt) == 0)
if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == 0)
{
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 void print_xpath_nodes(xmlNodeSetPtr nodes);
/* static void print_xpath_nodes(xmlNodeSetPtr nodes); */
static int
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);
}
/*
static void
print_xpath_nodes(xmlNodeSetPtr nodes) {
xmlNodePtr cur;
@ -343,10 +344,7 @@ print_xpath_nodes(xmlNodeSetPtr nodes) {
}
}
}
*/
#else
#include <stdio.h>

View File

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

View File

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

View File

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

View File

@ -44,10 +44,6 @@
#include <libxml/xmlerror.h>
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,
const xmlChar **atts) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderStartElement(%s)\n", fullname);
#endif
if ((reader != NULL) && (reader->startElement != NULL)) {
/*
* when processing an entity, the context may have been changed
*/
origctxt = reader->ctxt;
reader->startElement(ctx, fullname, atts);
if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
(ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') &&
@ -266,18 +261,12 @@ xmlTextReaderStartElement(void *ctx, const xmlChar *fullname,
static void
xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderEndElement(%s)\n", fullname);
#endif
if ((reader != NULL) && (reader->endElement != NULL)) {
/*
* when processing an entity, the context may have been changed
*/
origctxt = reader->ctxt;
reader->endElement(ctx, fullname);
}
}
@ -294,7 +283,6 @@ static void
xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
@ -302,10 +290,6 @@ xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len)
#endif
if ((reader != NULL) && (reader->characters != NULL)) {
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 int extra;
unsigned int sign:1;
int frac:7;
int total:8;
unsigned int frac:7;
unsigned int total:8;
};
typedef struct _xmlSchemaValQName xmlSchemaValQName;
@ -1413,7 +1413,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar *value,
goto return0;
case XML_SCHEMAS_DECIMAL: {
const xmlChar *cur = value, *tmp;
int frac = 0, len, neg = 0;
unsigned int frac = 0, len, neg = 0;
unsigned long base = 0;
if (cur == NULL)
goto return1;