[svn-r27801] Minor warning fixes in the tools.

Tested on: jam (too minor for h5committest)
This commit is contained in:
Dana Robinson 2015-09-16 10:23:16 -05:00
parent 2385b2b0ad
commit d90e4acfa7
15 changed files with 152 additions and 236 deletions

View File

@ -1014,14 +1014,14 @@ int test_attributes(const char *file,
static int test_attributes_verbose_level(const char *fname1, const char *fname2)
{
herr_t status = SUCCEED;
hid_t fid1, fid2;
hid_t f1_gid, f2_gid;
hid_t f1_gid2, f2_gid2;
hid_t f1_gid3, f2_gid3;
hid_t f1_gid4, f2_gid4;
hid_t f1_did, f2_did;
hid_t f1_sid, f2_sid;
hid_t f1_tid, f2_tid;
hid_t fid1 = -1, fid2 = -1;
hid_t f1_gid = -1, f2_gid = -1;
hid_t f1_gid2 = -1, f2_gid2 = -1;
hid_t f1_gid3 = -1, f2_gid3 = -1;
hid_t f1_gid4 = -1, f2_gid4 = -1;
hid_t f1_did = -1, f2_did = -1;
hid_t f1_sid = -1, f2_sid = -1;
hid_t f1_tid = -1, f2_tid = -1;
/* dset */
hsize_t dset_dims[1]={3};
int dset_data[3] = {0,1,2};
@ -1252,9 +1252,9 @@ out:
/*-----------------------------------------------------------------------
* Close
*-----------------------------------------------------------------------*/
if(fid1)
if(fid1 > 0)
H5Fclose(fid1);
if(fid2)
if(fid2 > 0)
H5Fclose(fid2);
if(f1_gid > 0)
H5Gclose(f1_gid);
@ -1276,13 +1276,13 @@ out:
H5Dclose(f1_did);
if(f2_did > 0)
H5Dclose(f2_did);
if(f1_sid >0)
if(f1_sid > 0)
H5Sclose(f1_sid);
if(f2_sid >0)
if(f2_sid > 0)
H5Sclose(f2_sid);
if(f1_tid >0)
if(f1_tid > 0)
H5Tclose(f1_tid);
if(f2_tid >0)
if(f2_tid > 0)
H5Tclose(f2_tid);
return status;
@ -2797,15 +2797,18 @@ out:
#define GRP_R_DSETNAME2 "dset2"
static int test_group_recurse2(void)
{
hid_t fileid1;
hid_t grp1=0, grp2;
hid_t grp3=0;
hid_t grp4=0;
hid_t dset1, dset2;
hid_t datatype, dataspace; /* handles */
hid_t fileid2;
hid_t fileid3;
hid_t fileid4;
hid_t fileid1 = -1;
hid_t grp1 = -1;
hid_t grp2 = -1;
hid_t grp3 = -1;
hid_t grp4 = -1;
hid_t dset1 = -1;
hid_t dset2 = -1;
hid_t datatype = -1;
hid_t dataspace = -1;
hid_t fileid2 = -1;
hid_t fileid3 = -1;
hid_t fileid4 = -1;
hsize_t dimsf[2]; /* dataset dimensions */
herr_t status=0;
int data1[4][2] = {{0,0},{1,1},{2,2},{3,3}};
@ -3098,12 +3101,18 @@ out:
/*
* Close/release resources.
*/
H5Sclose(dataspace);
H5Tclose(datatype);
H5Fclose(fileid1);
H5Fclose(fileid2);
H5Fclose(fileid3);
H5Fclose(fileid4);
if(dataspace > 0)
H5Sclose(dataspace);
if(datatype > 0)
H5Tclose(datatype);
if(fileid1 > 0)
H5Fclose(fileid1);
if(fileid2 > 0)
H5Fclose(fileid2);
if(fileid3 > 0)
H5Fclose(fileid3);
if(fileid4 > 0)
H5Fclose(fileid4);
return status;
}
@ -3506,8 +3515,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
{
int i;
hid_t fid1; /* file id */
hid_t gid;
hid_t fid1 = -1; /* file id */
hid_t gid = -1;
/* compound1 datatype */
typedef struct comp1_t
@ -4153,60 +4162,60 @@ out:
/*-----------------------------------------------------------------------
* Close
*-----------------------------------------------------------------------*/
if(fid1)
if(fid1 > 0)
H5Fclose(fid1);
if(gid)
if(gid > 0)
H5Gclose(gid);
/* vlen string */
if(tid_vlen_str)
if(tid_vlen_str > 0)
H5Tclose(tid_vlen_str);
if(sid_vlen_str)
if(sid_vlen_str > 0)
H5Sclose(sid_vlen_str);
/* fixed len string */
if(tid_fixlen_str)
if(tid_fixlen_str > 0)
H5Tclose(tid_fixlen_str);
if(sid_fixlen_str)
if(sid_fixlen_str > 0)
H5Sclose(sid_fixlen_str);
/* vlen string array */
if(tid_vlen_str_array_pre)
if(tid_vlen_str_array_pre > 0)
H5Tclose(tid_vlen_str_array_pre);
if(tid_vlen_str_array)
if(tid_vlen_str_array > 0)
H5Tclose(tid_vlen_str_array);
if(sid_vlen_str_array)
if(sid_vlen_str_array > 0)
H5Sclose(sid_vlen_str_array);
/* fixed len string array */
if(tid_fixlen_str_array_pre)
if(tid_fixlen_str_array_pre > 0)
H5Tclose(tid_fixlen_str_array_pre);
if(tid_fixlen_str_array)
if(tid_fixlen_str_array > 0)
H5Tclose(tid_fixlen_str_array);
if(sid_fixlen_str_array)
if(sid_fixlen_str_array > 0)
H5Sclose(sid_fixlen_str_array);
/* compound */
if(tid1_comp)
if(tid1_comp > 0)
H5Tclose(tid1_comp);
if(tid2_comp)
if(tid2_comp > 0)
H5Tclose(tid2_comp);
if(tid3_comp)
if(tid3_comp > 0)
H5Tclose(tid3_comp);
if(tid4_comp)
if(tid4_comp > 0)
H5Tclose(tid4_comp);
if(tid5_comp)
if(tid5_comp > 0)
H5Tclose(tid5_comp);
if(tid6_comp)
if(tid6_comp > 0)
H5Tclose(tid6_comp);
if(tid7_comp)
if(tid7_comp > 0)
H5Tclose(tid7_comp);
if(tid8_comp)
if(tid8_comp > 0)
H5Tclose(tid8_comp);
if(tid9_comp)
if(tid9_comp > 0)
H5Tclose(tid9_comp);
if(did_comp)
if(did_comp > 0)
H5Dclose(did_comp);
if(sid_comp)
if(sid_comp > 0)
H5Sclose(sid_comp);
return status;
}
} /* end test_comp_vlen_strings() */
/*-------------------------------------------------------------------------

View File

@ -1518,10 +1518,10 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
void
handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
hid_t oid = -1;
hid_t attr_id = -1;
char *obj_name;
char *attr_name;
hid_t oid = -1;
hid_t attr_id = -1;
char *obj_name = NULL;
char *attr_name = NULL;
int j;
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@ -1898,8 +1898,9 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0)
if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
}
else {
error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
@ -1941,7 +1942,7 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
case H5L_TYPE_MAX:
HDassert(0);
/* fall through */
H5L_TYPE_HARD:
case H5L_TYPE_HARD:
default:
begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");

View File

@ -34,6 +34,10 @@ void dump_fcontents(hid_t fid);
/* callback function used by H5Aiterate2() */
herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
/* other iteration functions */
void link_iteration(hid_t gid, unsigned crt_order_flags);
void attr_iteration(hid_t gid, unsigned attr_crt_order_flags);
void handle_paths(hid_t fid, const char *path_name, void *data, int pe, const char *display_name);
void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name);
void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);

View File

@ -23,23 +23,25 @@
#define COL 3
/* Macros for displaying objects */
#define begin_obj(obj,name,begin) \
do { \
if ((name)) \
#define begin_obj(obj,name,begin) \
do { \
if ((name)) { \
PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
else \
PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
} \
else { \
PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
} \
} while(0);
#define end_obj(obj,end) \
do { \
if(HDstrlen(end)) { \
PRINTSTREAM(rawoutstream, "%s", end); \
if(HDstrlen(obj)) \
PRINTVALSTREAM(rawoutstream, " "); \
} \
if(HDstrlen(obj)) \
PRINTSTREAM(rawoutstream, "%s", obj); \
#define end_obj(obj,end) \
do { \
if(HDstrlen(end)) { \
PRINTSTREAM(rawoutstream, "%s", end); \
if(HDstrlen(obj)) \
PRINTVALSTREAM(rawoutstream, " "); \
} \
if(HDstrlen(obj)) \
PRINTSTREAM(rawoutstream, "%s", obj); \
} while(0);

View File

@ -2968,9 +2968,9 @@ static int
xml_print_refs(hid_t did, int source)
{
herr_t e;
hid_t type;
hid_t space;
hssize_t ssiz;
hid_t type = -1;
hid_t space = -1;
hssize_t ssiz = -1;
hsize_t i;
size_t tsiz;
hobj_ref_t *refbuf = NULL;
@ -3125,11 +3125,11 @@ static int
xml_print_strs(hid_t did, int source)
{
herr_t e;
hid_t type;
hid_t space;
hssize_t ssiz;
hid_t type = -1;
hid_t space = -1;
hssize_t ssiz = -1;
htri_t is_vlstr = FALSE;
size_t tsiz;
size_t tsiz = 0;
size_t i;
size_t str_size = 0;
char *bp = NULL;

View File

@ -265,7 +265,7 @@ err:
static int gtoken(char *s)
{
size_t len;
int token;
int token = ERR;
const char *err1 = "Illegal argument: %s.\n";
@ -995,16 +995,16 @@ out:
*/
static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
{
hid_t group_id;
hid_t dset_id;
hid_t space_id;
hid_t mspace_id;
hid_t type_id;
hid_t handle;
char *str1 = NULL;
char *str2 = NULL;
char *str3 = NULL;
char str[1024] = "";
hid_t group_id = -1;
hid_t dset_id = -1;
hid_t space_id = -1;
hid_t mspace_id = -1;
hid_t type_id = -1;
hid_t handle = -1;
char *str1 = NULL;
char *str2 = NULL;
char *str3 = NULL;
char str[1024] = "";
int j;
hsize_t line;

View File

@ -51,17 +51,17 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
int
h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
hid_t fidin; /* file ID for input file*/
hid_t fidout; /* file ID for output file*/
hid_t did; /* dataset ID */
hid_t pid; /* dataset creation property list ID */
hid_t sid; /* space ID */
hid_t tid; /* type ID */
hid_t fidin = -1; /* file ID for input file*/
hid_t fidout = -1; /* file ID for output file*/
hid_t did = -1; /* dataset ID */
hid_t pid = -1; /* dataset creation property list ID */
hid_t sid = -1; /* space ID */
hid_t tid = -1; /* type ID */
unsigned int i;
trav_table_t *travt = NULL;
int ok = 1;
hid_t fcpl_in; /* file creation property for input file */
hid_t fcpl_out; /* file creation property for output file */
hid_t fcpl_in = -1; /* file creation property for input file */
hid_t fcpl_out = -1; /* file creation property for output file */
H5F_file_space_type_t in_strat, out_strat; /* file space handling strategy for in/output file */
hsize_t in_thresh, out_thresh; /* free space section threshold for in/output file */

View File

@ -48,14 +48,14 @@
static void
gen_newgrat_file(const char *fname)
{
hid_t fcpl; /* File creation property */
hid_t fapl; /* File access property */
hid_t fid; /* File id */
hid_t gid; /* Group id */
hid_t tid; /* Datatype id */
hid_t sid; /* Dataspace id */
hid_t attr_id; /* Attribute id */
hid_t did; /* Dataset id */
hid_t fcpl = -1; /* File creation property */
hid_t fapl = -1; /* File access property */
hid_t fid = -1; /* File id */
hid_t gid = -1; /* Group id */
hid_t tid = -1; /* Datatype id */
hid_t sid = -1; /* Dataspace id */
hid_t attr_id = -1; /* Attribute id */
hid_t did = -1; /* Dataset id */
char name[30]; /* Group name */
char attrname[30]; /* Attribute name */
int i; /* Local index variable */

View File

@ -594,8 +594,8 @@ hsize_t h5diff(const char *fname1,
trav_info_t *info1_grp = NULL;
trav_info_t *info2_grp = NULL;
/* local pointer */
trav_info_t *info1_lp;
trav_info_t *info2_lp;
trav_info_t *info1_lp = NULL;
trav_info_t *info2_lp = NULL;
/* link info from specified object */
H5L_info_t src_linfo1;
H5L_info_t src_linfo2;

View File

@ -1641,8 +1641,8 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hsize_t alloc_size;
hsize_t *ptdata;
int ndims;
hid_t dtype;
hid_t type_id;
hid_t dtype = -1;
hid_t type_id = -1;
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
@ -1672,10 +1672,10 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
done:
HDfree(ptdata);
if(H5Tclose(type_id) < 0)
if(type_id > 0 && H5Tclose(type_id) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(dtype) < 0)
if(dtype > 0 && H5Tclose(dtype) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
H5_LEAVE(TRUE)
@ -1765,8 +1765,8 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
HERR_INIT(hbool_t, TRUE)
hssize_t npoints;
int ndims;
hid_t dtype;
hid_t type_id;
hid_t dtype = -1;
hid_t type_id = -1;
if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0)
H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
@ -1785,10 +1785,10 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
stream, container, ndims, type_id, npoints);
done:
if(H5Tclose(type_id) < 0)
if(type_id > 0 && H5Tclose(type_id) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(dtype) < 0)
if(dtype > 0 && H5Tclose(dtype) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
H5_LEAVE(ret_value)

View File

@ -574,8 +574,12 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_form
h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum);
H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts);
H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container);
H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
FILE* stream, hid_t container, int ndims, hid_t type_id, hssize_t npoints);
H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container);

View File

@ -926,8 +926,8 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
hsize_t *ptdata;
int ndims;
hssize_t indx;
hid_t dtype;
hid_t type_id;
hid_t dtype = -1;
hid_t type_id = -1;
HDassert(info);
HDassert(ctx);
@ -1048,10 +1048,10 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
done:
HDfree(ptdata);
if(H5Tclose(type_id) < 0)
if(type_id > 0 && H5Tclose(type_id) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(dtype) < 0)
if(dtype > 0 && H5Tclose(dtype) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
ctx->need_prefix = TRUE;

View File

@ -37,11 +37,11 @@ const char *setname = "align";
int main(void)
{
hid_t fil,spc,set;
hid_t cs6, cmp, fix;
hid_t cmp1, cmp2, cmp3;
hid_t plist;
hid_t array_dt;
hid_t fil=-1, spc=-1, set=-1;
hid_t cs6=-1, cmp=-1, fix=-1;
hid_t cmp1=-1, cmp2=-1, cmp3=-1;
hid_t plist=-1;
hid_t array_dt=-1;
hsize_t dim[2];
hsize_t cdim[4];

View File

@ -1673,60 +1673,8 @@ usage(const char *prog)
printf(" HDF5_MPI_INFO MPI INFO object key=value separated by ;\n");
printf(" HDF5_PARAPREFIX Paralllel data files prefix\n");
fflush(stdout);
}
}
void debug_start_stop_time(io_time_t *pt, timer_type t, int start_stop)
{
#if 1
if (pio_debug_level >= 4) {
const char *msg;
int myrank;
MPI_Comm_rank(pio_comm_g, &myrank);
switch (t) {
case HDF5_FILE_OPENCLOSE:
msg = "File Open/Close";
break;
case HDF5_DATASET_CREATE:
msg = "Dataset Create";
break;
case HDF5_MPI_WRITE:
msg = "MPI Write";
break;
case HDF5_MPI_READ:
msg = "MPI Read";
break;
case HDF5_FINE_WRITE_FIXED_DIMS:
msg = "Fine Write";
break;
case HDF5_FINE_READ_FIXED_DIMS:
msg = "Fine Read";
break;
case HDF5_GROSS_WRITE_FIXED_DIMS:
msg = "Gross Write";
break;
case HDF5_GROSS_READ_FIXED_DIMS:
msg = "Gross Read";
break;
case HDF5_RAW_WRITE_FIXED_DIMS:
msg = "Raw Write";
break;
case HDF5_RAW_READ_FIXED_DIMS:
msg = "Raw Read";
break;
default:
msg = "Unknown Timer";
break;
}
fprintf(output, " Proc %d: %s %s: %.2f\n", myrank, msg,
(start_stop == TSTART ? "Start" : "Stop"),
pt->total_time[t]);
}
#endif
} /* debug_start_stop_time */
} /* end if */
} /* end usage() */
#else /* H5_HAVE_PARALLEL */
@ -1736,13 +1684,12 @@ void debug_start_stop_time(io_time_t *pt, timer_type t, int start_stop)
* parallel stuff.
* Return: EXIT_SUCCESS
* Programmer: Bill Wendling, 14. November 2001
* Modifications:
*/
int
main(void)
{
printf("No parallel IO performance because parallel is not configured\n");
return EXIT_SUCCESS;
}
} /* end main */
#endif /* !H5_HAVE_PARALLEL */

View File

@ -1405,56 +1405,5 @@ usage(const char *prog)
printf(" HDF5_PREFIX Data file prefix\n");
printf("\n");
fflush(stdout);
}
void debug_start_stop_time(io_time_t *pt, timer_type t, int start_stop)
{
if (sio_debug_level >= 4) {
const char *msg;
switch (t) {
case HDF5_FILE_OPENCLOSE:
msg = "File Open/Close";
break;
case HDF5_DATASET_CREATE:
msg = "Dataset Create";
break;
case HDF5_MPI_WRITE:
msg = "MPI Write";
break;
case HDF5_MPI_READ:
msg = "MPI Read";
break;
case HDF5_FINE_WRITE_FIXED_DIMS:
msg = "Fine Write";
break;
case HDF5_FINE_READ_FIXED_DIMS:
msg = "Fine Read";
break;
case HDF5_GROSS_WRITE_FIXED_DIMS:
msg = "Gross Write";
break;
case HDF5_GROSS_READ_FIXED_DIMS:
msg = "Gross Read";
break;
case HDF5_RAW_WRITE_FIXED_DIMS:
msg = "Raw Write";
break;
case HDF5_RAW_READ_FIXED_DIMS:
msg = "Raw Read";
break;
case HDF5_FILE_READ_OPEN:
case HDF5_FILE_READ_CLOSE:
case HDF5_FILE_WRITE_OPEN:
case HDF5_FILE_WRITE_CLOSE:
default:
msg = "Unknown Timer";
break;
}
fprintf(output, " %s %s: %.2f\n", msg,
(start_stop == TSTART ? "Start" : "Stop"),
pt->total_time[t]);
}
} /* debug_start_stop_time */
} /* end usage() */