# HG changeset patch # User jwe # Date 1112121332 0 # Node ID 3c4237738c3e6ebb4f6086a8003cff3b1ad0c923 # Parent 2fa6253e36a3db1c020e359e94c8c9bf9694e8a7 [project @ 2005-03-29 18:35:32 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2005-03-29 John W. Eaton + + * ls-hdf5.h (hdf5_fstreambase::hdf5_fstreambase, + hdf5_fstreambase::open): Use & instead of == to test whether mode + is std::ios::in or std::ios::out. + (hd5_ifstream::istream, hd5_ifstream::open, hd5_ofstream::istream, + hd5_ofstream::open): Default mode now includes binary flag. + 2005-03-28 John W. Eaton * oct-stream.cc (octave_stream::write): For compatibility, Write diff --git a/src/ls-hdf5.h b/src/ls-hdf5.h --- a/src/ls-hdf5.h +++ b/src/ls-hdf5.h @@ -45,9 +45,9 @@ hdf5_fstreambase (const char *name, int mode, int /* prot */ = 0) { - if (mode == std::ios::in) + if (mode & std::ios::in) file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT); - else if (mode == std::ios::out) + else if (mode & std::ios::out) file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (file_id < 0) @@ -70,9 +70,9 @@ { clear (); - if (mode == std::ios::in) + if (mode & std::ios::in) file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT); - else if (mode == std::ios::out) + else if (mode & std::ios::out) file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (file_id < 0) @@ -91,10 +91,12 @@ hdf5_ifstream () : hdf5_fstreambase (), std::istream (0) { } - hdf5_ifstream (const char *name, int mode = std::ios::in, int prot = 0) + hdf5_ifstream (const char *name, int mode = std::ios::in|std::ios::binary, + int prot = 0) : hdf5_fstreambase (name, mode, prot), std::istream (0) { } - void open (const char *name, int mode = std::ios::in, int prot = 0) + void open (const char *name, int mode = std::ios::in|std::ios::binary, + int prot = 0) { hdf5_fstreambase::open (name, mode, prot); } }; @@ -104,10 +106,12 @@ hdf5_ofstream () : hdf5_fstreambase (), std::ostream (0) { } - hdf5_ofstream (const char *name, int mode = std::ios::out, int prot = 0) + hdf5_ofstream (const char *name, int mode = std::ios::out|std::ios::binary, + int prot = 0) : hdf5_fstreambase (name, mode, prot), std::ostream (0) { } - void open (const char *name, int mode = std::ios::out, int prot = 0) + void open (const char *name, int mode = std::ios::out|std::ios::binary, + int prot = 0) { hdf5_fstreambase::open (name, mode, prot); } };