octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54299] HDF5 file I/O unit tests fail or crash


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #54299] HDF5 file I/O unit tests fail or crash Octave
Date: Fri, 13 Jul 2018 11:23:41 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #8, bug #54299 (project octave):

Markus:

In my patch, I changed




  const char *s_name = 
     octave::sys::get_ASCII_filename (std::string (name)).c_str ();

  if (mode & std::ios::in)
    file_id = H5Fopen (s_name, H5F_ACC_RDONLY, octave_H5P_DEFAULT);
  else if (mode & std::ios::out)
    {
      if (mode & std::ios::app && H5Fis_hdf5 (s_name) > 0)
        file_id = H5Fopen (s_name, H5F_ACC_RDWR, octave_H5P_DEFAULT);
      else
        // FIXME: For Windows, create a file with an ASCII name in an
        //        accessible folder, close the file move and rename using
        //        wide character API and re-open.
        file_id = H5Fcreate (name, H5F_ACC_TRUNC, octave_H5P_DEFAULT,
                             octave_H5P_DEFAULT);
    }


to


  if (mode & std::ios::in)
    file_id = H5Fopen (s_name, H5F_ACC_RDONLY, octave_H5P_DEFAULT);
  else if (mode & std::ios::out)
    {
      if (mode & std::ios::app && H5Fis_hdf5 (s_name) > 0)
        file_id = H5Fopen (s_name, H5F_ACC_RDWR, octave_H5P_DEFAULT);
      else
        // FIXME: For Windows, create a file with an ASCII name in an
        //        accessible folder, close the file move and rename using
        //        wide character API and re-open.
        file_id = H5Fcreate (s_name, H5F_ACC_TRUNC, octave_H5P_DEFAULT,
                             octave_H5P_DEFAULT);
    }


This is the kind of thing I was asking about in comment #4.  Why was S_NAME
used in the call to H5Fopen, but NAME used in the call to H5Fcreate?

I know I'm probably partly to blame for these bad tmp names, but it would
probably also help if we consistently used more meaningful variable names
here.  So instead of s_name, wchar_name or ascii_name or similar.  Then it
might be more obvious from the code what is happening.  I can't quickly
understand what that FIXME comment means, for example.

This code appears twice (copy and paste, apparently).  Probably a common
function to do this job would also help with understanding  and future
maintenance.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54299>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]