diff src/oct-stream.cc @ 12984:7626f8934466 stable

correctly resize scanf output for %c formats (bug #34037) * oct-stream.cc (BEGIN_C_CONVERSION): Resize tmp buffer to number of characters read.
author John W. Eaton <jwe@octave.org>
date Mon, 22 Aug 2011 20:27:27 -0400
parents 18797a4b6174
children 8df8b402797d b12e2cffaa2f
line wrap: on
line diff
--- a/src/oct-stream.cc	Wed Jul 13 17:53:05 2011 -0700
+++ b/src/oct-stream.cc	Mon Aug 22 20:27:27 2011 -0400
@@ -1521,7 +1521,9 @@
     tmp[n++] = static_cast<char> (c); \
  \
   if (n > 0 && c == EOF) \
-    is.clear ()
+    is.clear (); \
+ \
+  tmp.resize (n)
 
 // For a `%s' format, skip initial whitespace and then read until the
 // next whitespace character or until WIDTH characters have been read.