changeset 5255:3c4237738c3e

[project @ 2005-03-29 18:35:32 by jwe]
author jwe
date Tue, 29 Mar 2005 18:35:32 +0000
parents 2fa6253e36a3
children 418771cb5ab2
files src/ChangeLog src/ls-hdf5.h
diffstat 2 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Mar 28 23:37:22 2005 +0000
+++ b/src/ChangeLog	Tue Mar 29 18:35:32 2005 +0000
@@ -1,3 +1,11 @@
+2005-03-29  John W. Eaton  <jwe@octave.org>
+
+	* 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  <jwe@octave.org>
 
 	* oct-stream.cc (octave_stream::write): For compatibility, Write
--- a/src/ls-hdf5.h	Mon Mar 28 23:37:22 2005 +0000
+++ b/src/ls-hdf5.h	Tue Mar 29 18:35:32 2005 +0000
@@ -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); }
 };