From: Bruno Haible Date: Mon, 27 Nov 2006 12:55:29 +0000 (+0000) Subject: Two obvious fixes. X-Git-Tag: v0.17~625 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=305864203f7f006c3314778488fd1d8ddd7ad7e3;p=thirdparty%2Fgettext.git Two obvious fixes. --- diff --git a/gnulib-local/lib/html-ostream.oo.c b/gnulib-local/lib/html-ostream.oo.c index 123f04076..bd108932e 100644 --- a/gnulib-local/lib/html-ostream.oo.c +++ b/gnulib-local/lib/html-ostream.oo.c @@ -62,7 +62,7 @@ emit_pending_spans (html_ostream_t stream, bool shrink_stack) ostream_write_str (stream->destination, "destination, classname); - ostream_write_str (stream->destination, ">"); + ostream_write_str (stream->destination, "\">"); } stream->last_class_stack_size = stream->curr_class_stack_size; } @@ -96,8 +96,6 @@ html_ostream::write_mem (html_ostream_t stream, const void *data, size_t len) char inbuffer[BUFFERSIZE]; size_t inbufcount; - emit_pending_spans (stream, true); - inbufcount = stream->buflen; if (inbufcount > 0) memcpy (inbuffer, stream->buf, inbufcount); @@ -135,51 +133,56 @@ html_ostream::write_mem (html_ostream_t stream, const void *data, size_t len) nbytes = u8_mbtouc (&uc, (const unsigned char *) inptr, insize); - switch (uc) + if (uc == '\n') { - case '"': - ostream_write_str (stream->destination, """); - break; - case '&': - ostream_write_str (stream->destination, "&"); - break; - case '<': - ostream_write_str (stream->destination, "<"); - break; - case '>': - /* Needed to avoid "]]>" in the output. */ - ostream_write_str (stream->destination, ">"); - break; - case ' ': - /* Needed because HTML viewers merge adjacent spaces and - drop spaces adjacent to
and similar. */ - ostream_write_str (stream->destination, " "); - break; - case '\n': - { - size_t prev_class_stack_size = stream->curr_class_stack_size; - stream->curr_class_stack_size = 0; - emit_pending_spans (stream, false); - ostream_write_str (stream->destination, "
"); - stream->curr_class_stack_size = prev_class_stack_size; - } - break; - default: - if (uc >= 0x20 && uc < 0x7F) - { - /* Output ASCII characters as such. */ - char bytes[1]; - bytes[0] = uc; - ostream_write_mem (stream->destination, bytes, 1); - } - else + size_t prev_class_stack_size = stream->curr_class_stack_size; + stream->curr_class_stack_size = 0; + emit_pending_spans (stream, false); + ostream_write_str (stream->destination, "
"); + stream->curr_class_stack_size = prev_class_stack_size; + } + else + { + emit_pending_spans (stream, true); + + switch (uc) { - /* Output non-ASCII characters in #&nnn; notation. */ - char bytes[32]; - sprintf (bytes, "&#%d;", uc); - ostream_write_str (stream->destination, bytes); + case '"': + ostream_write_str (stream->destination, """); + break; + case '&': + ostream_write_str (stream->destination, "&"); + break; + case '<': + ostream_write_str (stream->destination, "<"); + break; + case '>': + /* Needed to avoid "]]>" in the output. */ + ostream_write_str (stream->destination, ">"); + break; + case ' ': + /* Needed because HTML viewers merge adjacent spaces + and drop spaces adjacent to
and similar. */ + ostream_write_str (stream->destination, " "); + break; + default: + if (uc >= 0x20 && uc < 0x7F) + { + /* Output ASCII characters as such. */ + char bytes[1]; + bytes[0] = uc; + ostream_write_mem (stream->destination, bytes, 1); + } + else + { + /* Output non-ASCII characters in #&nnn; + notation. */ + char bytes[32]; + sprintf (bytes, "&#%d;", uc); + ostream_write_str (stream->destination, bytes); + } + break; } - break; } inptr += nbytes;