1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

* c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c

valid.c xmlschemas.c xmlwriter.c xpath.c: use %s to printf string
  patch by Christian Persch, fixes #581612
This commit is contained in:
Daniel Veillard
2009-06-04 11:22:45 +02:00
parent 7dd7080ad7
commit bccae2d210
10 changed files with 35 additions and 29 deletions

View File

@ -1,3 +1,9 @@
Thu Jun 4 11:17:23 CEST 2009 Daniel Veillard <daniel@veillard.com>
* c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c
valid.c xmlschemas.c xmlwriter.c xpath.c: use %s to printf string
patch by Christian Persch
Thu Jun 4 11:06:07 CEST 2009 Daniel Veillard <daniel@veillard.com> Thu Jun 4 11:06:07 CEST 2009 Daniel Veillard <daniel@veillard.com>
* parser.c threads.c: change the threading initialization sequence * parser.c threads.c: change the threading initialization sequence

2
c14n.c
View File

@ -234,7 +234,7 @@ xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error,
__xmlRaiseError(NULL, NULL, NULL, __xmlRaiseError(NULL, NULL, NULL,
ctxt, node, XML_FROM_C14N, error, ctxt, node, XML_FROM_C14N, error,
XML_ERR_ERROR, NULL, 0, XML_ERR_ERROR, NULL, 0,
NULL, NULL, NULL, 0, 0, msg); NULL, NULL, NULL, 0, 0, "%s", msg);
} }
/************************************************************************ /************************************************************************

View File

@ -141,9 +141,9 @@ xmlCtxtDumpSpaces(xmlDebugCtxtPtr ctxt)
return; return;
if ((ctxt->output != NULL) && (ctxt->depth > 0)) { if ((ctxt->output != NULL) && (ctxt->depth > 0)) {
if (ctxt->depth < 50) if (ctxt->depth < 50)
fprintf(ctxt->output, &ctxt->shift[100 - 2 * ctxt->depth]); fprintf(ctxt->output, "%s", &ctxt->shift[100 - 2 * ctxt->depth]);
else else
fprintf(ctxt->output, ctxt->shift); fprintf(ctxt->output, "%s", ctxt->shift);
} }
} }
@ -162,7 +162,7 @@ xmlDebugErr(xmlDebugCtxtPtr ctxt, int error, const char *msg)
NULL, ctxt->node, XML_FROM_CHECK, NULL, ctxt->node, XML_FROM_CHECK,
error, XML_ERR_ERROR, NULL, 0, error, XML_ERR_ERROR, NULL, 0,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
msg); "%s", msg);
} }
static void static void
xmlDebugErr2(xmlDebugCtxtPtr ctxt, int error, const char *msg, int extra) xmlDebugErr2(xmlDebugCtxtPtr ctxt, int error, const char *msg, int extra)

View File

@ -34,7 +34,7 @@ main(void)
* for demonstration purposes. * for demonstration purposes.
*/ */
xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1); xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1);
printf((char *) xmlbuff); printf("%s", (char *) xmlbuff);
/* /*
* Free associated memory. * Free associated memory.

View File

@ -493,7 +493,7 @@ xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
if (ctxt != NULL) if (ctxt != NULL)
ctxt->errNo = error; ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
if (ctxt != NULL) { if (ctxt != NULL) {
ctxt->wellFormed = 0; ctxt->wellFormed = 0;
if (ctxt->recovery == 0) if (ctxt->recovery == 0)

View File

@ -1425,7 +1425,7 @@ xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt,
(pattern == NULL)?NULL:((const char *) pattern->name), (pattern == NULL)?NULL:((const char *) pattern->name),
(const char *) path, (const char *) path,
(const char *) report, 0, 0, (const char *) report, 0, 0,
msg); "%s", msg);
} else { } else {
xmlSchematronReportOutput(ctxt, cur, &msg[0]); xmlSchematronReportOutput(ctxt, cur, &msg[0]);
} }

View File

@ -122,7 +122,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
__xmlRaiseError(NULL, channel, data, __xmlRaiseError(NULL, channel, data,
pctxt, NULL, XML_FROM_VALID, error, pctxt, NULL, XML_FROM_VALID, error,
XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, 0, 0, XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, 0, 0,
msg); "%s", msg);
} }
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) #if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)

View File

@ -4274,7 +4274,7 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept
for (i = 0;((i < depth) && (i < 25));i++) for (i = 0;((i < depth) && (i < 25));i++)
shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift); fprintf(output, "%s", shift);
if (particle->children == NULL) { if (particle->children == NULL) {
fprintf(output, "MISSING particle term\n"); fprintf(output, "MISSING particle term\n");
return; return;

View File

@ -129,10 +129,10 @@ xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error,
if (ctxt != NULL) { if (ctxt != NULL) {
__xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt,
NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, NULL, XML_FROM_WRITER, error, XML_ERR_FATAL,
NULL, 0, NULL, NULL, NULL, 0, 0, msg); NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
} else { } else {
__xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error,
XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg);
} }
} }

36
xpath.c
View File

@ -334,7 +334,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
error + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK, error + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK,
XML_ERR_ERROR, NULL, 0, XML_ERR_ERROR, NULL, 0,
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0,
xmlXPathErrorMessages[error]); "%s", xmlXPathErrorMessages[error]);
return; return;
} }
ctxt->error = error; ctxt->error = error;
@ -345,7 +345,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
XML_ERR_ERROR, NULL, 0, XML_ERR_ERROR, NULL, 0,
(const char *) ctxt->base, NULL, NULL, (const char *) ctxt->base, NULL, NULL,
ctxt->cur - ctxt->base, 0, ctxt->cur - ctxt->base, 0,
xmlXPathErrorMessages[error]); "%s", xmlXPathErrorMessages[error]);
return; return;
} }
@ -369,7 +369,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
XML_ERR_ERROR, NULL, 0, XML_ERR_ERROR, NULL, 0,
(const char *) ctxt->base, NULL, NULL, (const char *) ctxt->base, NULL, NULL,
ctxt->cur - ctxt->base, 0, ctxt->cur - ctxt->base, 0,
xmlXPathErrorMessages[error]); "%s", xmlXPathErrorMessages[error]);
} }
} }
@ -879,7 +879,7 @@ xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) { if (cur == NULL) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "Node is NULL !\n"); fprintf(output, "Node is NULL !\n");
return; return;
@ -887,7 +887,7 @@ xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
if ((cur->type == XML_DOCUMENT_NODE) || if ((cur->type == XML_DOCUMENT_NODE) ||
(cur->type == XML_HTML_DOCUMENT_NODE)) { (cur->type == XML_HTML_DOCUMENT_NODE)) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, " /\n"); fprintf(output, " /\n");
} else if (cur->type == XML_ATTRIBUTE_NODE) } else if (cur->type == XML_ATTRIBUTE_NODE)
xmlDebugDumpAttr(output, (xmlAttrPtr)cur, depth); xmlDebugDumpAttr(output, (xmlAttrPtr)cur, depth);
@ -904,7 +904,7 @@ xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) { if (cur == NULL) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "Node is NULL !\n"); fprintf(output, "Node is NULL !\n");
return; return;
@ -927,7 +927,7 @@ xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) { if (cur == NULL) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "NodeSet is NULL !\n"); fprintf(output, "NodeSet is NULL !\n");
return; return;
@ -936,7 +936,7 @@ xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
if (cur != NULL) { if (cur != NULL) {
fprintf(output, "Set contains %d nodes:\n", cur->nodeNr); fprintf(output, "Set contains %d nodes:\n", cur->nodeNr);
for (i = 0;i < cur->nodeNr;i++) { for (i = 0;i < cur->nodeNr;i++) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "%d", i + 1); fprintf(output, "%d", i + 1);
xmlXPathDebugDumpNode(output, cur->nodeTab[i], depth + 1); xmlXPathDebugDumpNode(output, cur->nodeTab[i], depth + 1);
} }
@ -953,13 +953,13 @@ xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
if ((cur == NULL) || (cur->nodeNr == 0) || (cur->nodeTab[0] == NULL)) { if ((cur == NULL) || (cur->nodeNr == 0) || (cur->nodeTab[0] == NULL)) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "Value Tree is NULL !\n"); fprintf(output, "Value Tree is NULL !\n");
return; return;
} }
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "%d", i + 1); fprintf(output, "%d", i + 1);
xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1); xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1);
} }
@ -974,14 +974,14 @@ xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
if (cur == NULL) { if (cur == NULL) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "LocationSet is NULL !\n"); fprintf(output, "LocationSet is NULL !\n");
return; return;
} }
for (i = 0;i < cur->locNr;i++) { for (i = 0;i < cur->locNr;i++) {
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "%d : ", i + 1); fprintf(output, "%d : ", i + 1);
xmlXPathDebugDumpObject(output, cur->locTab[i], depth + 1); xmlXPathDebugDumpObject(output, cur->locTab[i], depth + 1);
} }
@ -1008,7 +1008,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift); fprintf(output, "%s", shift);
if (cur == NULL) { if (cur == NULL) {
fprintf(output, "Object is empty (NULL)\n"); fprintf(output, "Object is empty (NULL)\n");
@ -1063,7 +1063,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
if ((cur->user2 == NULL) || if ((cur->user2 == NULL) ||
((cur->user2 == cur->user) && (cur->index == cur->index2))) { ((cur->user2 == cur->user) && (cur->index == cur->index2))) {
fprintf(output, "Object is a collapsed range :\n"); fprintf(output, "Object is a collapsed range :\n");
fprintf(output, shift); fprintf(output, "%s", shift);
if (cur->index >= 0) if (cur->index >= 0)
fprintf(output, "index %d in ", cur->index); fprintf(output, "index %d in ", cur->index);
fprintf(output, "node\n"); fprintf(output, "node\n");
@ -1071,14 +1071,14 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
depth + 1); depth + 1);
} else { } else {
fprintf(output, "Object is a range :\n"); fprintf(output, "Object is a range :\n");
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "From "); fprintf(output, "From ");
if (cur->index >= 0) if (cur->index >= 0)
fprintf(output, "index %d in ", cur->index); fprintf(output, "index %d in ", cur->index);
fprintf(output, "node\n"); fprintf(output, "node\n");
xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user, xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user,
depth + 1); depth + 1);
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "To "); fprintf(output, "To ");
if (cur->index2 >= 0) if (cur->index2 >= 0)
fprintf(output, "index %d in ", cur->index2); fprintf(output, "index %d in ", cur->index2);
@ -1111,7 +1111,7 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift); fprintf(output, "%s", shift);
if (op == NULL) { if (op == NULL) {
fprintf(output, "Step is NULL\n"); fprintf(output, "Step is NULL\n");
return; return;
@ -1298,7 +1298,7 @@ xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = ' ';
shift[2 * i] = shift[2 * i + 1] = 0; shift[2 * i] = shift[2 * i + 1] = 0;
fprintf(output, shift); fprintf(output, "%s", shift);
fprintf(output, "Compiled Expression : %d elements\n", fprintf(output, "Compiled Expression : %d elements\n",
comp->nbStep); comp->nbStep);