#include <libxml/parser.h>
#include <libxml/parserInternals.h>
+#include "buf.h"
+
int lastError;
static void errorHandler(void *unused, xmlErrorPtr err) {
* We should see no error in remaning cases
*/
else if ((lastError != 0) || (res == NULL)) {
- fprintf(stderr,
+ fprintf(stderr,
"Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
}
if (res != NULL)
* We should see no error in remaining cases
*/
else if ((lastError != 0) || (len != 3)) {
- fprintf(stderr,
+ fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
}
* Finally check the value is right
*/
else if (c != value) {
- fprintf(stderr,
+ fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
}
* There are values in that range that are not allowed in XML-1.0
*/
else if (((value > 0xD7FF) && (value <0xE000)) ||
- ((value > 0xFFFD) && (value <0x10000)) ||
+ ((value > 0xFFFD) && (value <0x10000)) ||
(value > 0x10FFFF)) {
if (lastError != XML_ERR_INVALID_CHAR)
fprintf(stderr,
* We should see no error in remaining cases
*/
else if ((lastError != 0) || (len != 4)) {
- fprintf(stderr,
+ fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
}
* Finally check the value is right
*/
else if (c != value) {
- fprintf(stderr,
+ fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
}
}
input->filename = NULL;
input->buf = buf;
- input->base = input->buf->buffer->content;
- input->cur = input->buf->buffer->content;
- input->end = &input->buf->buffer->content[4];
+ input->cur =
+ input->base = xmlBufContent(input->buf->buffer);
+ input->end = input->base + 4;
inputPush(ctxt, input);
printf("testing char range: 1");