changeset 4351:1e7f4405e037

[project @ 2003-02-21 19:42:01 by jwe]
author jwe
date Fri, 21 Feb 2003 19:42:01 +0000
parents b4661459eff7
children 80b83de0aa2a
files src/ChangeLog src/utils.cc test/octave.test/signal/detrend-3.m
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Feb 21 19:29:43 2003 +0000
+++ b/src/ChangeLog	Fri Feb 21 19:42:01 2003 +0000
@@ -1,3 +1,10 @@
+2003-02-21  Paul Kienzle <pkienzle@users.sf.net>
+
+	* utils.cc (octave_vsnprintf): Return value of vsnprintf is int,
+	not size_t.  Make sure there is some space left in the buffer for
+	vsnprintf versions which return the number of characters written
+	even when the buffer is too short.
+
 2003-02-20  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* debug.cc (get_user_function): Use dynamic_cast, not static_cast.
--- a/src/utils.cc	Fri Feb 21 19:29:43 2003 +0000
+++ b/src/utils.cc	Fri Feb 21 19:42:01 2003 +0000
@@ -914,7 +914,7 @@
 
   static char *buf = 0;
 
-  size_t nchars;
+  int nchars;
 
   if (! buf)
     buf = new char [size];
@@ -958,7 +958,7 @@
 
       END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
 
-      if (nchars > -1)
+      if (nchars > -1 && nchars < size-1)
        return buf;
       else
        {
--- a/test/octave.test/signal/detrend-3.m	Fri Feb 21 19:29:43 2003 +0000
+++ b/test/octave.test/signal/detrend-3.m	Fri Feb 21 19:42:01 2003 +0000
@@ -7,4 +7,4 @@
 t = (0:1:N-1)/N;
 x = [t;4*t-3]';
 y = detrend(x);
-all (all (abs (y) < 10*eps))
+all (all (abs (y) < 20*eps))