mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
more fixes. Daniel
* parser.c testapi.c xmlIO.c xmlstring.c: more fixes. Daniel
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
Mon Nov 8 12:55:16 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* parser.c testapi.c xmlIO.c xmlstring.c: more fixes.
|
||||||
|
|
||||||
Mon Nov 8 11:24:57 CET 2004 Daniel Veillard <daniel@veillard.com>
|
Mon Nov 8 11:24:57 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* gentest.py testapi.c: more types, more coverage
|
* gentest.py testapi.c: more types, more coverage
|
||||||
|
12
parser.c
12
parser.c
@@ -9978,7 +9978,11 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
|
|||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
|
memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
|
||||||
|
if (sax->initialized == XML_SAX2_MAGIC)
|
||||||
|
memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
|
||||||
|
else
|
||||||
|
memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
|
||||||
if (user_data != NULL)
|
if (user_data != NULL)
|
||||||
ctxt->userData = user_data;
|
ctxt->userData = user_data;
|
||||||
}
|
}
|
||||||
@@ -10081,7 +10085,11 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
|
|||||||
xmlFree(ctxt);
|
xmlFree(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
|
memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
|
||||||
|
if (sax->initialized == XML_SAX2_MAGIC)
|
||||||
|
memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
|
||||||
|
else
|
||||||
|
memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
|
||||||
if (user_data != NULL)
|
if (user_data != NULL)
|
||||||
ctxt->userData = user_data;
|
ctxt->userData = user_data;
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ static int generic_errors = 0;
|
|||||||
static int call_tests = 0;
|
static int call_tests = 0;
|
||||||
static int function_tests = 0;
|
static int function_tests = 0;
|
||||||
|
|
||||||
static xmlChar chartab[1024] = " chartab\n";
|
static xmlChar chartab[1024];
|
||||||
static int inttab[1024];
|
static int inttab[1024];
|
||||||
static unsigned long longtab[1024];
|
static unsigned long longtab[1024];
|
||||||
|
|
||||||
@@ -110,6 +110,11 @@ int main(int argc, char **argv) {
|
|||||||
int ret;
|
int ret;
|
||||||
int blocks, mem;
|
int blocks, mem;
|
||||||
|
|
||||||
|
memset(chartab, 0, sizeof(chartab));
|
||||||
|
strncpy(chartab, " chartab\n", 20);
|
||||||
|
memset(inttab, 0, sizeof(inttab));
|
||||||
|
memset(longtab, 0, sizeof(longtab));
|
||||||
|
|
||||||
xmlInitParser();
|
xmlInitParser();
|
||||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
xmlRelaxNGInitTypes();
|
xmlRelaxNGInitTypes();
|
||||||
|
5
xmlIO.c
5
xmlIO.c
@@ -420,7 +420,8 @@ __xmlLoaderErr(void *ctx, const char *msg, const char *filename)
|
|||||||
channel = ctxt->sax->warning;
|
channel = ctxt->sax->warning;
|
||||||
level = XML_ERR_WARNING;
|
level = XML_ERR_WARNING;
|
||||||
}
|
}
|
||||||
schannel = ctxt->sax->serror;
|
if (ctxt->sax->initialized == XML_SAX2_MAGIC)
|
||||||
|
schannel = ctxt->sax->serror;
|
||||||
data = ctxt->userData;
|
data = ctxt->userData;
|
||||||
}
|
}
|
||||||
__xmlRaiseError(schannel, channel, data, ctxt, NULL, XML_FROM_IO,
|
__xmlRaiseError(schannel, channel, data, ctxt, NULL, XML_FROM_IO,
|
||||||
@@ -1549,6 +1550,7 @@ xmlIOHTTPDfltOpenW( const char * post_uri ) {
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xmlIOHTTPRead(void * context, char * buffer, int len) {
|
xmlIOHTTPRead(void * context, char * buffer, int len) {
|
||||||
|
if ((buffer == NULL) || (len < 0)) return(-1);
|
||||||
return(xmlNanoHTTPRead(context, &buffer[0], len));
|
return(xmlNanoHTTPRead(context, &buffer[0], len));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1827,6 +1829,7 @@ xmlIOFTPOpen (const char *filename) {
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xmlIOFTPRead(void * context, char * buffer, int len) {
|
xmlIOFTPRead(void * context, char * buffer, int len) {
|
||||||
|
if ((buffer == NULL) || (len < 0)) return(-1);
|
||||||
return(xmlNanoFTPRead(context, &buffer[0], len));
|
return(xmlNanoFTPRead(context, &buffer[0], len));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,8 +92,10 @@ xmlCharStrndup(const char *cur, int len) {
|
|||||||
xmlErrMemory(NULL, NULL);
|
xmlErrMemory(NULL, NULL);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
for (i = 0;i < len;i++)
|
for (i = 0;i < len;i++) {
|
||||||
ret[i] = (xmlChar) cur[i];
|
ret[i] = (xmlChar) cur[i];
|
||||||
|
if (ret[i] == 0) return(ret);
|
||||||
|
}
|
||||||
ret[len] = 0;
|
ret[len] = 0;
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
@@ -809,6 +811,7 @@ xmlCheckUTF8(const unsigned char *utf)
|
|||||||
* @len: the number of characters in the array
|
* @len: the number of characters in the array
|
||||||
*
|
*
|
||||||
* storage size of an UTF8 string
|
* storage size of an UTF8 string
|
||||||
|
* the behaviour is not garanteed if the input string is not UTF-8
|
||||||
*
|
*
|
||||||
* Returns the storage size of
|
* Returns the storage size of
|
||||||
* the first 'len' characters of ARRAY
|
* the first 'len' characters of ARRAY
|
||||||
@@ -829,8 +832,10 @@ xmlUTF8Strsize(const xmlChar *utf, int len) {
|
|||||||
if ( !*ptr )
|
if ( !*ptr )
|
||||||
break;
|
break;
|
||||||
if ( (ch = *ptr++) & 0x80)
|
if ( (ch = *ptr++) & 0x80)
|
||||||
while ( (ch<<=1) & 0x80 )
|
while ((ch<<=1) & 0x80 ) {
|
||||||
ptr++;
|
ptr++;
|
||||||
|
if (*ptr == 0) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (ptr - utf);
|
return (ptr - utf);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user