Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HD from C std lib file ops #3206

Merged
merged 6 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions hl/c++/test/ptableTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ BasicTest()
int error;

printf("Testing %-62s", "basic functionality");
HDfflush(stdout);
fflush(stdout);

FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1);
if (!wrapper.IsValid())
Expand Down Expand Up @@ -139,7 +139,7 @@ TestCompoundDatatype()
int error;

printf("Testing %-62s", "compound datatypes");
HDfflush(stdout);
fflush(stdout);

/* Create compound datatype */
typedef struct {
Expand Down Expand Up @@ -210,7 +210,7 @@ TestGetNext()
int i;

printf("Testing %-62s", "GetNextPacket");
HDfflush(stdout);
fflush(stdout);

/* Create a dataset */
FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500);
Expand Down Expand Up @@ -277,7 +277,7 @@ TestCompress()
size_t cd_nelemts = 0;

printf("Testing %-62s", "compression");
HDfflush(stdout);
fflush(stdout);
try {
/* Prepare property list to set compression, randomly use deflate */
DSetCreatPropList dscreatplist;
Expand Down Expand Up @@ -326,7 +326,7 @@ TestGetPacket()
int theRecs[3];
int i;
printf("Testing %-62s", "GetPacket");
HDfflush(stdout);
fflush(stdout);

/* Create a dataset. Does not need to specify property list because
there is no compression. */
Expand Down Expand Up @@ -365,7 +365,7 @@ int
TestErrors()
{
printf("Testing %-62s", "error conditions");
HDfflush(stdout);
fflush(stdout);

/* Create a dataset */
FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1);
Expand Down Expand Up @@ -484,7 +484,7 @@ int
SystemTest()
{
printf("Testing %-62s", "multiple datatypes");
HDfflush(stdout);
fflush(stdout);

hid_t dtypeID1, dtypeID2;
hsize_t count;
Expand Down Expand Up @@ -626,7 +626,7 @@ TestHDFFV_9758()
}

printf("Testing %-62s", "data corruption in packed structs (HDFFV-9758)");
HDfflush(stdout);
fflush(stdout);

// Build a compound datatype
compound_type = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
Expand Down
4 changes: 2 additions & 2 deletions src/H5.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ H5_term_library(void)
H5_debug_open_stream_t *tmp_open_stream;

tmp_open_stream = H5_debug_g.open_stream;
(void)HDfclose(H5_debug_g.open_stream->stream);
(void)fclose(H5_debug_g.open_stream->stream);
H5_debug_g.open_stream = H5_debug_g.open_stream->next;
(void)H5MM_free(tmp_open_stream);
} /* end while */
Expand Down Expand Up @@ -753,7 +753,7 @@ H5__debug_mask(const char *s)

if (NULL ==
(open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
(void)HDfclose(stream);
(void)fclose(stream);
return;
} /* end if */

Expand Down
4 changes: 2 additions & 2 deletions src/H5Clog_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ H5C__log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mp
HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location);

/* Open log file and set it to be unbuffered */
if (NULL == (json_udata->outfile = HDfopen(file_name, "w")))
if (NULL == (json_udata->outfile = fopen(file_name, "w")))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
HDsetbuf(json_udata->outfile, NULL);

Expand Down Expand Up @@ -303,7 +303,7 @@ H5C__json_tear_down_logging(H5C_log_info_t *log_info)
H5MM_xfree(json_udata->message);

/* Close log file */
if (EOF == HDfclose(json_udata->outfile))
if (EOF == fclose(json_udata->outfile))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
json_udata->outfile = NULL;

Expand Down
4 changes: 2 additions & 2 deletions src/H5Clog_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ H5C__log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int m
HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank);

/* Open log file and set it to be unbuffered */
if (NULL == (trace_udata->outfile = HDfopen(file_name, "w")))
if (NULL == (trace_udata->outfile = fopen(file_name, "w")))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
HDsetbuf(trace_udata->outfile, NULL);

Expand Down Expand Up @@ -301,7 +301,7 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info)
H5MM_xfree(trace_udata->message);

/* Close log file */
if (EOF == HDfclose(trace_udata->outfile))
if (EOF == fclose(trace_udata->outfile))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
trace_udata->outfile = NULL;

Expand Down
8 changes: 4 additions & 4 deletions src/H5Dmpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static FILE *debug_stream = NULL;
do { \
if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \
fprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank); \
HDfflush(debug_stream); \
fflush(debug_stream); \
} \
} while (0)

Expand All @@ -442,7 +442,7 @@ static FILE *debug_stream = NULL;
do { \
if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \
fprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank, __VA_ARGS__); \
HDfflush(debug_stream); \
fflush(debug_stream); \
} \
} while (0)

Expand Down Expand Up @@ -1145,7 +1145,7 @@ H5D__piece_io(H5D_io_info_t *io_info)

HDsnprintf(debug_log_filename, 1024, "H5Dmpio_debug.rank%d", mpi_rank);

if (NULL == (debug_log_file = HDfopen(debug_log_filename, "a")))
if (NULL == (debug_log_file = fopen(debug_log_filename, "a")))
HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file")

/* Print a short header for this I/O operation */
Expand Down Expand Up @@ -1357,7 +1357,7 @@ H5D__piece_io(H5D_io_info_t *io_info)
/* Close debugging log file */
if (debug_log_file) {
fprintf(debug_log_file, "##############\n\n");
if (EOF == HDfclose(debug_log_file))
if (EOF == fclose(debug_log_file))
HDONE_ERROR(H5E_IO, H5E_CLOSEERROR, FAIL, "couldn't close debugging log file")
debug_stream = H5DEBUG(D);
}
Expand Down
2 changes: 1 addition & 1 deletion src/H5FDhdfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file)
br_val, br_suffix, /* raw data bytes */
am_val, am_suffix, /* metadata average */
ar_val, ar_suffix); /* raw data average */
HDfflush(stream);
fflush(stream);
}

done:
Expand Down
4 changes: 2 additions & 2 deletions src/H5FDlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)

/* Set the log file pointer */
if (fa->logfile)
file->logfp = HDfopen(fa->logfile, "w");
file->logfp = fopen(fa->logfile, "w");
else
file->logfp = stderr;

Expand Down Expand Up @@ -797,7 +797,7 @@ H5FD__log_close(H5FD_t *_file)
if (file->fa.flags & H5FD_LOG_FLAVOR)
file->flavor = (unsigned char *)H5MM_xfree(file->flavor);
if (file->logfp != stderr)
HDfclose(file->logfp);
fclose(file->logfp);
} /* end if */

if (file->fa.logfile)
Expand Down
4 changes: 2 additions & 2 deletions src/H5FDmirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ typedef struct H5FD_mirror_t {
/* end partial line */ \
fprintf(stdout, "\n"); \
fprintf(stdout, "```\n"); \
HDfflush(stdout); \
fflush(stdout); \
} while (0)
#else
#define LOG_XMIT_BYTES(label, buf, len) /* no-op */
Expand All @@ -132,7 +132,7 @@ typedef struct H5FD_mirror_t {
#define LOG_OP_CALL(name) \
do { \
printf("called %s()\n", (name)); \
HDfflush(stdout); \
fflush(stdout); \
} while (0)
#else
#define LOG_OP_CALL(name) /* no-op */
Expand Down
2 changes: 1 addition & 1 deletion src/H5FDros3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file)
am_val, am_suffix, /* metadata average */
ar_val, ar_suffix); /* raw data average */

HDfflush(stream);
fflush(stream);
}

done:
Expand Down
42 changes: 21 additions & 21 deletions src/H5FDs3comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next)
fprintf(stdout, "{%s}\n->", node_ptr->cat);
printf("(null)\n");
HDfflush(stdout);
fflush(stdout);
node_ptr = NULL;
#endif

Expand Down Expand Up @@ -302,7 +302,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
else {
#if S3COMMS_DEBUG
printf("CREATE NEW\n");
HDfflush(stdout);
fflush(stdout);
#endif
/*******************
* CREATE NEW LIST *
Expand Down Expand Up @@ -333,7 +333,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
if (value == NULL) {
#if S3COMMS_DEBUG
printf("REMOVE HEAD\n");
HDfflush(stdout);
fflush(stdout);
#endif
/***************
* REMOVE HEAD *
Expand All @@ -343,47 +343,47 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)

#if S3COMMS_DEBUG
printf("FREEING CAT (node)\n");
HDfflush(stdout);
fflush(stdout);
#endif
H5MM_xfree(node_ptr->cat);
#if S3COMMS_DEBUG
printf("FREEING LOWERNAME (node)\n");
HDfflush(stdout);
fflush(stdout);
#endif
H5MM_xfree(node_ptr->lowername);
#if S3COMMS_DEBUG
printf("FREEING NAME (node)\n");
HDfflush(stdout);
fflush(stdout);
#endif
H5MM_xfree(node_ptr->name);
#if S3COMMS_DEBUG
printf("FREEING VALUE (node)\n");
HDfflush(stdout);
fflush(stdout);
#endif
H5MM_xfree(node_ptr->value);
#if S3COMMS_DEBUG
printf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO");
HDfflush(stdout);
fflush(stdout);
#endif
assert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC);
node_ptr->magic += 1ul;
#if S3COMMS_DEBUG
printf("FREEING POINTER\n");
HDfflush(stdout);
fflush(stdout);
#endif
H5MM_xfree(node_ptr);

#if S3COMMS_DEBUG
printf("FREEING WORKING LOWERNAME\n");
HDfflush(stdout);
fflush(stdout);
#endif
H5MM_xfree(lowername);
lowername = NULL;
}
else {
#if S3COMMS_DEBUG
printf("MODIFY HEAD\n");
HDfflush(stdout);
fflush(stdout);
#endif
/***************
* MODIFY HEAD *
Expand Down Expand Up @@ -413,7 +413,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
else {
#if S3COMMS_DEBUG
printf("PREPEND NEW HEAD\n");
HDfflush(stdout);
fflush(stdout);
#endif
/*******************
* INSERT NEW HEAD *
Expand Down Expand Up @@ -442,7 +442,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
else {
#if S3COMMS_DEBUG
printf("APPEND A NODE\n");
HDfflush(stdout);
fflush(stdout);
#endif
/*******************
* APPEND NEW NODE *
Expand All @@ -465,7 +465,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
else {
#if S3COMMS_DEBUG
printf("INSERT A NODE\n");
HDfflush(stdout);
fflush(stdout);
#endif
/*******************
* INSERT NEW NODE *
Expand Down Expand Up @@ -494,7 +494,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)

#if S3COMMS_DEBUG
printf("REMOVE A NODE\n");
HDfflush(stdout);
fflush(stdout);
#endif
H5MM_xfree(tmp->cat);
H5MM_xfree(tmp->lowername);
Expand All @@ -511,7 +511,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
else {
#if S3COMMS_DEBUG
printf("MODIFY A NODE\n");
HDfflush(stdout);
fflush(stdout);
#endif
/*****************
* MODIFY A NODE *
Expand Down Expand Up @@ -2077,27 +2077,27 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *
if (ret < 0 || (size_t)ret >= 128)
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path")

credfile = HDfopen(filepath, "r");
credfile = fopen(filepath, "r");
if (credfile != NULL) {
if (H5FD__s3comms_load_aws_creds_from_file(credfile, profile_name, key_id_out, secret_access_key_out,
aws_region_out) == FAIL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials")
if (HDfclose(credfile) == EOF)
if (fclose(credfile) == EOF)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file")
credfile = NULL;
} /* end if credential file opened */

ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config");
if (ret < 0 || (size_t)ret >= 128)
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path")
credfile = HDfopen(filepath, "r");
credfile = fopen(filepath, "r");
if (credfile != NULL) {
if (H5FD__s3comms_load_aws_creds_from_file(
credfile, profile_name, (*key_id_out == 0) ? key_id_out : NULL,
(*secret_access_key_out == 0) ? secret_access_key_out : NULL,
(*aws_region_out == 0) ? aws_region_out : NULL) == FAIL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config")
if (HDfclose(credfile) == EOF)
if (fclose(credfile) == EOF)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file")
credfile = NULL;
} /* end if credential file opened */
Expand All @@ -2108,7 +2108,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *

done:
if (credfile != NULL)
if (HDfclose(credfile) == EOF)
if (fclose(credfile) == EOF)
HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file")

FUNC_LEAVE_NOAPI(ret_value)
Expand Down
Loading