mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-18 17:40:55 +08:00
[svn-r23953] Update stream handling to allow binary mode - due to unjam fix.
Tested: local linux
This commit is contained in:
parent
ba181d404d
commit
4e1695576c
@ -1020,7 +1020,7 @@ parse_start:
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
if (h5tools_set_output_file(opt_arg) < 0) {
|
||||
if (h5tools_set_output_file(opt_arg, 0) < 0) {
|
||||
usage(h5tools_getprogname());
|
||||
goto error;
|
||||
}
|
||||
|
@ -287,9 +287,18 @@ h5tools_set_attr_output_file(const char *fname, int is_bin)
|
||||
|
||||
/* First check if filename is string "NULL" */
|
||||
if (fname != NULL) {
|
||||
if ((f = HDfopen(fname, "w")) != NULL) {
|
||||
rawattrstream = f;
|
||||
retvalue = SUCCEED;
|
||||
/* binary output */
|
||||
if (is_bin) {
|
||||
if ((f = HDfopen(fname, "wb")) != NULL) {
|
||||
rawattrstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((f = HDfopen(fname, "w")) != NULL) {
|
||||
rawattrstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -312,7 +321,7 @@ h5tools_set_attr_output_file(const char *fname, int is_bin)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
h5tools_set_input_file(const char *fname)
|
||||
h5tools_set_input_file(const char *fname, int is_bin)
|
||||
{
|
||||
int retvalue = FAIL;
|
||||
FILE *f; /* temporary holding place for the stream pointer
|
||||
@ -326,9 +335,18 @@ h5tools_set_input_file(const char *fname)
|
||||
}
|
||||
/* First check if filename is string "NULL" */
|
||||
if (fname != NULL) {
|
||||
if ((f = HDfopen(fname, "r")) != NULL) {
|
||||
rawinstream = f;
|
||||
retvalue = SUCCEED;
|
||||
/* binary output */
|
||||
if (is_bin) {
|
||||
if ((f = HDfopen(fname, "rb")) != NULL) {
|
||||
rawinstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((f = HDfopen(fname, "r")) != NULL) {
|
||||
rawinstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -351,7 +369,7 @@ h5tools_set_input_file(const char *fname)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
h5tools_set_output_file(const char *fname)
|
||||
h5tools_set_output_file(const char *fname, int is_bin)
|
||||
{
|
||||
int retvalue = FAIL;
|
||||
FILE *f; /* temporary holding place for the stream pointer
|
||||
@ -365,9 +383,18 @@ h5tools_set_output_file(const char *fname)
|
||||
}
|
||||
/* First check if filename is string "NULL" */
|
||||
if (fname != NULL) {
|
||||
if ((f = HDfopen(fname, "w")) != NULL) {
|
||||
rawoutstream = f;
|
||||
retvalue = SUCCEED;
|
||||
/* binary output */
|
||||
if (is_bin) {
|
||||
if ((f = HDfopen(fname, "wb")) != NULL) {
|
||||
rawoutstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((f = HDfopen(fname, "w")) != NULL) {
|
||||
rawoutstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -390,7 +417,7 @@ h5tools_set_output_file(const char *fname)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
h5tools_set_error_file(const char *fname)
|
||||
h5tools_set_error_file(const char *fname, int is_bin)
|
||||
{
|
||||
int retvalue = FAIL;
|
||||
FILE *f; /* temporary holding place for the stream pointer
|
||||
@ -403,8 +430,24 @@ h5tools_set_error_file(const char *fname)
|
||||
rawerrorstream = NULL;
|
||||
}
|
||||
|
||||
if ((f = HDfopen(fname, "w")) != NULL) {
|
||||
rawerrorstream = f;
|
||||
/* First check if filename is string "NULL" */
|
||||
if (fname != NULL) {
|
||||
/* binary output */
|
||||
if (is_bin) {
|
||||
if ((f = HDfopen(fname, "wb")) != NULL) {
|
||||
rawerrorstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((f = HDfopen(fname, "w")) != NULL) {
|
||||
rawerrorstream = f;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
rawerrorstream = NULL;
|
||||
retvalue = SUCCEED;
|
||||
}
|
||||
|
||||
|
@ -552,9 +552,9 @@ H5TOOLS_DLL void h5tools_init(void);
|
||||
H5TOOLS_DLL void h5tools_close(void);
|
||||
H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin);
|
||||
H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin);
|
||||
H5TOOLS_DLL int h5tools_set_input_file(const char *fname);
|
||||
H5TOOLS_DLL int h5tools_set_output_file(const char *fname);
|
||||
H5TOOLS_DLL int h5tools_set_error_file(const char *fname);
|
||||
H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin);
|
||||
H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
|
||||
H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
|
||||
H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
|
||||
const char *driver, char *drivername, size_t drivername_len);
|
||||
H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user