changeset 4425:82f8aae8cf20

[project @ 2003-06-13 15:08:25 by jwe]
author jwe
date Fri, 13 Jun 2003 15:08:26 +0000
parents ab82d3a27d96
children 51a0dcde8778
files src/ChangeLog src/oct-stream.cc
diffstat 2 files changed, 31 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jun 13 14:35:25 2003 +0000
+++ b/src/ChangeLog	Fri Jun 13 15:08:26 2003 +0000
@@ -1,3 +1,8 @@
+2003-06-13  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* oct-stream.cc (printf_value_cache::string_value): Don't attempt
+	to extract values when none are available.
+
 2003-06-04  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* pt-plot.cc (Vgnuplot_has_multiplot): Delete variable.
--- a/src/oct-stream.cc	Fri Jun 13 14:35:25 2003 +0000
+++ b/src/oct-stream.cc	Fri Jun 13 15:08:26 2003 +0000
@@ -2175,31 +2175,36 @@
 {
   std::string retval;
 
-  octave_value tval = values (val_idx++);
-
-  if (tval.rows () == 1)
-    retval = tval.string_value ();
+  if (exhausted ())
+    curr_state = conversion_error;
   else
     {
-      // In the name of Matlab compatibility.
-
-      charMatrix chm = tval.char_matrix_value ();
-
-      int nr = chm.rows ();
-      int nc = chm.columns ();
-
-      int k = 0;
-
-      retval.resize (nr * nc, '\0');
-
-      for (int j = 0; j < nc; j++)
-	for (int i = 0; i < nr; i++)
-	  retval[k++] = chm(i,j);
+      octave_value tval = values (val_idx++);
+
+      if (tval.rows () == 1)
+	retval = tval.string_value ();
+      else
+	{
+	  // In the name of Matlab compatibility.
+
+	  charMatrix chm = tval.char_matrix_value ();
+
+	  int nr = chm.rows ();
+	  int nc = chm.columns ();
+
+	  int k = 0;
+
+	  retval.resize (nr * nc, '\0');
+
+	  for (int j = 0; j < nc; j++)
+	    for (int i = 0; i < nr; i++)
+	      retval[k++] = chm(i,j);
+	}
+
+      if (error_state)
+	curr_state = conversion_error;
     }
 
-  if (error_state)
-    curr_state = conversion_error;
-
   return retval;
 }