Fix some bugs...

This commit is contained in:
Michael R Sweet 2003-07-20 13:19:08 +00:00
parent cd5601fd40
commit 95fc4e37f1
3 changed files with 30 additions and 14 deletions

View File

@ -1,8 +1,15 @@
*.bck
*.bak
Makefile
autom4te*.cache
config.cache
config.log
config.status
Makefile
libmxml.a
mxml.0
mxml.3
mxml.list
mxmldoc
mxmldoc.0
mxmldoc.1
testmxml
*.bck
*.bak

View File

@ -1,5 +1,5 @@
#
# "$Id: Makefile.in,v 1.8 2003/06/15 01:29:02 mike Exp $"
# "$Id: Makefile.in,v 1.9 2003/07/20 13:19:08 mike Exp $"
#
# Makefile for mini-XML, a small XML-like file parsing library.
#
@ -188,8 +188,8 @@ mxmldoc.o: mxml.h
testmxml: libmxml.a testmxml.o
$(CC) $(LDFLAGS) -o $@ testmxml.o libmxml.a
@echo Testing library...
@./testmxml test.xml >temp1.xml
@./testmxml temp1.xml >temp2.xml
./testmxml test.xml >temp1.xml
./testmxml temp1.xml >temp2.xml
@if cmp temp1.xml temp2.xml; then \
echo Test passed!; \
$(RM) temp1.xml temp2.xml; \
@ -217,5 +217,5 @@ $(OBJS): Makefile
#
# End of "$Id: Makefile.in,v 1.8 2003/06/15 01:29:02 mike Exp $".
# End of "$Id: Makefile.in,v 1.9 2003/07/20 13:19:08 mike Exp $".
#

View File

@ -1,5 +1,5 @@
/*
* "$Id: mxml-file.c,v 1.13 2003/06/19 04:25:12 mike Exp $"
* "$Id: mxml-file.c,v 1.14 2003/07/20 13:19:08 mike Exp $"
*
* File loading code for mini-XML, a small XML-like file parsing library.
*
@ -786,7 +786,9 @@ mxml_parse_element(mxml_node_t *node, /* I - Element node */
while ((ch = (*getc_cb)(p)) != EOF)
{
printf("parse_element: ch='%c'\n", ch);
#ifdef DEBUG
fprintf(stderr, "parse_element: ch='%c'\n", ch);
#endif /* DEBUG */
/*
* Skip leading whitespace...
@ -1060,8 +1062,12 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */
if (node->value.element.name[0] == '?')
{
if (mxml_write_string("?>\n", p, putc_cb) < 0)
return (-1);
if ((*putc_cb)('?', p) < 0)
return (-1);
if ((*putc_cb)('>', p) < 0)
return (-1);
if ((*putc_cb)('\n', p) < 0)
return (-1);
col = 0;
}
@ -1103,10 +1109,13 @@ mxml_write_node(mxml_node_t *node, /* I - Node to write */
col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb);
}
else if (mxml_write_string("/>", p, putc_cb) < 0)
return (-1);
else
{
if ((*putc_cb)('/', p) < 0)
return (-1);
if ((*putc_cb)('>', p) < 0)
return (-1);
col += 2;
col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb);
@ -1363,5 +1372,5 @@ mxml_write_ws(mxml_node_t *node, /* I - Current node */
/*
* End of "$Id: mxml-file.c,v 1.13 2003/06/19 04:25:12 mike Exp $".
* End of "$Id: mxml-file.c,v 1.14 2003/07/20 13:19:08 mike Exp $".
*/