Help save net neutrality! Learn more.
Close

Diff of /mcsource.c [3f615e] .. [23eafb]  Maximize  Restore

Switch to side-by-side view

--- a/mcsource.c
+++ b/mcsource.c
@@ -738,7 +738,6 @@
          * which now needs to be flushed to the output queue,
          * BEFORE we proceed to the next cycle.
          */
-
         while( headroom < (xcount + ICONV_MB_LEN_MAX) )
         {
           headroom += BUFSIZ;
@@ -789,6 +788,19 @@
       }
     }
     dfprintf(( stderr, "\n%s:end of input; (count is now %d bytes)", input, count ));
+    /*
+     * We reached the end of the input stream.
+     * If the final record was a message definition,
+     * then the MSGTEXT parser state will still be active;
+     * this state would be cancelled immediately, at the start of the next cycle,
+     * but becuase there is no more input data, we will not start another cycle.
+     * To avoid misidentifying this case as an incomplete final message,
+     * and so displaying an erroneous warning,
+     * we clear this state now.
+     */
+    if(  (count == 0)
+    &&  ((status & (MSGTEXT | NEWLINE | CONTINUED)) == (MSGTEXT | NEWLINE))  )
+      status &= ~MSGTEXT;
   }
   /*
    * At the end of the current input file...
@@ -844,4 +856,4 @@
   return head;
 }
 
-/* $RCSfile$Revision$: end of file */
+/* $RCSfile$Revision: 1.1.1.1 $: end of file */