diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-29 15:19:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-29 15:19:31 (GMT) |
commit | fd56a593b7928da636b2494b25cd7478fed78c29 (patch) | |
tree | b815098d8bcf67f4290d3ca74132ce793503b94e /tools/lib | |
parent | 8aef67f0ae3e037df22c5319eb2eac8b95521b19 (diff) | |
download | hdf5-fd56a593b7928da636b2494b25cd7478fed78c29.zip hdf5-fd56a593b7928da636b2494b25cd7478fed78c29.tar.gz hdf5-fd56a593b7928da636b2494b25cd7478fed78c29.tar.bz2 |
Remove HD from C std lib file ops (#3206)
* HDfclose
* HDferror
* HDfeof
* HDfflush
* HDfopen
* HDfread
* HDfwrite
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools.c | 38 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_error.h | 6 |
3 files changed, 23 insertions, 23 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 50c6aae..30edd5f 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -245,7 +245,7 @@ h5tools_set_data_output_file(const char *fname, int is_bin) * so that rawdatastream is changed only when succeeded */ if (rawdatastream && rawdatastream != stdout) { - if (HDfclose(rawdatastream)) + if (fclose(rawdatastream)) HDperror("closing rawdatastream"); else rawdatastream = NULL; @@ -255,13 +255,13 @@ h5tools_set_data_output_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawdatastream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawdatastream = f; retvalue = SUCCEED; } @@ -293,7 +293,7 @@ h5tools_set_attr_output_file(const char *fname, int is_bin) * so that rawattrstream is changed only when succeeded */ if (rawattrstream && rawattrstream != stdout) { - if (HDfclose(rawattrstream)) + if (fclose(rawattrstream)) HDperror("closing rawattrstream"); else rawattrstream = NULL; @@ -303,13 +303,13 @@ h5tools_set_attr_output_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawattrstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawattrstream = f; retvalue = SUCCEED; } @@ -342,7 +342,7 @@ h5tools_set_input_file(const char *fname, int is_bin) * so that rawinstream is changed only when succeeded */ if (rawinstream && rawinstream != stdin) { - if (HDfclose(rawinstream)) + if (fclose(rawinstream)) HDperror("closing rawinstream"); else rawinstream = NULL; @@ -351,13 +351,13 @@ h5tools_set_input_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "rb")) != NULL) { + if ((f = fopen(fname, "rb")) != NULL) { rawinstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "r")) != NULL) { + if ((f = fopen(fname, "r")) != NULL) { rawinstream = f; retvalue = SUCCEED; } @@ -390,7 +390,7 @@ h5tools_set_output_file(const char *fname, int is_bin) * so that rawoutstream is changed only when succeeded */ if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if (fclose(rawoutstream)) HDperror("closing rawoutstream"); else rawoutstream = NULL; @@ -399,13 +399,13 @@ h5tools_set_output_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawoutstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawoutstream = f; retvalue = SUCCEED; } @@ -437,7 +437,7 @@ h5tools_set_error_file(const char *fname, int is_bin) * so that rawerrorstream is changed only when succeeded */ if (rawerrorstream && rawerrorstream != stderr) { - if (HDfclose(rawerrorstream)) + if (fclose(rawerrorstream)) HDperror("closing rawerrorstream"); else rawerrorstream = NULL; @@ -447,13 +447,13 @@ h5tools_set_error_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawerrorstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawerrorstream = f; retvalue = SUCCEED; } @@ -1810,9 +1810,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t else bytes_in = (size_t)block_index; - bytes_wrote = HDfwrite(mem, 1, bytes_in, stream); + bytes_wrote = fwrite(mem, 1, bytes_in, stream); - if (bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream))) + if (bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(stream))) H5TOOLS_THROW((-1), "fwrite failed"); block_index -= (hsize_t)bytes_wrote; @@ -1843,7 +1843,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); - if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream)) + if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) H5TOOLS_THROW((-1), "fwrite failed"); } /* i */ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ @@ -1990,7 +1990,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t H5TOOLS_DEBUG("H5T_OPAQUE"); for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char *)_mem) + block_index * size; - if (size != HDfwrite(mem, sizeof(char), size, stream)) + if (size != fwrite(mem, sizeof(char), size, stream)) H5TOOLS_THROW((-1), "fwrite failed"); } /* end for */ break; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 86fea01..bbe9554 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -33,7 +33,7 @@ /* Stream macros */ #define FLUSHSTREAM(S) \ if (S != NULL) \ - HDfflush(S) + fflush(S) #define PRINTSTREAM(S, F, ...) \ if (S != NULL) \ fprintf(S, F, __VA_ARGS__) diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 0e30cdf..4d0bef2 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -169,7 +169,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; fprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \ fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, "\n"); \ - HDfflush(stderr); \ + fflush(stderr); \ } while (0) #define H5TOOLS_DEBUG(...) \ @@ -177,7 +177,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; fprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, __func__); \ fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, "\n"); \ - HDfflush(stderr); \ + fflush(stderr); \ } while (0) #define H5TOOLS_ENDDEBUG(...) \ @@ -186,7 +186,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, "\n"); \ H5tools_INDENT_g -= 2; \ - HDfflush(stderr); \ + fflush(stderr); \ } while (0) #else |