Commit 13dfa87e authored by William M. Brack's avatar William M. Brack

added the routine xmlNanoHTTPContentLength to the external API

* nanohttp.c, include/libxml/nanohttp.h: added the routine
  xmlNanoHTTPContentLength to the external API (bug151968).
* parser.c: fixed unnecessary internal error message (bug152060);
  also changed call to strncmp over to xmlStrncmp.
* encoding.c: fixed compilation warning (bug152307).
* tree.c: fixed segfault in xmlCopyPropList (bug152368); fixed
  a couple of compilation warnings.
* HTMLtree.c, debugXML.c, xmlmemory.c: fixed a few compilation
  warnings; no change to logic.
parent 7a5e0dd1
Fri Sep 17 21:25:33 PDT 2004 William Brack <wbrack@mmm.com.hk>
* nanohttp.c, include/libxml/nanohttp.h: added the routine
xmlNanoHTTPContentLength to the external API (bug151968).
* parser.c: fixed unnecessary internal error message (bug152060);
also changed call to strncmp over to xmlStrncmp.
* encoding.c: fixed compilation warning (bug152307).
* tree.c: fixed segfault in xmlCopyPropList (bug152368); fixed
a couple of compilation warnings.
* HTMLtree.c, debugXML.c, xmlmemory.c: fixed a few compilation
warnings; no change to logic.
Fri Sep 17 10:40:23 CEST 2004 Daniel Veillard <daniel@veillard.com>
* parser.c: removed some extern before function code reported by
......
......@@ -170,7 +170,7 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) {
if (encoding != NULL) {
snprintf(newcontent, sizeof(newcontent), "text/html; charset=%s",
encoding);
(char *)encoding);
newcontent[sizeof(newcontent) - 1] = 0;
}
......
......@@ -85,13 +85,13 @@ xmlDebugDumpDtdNode(FILE *output, xmlDtdPtr dtd, int depth) {
return;
}
if (dtd->name != NULL)
fprintf(output, "DTD(%s)", dtd->name);
fprintf(output, "DTD(%s)", (char *)dtd->name);
else
fprintf(output, "DTD");
if (dtd->ExternalID != NULL)
fprintf(output, ", PUBLIC %s", dtd->ExternalID);
fprintf(output, ", PUBLIC %s", (char *)dtd->ExternalID);
if (dtd->SystemID != NULL)
fprintf(output, ", SYSTEM %s", dtd->SystemID);
fprintf(output, ", SYSTEM %s", (char *)dtd->SystemID);
fprintf(output, "\n");
/*
* Do a bit of checking
......@@ -138,11 +138,11 @@ xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) {
return;
}
if (attr->name != NULL)
fprintf(output, "ATTRDECL(%s)", attr->name);
fprintf(output, "ATTRDECL(%s)", (char *)attr->name);
else
fprintf(output, "PBM ATTRDECL noname!!!");
if (attr->elem != NULL)
fprintf(output, " for %s", attr->elem);
fprintf(output, " for %s", (char *)attr->elem);
else
fprintf(output, " PBM noelem!!!");
switch (attr->atype) {
......@@ -183,9 +183,9 @@ xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) {
for (indx = 0;indx < 5; indx++) {
if (indx != 0)
fprintf(output, "|%s", cur->name);
fprintf(output, "|%s", (char *)cur->name);
else
fprintf(output, " (%s", cur->name);
fprintf(output, " (%s", (char *)cur->name);
cur = cur->next;
if (cur == NULL) break;
}
......@@ -364,15 +364,15 @@ xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) {
}
if (ent->ExternalID) {
fprintf(output, shift);
fprintf(output, " ExternalID=%s\n", ent->ExternalID);
fprintf(output, " ExternalID=%s\n", (char *)ent->ExternalID);
}
if (ent->SystemID) {
fprintf(output, shift);
fprintf(output, " SystemID=%s\n", ent->SystemID);
fprintf(output, " SystemID=%s\n", (char *)ent->SystemID);
}
if (ent->URI != NULL) {
fprintf(output, shift);
fprintf(output, " URI=%s\n", ent->URI);
fprintf(output, " URI=%s\n", (char *)ent->URI);
}
if (ent->content) {
fprintf(output, shift);
......@@ -422,17 +422,18 @@ xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) {
return;
}
if (ns->type != XML_NAMESPACE_DECL) {
fprintf(output, "invalid namespace node %d\n", ns->type);
fprintf(output, "invalid namespace node %d\n", (char *)ns->type);
return;
}
if (ns->href == NULL) {
if (ns->prefix != NULL)
fprintf(output, "incomplete namespace %s href=NULL\n", ns->prefix);
fprintf(output, "incomplete namespace %s href=NULL\n",
(char *)ns->prefix);
else
fprintf(output, "incomplete default namespace href=NULL\n");
} else {
if (ns->prefix != NULL)
fprintf(output, "namespace %s href=", ns->prefix);
fprintf(output, "namespace %s href=", (char *)ns->prefix);
else
fprintf(output, "default namespace href=");
......@@ -481,20 +482,20 @@ xmlDebugDumpEntity(FILE *output, xmlEntityPtr ent, int depth) {
fprintf(output, "EXTERNAL_PARAMETER_ENTITY ");
break;
default:
fprintf(output, "ENTITY_%d ! ", ent->etype);
fprintf(output, "ENTITY_%d ! ", (char *)ent->etype);
}
fprintf(output, "%s\n", ent->name);
if (ent->ExternalID) {
fprintf(output, shift);
fprintf(output, "ExternalID=%s\n", ent->ExternalID);
fprintf(output, "ExternalID=%s\n", (char *)ent->ExternalID);
}
if (ent->SystemID) {
fprintf(output, shift);
fprintf(output, "SystemID=%s\n", ent->SystemID);
fprintf(output, "SystemID=%s\n", (char *)ent->SystemID);
}
if (ent->URI) {
fprintf(output, shift);
fprintf(output, "URI=%s\n", ent->URI);
fprintf(output, "URI=%s\n", (char *)ent->URI);
}
if (ent->content) {
fprintf(output, shift);
......@@ -627,7 +628,7 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
break;
case XML_ENTITY_REF_NODE:
fprintf(output, shift);
fprintf(output, "ENTITY_REF(%s)\n", node->name);
fprintf(output, "ENTITY_REF(%s)\n", (char *)node->name);
break;
case XML_ENTITY_NODE:
fprintf(output, shift);
......@@ -635,7 +636,7 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
break;
case XML_PI_NODE:
fprintf(output, shift);
fprintf(output, "PI %s\n", node->name);
fprintf(output, "PI %s\n", (char *)node->name);
break;
case XML_COMMENT_NODE:
fprintf(output, shift);
......@@ -683,7 +684,7 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
return;
default:
fprintf(output, shift);
fprintf(output, "NODE_%d !!!\n", node->type);
fprintf(output, "NODE_%d !!!\n", (char *)node->type);
return;
}
if (node->doc == NULL) {
......@@ -845,7 +846,7 @@ xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc)
fprintf(output, "Error, NOTATION\n");
break;
default:
fprintf(output, "NODE_%d\n", doc->type);
fprintf(output, "NODE_%d\n", (char *)doc->type);
}
if (doc->name != NULL) {
fprintf(output, "name=");
......@@ -916,13 +917,13 @@ xmlDebugDumpDTD(FILE * output, xmlDtdPtr dtd)
return;
}
if (dtd->name != NULL)
fprintf(output, "DTD(%s)", dtd->name);
fprintf(output, "DTD(%s)", (char *)dtd->name);
else
fprintf(output, "DTD");
if (dtd->ExternalID != NULL)
fprintf(output, ", PUBLIC %s", dtd->ExternalID);
fprintf(output, ", PUBLIC %s", (char *)dtd->ExternalID);
if (dtd->SystemID != NULL)
fprintf(output, ", SYSTEM %s", dtd->SystemID);
fprintf(output, ", SYSTEM %s", (char *)dtd->SystemID);
fprintf(output, "\n");
/*
* Do a bit of checking
......@@ -958,7 +959,7 @@ xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output) {
fprintf(output, "Entity is NULL");
return;
}
fprintf(output, "%s : ", cur->name);
fprintf(output, "%s : ", (char *)cur->name);
switch (cur->etype) {
case XML_INTERNAL_GENERAL_ENTITY:
fprintf(output, "INTERNAL GENERAL, ");
......@@ -977,17 +978,17 @@ xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output) {
break;
default:
fprintf(output, "UNKNOWN TYPE %d",
cur->etype);
(char *)cur->etype);
}
if (cur->ExternalID != NULL)
fprintf(output, "ID \"%s\"", cur->ExternalID);
fprintf(output, "ID \"%s\"", (char *)cur->ExternalID);
if (cur->SystemID != NULL)
fprintf(output, "SYSTEM \"%s\"", cur->SystemID);
fprintf(output, "SYSTEM \"%s\"", (char *)cur->SystemID);
if (cur->orig != NULL)
fprintf(output, "\n orig \"%s\"", cur->orig);
fprintf(output, "\n orig \"%s\"", (char *)cur->orig);
if ((cur->type != XML_ELEMENT_NODE) &&
(cur->content != NULL))
fprintf(output, "\n content \"%s\"", cur->content);
fprintf(output, "\n content \"%s\"", (char *)cur->content);
fprintf(output, "\n");
}
......@@ -1049,7 +1050,7 @@ xmlDebugDumpEntities(FILE * output, xmlDocPtr doc)
fprintf(output, "Error, NOTATION\n");
break;
default:
fprintf(output, "NODE_%d\n", doc->type);
fprintf(output, "NODE_%d\n", (char *)doc->type);
}
if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) {
xmlEntitiesTablePtr table = (xmlEntitiesTablePtr)
......@@ -1245,9 +1246,10 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) {
xmlNsPtr ns = (xmlNsPtr) node;
if (ns->prefix == NULL)
fprintf(output, "default -> %s", ns->href);
fprintf(output, "default -> %s", (char *)ns->href);
else
fprintf(output, "%s -> %s", ns->prefix, ns->href);
fprintf(output, "%s -> %s", (char *)ns->prefix,
(char *)ns->href);
break;
}
default:
......
......@@ -2132,7 +2132,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
*/
if (in->end - in->cur > 0) {
static unsigned char convbuf[32000];
unsigned const char *cur = (unsigned const char *)in->cur;
const unsigned char *cur = (const unsigned char *)in->cur;
int toconv = in->end - in->cur, written = 32000;
int ret;
......
......@@ -56,6 +56,8 @@ XMLPUBFUN const char * XMLCALL
xmlNanoHTTPAuthHeader (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPRedir (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoHTTPContentLength( void * ctx );
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPEncoding (void *ctx);
XMLPUBFUN const char * XMLCALL
......
......@@ -159,7 +159,6 @@ static int proxyPort; /* the proxy port if any */
static unsigned int timeout = 60;/* the select() timeout in seconds */
static int xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len );
int xmlNanoHTTPContentLength( void * ctx );
/**
* xmlHTTPErrMemory:
......
......@@ -7437,6 +7437,7 @@ failed:
if (!IS_BLANK_CH(RAW)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"attributes construct error\n");
break;
}
SKIP_BLANKS;
if ((cons == ctxt->input->consumed) && (q == CUR_PTR) &&
......@@ -7635,8 +7636,7 @@ xmlParseEndTag2(xmlParserCtxtPtr ctxt, const xmlChar *prefix,
}
SKIP(2);
if ((tlen > 0) && (strncmp(ctxt->input->cur,
(const char *)ctxt->name, tlen) == 0)) {
if ((tlen > 0) && (xmlStrncmp(ctxt->input->cur, ctxt->name, tlen) == 0)) {
if (ctxt->input->cur[tlen] == '>') {
ctxt->input->cur += tlen + 1;
goto done;
......
This diff is collapsed.
......@@ -3707,6 +3707,8 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
while (cur != NULL) {
q = xmlCopyProp(target, cur);
if (q == NULL)
return(NULL);
if (p == NULL) {
ret = p = q;
} else {
......@@ -4207,11 +4209,11 @@ xmlGetNodePath(xmlNodePtr node)
name = (const char *) cur->name;
if (cur->ns) {
if (cur->ns->prefix != NULL)
snprintf(nametemp, sizeof(nametemp) - 1,
"%s:%s", cur->ns->prefix, cur->name);
snprintf(nametemp, sizeof(nametemp) - 1, "%s:%s",
(char *)cur->ns->prefix, (char *)cur->name);
else
snprintf(nametemp, sizeof(nametemp) - 1,
"%s", cur->name);
snprintf(nametemp, sizeof(nametemp) - 1, "%s",
(char *)cur->name);
nametemp[sizeof(nametemp) - 1] = 0;
name = nametemp;
}
......@@ -4296,7 +4298,7 @@ xmlGetNodePath(xmlNodePtr node)
} else if (cur->type == XML_PI_NODE) {
sep = "/";
snprintf(nametemp, sizeof(nametemp) - 1,
"processing-instruction('%s')", cur->name);
"processing-instruction('%s')", (char *)cur->name);
nametemp[sizeof(nametemp) - 1] = 0;
name = nametemp;
......@@ -4362,7 +4364,7 @@ xmlGetNodePath(xmlNodePtr node)
else
snprintf((char *) buf, buf_len, "%s%s[%d]%s",
sep, name, occur, (char *) buffer);
snprintf((char *) buffer, buf_len, "%s", buf);
snprintf((char *) buffer, buf_len, "%s", (char *)buf);
cur = next;
} while (cur != NULL);
xmlFree(buf);
......@@ -5637,7 +5639,7 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
if (ns->prefix == NULL)
snprintf((char *) prefix, sizeof(prefix), "default");
else
snprintf((char *) prefix, sizeof(prefix), "%.20s", ns->prefix);
snprintf((char *) prefix, sizeof(prefix), "%.20s", (char *)ns->prefix);
def = xmlSearchNs(doc, tree, prefix);
while (def != NULL) {
......@@ -5645,7 +5647,8 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) {
if (ns->prefix == NULL)
snprintf((char *) prefix, sizeof(prefix), "default%d", counter++);
else
snprintf((char *) prefix, sizeof(prefix), "%.20s%d", ns->prefix, counter++);
snprintf((char *) prefix, sizeof(prefix), "%.20s%d",
(char *)ns->prefix, counter++);
def = xmlSearchNs(doc, tree, prefix);
}
......
......@@ -644,11 +644,11 @@ xmlMemDisplay(FILE *fp)
case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break;
case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
default:
fprintf(fp,"Unknow memory block, corruped maybe");
fprintf(fp,"Unknown memory block, may be corrupted");
xmlMutexUnlock(xmlMemMutex);
return;
}
if (p->mh_file != NULL) fprintf(fp,"%s(%d)", p->mh_file, p->mh_line);
if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
if (p->mh_tag != MEMTAG)
fprintf(fp," INVALID");
nb++;
......@@ -750,7 +750,7 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
default:fprintf(fp," ??? in ");break;
}
if (p->mh_file != NULL)
fprintf(fp,"%s(%d)", p->mh_file, p->mh_line);
fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
if (p->mh_tag != MEMTAG)
fprintf(fp," INVALID");
xmlMemContentShow(fp, p);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment