From 9f2b38bb61df6136d214cb7ab248f73d1ff9458c Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 5 Apr 2022 11:02:12 -0500 Subject: Clang warning fixes from develop. (#1583) --- src/H5C.c | 4 ++-- src/H5Dchunk.c | 2 +- src/H5Dio.c | 2 +- src/H5FDdirect.c | 5 ++++- src/H5FDmirror.c | 6 ++++-- src/H5FDmirror_priv.h | 2 +- src/H5FDros3.c | 6 +++++- src/H5HFcache.c | 2 +- src/H5Zscaleoffset.c | 2 +- test/dsets.c | 16 ++++++++++------ test/dtypes.c | 6 +++--- testpar/t_2Gio.c | 16 ++++++++-------- testpar/t_dset.c | 16 ++++++++-------- testpar/t_file.c | 2 +- testpar/t_prop.c | 4 ++-- testpar/testpflush.sh.in | 2 +- tools/src/h5perf/perf.c | 2 +- tools/src/h5perf/pio_engine.c | 8 ++++---- tools/src/h5perf/pio_perf.c | 2 +- utils/mirror_vfd/mirror_remote.c | 2 +- utils/mirror_vfd/mirror_remote.h | 2 +- utils/mirror_vfd/mirror_server.c | 27 +++++++++++++-------------- utils/mirror_vfd/mirror_writer.c | 8 +++----- 23 files changed, 77 insertions(+), 67 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index 317a35d..0fc4416 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -1477,7 +1477,7 @@ H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, u * Finally, we usually don't check to see if the cache is * oversized at the end of an unprotect. As a result, it is * possible to have a vastly oversized cache with no protected - * entries as long as all the protects preceed the unprotects. + * entries as long as all the protects precede the unprotects. * * Since items 1 and 2 are not changing any time soon, I see * no point in worrying about the third. @@ -2449,7 +2449,7 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign * Finally, we usually don't check to see if the cache is * oversized at the end of an unprotect. As a result, it is * possible to have a vastly oversized cache with no protected - * entries as long as all the protects preceed the unprotects. + * entries as long as all the protects precede the unprotects. * * Since items 1, 2, and 3 are not changing any time soon, I * see no point in worrying about the fourth. diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6d4887e..8884cb2 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -5298,7 +5298,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) /* The number of bytes accessed in the chunk */ /* (i.e. the bytes replaced with fill values) */ - H5_CHECK_OVERFLOW(sel_nelmts, hssize_t, uint32_t); + H5_CHECK_OVERFLOW(sel_nelmts, hsize_t, uint32_t); bytes_accessed = (uint32_t)sel_nelmts * layout->u.chunk.dim[rank]; /* Release lock on chunk */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 4010854..9f220c6 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -448,7 +448,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t * difficulties with the notion. * * To solve this, we check to see if H5S_select_shape_same() returns true, - * and if the ranks of the mem and file spaces are different. If the are, + * and if the ranks of the mem and file spaces are different. If they are, * construct a new mem space that is equivalent to the old mem space, and * use that instead. * diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 35da1f1..367a613 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -233,8 +233,11 @@ H5FD_direct_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - if (H5I_VFL != H5I_get_type(H5FD_DIRECT_g)) + if (H5I_VFL != H5I_get_type(H5FD_DIRECT_g)) { H5FD_DIRECT_g = H5FD_register(&H5FD_direct_g, sizeof(H5FD_class_t), FALSE); + if (H5I_INVALID_HID == H5FD_DIRECT_g) + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register direct"); + } /* Set return value */ ret_value = H5FD_DIRECT_g; diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index f604eaf..f36b9c3 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -246,9 +246,11 @@ H5FD_mirror_init(void) LOG_OP_CALL(FUNC); - if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) + if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) { H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), FALSE); - + if (H5I_INVALID_HID == H5FD_MIRROR_g) + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register mirror"); + } ret_value = H5FD_MIRROR_g; done: diff --git a/src/H5FDmirror_priv.h b/src/H5FDmirror_priv.h index b387f72..f647c21 100644 --- a/src/H5FDmirror_priv.h +++ b/src/H5FDmirror_priv.h @@ -31,7 +31,7 @@ extern "C" { /* Define the maximum allowed size for a receiving buffer when accepting bytes to * write. Writes larger than this size are performed by multiple accept-write * steps by the Writer. */ -#define H5FD_MIRROR_DATA_BUFFER_MAX H5_GB /* 1 Gigabyte */ +#define H5FD_MIRROR_DATA_BUFFER_MAX (1024 * 1024 * 1024) /* 1 Gigabyte */ #define H5FD_MIRROR_XMIT_CURR_VERSION 1 #define H5FD_MIRROR_XMIT_MAGIC 0x87F8005B diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 2470c8b..decc341 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -326,8 +326,12 @@ H5FD_ros3_init(void) HDfprintf(stdout, "H5FD_ros3_init() called.\n"); #endif - if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) + if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) { H5FD_ROS3_g = H5FD_register(&H5FD_ros3_g, sizeof(H5FD_class_t), FALSE); + if (H5I_INVALID_HID == H5FD_ROS3_g) { + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register ros3"); + } + } #if ROS3_STATS /* pre-compute statsbin boundaries diff --git a/src/H5HFcache.c b/src/H5HFcache.c index fde5a4f..7b5078e 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -895,7 +895,7 @@ H5HF__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) * Function: H5HF__cache_iblock_verify_chksum * * Purpose: Verify the computed checksum of the data structure is the - * same as the stored chksum. + * same as the stored checksum. * * Return: Success: TRUE/FALSE * Failure: Negative diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index a1edf68..c7be014 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -1205,7 +1205,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* prepare parameters to pass to compress/decompress functions */ p.size = cd_values[H5Z_SCALEOFFSET_PARM_SIZE]; - p.mem_order = H5T_native_order_g; + p.mem_order = (unsigned)H5T_native_order_g; /* input; decompress */ if (flags & H5Z_FLAG_REVERSE) { diff --git a/test/dsets.c b/test/dsets.c index 941dd11..0423898 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -833,7 +833,11 @@ error: static herr_t test_compact_io(hid_t fapl) { - hid_t file, dataset, space, plist; + hid_t file = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; + hid_t verfile = -1, new_fapl = -1; hsize_t dims[2]; int wbuf[16][8], rbuf[16][8]; @@ -7585,9 +7589,9 @@ test_missing_chunk(hid_t file) hsize_t csize2[2] = {5, 5}; size_t u, i, j; /* Local Index variable */ - hid_t fapl; /* File access property list */ - H5F_libver_t low; /* File format low bound */ - H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index types */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + H5F_libver_t low; /* File format low bound */ + H5D_chunk_index_t idx_type, idx_type2; /* Dataset chunk index types */ TESTING("Read dataset with unwritten chunk & undefined fill value"); @@ -10720,8 +10724,8 @@ test_fixed_array(hid_t fapl) const hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */ hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */ - hid_t mem_id; /* Memory space ID */ - hid_t big_mem_id; /* Memory space ID for big dataset */ + hid_t mem_id = H5I_INVALID_HID; /* Memory space ID */ + hid_t big_mem_id; /* Memory space ID for big dataset */ hsize_t msize[1] = {POINTS}; /* Size of memory space */ hsize_t msize_big[1] = {POINTS_BIG}; /* Size of memory space for big dataset */ diff --git a/test/dtypes.c b/test/dtypes.c index 6c1a440..bf2ad5a 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2359,7 +2359,7 @@ test_compound_11(void) TEST_ERROR } /* end if */ if (((big_t *)buf_orig)[u].s1 == NULL || ((little_t *)buf)[u].s1 == NULL) { - HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n", __LINE__, (unsigned)u, + HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u, ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ @@ -2410,7 +2410,7 @@ test_compound_11(void) TEST_ERROR } /* end if */ if (((big_t *)buf_orig)[u].s1 == NULL || ((little_t *)buf)[u].s1 == NULL) { - HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n", __LINE__, (unsigned)u, + HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u, ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ @@ -2451,7 +2451,7 @@ test_compound_11(void) TEST_ERROR } /* end if */ if (((big_t *)buf_orig)[u].s1 == NULL || ((little_t *)buf)[u].s1 == NULL) { - HDprintf("Error, line #%d: buf_orig[%u].s1=%p, buf[%u].s1=%p\n", __LINE__, (unsigned)u, + HDprintf("Error, line #%d: buf_orig[%u].s1=%s, buf[%u].s1=%s\n", __LINE__, (unsigned)u, ((big_t *)buf_orig)[u].s1, (unsigned)u, ((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 0556929..b1c6e78 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -3347,12 +3347,12 @@ none_selection_chunk(void) static void test_actual_io_mode(int selection_mode) { - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = -1; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = -1; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = -1; - H5D_mpio_actual_io_mode_t actual_io_mode_write = -1; - H5D_mpio_actual_io_mode_t actual_io_mode_read = -1; - H5D_mpio_actual_io_mode_t actual_io_mode_expected = -1; + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + H5D_mpio_actual_io_mode_t actual_io_mode_write = H5D_MPIO_NO_COLLECTIVE; + H5D_mpio_actual_io_mode_t actual_io_mode_read = H5D_MPIO_NO_COLLECTIVE; + H5D_mpio_actual_io_mode_t actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; const char * filename; const char * test_name; hbool_t direct_multi_chunk_io; @@ -3605,8 +3605,8 @@ test_actual_io_mode(int selection_mode) default: test_name = "Undefined Selection Mode"; - actual_chunk_opt_mode_expected = -1; - actual_io_mode_expected = -1; + actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; break; } diff --git a/testpar/t_dset.c b/testpar/t_dset.c index f5746e1..d6be619 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -2905,12 +2905,12 @@ none_selection_chunk(void) static void test_actual_io_mode(int selection_mode) { - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = -1; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = -1; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = -1; - H5D_mpio_actual_io_mode_t actual_io_mode_write = -1; - H5D_mpio_actual_io_mode_t actual_io_mode_read = -1; - H5D_mpio_actual_io_mode_t actual_io_mode_expected = -1; + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + H5D_mpio_actual_io_mode_t actual_io_mode_write = H5D_MPIO_NO_COLLECTIVE; + H5D_mpio_actual_io_mode_t actual_io_mode_read = H5D_MPIO_NO_COLLECTIVE; + H5D_mpio_actual_io_mode_t actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; const char * filename; const char * test_name; hbool_t direct_multi_chunk_io; @@ -3163,8 +3163,8 @@ test_actual_io_mode(int selection_mode) default: test_name = "Undefined Selection Mode"; - actual_chunk_opt_mode_expected = -1; - actual_io_mode_expected = -1; + actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; + actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; break; } diff --git a/testpar/t_file.c b/testpar/t_file.c index a3be81d..52cae6d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -106,7 +106,7 @@ test_split_comm_access(void) /* delete the test file */ if (sub_mpi_rank == 0) { - mrc = MPI_File_delete((char *)filename, info); + mrc = MPI_File_delete(filename, info); /*VRFY((mrc==MPI_SUCCESS), ""); */ } } diff --git a/testpar/t_prop.c b/testpar/t_prop.c index b6adffd..606e100 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -215,7 +215,7 @@ test_plist_ed(void) dxpl = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl >= 0), "H5Pcreate succeeded"); - ret = H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f); + ret = H5Pset_btree_ratios(dxpl, 0.2, 0.6, 0.2); VRFY((ret >= 0), "H5Pset_btree_ratios succeeded"); ret = H5Pset_hyper_vector_size(dxpl, 5); @@ -354,7 +354,7 @@ test_plist_ed(void) ret = H5Pset_alignment(fapl, 2, 1024); VRFY((ret >= 0), "H5Pset_alignment succeeded"); - ret = H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f); + ret = H5Pset_cache(fapl, 1024, 128, 10485760, 0.3); VRFY((ret >= 0), "H5Pset_cache succeeded"); ret = H5Pset_elink_file_cache_size(fapl, 10485760); diff --git a/testpar/testpflush.sh.in b/testpar/testpflush.sh.in index be0dcb3..b400447 100644 --- a/testpar/testpflush.sh.in +++ b/testpar/testpflush.sh.in @@ -50,7 +50,7 @@ RUNPARALLELSCRIPT=`echo "@RUNPARALLEL@" | sed "s/$$/\$/g"` echo "*** NOTE ***********************************************************" echo "You may see complaints from mpiexec et al. that not all processes" echo "called MPI_Finalize(). This is an intended characteristic of the" -echo "test and should not be considered an error." +echo "test and should not be considered an error." echo "********************************************************************" eval ${RUNPARALLELSCRIPT} ./t_pflush1 diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c index e8c03d8..48f76f2 100644 --- a/tools/src/h5perf/perf.c +++ b/tools/src/h5perf/perf.c @@ -126,7 +126,7 @@ static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suf int main(int argc, char **argv) { - char * buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check; + char * buf = NULL, *tmp = NULL, *buf2 = NULL, *tmp2 = NULL, *check = NULL; int i, j, mynod = 0, nprocs = 1, my_correct = 1, correct, myerrno; double stim, etim; double write_tim = 0; diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index 4eaa284..e35f86e 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -1185,7 +1185,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby /* Set the file view */ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type, - (char *)"native", h5_io_info_g); + "native", h5_io_info_g); VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); /* Perform write */ @@ -1322,7 +1322,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby else { /* Set the file view */ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type, - (char *)"native", h5_io_info_g); + "native", h5_io_info_g); VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); /* Perform write */ @@ -2156,7 +2156,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt /* Set the file view */ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type, - (char *)"native", h5_io_info_g); + "native", h5_io_info_g); VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); /* Perform collective read */ @@ -2293,7 +2293,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt else { /* Set the file view */ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type, - (char *)"native", h5_io_info_g); + "native", h5_io_info_g); VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW"); /* Perform read */ diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c index 01165bb..948eec5 100644 --- a/tools/src/h5perf/pio_perf.c +++ b/tools/src/h5perf/pio_perf.c @@ -904,7 +904,7 @@ accumulate_minmax_stuff(minmax *mm, int count) int i; minmax total_mm; - total_mm.sum = 0.0f; + total_mm.sum = 0.0; total_mm.max = -DBL_MAX; total_mm.min = DBL_MAX; total_mm.num = count; diff --git a/utils/mirror_vfd/mirror_remote.c b/utils/mirror_vfd/mirror_remote.c index f61580d..8bb9544 100644 --- a/utils/mirror_vfd/mirror_remote.c +++ b/utils/mirror_vfd/mirror_remote.c @@ -147,7 +147,7 @@ mirror_log_bytes(struct mirror_log_info *info, unsigned int level, size_t n_byte * ---------------------------------------------------------------------------- */ loginfo_t * -mirror_log_init(char *path, char *prefix, unsigned int verbosity) +mirror_log_init(char *path, const char *prefix, unsigned int verbosity) { loginfo_t *info = NULL; diff --git a/utils/mirror_vfd/mirror_remote.h b/utils/mirror_vfd/mirror_remote.h index 6f37b0b..9415f7f 100644 --- a/utils/mirror_vfd/mirror_remote.h +++ b/utils/mirror_vfd/mirror_remote.h @@ -42,7 +42,7 @@ typedef struct mirror_log_info { void mirror_log(loginfo_t *info, unsigned int level, const char *format, ...); void mirror_log_bytes(loginfo_t *info, unsigned int level, size_t n_bytes, const unsigned char *buf); -loginfo_t *mirror_log_init(char *path, char *prefix, unsigned int verbosity); +loginfo_t *mirror_log_init(char *path, const char *prefix, unsigned int verbosity); int mirror_log_term(loginfo_t *loginfo); herr_t run_writer(int socketfd, H5FD_mirror_xmit_open_t *xmit_open); diff --git a/utils/mirror_vfd/mirror_server.c b/utils/mirror_vfd/mirror_server.c index 9de07c1..d00e443 100644 --- a/utils/mirror_vfd/mirror_server.c +++ b/utils/mirror_vfd/mirror_server.c @@ -94,14 +94,14 @@ * --------------------------------------------------------------------------- */ struct op_args { - uint32_t magic; - int help; - int main_port; - int verbosity; - int log_prepend_serv; - int log_prepend_type; - char log_path[PATH_MAX + 1]; - char writer_log_path[PATH_MAX + 1]; + uint32_t magic; + int help; + int main_port; + unsigned int verbosity; + int log_prepend_serv; + int log_prepend_type; + char log_path[PATH_MAX + 1]; + char writer_log_path[PATH_MAX + 1]; }; /* --------------------------------------------------------------------------- @@ -224,7 +224,7 @@ parse_args(int argc, char **argv, struct op_args *args_out) } /* end if port */ else if (!HDstrncmp(argv[i], "--verbosity=", 12)) { mirror_log(NULL, V_INFO, "parsing 'verbosity' (%s)", argv[i] + 12); - args_out->verbosity = HDatoi(argv[i] + 12); + args_out->verbosity = (unsigned int)HDatoi(argv[i] + 12); } /* end if verbosity */ else if (!HDstrncmp(argv[i], "--logpath=", 10)) { mirror_log(NULL, V_INFO, "parsing 'logpath' (%s)", argv[i] + 10); @@ -456,7 +456,7 @@ error: * --------------------------------------------------------------------------- */ static void -wait_for_child(int sig) +wait_for_child(int H5_ATTR_UNUSED sig) { while (HDwaitpid(-1, NULL, WNOHANG) > 0) ; @@ -476,7 +476,7 @@ handle_requests(struct server_run *run) { int connfd = -1; /**/ char mybuf[H5FD_MIRROR_XMIT_OPEN_SIZE]; /**/ - int ret; /* general-purpose error-checking */ + ssize_t ret; /* general-purpose error-checking */ int pid; /* process ID of fork */ struct sigaction sa; int ret_value = 0; @@ -521,14 +521,13 @@ handle_requests(struct server_run *run) /* Read handshake from port connection. */ - ret = (int)HDread(connfd, &mybuf, H5FD_MIRROR_XMIT_OPEN_SIZE); - if (-1 == ret) { + if ((ret = HDread(connfd, &mybuf, H5FD_MIRROR_XMIT_OPEN_SIZE)) < 0) { mirror_log(run->loginfo, V_ERR, "read:%d", ret); goto error; } mirror_log(run->loginfo, V_INFO, "received %d bytes", ret); mirror_log(run->loginfo, V_ALL, "```"); - mirror_log_bytes(run->loginfo, V_ALL, ret, (const unsigned char *)mybuf); + mirror_log_bytes(run->loginfo, V_ALL, (size_t)ret, (const unsigned char *)mybuf); mirror_log(run->loginfo, V_ALL, "```"); /* Respond to handshake message. diff --git a/utils/mirror_vfd/mirror_writer.c b/utils/mirror_vfd/mirror_writer.c index d3f12de..5726db5 100644 --- a/utils/mirror_vfd/mirror_writer.c +++ b/utils/mirror_vfd/mirror_writer.c @@ -788,8 +788,7 @@ do_write(struct mirror_session *session, const unsigned char *xmit_buf) */ sum_bytes_written = 0; do { - nbytes_in_packet = HDread(session->sockfd, buf, H5FD_MIRROR_DATA_BUFFER_MAX); - if (-1 == nbytes_in_packet) { + if ((nbytes_in_packet = HDread(session->sockfd, buf, H5FD_MIRROR_DATA_BUFFER_MAX)) < 0) { mirror_log(session->loginfo, V_ERR, "can't read into databuffer"); reply_error(session, "can't read data buffer"); return -1; @@ -798,7 +797,7 @@ do_write(struct mirror_session *session, const unsigned char *xmit_buf) mirror_log(session->loginfo, V_INFO, "received %zd bytes", nbytes_in_packet); if (HEXDUMP_WRITEDATA) { mirror_log(session->loginfo, V_ALL, "DATA:\n```"); - mirror_log_bytes(session->loginfo, V_ALL, nbytes_in_packet, (const unsigned char *)buf); + mirror_log_bytes(session->loginfo, V_ALL, (size_t)nbytes_in_packet, (const unsigned char *)buf); mirror_log(session->loginfo, V_ALL, "```"); } @@ -859,8 +858,7 @@ receive_communique(struct mirror_session *session, struct sock_comm *comm) mirror_log(session->loginfo, V_INFO, "ready to receive"); /* TODO */ - read_ret = HDread(session->sockfd, comm->raw, H5FD_MIRROR_XMIT_BUFFER_MAX); - if (-1 == read_ret) { + if ((read_ret = HDread(session->sockfd, comm->raw, H5FD_MIRROR_XMIT_BUFFER_MAX)) < 0) { mirror_log(session->loginfo, V_ERR, "read:%zd", read_ret); goto error; } -- cgit v0.12