Mercurial > hg > octave-lojdl
changeset 14309:824e5d362aba stable
Fix Qhull calling convention by passing true file pointer to qh_new_qhull
* __delaunayn__.cc, __voronoi__.cc, convhulln.cc: Pass file pointer
to "/dev/null" for output of Qhull rather than 0.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 01 Feb 2012 10:37:25 -0800 |
parents | 61db003b8e47 |
children | decea31ea010 |
files | src/DLD-FUNCTIONS/__delaunayn__.cc src/DLD-FUNCTIONS/__voronoi__.cc src/DLD-FUNCTIONS/convhulln.cc |
diffstat | 3 files changed, 37 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/__delaunayn__.cc +++ b/src/DLD-FUNCTIONS/__delaunayn__.cc @@ -121,10 +121,20 @@ sprintf (flags, "qhull d %s", options.c_str ()); - // Replace the 0 pointer with stdout for debugging information - FILE *outfile = 0; + // Replace the outfile pointer with stdout for debugging information. +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + FILE *outfile = gnulib::fopen ("NUL", "w"); +#else + FILE *outfile = gnulib::fopen ("/dev/null", "w"); +#endif FILE *errfile = stderr; - + + if (! outfile) + { + error ("__delaunayn__: Unable to create temporary file for output."); + return retval; + } + int exitcode = qh_new_qhull (dim, n, pt_array, ismalloc, flags, outfile, errfile); if (! exitcode)
--- a/src/DLD-FUNCTIONS/__voronoi__.cc +++ b/src/DLD-FUNCTIONS/__voronoi__.cc @@ -115,9 +115,19 @@ boolT ismalloc = false; - // Replace the 0 pointer with stdout for debugging information - FILE *outfile = 0; + // Replace the outfile pointer with stdout for debugging information. +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + FILE *outfile = gnulib::fopen ("NUL", "w"); +#else + FILE *outfile = gnulib::fopen ("/dev/null", "w"); +#endif FILE *errfile = stderr; + + if (! outfile) + { + error ("__voronoi__: Unable to create temporary file for output."); + return retval; + } // qh_new_qhull command and points arguments are not const...
--- a/src/DLD-FUNCTIONS/convhulln.cc +++ b/src/DLD-FUNCTIONS/convhulln.cc @@ -128,10 +128,20 @@ boolT ismalloc = false; - // Replace the 0 pointer with stdout for debugging information. - FILE *outfile = 0; + // Replace the outfile pointer with stdout for debugging information. +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + FILE *outfile = gnulib::fopen ("NUL", "w"); +#else + FILE *outfile = gnulib::fopen ("/dev/null", "w"); +#endif FILE *errfile = stderr; + if (! outfile) + { + error ("convhulln: Unable to create temporary file for output."); + return retval; + } + // qh_new_qhull command and points arguments are not const... std::string cmd = "qhull" + options;