mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-23 02:50:08 +03:00
Remove unused code
This commit is contained in:
parent
fee0006a06
commit
6be79014d7
@ -267,12 +267,6 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) {
|
||||
} else {
|
||||
dict = doc->dict;
|
||||
if ((dict == NULL) && (ctxt->nodict == 0)) {
|
||||
#if 0
|
||||
/* deactivated right now as it raises too many errors */
|
||||
if (doc->type == XML_DOCUMENT_NODE)
|
||||
xmlDebugErr(ctxt, XML_CHECK_NO_DICT,
|
||||
"Document has no dictionary\n");
|
||||
#endif
|
||||
ctxt->nodict = 1;
|
||||
}
|
||||
if (ctxt->doc == NULL)
|
||||
|
@ -21,7 +21,6 @@ debugsym=None
|
||||
ignored_files = {
|
||||
"config.h": "generated portability layer",
|
||||
"libxml.h": "internal only",
|
||||
"rngparser.c": "not yet integrated",
|
||||
"testModule.c": "test tool",
|
||||
"testapi.c": "generated regression tests",
|
||||
"runtest.c": "regression tests program",
|
||||
|
34
nanohttp.c
34
nanohttp.c
@ -90,11 +90,6 @@
|
||||
#define GETHOSTBYNAME_ARG_CAST (char *)
|
||||
#define SEND_ARG2_CAST (char *)
|
||||
|
||||
#ifdef STANDALONE
|
||||
#define xmlStrncasecmp(a, b, n) strncasecmp((char *)a, (char *)b, n)
|
||||
#define xmlStrcasecmpi(a, b) strcasecmp((char *)a, (char *)b)
|
||||
#endif
|
||||
|
||||
#define XML_NANO_HTTP_MAX_REDIR 10
|
||||
|
||||
#define XML_NANO_HTTP_CHUNK 4096
|
||||
@ -1825,33 +1820,4 @@ xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len ) {
|
||||
return ( rc );
|
||||
}
|
||||
|
||||
#ifdef STANDALONE
|
||||
int main(int argc, char **argv) {
|
||||
char *contentType = NULL;
|
||||
|
||||
if (argv[1] != NULL) {
|
||||
if (argv[2] != NULL)
|
||||
xmlNanoHTTPFetch(argv[1], argv[2], &contentType);
|
||||
else
|
||||
xmlNanoHTTPFetch(argv[1], "-", &contentType);
|
||||
if (contentType != NULL) xmlFree(contentType);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"%s: minimal HTTP GET implementation\n", argv[0]);
|
||||
fprintf(stderr,
|
||||
"\tusage %s [ URL [ filename ] ]\n", argv[0]);
|
||||
}
|
||||
xmlNanoHTTPCleanup();
|
||||
return(0);
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
#else /* !LIBXML_HTTP_ENABLED */
|
||||
#ifdef STANDALONE
|
||||
#include <stdio.h>
|
||||
int main(int argc, char **argv) {
|
||||
fprintf(stderr,
|
||||
"%s : HTTP support not compiled in\n", argv[0]);
|
||||
return(0);
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
#endif /* LIBXML_HTTP_ENABLED */
|
||||
|
5
parser.c
5
parser.c
@ -13405,11 +13405,6 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
|
||||
ctxt->nsWellFormed = 1;
|
||||
ctxt->disableSAX = 0;
|
||||
ctxt->valid = 1;
|
||||
#if 0
|
||||
ctxt->vctxt.userData = ctxt;
|
||||
ctxt->vctxt.error = xmlParserValidityError;
|
||||
ctxt->vctxt.warning = xmlParserValidityWarning;
|
||||
#endif
|
||||
ctxt->record_info = 0;
|
||||
ctxt->checkIndex = 0;
|
||||
ctxt->endCheckState = 0;
|
||||
|
144
pattern.c
144
pattern.c
@ -367,35 +367,6 @@ xmlPatternAdd(xmlPatParserContextPtr ctxt, xmlPatternPtr comp,
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* xsltSwapTopPattern:
|
||||
* @comp: the compiled match expression
|
||||
*
|
||||
* reverse the two top steps.
|
||||
*/
|
||||
static void
|
||||
xsltSwapTopPattern(xmlPatternPtr comp) {
|
||||
int i;
|
||||
int j = comp->nbStep - 1;
|
||||
|
||||
if (j > 0) {
|
||||
register const xmlChar *tmp;
|
||||
register xmlPatOp op;
|
||||
i = j - 1;
|
||||
tmp = comp->steps[i].value;
|
||||
comp->steps[i].value = comp->steps[j].value;
|
||||
comp->steps[j].value = tmp;
|
||||
tmp = comp->steps[i].value2;
|
||||
comp->steps[i].value2 = comp->steps[j].value2;
|
||||
comp->steps[j].value2 = tmp;
|
||||
op = comp->steps[i].op;
|
||||
comp->steps[i].op = comp->steps[j].op;
|
||||
comp->steps[j].op = op;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlReversePattern:
|
||||
* @comp: the compiled match expression
|
||||
@ -479,9 +450,6 @@ xmlPatPushState(xmlStepStates *states, int step, xmlNodePtr node) {
|
||||
}
|
||||
states->states[states->nbstates].step = step;
|
||||
states->states[states->nbstates++].node = node;
|
||||
#if 0
|
||||
fprintf(stderr, "Push: %d, %s\n", step, node->name);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -685,9 +653,6 @@ rollback:
|
||||
states.nbstates--;
|
||||
i = states.states[states.nbstates].step;
|
||||
node = states.states[states.nbstates].node;
|
||||
#if 0
|
||||
fprintf(stderr, "Pop: %d, %s\n", i, node->name);
|
||||
#endif
|
||||
goto restart;
|
||||
}
|
||||
|
||||
@ -713,73 +678,6 @@ rollback:
|
||||
#define PUSH(op, val, val2) \
|
||||
if (xmlPatternAdd(ctxt, ctxt->comp, (op), (val), (val2))) goto error;
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* xmlPatScanLiteral:
|
||||
* @ctxt: the XPath Parser context
|
||||
*
|
||||
* Parse an XPath Literal:
|
||||
*
|
||||
* [29] Literal ::= '"' [^"]* '"'
|
||||
* | "'" [^']* "'"
|
||||
*
|
||||
* Returns the Literal parsed or NULL
|
||||
*/
|
||||
|
||||
static xmlChar *
|
||||
xmlPatScanLiteral(xmlPatParserContextPtr ctxt) {
|
||||
const xmlChar *q, *cur;
|
||||
xmlChar *ret = NULL;
|
||||
int val, len;
|
||||
|
||||
SKIP_BLANKS;
|
||||
if (CUR == '"') {
|
||||
NEXT;
|
||||
cur = q = CUR_PTR;
|
||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||
while ((IS_CHAR(val)) && (val != '"')) {
|
||||
cur += len;
|
||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||
}
|
||||
if (!IS_CHAR(val)) {
|
||||
ctxt->error = 1;
|
||||
return(NULL);
|
||||
} else {
|
||||
if (ctxt->dict)
|
||||
ret = (xmlChar *) xmlDictLookup(ctxt->dict, q, cur - q);
|
||||
else
|
||||
ret = xmlStrndup(q, cur - q);
|
||||
}
|
||||
cur += len;
|
||||
CUR_PTR = cur;
|
||||
} else if (CUR == '\'') {
|
||||
NEXT;
|
||||
cur = q = CUR_PTR;
|
||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||
while ((IS_CHAR(val)) && (val != '\'')) {
|
||||
cur += len;
|
||||
val = xmlStringCurrentChar(NULL, cur, &len);
|
||||
}
|
||||
if (!IS_CHAR(val)) {
|
||||
ctxt->error = 1;
|
||||
return(NULL);
|
||||
} else {
|
||||
if (ctxt->dict)
|
||||
ret = (xmlChar *) xmlDictLookup(ctxt->dict, q, cur - q);
|
||||
else
|
||||
ret = xmlStrndup(q, cur - q);
|
||||
}
|
||||
cur += len;
|
||||
CUR_PTR = cur;
|
||||
} else {
|
||||
/* XP_ERROR(XPATH_START_LITERAL_ERROR); */
|
||||
ctxt->error = 1;
|
||||
return(NULL);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlPatScanName:
|
||||
* @ctxt: the XPath Parser context
|
||||
@ -863,32 +761,6 @@ xmlPatScanNCName(xmlPatParserContextPtr ctxt) {
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* xmlPatScanQName:
|
||||
* @ctxt: the XPath Parser context
|
||||
* @prefix: the place to store the prefix
|
||||
*
|
||||
* Parse a qualified name
|
||||
*
|
||||
* Returns the Name parsed or NULL
|
||||
*/
|
||||
|
||||
static xmlChar *
|
||||
xmlPatScanQName(xmlPatParserContextPtr ctxt, xmlChar **prefix) {
|
||||
xmlChar *ret = NULL;
|
||||
|
||||
*prefix = NULL;
|
||||
ret = xmlPatScanNCName(ctxt);
|
||||
if (CUR == ':') {
|
||||
*prefix = ret;
|
||||
NEXT;
|
||||
ret = xmlPatScanNCName(ctxt);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlCompileAttributeTest:
|
||||
* @ctxt: the compilation context
|
||||
@ -1950,22 +1822,6 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
|
||||
{
|
||||
match = 1;
|
||||
}
|
||||
#if 0
|
||||
/*
|
||||
* TODO: Pointer comparison won't work, since not guaranteed that the given
|
||||
* values are in the same dict; especially if it's the namespace name,
|
||||
* normally coming from ns->href. We need a namespace dict mechanism !
|
||||
*/
|
||||
} else if (comp->dict) {
|
||||
if (step.name == NULL) {
|
||||
if (step.ns == NULL)
|
||||
match = 1;
|
||||
else
|
||||
match = (step.ns == ns);
|
||||
} else {
|
||||
match = ((step.name == name) && (step.ns == ns));
|
||||
}
|
||||
#endif /* if 0 ------------------------------------------------------- */
|
||||
if (match) {
|
||||
final = step.flags & XML_STREAM_STEP_FINAL;
|
||||
if (final) {
|
||||
|
1588
rngparser.c
1588
rngparser.c
File diff suppressed because it is too large
Load Diff
43
schematron.c
43
schematron.c
@ -2046,47 +2046,4 @@ xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctxt, xmlDocPtr instance)
|
||||
return(ctxt->nberrors);
|
||||
}
|
||||
|
||||
#ifdef STANDALONE
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int ret;
|
||||
xmlDocPtr instance;
|
||||
xmlSchematronParserCtxtPtr pctxt;
|
||||
xmlSchematronValidCtxtPtr vctxt;
|
||||
xmlSchematronPtr schema = NULL;
|
||||
|
||||
pctxt = xmlSchematronNewParserCtxt("tst.sct");
|
||||
if (pctxt == NULL) {
|
||||
fprintf(stderr, "failed to build schematron parser\n");
|
||||
} else {
|
||||
schema = xmlSchematronParse(pctxt);
|
||||
if (schema == NULL) {
|
||||
fprintf(stderr, "failed to compile schematron\n");
|
||||
}
|
||||
xmlSchematronFreeParserCtxt(pctxt);
|
||||
}
|
||||
instance = xmlReadFile("tst.sct", NULL,
|
||||
XML_PARSE_NOENT | XML_PARSE_NOCDATA);
|
||||
if (instance == NULL) {
|
||||
fprintf(stderr, "failed to parse instance\n");
|
||||
}
|
||||
if ((schema != NULL) && (instance != NULL)) {
|
||||
vctxt = xmlSchematronNewValidCtxt(schema);
|
||||
if (vctxt == NULL) {
|
||||
fprintf(stderr, "failed to build schematron validator\n");
|
||||
} else {
|
||||
ret = xmlSchematronValidateDoc(vctxt, instance);
|
||||
xmlSchematronFreeValidCtxt(vctxt);
|
||||
}
|
||||
}
|
||||
xmlSchematronFree(schema);
|
||||
xmlFreeDoc(instance);
|
||||
|
||||
xmlCleanupParser();
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMATRON_ENABLED */
|
||||
|
31
valid.c
31
valid.c
@ -4101,13 +4101,6 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
|
||||
if (elem == NULL) return(1);
|
||||
|
||||
#if 0
|
||||
#ifdef LIBXML_REGEXP_ENABLED
|
||||
/* Build the regexp associated to the content model */
|
||||
ret = xmlValidBuildContentModel(ctxt, elem);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* No Duplicate Types */
|
||||
if (elem->etype == XML_ELEMENT_TYPE_MIXED) {
|
||||
xmlElementContentPtr cur, next;
|
||||
@ -4499,25 +4492,6 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Casting ns to xmlAttrPtr is wrong. We'd need separate functions
|
||||
* xmlAddID and xmlAddRef for namespace declarations, but it makes
|
||||
* no practical sense to use ID types anyway.
|
||||
*/
|
||||
#if 0
|
||||
/* Validity Constraint: ID uniqueness */
|
||||
if (attrDecl->atype == XML_ATTRIBUTE_ID) {
|
||||
if (xmlAddID(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if ((attrDecl->atype == XML_ATTRIBUTE_IDREF) ||
|
||||
(attrDecl->atype == XML_ATTRIBUTE_IDREFS)) {
|
||||
if (xmlAddRef(ctxt, doc, value, (xmlAttrPtr) ns) == NULL)
|
||||
ret = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Validity Constraint: Notation Attributes */
|
||||
if (attrDecl->atype == XML_ATTRIBUTE_NOTATION) {
|
||||
xmlEnumerationPtr tree = attrDecl->tree;
|
||||
@ -5575,7 +5549,7 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
|
||||
if (ctxt == NULL)
|
||||
return(0);
|
||||
/* printf("PushElem %s\n", qname); */
|
||||
|
||||
if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) {
|
||||
xmlValidStatePtr state = ctxt->vstate;
|
||||
xmlElementPtr elemDecl;
|
||||
@ -5669,7 +5643,6 @@ int
|
||||
xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
|
||||
int ret = 1;
|
||||
|
||||
/* printf("CDATA %s %d\n", data, len); */
|
||||
if (ctxt == NULL)
|
||||
return(0);
|
||||
if (len <= 0)
|
||||
@ -5748,7 +5721,7 @@ xmlValidatePopElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc ATTRIBUTE_UNUSED,
|
||||
|
||||
if (ctxt == NULL)
|
||||
return(0);
|
||||
/* printf("PopElem %s\n", qname); */
|
||||
|
||||
if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) {
|
||||
xmlValidStatePtr state = ctxt->vstate;
|
||||
xmlElementPtr elemDecl;
|
||||
|
@ -1817,11 +1817,6 @@ xmlXIncludeTestNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
|
||||
(xmlStrEqual(node->ns->href, XINCLUDE_OLD_NS))) {
|
||||
if (xmlStrEqual(node->ns->href, XINCLUDE_OLD_NS)) {
|
||||
if (ctxt->legacy == 0) {
|
||||
#if 0 /* wait for the XML Core Working Group to get something stable ! */
|
||||
xmlXIncludeWarn(ctxt, node, XML_XINCLUDE_DEPRECATED_NS,
|
||||
"Deprecated XInclude namespace found, use %s",
|
||||
XINCLUDE_NS);
|
||||
#endif
|
||||
ctxt->legacy = 1;
|
||||
}
|
||||
}
|
||||
|
269
xmlreader.c
269
xmlreader.c
@ -1812,66 +1812,6 @@ done:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* xmlTextReaderReadBase64:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @array: a byte array to store the content.
|
||||
* @offset: the zero-based index into array where the method should
|
||||
* begin to write.
|
||||
* @len: the number of bytes to write.
|
||||
*
|
||||
* Reads and decodes the Base64 encoded contents of an element and
|
||||
* stores the result in a byte buffer.
|
||||
*
|
||||
* Returns the number of bytes written to array, or zero if the current
|
||||
* instance is not positioned on an element or -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlTextReaderReadBase64(xmlTextReaderPtr reader,
|
||||
unsigned char *array ATTRIBUTE_UNUSED,
|
||||
int offset ATTRIBUTE_UNUSED,
|
||||
int len ATTRIBUTE_UNUSED) {
|
||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
||||
return(-1);
|
||||
if (reader->ctxt->wellFormed != 1)
|
||||
return(-1);
|
||||
|
||||
if ((reader->node == NULL) || (reader->node->type == XML_ELEMENT_NODE))
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderReadBinHex:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @array: a byte array to store the content.
|
||||
* @offset: the zero-based index into array where the method should
|
||||
* begin to write.
|
||||
* @len: the number of bytes to write.
|
||||
*
|
||||
* Reads and decodes the BinHex encoded contents of an element and
|
||||
* stores the result in a byte buffer.
|
||||
*
|
||||
* Returns the number of bytes written to array, or zero if the current
|
||||
* instance is not positioned on an element or -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlTextReaderReadBinHex(xmlTextReaderPtr reader,
|
||||
unsigned char *array ATTRIBUTE_UNUSED,
|
||||
int offset ATTRIBUTE_UNUSED,
|
||||
int len ATTRIBUTE_UNUSED) {
|
||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
||||
return(-1);
|
||||
if (reader->ctxt->wellFormed != 1)
|
||||
return(-1);
|
||||
|
||||
if ((reader->node == NULL) || (reader->node->type == XML_ELEMENT_NODE))
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Operating on a preparsed tree *
|
||||
@ -5547,213 +5487,4 @@ xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread,
|
||||
return (xmlTextReaderSetup(reader, input, URL, encoding, options));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Utilities *
|
||||
* *
|
||||
************************************************************************/
|
||||
#ifdef NOT_USED_YET
|
||||
|
||||
/**
|
||||
* xmlBase64Decode:
|
||||
* @in: the input buffer
|
||||
* @inlen: the size of the input (in), the size read from it (out)
|
||||
* @to: the output buffer
|
||||
* @tolen: the size of the output (in), the size written to (out)
|
||||
*
|
||||
* Base64 decoder, reads from @in and save in @to
|
||||
* TODO: tell jody when this is actually exported
|
||||
*
|
||||
* Returns 0 if all the input was consumer, 1 if the Base64 end was reached,
|
||||
* 2 if there wasn't enough space on the output or -1 in case of error.
|
||||
*/
|
||||
static int
|
||||
xmlBase64Decode(const unsigned char *in, unsigned long *inlen,
|
||||
unsigned char *to, unsigned long *tolen)
|
||||
{
|
||||
unsigned long incur; /* current index in in[] */
|
||||
|
||||
unsigned long inblk; /* last block index in in[] */
|
||||
|
||||
unsigned long outcur; /* current index in out[] */
|
||||
|
||||
unsigned long inmax; /* size of in[] */
|
||||
|
||||
unsigned long outmax; /* size of out[] */
|
||||
|
||||
unsigned char cur; /* the current value read from in[] */
|
||||
|
||||
unsigned char intmp[4], outtmp[4]; /* temporary buffers for the convert */
|
||||
|
||||
int nbintmp; /* number of byte in intmp[] */
|
||||
|
||||
int is_ignore; /* cur should be ignored */
|
||||
|
||||
int is_end = 0; /* the end of the base64 was found */
|
||||
|
||||
int retval = 1;
|
||||
|
||||
int i;
|
||||
|
||||
if ((in == NULL) || (inlen == NULL) || (to == NULL) || (tolen == NULL))
|
||||
return (-1);
|
||||
|
||||
incur = 0;
|
||||
inblk = 0;
|
||||
outcur = 0;
|
||||
inmax = *inlen;
|
||||
outmax = *tolen;
|
||||
nbintmp = 0;
|
||||
|
||||
while (1) {
|
||||
if (incur >= inmax)
|
||||
break;
|
||||
cur = in[incur++];
|
||||
is_ignore = 0;
|
||||
if ((cur >= 'A') && (cur <= 'Z'))
|
||||
cur = cur - 'A';
|
||||
else if ((cur >= 'a') && (cur <= 'z'))
|
||||
cur = cur - 'a' + 26;
|
||||
else if ((cur >= '0') && (cur <= '9'))
|
||||
cur = cur - '0' + 52;
|
||||
else if (cur == '+')
|
||||
cur = 62;
|
||||
else if (cur == '/')
|
||||
cur = 63;
|
||||
else if (cur == '.')
|
||||
cur = 0;
|
||||
else if (cur == '=') /*no op , end of the base64 stream */
|
||||
is_end = 1;
|
||||
else {
|
||||
is_ignore = 1;
|
||||
if (nbintmp == 0)
|
||||
inblk = incur;
|
||||
}
|
||||
|
||||
if (!is_ignore) {
|
||||
int nbouttmp = 3;
|
||||
|
||||
int is_break = 0;
|
||||
|
||||
if (is_end) {
|
||||
if (nbintmp == 0)
|
||||
break;
|
||||
if ((nbintmp == 1) || (nbintmp == 2))
|
||||
nbouttmp = 1;
|
||||
else
|
||||
nbouttmp = 2;
|
||||
nbintmp = 3;
|
||||
is_break = 1;
|
||||
}
|
||||
intmp[nbintmp++] = cur;
|
||||
/*
|
||||
* if intmp is full, push the 4byte sequence as a 3 byte
|
||||
* sequence out
|
||||
*/
|
||||
if (nbintmp == 4) {
|
||||
nbintmp = 0;
|
||||
outtmp[0] = (intmp[0] << 2) | ((intmp[1] & 0x30) >> 4);
|
||||
outtmp[1] =
|
||||
((intmp[1] & 0x0F) << 4) | ((intmp[2] & 0x3C) >> 2);
|
||||
outtmp[2] = ((intmp[2] & 0x03) << 6) | (intmp[3] & 0x3F);
|
||||
if (outcur + 3 >= outmax) {
|
||||
retval = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < nbouttmp; i++)
|
||||
to[outcur++] = outtmp[i];
|
||||
inblk = incur;
|
||||
}
|
||||
|
||||
if (is_break) {
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*tolen = outcur;
|
||||
*inlen = inblk;
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test routine for the xmlBase64Decode function
|
||||
*/
|
||||
#if 0
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *input = " VW4 gcGV0 \n aXQgdGVzdCAuCg== ";
|
||||
|
||||
char output[100];
|
||||
|
||||
char output2[100];
|
||||
|
||||
char output3[100];
|
||||
|
||||
unsigned long inlen = strlen(input);
|
||||
|
||||
unsigned long outlen = 100;
|
||||
|
||||
int ret;
|
||||
|
||||
unsigned long cons, tmp, tmp2, prod;
|
||||
|
||||
/*
|
||||
* Direct
|
||||
*/
|
||||
ret = xmlBase64Decode(input, &inlen, output, &outlen);
|
||||
|
||||
output[outlen] = 0;
|
||||
printf("ret: %d, inlen: %ld , outlen: %ld, output: '%s'\n", ret, inlen,
|
||||
outlen, output)indent: Standard input:179: Error:Unmatched #endif
|
||||
;
|
||||
|
||||
/*
|
||||
* output chunking
|
||||
*/
|
||||
cons = 0;
|
||||
prod = 0;
|
||||
while (cons < inlen) {
|
||||
tmp = 5;
|
||||
tmp2 = inlen - cons;
|
||||
|
||||
printf("%ld %ld\n", cons, prod);
|
||||
ret = xmlBase64Decode(&input[cons], &tmp2, &output2[prod], &tmp);
|
||||
cons += tmp2;
|
||||
prod += tmp;
|
||||
printf("%ld %ld\n", cons, prod);
|
||||
}
|
||||
output2[outlen] = 0;
|
||||
printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons,
|
||||
prod, output2);
|
||||
|
||||
/*
|
||||
* input chunking
|
||||
*/
|
||||
cons = 0;
|
||||
prod = 0;
|
||||
while (cons < inlen) {
|
||||
tmp = 100 - prod;
|
||||
tmp2 = inlen - cons;
|
||||
if (tmp2 > 5)
|
||||
tmp2 = 5;
|
||||
|
||||
printf("%ld %ld\n", cons, prod);
|
||||
ret = xmlBase64Decode(&input[cons], &tmp2, &output3[prod], &tmp);
|
||||
cons += tmp2;
|
||||
prod += tmp;
|
||||
printf("%ld %ld\n", cons, prod);
|
||||
}
|
||||
output3[outlen] = 0;
|
||||
printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons,
|
||||
prod, output3);
|
||||
return (0);
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif /* NOT_USED_YET */
|
||||
|
||||
#endif /* LIBXML_READER_ENABLED */
|
||||
|
153
xmlregexp.c
153
xmlregexp.c
@ -611,10 +611,6 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) {
|
||||
goto not_determ;
|
||||
}
|
||||
} else {
|
||||
#if 0
|
||||
printf("State %d trans %d: atom %d to %d : %d to %d\n",
|
||||
i, j, trans->atom->no, trans->to, atomno, targetno);
|
||||
#endif
|
||||
transitions[stateno * (nbatoms + 1) + atomno + 1] =
|
||||
targetno + 1; /* to avoid 0 */
|
||||
if (transdata != NULL)
|
||||
@ -2964,7 +2960,6 @@ xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint) {
|
||||
return(accept);
|
||||
}
|
||||
case XML_REGEXP_STRING:
|
||||
printf("TODO: XML_REGEXP_STRING\n");
|
||||
return(-1);
|
||||
case XML_REGEXP_ANYCHAR:
|
||||
case XML_REGEXP_ANYSPACE:
|
||||
@ -4274,150 +4269,6 @@ xmlRegExecErrInfo(xmlRegExecCtxtPtr exec, const xmlChar **string,
|
||||
return(xmlRegExecGetValues(exec, 1, nbval, nbneg, values, terminal));
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
xmlRegExecPushChar(xmlRegExecCtxtPtr exec, int UCS) {
|
||||
xmlRegTransPtr trans;
|
||||
xmlRegAtomPtr atom;
|
||||
int ret;
|
||||
int codepoint, len;
|
||||
|
||||
if (exec == NULL)
|
||||
return(-1);
|
||||
if (exec->status != XML_REGEXP_OK)
|
||||
return(exec->status);
|
||||
|
||||
while ((exec->status == XML_REGEXP_OK) &&
|
||||
((exec->inputString[exec->index] != 0) ||
|
||||
(exec->state->type != XML_REGEXP_FINAL_STATE))) {
|
||||
|
||||
/*
|
||||
* End of input on non-terminal state, rollback, however we may
|
||||
* still have epsilon like transition for counted transitions
|
||||
* on counters, in that case don't break too early.
|
||||
*/
|
||||
if ((exec->inputString[exec->index] == 0) && (exec->counts == NULL))
|
||||
goto rollback;
|
||||
|
||||
exec->transcount = 0;
|
||||
for (;exec->transno < exec->state->nbTrans;exec->transno++) {
|
||||
trans = &exec->state->trans[exec->transno];
|
||||
if (trans->to < 0)
|
||||
continue;
|
||||
atom = trans->atom;
|
||||
ret = 0;
|
||||
if (trans->count >= 0) {
|
||||
int count;
|
||||
xmlRegCounterPtr counter;
|
||||
|
||||
/*
|
||||
* A counted transition.
|
||||
*/
|
||||
|
||||
count = exec->counts[trans->count];
|
||||
counter = &exec->comp->counters[trans->count];
|
||||
ret = ((count >= counter->min) && (count <= counter->max));
|
||||
} else if (atom == NULL) {
|
||||
fprintf(stderr, "epsilon transition left at runtime\n");
|
||||
exec->status = XML_REGEXP_INTERNAL_ERROR;
|
||||
break;
|
||||
} else if (exec->inputString[exec->index] != 0) {
|
||||
codepoint = CUR_SCHAR(&(exec->inputString[exec->index]), len);
|
||||
ret = xmlRegCheckCharacter(atom, codepoint);
|
||||
if ((ret == 1) && (atom->min > 0) && (atom->max > 0)) {
|
||||
xmlRegStatePtr to = exec->comp->states[trans->to];
|
||||
|
||||
/*
|
||||
* this is a multiple input sequence
|
||||
*/
|
||||
if (exec->state->nbTrans > exec->transno + 1) {
|
||||
xmlFARegExecSave(exec);
|
||||
}
|
||||
exec->transcount = 1;
|
||||
do {
|
||||
/*
|
||||
* Try to progress as much as possible on the input
|
||||
*/
|
||||
if (exec->transcount == atom->max) {
|
||||
break;
|
||||
}
|
||||
exec->index += len;
|
||||
/*
|
||||
* End of input: stop here
|
||||
*/
|
||||
if (exec->inputString[exec->index] == 0) {
|
||||
exec->index -= len;
|
||||
break;
|
||||
}
|
||||
if (exec->transcount >= atom->min) {
|
||||
int transno = exec->transno;
|
||||
xmlRegStatePtr state = exec->state;
|
||||
|
||||
/*
|
||||
* The transition is acceptable save it
|
||||
*/
|
||||
exec->transno = -1; /* trick */
|
||||
exec->state = to;
|
||||
xmlFARegExecSave(exec);
|
||||
exec->transno = transno;
|
||||
exec->state = state;
|
||||
}
|
||||
codepoint = CUR_SCHAR(&(exec->inputString[exec->index]),
|
||||
len);
|
||||
ret = xmlRegCheckCharacter(atom, codepoint);
|
||||
exec->transcount++;
|
||||
} while (ret == 1);
|
||||
if (exec->transcount < atom->min)
|
||||
ret = 0;
|
||||
|
||||
/*
|
||||
* If the last check failed but one transition was found
|
||||
* possible, rollback
|
||||
*/
|
||||
if (ret < 0)
|
||||
ret = 0;
|
||||
if (ret == 0) {
|
||||
goto rollback;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret == 1) {
|
||||
if (exec->state->nbTrans > exec->transno + 1) {
|
||||
xmlFARegExecSave(exec);
|
||||
}
|
||||
/*
|
||||
* restart count for expressions like this ((abc){2})*
|
||||
*/
|
||||
if (trans->count >= 0) {
|
||||
exec->counts[trans->count] = 0;
|
||||
}
|
||||
if (trans->counter >= 0) {
|
||||
exec->counts[trans->counter]++;
|
||||
}
|
||||
exec->state = exec->comp->states[trans->to];
|
||||
exec->transno = 0;
|
||||
if (trans->atom != NULL) {
|
||||
exec->index += len;
|
||||
}
|
||||
goto progress;
|
||||
} else if (ret < 0) {
|
||||
exec->status = XML_REGEXP_INTERNAL_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((exec->transno != 0) || (exec->state->nbTrans == 0)) {
|
||||
rollback:
|
||||
/*
|
||||
* Failed to find a way out
|
||||
*/
|
||||
exec->determinist = 0;
|
||||
xmlFARegExecRollBack(exec);
|
||||
}
|
||||
progress:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/************************************************************************
|
||||
* *
|
||||
* Parser for the Schemas Datatype Regular Expressions *
|
||||
@ -7299,10 +7150,6 @@ xmlExpCheckCard(xmlExpNodePtr exp, xmlExpNodePtr sub) {
|
||||
} else if ((exp->c_max >= 0) && (exp->c_max < sub->c_max)) {
|
||||
ret = 0;
|
||||
}
|
||||
#if 0
|
||||
if ((IS_NILLABLE(sub)) && (!IS_NILLABLE(exp)))
|
||||
ret = 0;
|
||||
#endif
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@ -1484,10 +1484,9 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
|
||||
switch (p->state) {
|
||||
case XML_TEXTWRITER_NAME:
|
||||
case XML_TEXTWRITER_TEXT:
|
||||
#if 0
|
||||
buf = NULL;
|
||||
xmlOutputBufferWriteEscape(writer->out, content, NULL);
|
||||
#endif
|
||||
/*
|
||||
* TODO: Use xmlSerializeText
|
||||
*/
|
||||
buf = xmlEncodeSpecialChars(NULL, content);
|
||||
break;
|
||||
case XML_TEXTWRITER_ATTRIBUTE:
|
||||
|
121
xpath.c
121
xpath.c
@ -2130,11 +2130,6 @@ xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt) {
|
||||
}
|
||||
obj = valuePop(ctxt);
|
||||
ret = obj->nodesetval;
|
||||
#if 0
|
||||
/* to fix memory leak of not clearing obj->user */
|
||||
if (obj->boolval && obj->user != NULL)
|
||||
xmlFreeNodeList((xmlNodePtr) obj->user);
|
||||
#endif
|
||||
obj->nodesetval = NULL;
|
||||
xmlXPathReleaseObject(ctxt->context, obj);
|
||||
return(ret);
|
||||
@ -4386,38 +4381,6 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) {
|
||||
}
|
||||
break;
|
||||
case XPATH_XSLT_TREE:
|
||||
#if 0
|
||||
/*
|
||||
Removed 11 July 2004 - the current handling of xslt tmpRVT nodes means that
|
||||
this previous handling is no longer correct, and can cause some serious
|
||||
problems (ref. bug 145547)
|
||||
*/
|
||||
if ((val->nodesetval != NULL) &&
|
||||
(val->nodesetval->nodeTab != NULL)) {
|
||||
xmlNodePtr cur, tmp;
|
||||
xmlDocPtr top;
|
||||
|
||||
ret->boolval = 1;
|
||||
top = xmlNewDoc(NULL);
|
||||
top->name = (char *)
|
||||
xmlStrdup(val->nodesetval->nodeTab[0]->name);
|
||||
ret->user = top;
|
||||
if (top != NULL) {
|
||||
top->doc = top;
|
||||
cur = val->nodesetval->nodeTab[0]->children;
|
||||
while (cur != NULL) {
|
||||
tmp = xmlDocCopyNode(cur, top, 1);
|
||||
xmlAddChild((xmlNodePtr) top, tmp);
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
|
||||
ret->nodesetval = xmlXPathNodeSetCreate((xmlNodePtr) top);
|
||||
} else
|
||||
ret->nodesetval = xmlXPathNodeSetCreate(NULL);
|
||||
/* Deallocate the copied tree value */
|
||||
break;
|
||||
#endif
|
||||
case XPATH_NODESET:
|
||||
ret->nodesetval = xmlXPathNodeSetMerge(NULL, val->nodesetval);
|
||||
if (ret->nodesetval == NULL) {
|
||||
@ -6554,78 +6517,6 @@ xmlXPathNextChildElement(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* xmlXPathNextDescendantOrSelfElemParent:
|
||||
* @ctxt: the XPath Parser context
|
||||
* @cur: the current node in the traversal
|
||||
*
|
||||
* Traversal function for the "descendant-or-self" axis.
|
||||
* Additionally it returns only nodes which can be parents of
|
||||
* element nodes.
|
||||
*
|
||||
*
|
||||
* Returns the next element following that axis
|
||||
*/
|
||||
static xmlNodePtr
|
||||
xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur,
|
||||
xmlNodePtr contextNode)
|
||||
{
|
||||
if (cur == NULL) {
|
||||
if (contextNode == NULL)
|
||||
return(NULL);
|
||||
switch (contextNode->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_XINCLUDE_START:
|
||||
case XML_DOCUMENT_FRAG_NODE:
|
||||
case XML_DOCUMENT_NODE:
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
return(contextNode);
|
||||
default:
|
||||
return(NULL);
|
||||
}
|
||||
return(NULL);
|
||||
} else {
|
||||
xmlNodePtr start = cur;
|
||||
|
||||
while (cur != NULL) {
|
||||
switch (cur->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
/* TODO: OK to have XInclude here? */
|
||||
case XML_XINCLUDE_START:
|
||||
case XML_DOCUMENT_FRAG_NODE:
|
||||
if (cur != start)
|
||||
return(cur);
|
||||
if (cur->children != NULL) {
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
/* Not sure if we need those here. */
|
||||
case XML_DOCUMENT_NODE:
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
if (cur != start)
|
||||
return(cur);
|
||||
return(xmlDocGetRootElement((xmlDocPtr) cur));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
next_sibling:
|
||||
if ((cur == NULL) || (cur == contextNode))
|
||||
return(NULL);
|
||||
if (cur->next != NULL) {
|
||||
cur = cur->next;
|
||||
} else {
|
||||
cur = cur->parent;
|
||||
goto next_sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlXPathNextDescendant:
|
||||
* @ctxt: the XPath Parser context
|
||||
@ -9945,16 +9836,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
|
||||
* only at evaluation time. The compilation is done
|
||||
* outside of any context.
|
||||
*/
|
||||
#if 0
|
||||
*prefix = xmlXPathNsLookup(ctxt->context, name);
|
||||
if (name != NULL)
|
||||
xmlFree(name);
|
||||
if (*prefix == NULL) {
|
||||
XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR);
|
||||
}
|
||||
#else
|
||||
*prefix = name;
|
||||
#endif
|
||||
|
||||
if (CUR == '*') {
|
||||
/*
|
||||
@ -11969,9 +11851,6 @@ xmlXPathRunStreamEval(xmlXPathParserContextPtr pctxt, xmlPatternPtr comp,
|
||||
from_root = xmlPatternFromRoot(comp);
|
||||
if (from_root < 0)
|
||||
return(-1);
|
||||
#if 0
|
||||
printf("stream eval: depth %d from root %d\n", max_depth, from_root);
|
||||
#endif
|
||||
|
||||
if (! toBool) {
|
||||
if (resultSeq == NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user