changeset 15741:f63a4f23bfe7 stable

Fix infinite loop when setting fftw planner method (bug #37873) * liboctave/oct-fftw.h (octave_float_fftw_planner::method): Fix typo method -> do_method. * src/DLD-FUNCTIONS/fftw.cc: Add tests.
author Mike Miller <mtmiller@ieee.org>
date Thu, 06 Dec 2012 20:15:58 -0500
parents ddc651eecf7a
children 142de7308ebf 1f1fc4798f0a
files liboctave/oct-fftw.h src/DLD-FUNCTIONS/fftw.cc
diffstat 2 files changed, 31 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/oct-fftw.h	Wed Nov 28 09:13:56 2012 -0800
+++ b/liboctave/oct-fftw.h	Thu Dec 06 20:15:58 2012 -0500
@@ -225,14 +225,14 @@
   {
     static FftwMethod dummy;
 
-    return instance_ok () ? instance->method () : dummy;
+    return instance_ok () ? instance->do_method () : dummy;
   }
 
   static FftwMethod method (FftwMethod _meth)
   {
     static FftwMethod dummy;
 
-    return instance_ok () ? instance->method (_meth) : dummy;
+    return instance_ok () ? instance->do_method (_meth) : dummy;
   }
 
 private:
--- a/src/DLD-FUNCTIONS/fftw.cc	Wed Nov 28 09:13:56 2012 -0800
+++ b/src/DLD-FUNCTIONS/fftw.cc	Thu Dec 06 20:15:58 2012 -0500
@@ -267,3 +267,32 @@
 
   return retval;
 }
+
+/*
+
+%!testif HAVE_FFTW
+%! def_method = fftw ("planner");
+%! unwind_protect
+%!   method = "estimate";
+%!   fftw ("planner", method);
+%!   assert (fftw ("planner"), method);
+%!   method = "measure";
+%!   fftw ("planner", method);
+%!   assert (fftw ("planner"), method);
+%!   method = "patient";
+%!   fftw ("planner", method);
+%!   assert (fftw ("planner"), method);
+%!   method = "exhaustive";
+%!   fftw ("planner", method);
+%!   assert (fftw ("planner"), method);
+%!   method = "hybrid";
+%!   fftw ("planner", method);
+%!   assert (fftw ("planner"), method);
+%! unwind_protect_cleanup
+%!   fftw ("planner", def_method);
+%! end_unwind_protect
+
+%!error <Invalid call to fftw> fftw ();
+%!error <Invalid call to fftw> fftw ("planner", "estimate", "measure");
+
+ */