mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-08 21:17:39 +03:00
Fixed bug 109942
This commit is contained in:
parent
d72c7e339c
commit
3dd57f7981
@ -1,3 +1,8 @@
|
||||
Mon May 12 21:58:00 EDT 2003 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
* minor cleanup of configure '--help' display
|
||||
* error.c: enhanced xmlParserPrintFileContext to fix bug #109942
|
||||
|
||||
Mon May 12 17:53:30 EDT 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tree.c: PI nodes in external subset were not freed :-\
|
||||
|
37
error.c
37
error.c
@ -149,8 +149,8 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
|
||||
void
|
||||
xmlParserPrintFileContext(xmlParserInputPtr input) {
|
||||
const xmlChar *cur, *base;
|
||||
int n;
|
||||
xmlChar content[81];
|
||||
int n, col;
|
||||
xmlChar content[81]; /* space for 80 chars + line terminator */
|
||||
xmlChar *ctnt;
|
||||
|
||||
if (input == NULL) return;
|
||||
@ -161,37 +161,34 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
|
||||
cur--;
|
||||
}
|
||||
n = 0;
|
||||
/* search backwards for beginning-of-line maximum 80 characters */
|
||||
while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
|
||||
/* search backwards for beginning-of-line (to max buff size) */
|
||||
while ((n++ < sizeof(content)-1) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
|
||||
cur--;
|
||||
if ((*cur == '\n') || (*cur == '\r')) cur++;
|
||||
/* search forward for end-of-line maximum 80 characters */
|
||||
/* calculate the error position in terms of the current position */
|
||||
col = input->cur - cur;
|
||||
/* search forward for end-of-line (to max buff size) */
|
||||
n = 0;
|
||||
ctnt = content;
|
||||
while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) {
|
||||
/* copy selected text to our buffer */
|
||||
while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < sizeof(content)-1)) {
|
||||
*ctnt++ = *cur++;
|
||||
n++;
|
||||
}
|
||||
*ctnt = 0;
|
||||
/* print out the selected text */
|
||||
xmlGenericError(xmlGenericErrorContext,"%s\n", content);
|
||||
/* create blank line with problem pointer */
|
||||
cur = input->cur;
|
||||
while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
|
||||
cur--;
|
||||
}
|
||||
n = 0;
|
||||
ctnt = content;
|
||||
while ((n++ < 79) && (cur > base) && (*cur != '\n') && (*cur != '\r')) {
|
||||
*ctnt++ = ' ';
|
||||
cur--;
|
||||
}
|
||||
if (ctnt > content) {
|
||||
*(--ctnt) = '^';
|
||||
*(++ctnt) = 0;
|
||||
} else {
|
||||
*ctnt = '^';
|
||||
*(++ctnt) = 0;
|
||||
/* (leave buffer space for pointer + line terminator) */
|
||||
while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
|
||||
if (*ctnt!='\t')
|
||||
*ctnt = ' ';
|
||||
*ctnt++;
|
||||
}
|
||||
*ctnt++ = '^';
|
||||
*ctnt = 0;
|
||||
xmlGenericError(xmlGenericErrorContext,"%s\n", content);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user