diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2005-11-17 13:12:16 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2005-11-17 13:12:16 +0000 |
commit | c19d535e5e5c5281a9dd4405173e328d5b6b2623 (patch) | |
tree | d2a3a05770ba8098ba4d5d43f6abc3b0cbc824ce /parserInternals.c | |
parent | ae487ba020d1f5049de5fa4499ab1439d53bc5c4 (diff) | |
download | android_external_libxml2-c19d535e5e5c5281a9dd4405173e328d5b6b2623.tar.gz android_external_libxml2-c19d535e5e5c5281a9dd4405173e328d5b6b2623.tar.bz2 android_external_libxml2-c19d535e5e5c5281a9dd4405173e328d5b6b2623.zip |
removed unreachable code pointed out by Oleksandr Kononenko, fixes bug
* parserInternals.c: removed unreachable code pointed out by
Oleksandr Kononenko, fixes bug #321695
Daniel
Diffstat (limited to 'parserInternals.c')
-rw-r--r-- | parserInternals.c | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/parserInternals.c b/parserInternals.c index 58d462c3..aad43bc0 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -1206,50 +1206,13 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input, } return (0); - } else { - if ((input->length == 0) || (input->buf == NULL)) { - /* - * When parsing a static memory array one must know the - * size to be able to convert the buffer. - */ - xmlErrInternal(ctxt, "switching encoding : no input\n", NULL); - return (-1); - } else { - int processed; - - /* - * Shrink the current input buffer. - * Move it as the raw buffer and create a new input buffer - */ - processed = input->cur - input->base; - - input->buf->raw = xmlBufferCreate(); - xmlBufferAdd(input->buf->raw, input->cur, - input->length - processed); - input->buf->buffer = xmlBufferCreate(); - - /* - * convert as much as possible of the raw input - * to the parser reading buffer. - */ - nbchars = xmlCharEncInFunc(input->buf->encoder, - input->buf->buffer, - input->buf->raw); - if (nbchars < 0) { - xmlErrInternal(ctxt, - "switching encoding: encoder error\n", - NULL); - return (-1); - } - - /* - * Conversion succeeded, get rid of the old buffer - */ - if ((input->free != NULL) && (input->base != NULL)) - input->free((xmlChar *) input->base); - input->base = input->cur = input->buf->buffer->content; - input->end = &input->base[input->buf->buffer->use]; - } + } else if (input->length == 0) { + /* + * When parsing a static memory array one must know the + * size to be able to convert the buffer. + */ + xmlErrInternal(ctxt, "switching encoding : no input\n", NULL); + return (-1); } return (0); } |