]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Two obvious fixes.
authorBruno Haible <bruno@clisp.org>
Mon, 27 Nov 2006 12:55:29 +0000 (12:55 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:25 +0000 (12:14 +0200)
gnulib-local/lib/html-ostream.oo.c

index 123f04076f205e65c73e06093592788dfa42d58f..bd108932e4139d4a195f2beae9fb4e40b76b66a5 100644 (file)
@@ -62,7 +62,7 @@ emit_pending_spans (html_ostream_t stream, bool shrink_stack)
 
          ostream_write_str (stream->destination, "<span class=\"");
          ostream_write_str (stream->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, "&quot;");
-                   break;
-                 case '&':
-                   ostream_write_str (stream->destination, "&amp;");
-                   break;
-                 case '<':
-                   ostream_write_str (stream->destination, "&lt;");
-                   break;
-                 case '>':
-                   /* Needed to avoid "]]>" in the output.  */
-                   ostream_write_str (stream->destination, "&gt;");
-                   break;
-                 case ' ':
-                   /* Needed because HTML viewers merge adjacent spaces and
-                      drop spaces adjacent to <br> and similar.  */
-                   ostream_write_str (stream->destination, "&nbsp;");
-                   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, "<br/>");
-                     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, "<br/>");
+                   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, "&quot;");
+                       break;
+                     case '&':
+                       ostream_write_str (stream->destination, "&amp;");
+                       break;
+                     case '<':
+                       ostream_write_str (stream->destination, "&lt;");
+                       break;
+                     case '>':
+                       /* Needed to avoid "]]>" in the output.  */
+                       ostream_write_str (stream->destination, "&gt;");
+                       break;
+                     case ' ':
+                       /* Needed because HTML viewers merge adjacent spaces
+                          and drop spaces adjacent to <br> and similar.  */
+                       ostream_write_str (stream->destination, "&nbsp;");
+                       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;