Skip to content

Commit

Permalink
Fix several warnings (HDFGroup#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF committed May 8, 2022
1 parent 6d1a640 commit 64d53e8
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 70 deletions.
2 changes: 2 additions & 0 deletions src/H5FDros3.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
* Relies on "s3comms" utility layer to implement the AWS REST API.
*/

#ifdef H5_HAVE_ROS3_VFD
/* This source code file is part of the H5FD driver module */
#include "H5FDdrvr_module.h"
#endif

#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
Expand Down
58 changes: 29 additions & 29 deletions src/H5Sprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,35 +263,35 @@ H5_DLL herr_t H5S_extent_copy(H5S_t *dst, const H5S_t *src);
/* Operations on selections */
H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p);
H5_DLL H5S_sel_type H5S_get_select_type(const H5S_t *space);
H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_iter_op_t *op,
void *op_data);
H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *buf);
H5_DLL htri_t H5S_select_valid(const H5S_t *space);
H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space);
H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset);
H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space);
H5_DLL herr_t H5S_get_select_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim);
H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
H5_DLL htri_t H5S_select_shape_same(H5S_t *space1, H5S_t *space2);
H5_DLL htri_t H5S_select_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
H5_DLL herr_t H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr,
unsigned new_space_rank, hsize_t element_size,
ptrdiff_t *buf_adj);
H5_DLL herr_t H5S_select_release(H5S_t *ds);
H5_DLL hssize_t H5S_select_serial_size(H5S_t *space);
H5_DLL herr_t H5S_select_serialize(H5S_t *space, uint8_t **p);
H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
H5_DLL htri_t H5S_select_is_regular(H5S_t *space);
H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
H5_DLL herr_t H5S_select_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_intersect_space,
H5S_t **new_space_ptr, hbool_t share_space);
H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space);
H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_iter_op_t *op,
void *op_data);
H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *buf);
H5_DLL htri_t H5S_select_valid(const H5S_t *space);
H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space);
H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset);
H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space);
H5_DLL herr_t H5S_get_select_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim);
H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
H5_DLL htri_t H5S_select_shape_same(H5S_t *space1, H5S_t *space2);
H5_DLL htri_t H5S_select_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
H5_DLL herr_t H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr,
unsigned new_space_rank, hsize_t element_size,
ptrdiff_t *buf_adj);
H5_DLL herr_t H5S_select_release(H5S_t *ds);
H5_DLL hssize_t H5S_select_serial_size(H5S_t *space);
H5_DLL herr_t H5S_select_serialize(H5S_t *space, uint8_t **p);
H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
H5_DLL htri_t H5S_select_is_regular(H5S_t *space);
H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
H5_DLL herr_t H5S_select_adjust_s(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_intersect_space,
H5S_t **new_space_ptr, hbool_t share_space);
H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space);

/* Operations on all selections */
H5_DLL herr_t H5S_select_all(H5S_t *space, hbool_t rel_prev);
Expand Down
2 changes: 1 addition & 1 deletion test/cache_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -4513,7 +4513,7 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t
int mile_stone = 1;
int32_t type;
int32_t idx;
int32_t local_max_index[NUMBER_OF_ENTRY_TYPES];
int32_t local_max_index[NUMBER_OF_ENTRY_TYPES] = {0};

if (verbose)
HDfprintf(stdout, "%s: entering.\n", FUNC);
Expand Down
46 changes: 23 additions & 23 deletions test/chunk_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,31 +153,31 @@ reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size)
static herr_t
test_get_chunk_info_highest18(hid_t fapl)
{
char filename[FILENAME_BUF_SIZE];
hid_t chunkfile = -1; /* File ID */
hid_t dspace = -1; /* Dataspace ID */
hid_t dset = -1; /* Dataset ID */
hid_t cparms = -1; /* Creation plist */
hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */
int out_buf[NX][NY]; /* Buffer to read data in */
size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int); /* Buffer size of a chk */
unsigned filter_mask = 0; /* Filter mask */
unsigned read_flt_msk = 0; /* Filter mask after direct read */
int fillvalue = -1; /* Fill value */
char filename[FILENAME_BUF_SIZE];
hid_t chunkfile = -1; /* File ID */
hid_t dspace = -1; /* Dataspace ID */
hid_t dset = -1; /* Dataset ID */
hid_t cparms = -1; /* Creation plist */
hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */
int out_buf[NX][NY]; /* Buffer to read data in */
size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int); /* Buffer size of a chk */
unsigned filter_mask = 0; /* Filter mask */
unsigned read_flt_msk = 0; /* Filter mask after direct read */
int fillvalue = -1; /* Fill value */
#ifdef H5_HAVE_FILTER_DEFLATE
int aggression = 9; /* Compression aggression setting */
int aggression = 9; /* Compression aggression setting */
#endif
H5F_libver_t low, high; /* File format bounds */
hsize_t offset[2]; /* Offset coordinates of a chunk */
hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
hsize_t size = 0; /* Size of an allocated/written chunk */
hsize_t nchunks = 0; /* Number of chunks */
haddr_t addr = 0; /* Address of an allocated/written chunk */
hsize_t index = 0; /* Index of a chunk */
int n; /* Used on buffer, to avoid conversion warning */
H5F_libver_t low, high; /* File format bounds */
hsize_t offset[2]; /* Offset coordinates of a chunk */
hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
hsize_t size = 0; /* Size of an allocated/written chunk */
hsize_t nchunks = 0; /* Number of chunks */
haddr_t addr = 0; /* Address of an allocated/written chunk */
hsize_t index = 0; /* Index of a chunk */
int n; /* Used on buffer, to avoid conversion warning */
hsize_t i, j;
herr_t ret;

Expand Down
2 changes: 2 additions & 0 deletions test/dtypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,8 @@ test_compound_11(void)
((big_t *)buf)[u].i1 = (int)(u * 3);
((big_t *)buf)[u].i2 = (int)(u * 5);
((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32);
if (!((big_t *)buf)[u].s1)
TEST_ERROR
HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u);
} /* end for */

Expand Down
20 changes: 10 additions & 10 deletions test/genall5.c
Original file line number Diff line number Diff line change
Expand Up @@ -1649,10 +1649,10 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data)
failure_mssg = "ds_ctg_i: H5Dwrite() failed.";
}
HDassert(ret >= 0);

HDfree(wdata);
}

HDfree(wdata);

if (pass) {
ret = H5Dclose(dsid);

Expand Down Expand Up @@ -1867,10 +1867,10 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data)
}
HDassert((int)u == rdata[u]);
}

HDfree(rdata);
} /* end if */

HDfree(rdata);

if (pass) {
ret = H5Dclose(dsid);

Expand Down Expand Up @@ -2226,10 +2226,10 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data)
}
HDassert((int)u == rdata[u]);
}

HDfree(rdata);
} /* end if */

HDfree(rdata);

if (pass) {
ret = H5Dclose(dsid);

Expand Down Expand Up @@ -2566,10 +2566,10 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data)
}
HDassert((int)u == rdata[u]);
}

HDfree(rdata);
} /* end if */

HDfree(rdata);

if (pass) {
ret = H5Dclose(dsid);

Expand Down Expand Up @@ -2958,10 +2958,10 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data)
failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed.";
}
HDassert(ret >= 0);

HDfree(rdata);
} /* end if */

HDfree(rdata);

if (pass) {
ret = H5Sclose(sid);

Expand Down
12 changes: 12 additions & 0 deletions test/objcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -4459,6 +4459,10 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
TESTING("H5Ocopy(): compressed dataset");

#ifndef H5_HAVE_FILTER_DEFLATE
(void)fcpl_src;
(void)fcpl_dst;
(void)src_fapl;
(void)dst_fapl; /* Silence compiler */
SKIPPED();
puts(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
Expand Down Expand Up @@ -4884,6 +4888,10 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
}

#ifndef H5_HAVE_FILTER_DEFLATE
(void)fcpl_src;
(void)fcpl_dst;
(void)src_fapl;
(void)dst_fapl; /* Silence compiler */
SKIPPED();
puts(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
Expand Down Expand Up @@ -7231,6 +7239,10 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
TESTING("H5Ocopy(): compressed dataset with VLEN datatype");

#ifndef H5_HAVE_FILTER_DEFLATE
(void)fcpl_src;
(void)fcpl_dst;
(void)src_fapl;
(void)dst_fapl; /* Silence compiler */
SKIPPED();
puts(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
Expand Down
39 changes: 32 additions & 7 deletions tools/src/h5dump/h5dump_xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -2354,14 +2354,21 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_context_t ctx; /* print context */
h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
char * tmp;
char * dtxid;
char * parentxid;
char * t_tmp;
char * t_prefix;
char * t_name;
char * tmp = NULL;
char * dtxid = NULL;
char * parentxid = NULL;
char * t_tmp = NULL;
char * t_prefix = NULL;
char * t_name = NULL;

tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
if (tmp == NULL) {
indentation(dump_indent);
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}

HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
Expand Down Expand Up @@ -2616,6 +2623,13 @@ xml_dump_group(hid_t gid, const char *name)
}
else {
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
if (tmp == NULL) {
indentation(dump_indent);
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
return;
}

HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
cp = HDstrrchr(par, '/');
Expand Down Expand Up @@ -3126,8 +3140,11 @@ xml_print_strs(hid_t did, int source)
}

bp = (char *)buf;
if (!is_vlstr)
if (!is_vlstr) {
onestring = (char *)HDcalloc(tsiz, sizeof(char));
if (onestring == NULL)
goto error;
}

/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
Expand Down Expand Up @@ -3749,6 +3766,14 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
char *pstr = (char *)HDmalloc((size_t)100);

tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
if (tmp == NULL) {
error_msg("buffer allocation failed\n");
h5tools_setstatus(EXIT_FAILURE);
HDfree(rstr);
HDfree(pstr);
return;
}

HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
Expand Down

0 comments on commit 64d53e8

Please sign in to comment.