Mercurial > hg > octave-avbm
changeset 5722:8272a8f03b80
[project @ 2006-03-30 12:48:50 by jwe]
author | jwe |
---|---|
date | Thu, 30 Mar 2006 12:48:50 +0000 |
parents | bd39bbda9bd9 |
children | 7fc5276c8f2f |
files | src/ChangeLog src/DLD-FUNCTIONS/fftw_wisdom.cc |
diffstat | 2 files changed, 20 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-03-30 David Bateman <dbateman@free.fr> + + * DLD-FUNCTIONS/fftw_wisdom.cc: Don't attempt to save wisdom to + an empty filename or invalid filename. + 2006-03-28 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/matrix_type.cc: Update copyright notice and FSF
--- a/src/DLD-FUNCTIONS/fftw_wisdom.cc +++ b/src/DLD-FUNCTIONS/fftw_wisdom.cc @@ -108,18 +108,28 @@ overwrite = true; } + std::string str = args(0).string_value (); std::string wisdom = octave_env::make_absolute - (Vload_path_dir_path.find_first_of (args(0).string_value ()), - octave_env::getcwd ()); + (Vload_path_dir_path.find_first_of (str), octave_env::getcwd ()); // XXX FIXME XXX -- should probably protect FILE* resources with // auto_ptr or similar... if (wisdom.empty () || overwrite) { - FILE *ofile = fopen (wisdom.c_str (), "wb"); - fftw_export_wisdom_to_file (ofile); - fclose (ofile); + if (str.empty ()) + error ("fftw_wisdom: can not save to file"); + else + { + FILE *ofile = fopen (str.c_str (), "wb"); + if (! ofile) + error ("fftw_wisdom: can not save to file %s", str.c_str()); + else + { + fftw_export_wisdom_to_file (ofile); + fclose (ofile); + } + } } else {