changeset 17695:d6f4b01075e0

convn: give error for non-string shape argument. * conv2.cc (convn): if value for the shape option was not a string, convn was silently using the default value. Fixed to give an error instead.
author Carnë Draug <carandraug@octave.org>
date Sat, 19 Oct 2013 04:15:25 +0100
parents 1efe4c65c5cf
children 92226d09f91a
files libinterp/corefcn/conv2.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/conv2.cc	Fri Oct 18 22:40:06 2013 -0700
+++ b/libinterp/corefcn/conv2.cc	Sat Oct 19 04:15:25 2013 +0100
@@ -330,6 +330,11 @@
     {
       if (args(2).is_string ())
         shape = args(2).string_value ();
+      else
+        {
+          error ("convn: SHAPE must be a string");
+          return retval;
+        }
     }
 
   if (shape == "full")
@@ -397,4 +402,8 @@
 
 /*
  FIXME: Need tests for convn in addition to conv2.
+%!error convn ()
+%!error convn (1)
+%!error <SHAPE type not valid> convn (1,2, "NOT_A_SHAPE")
+%!error convn (rand (3), 1, 1)
 */