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;
......
......@@ -644,56 +644,6 @@ Class xmlDoc(xmlNode)
# functions from module xpointer
xpointerNewContext()
Class xpathContext()
# accessors
contextDoc()
contextNode()
contextPosition()
contextSize()
function()
functionURI()
setContextDoc()
setContextNode()
# functions from module python
registerXPathFunction()
# functions from module xpath
xpathEval()
xpathEvalExpression()
xpathFreeContext()
# functions from module xpathInternals
xpathNewParserContext()
xpathNsLookup()
xpathRegisterAllFunctions()
xpathRegisterNs()
xpathRegisteredFuncsCleanup()
xpathRegisteredNsCleanup()
xpathRegisteredVariablesCleanup()
xpathVariableLookup()
xpathVariableLookupNS()
# functions from module xpointer
xpointerEval()
Class xmlAttribute(xmlNode)
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlElement(xmlNode)
Class xmlAttr(xmlNode)
......@@ -712,100 +662,12 @@ Class xmlAttr(xmlNode)
# functions from module valid
removeID()
removeRef()
Class xmlTextReader(xmlTextReaderCore)
# functions from module xmlreader
AttributeCount()
BaseUri()
Close()
CurrentDoc()
CurrentNode()
Depth()
Expand()
GetAttribute()
GetAttributeNo()
GetAttributeNs()
GetParserProp()
GetRemainder()
HasAttributes()
HasValue()
IsDefault()
IsEmptyElement()
IsValid()
LocalName()
LookupNamespace()
MoveToAttribute()
MoveToAttributeNo()
MoveToAttributeNs()
MoveToElement()
MoveToFirstAttribute()
MoveToNextAttribute()
Name()
NamespaceUri()
NewDoc()
NewFd()
NewFile()
NewMemory()
NewWalker()
Next()
NextSibling()
NodeType()
Normalization()
Prefix()
Preserve()
QuoteChar()
Read()
ReadAttributeValue()
ReadInnerXml()
ReadOuterXml()
ReadState()
ReadString()
RelaxNGSetSchema()
RelaxNGValidate()
SetParserProp()
String()
Value()
XmlLang()
Class xmlReg()
# functions from module xmlregexp
regexpExec()
regexpIsDeterminist()
regexpPrint()
Class xmlEntity(xmlNode)
# functions from module parserInternals
handleEntity()
Class relaxNgSchema()
# functions from module relaxng
relaxNGDump()
relaxNGDumpTree()
relaxNGNewValidCtxt()
# functions from module xmlreader
RelaxNGSetSchema()
Class Schema()
# functions from module xmlschemas
schemaDump()
schemaNewValidCtxt()
Class Error()
# accessors
code()
domain()
file()
level()
line()
message()
# functions from module xmlerror
copyError()
resetError()
Class relaxNgValidCtxt()
# functions from module relaxng
......@@ -814,73 +676,6 @@ Class relaxNgValidCtxt()
relaxNGValidatePopElement()
relaxNGValidatePushCData()
relaxNGValidatePushElement()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class parserCtxt(parserCtxtCore)
......@@ -988,6 +783,94 @@ Class xmlDtd(xmlNode)
dtdElementDesc()
dtdQAttrDesc()
dtdQElementDesc()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGParse()
relaxParserSetFlag()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class SchemaParserCtxt()
# functions from module xmlschemas
schemaParse()
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlNs(xmlNode)
......@@ -1011,48 +894,6 @@ Class xmlNs(xmlNode)
# functions from module xpathInternals
xpathNodeSetFreeNs()
Class inputBuffer(ioReadWrapper)
# functions from module xmlIO
grow()
push()
read()
# functions from module xmlreader
newTextReader()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGParse()
relaxParserSetFlag()
Class outputBuffer(ioWriteWrapper)
# functions from module HTMLtree
htmlDocContentDumpFormatOutput()
htmlDocContentDumpOutput()
htmlNodeDumpFormatOutput()
htmlNodeDumpOutput()