summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-03-23 06:27:57 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-03-23 06:27:57 (GMT)
commitf97d63cb95fa2595e5137a7ac6e0d1282fb5118b (patch)
tree698d5f3e535b8f77e4ecfb2da9722ab0cb040386
parent67be45610fd450909038afea54f79e6a91c458cf (diff)
downloadhdf5-f97d63cb95fa2595e5137a7ac6e0d1282fb5118b.zip
hdf5-f97d63cb95fa2595e5137a7ac6e0d1282fb5118b.tar.gz
hdf5-f97d63cb95fa2595e5137a7ac6e0d1282fb5118b.tar.bz2
[svn-r24869] Description:
Clean up more compiler warnings, plus merge a few Coverity bug fixes from the hdf5_1_8_coverity branch back to the trunk: r20877: Purpose: Fix coverity issue 1723 Description: Modified test_generate in hl/test_image to close file "f" before exit, even if an error occurs. r20879: Issue 63: change check of return of H5Tget_nmembers to <=0. No need to go futher if call fails as well as empty. r20881: Coverity #659 in Run 46: I changed the Line 442 where it tries to check whether FLAG_PRINTED is TRUE. But it had just been set to FALSE. I took out the condition check in the print statement. Tested on: Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & Parallel (too minor to require h5committest)
-rw-r--r--hl/src/H5LT.c6
-rw-r--r--hl/src/H5LTanalyze.l8
-rw-r--r--hl/src/H5LTparse.y2
-rw-r--r--hl/test/test_image.c7
-rw-r--r--src/H5I.c12
-rw-r--r--src/H5Odbg.c14
-rw-r--r--src/H5Olink.c5
-rw-r--r--src/H5Zdeflate.c2
-rw-r--r--src/H5Zshuffle.c2
-rw-r--r--test/cache_api.c4
-rw-r--r--test/enc_dec_plist.c2
-rw-r--r--test/fillval.c16
-rw-r--r--test/freespace.c6
-rw-r--r--test/gen_cross.c18
-rw-r--r--test/istore.c2
-rw-r--r--test/tselect.c5
-rw-r--r--tools/h5dump/h5dumpgentest.c3
-rw-r--r--tools/h5repack/h5repack_refs.c199
18 files changed, 148 insertions, 165 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index d175099..aabd828 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -26,7 +26,7 @@
#define INCREMENT 1024
#define TMP_LEN 256
#define MAX(a,b) (((a)>(b)) ? (a) : (b))
-int input_len;
+size_t input_len;
char *myinput;
size_t indent = 0;
@@ -2290,9 +2290,9 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt)
size_t dst_size; /*destination value type size */
int i;
- if((nmembs = H5Tget_nmembers(type))==0)
+ if((nmembs = H5Tget_nmembers(type))<=0)
goto out;
- assert(nmembs>0);
+
if((super = H5Tget_super(type)) < 0)
goto out;
diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l
index 581672b..7407520 100644
--- a/hl/src/H5LTanalyze.l
+++ b/hl/src/H5LTanalyze.l
@@ -30,7 +30,7 @@ int my_yyinput(char *, int);
#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/
extern char *myinput;
-extern int input_len;
+extern size_t input_len;
#define STACK_SIZE 16
@@ -65,10 +65,6 @@ extern hbool_t is_opq_tag;
hbool_t first_quote = 1;
-/* For Lex and Yacc */
-/*int input_len;
-char *myinput;*/
-
%}
%s TAG_STRING
@@ -181,7 +177,7 @@ int my_yyinput(char *buf, int max_size)
int ret;
memcpy(buf, myinput, input_len);
- ret = input_len;
+ ret = (int)input_len;
return ret;
}
diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y
index b91e97e..973f2cb 100644
--- a/hl/src/H5LTparse.y
+++ b/hl/src/H5LTparse.y
@@ -51,7 +51,7 @@ int asindex = -1; /*pointer to the top of array stack*/
hbool_t is_str_size = 0; /*flag to lexer for string size*/
hbool_t is_str_pad = 0; /*flag to lexer for string padding*/
-H5T_pad_t str_pad; /*variable for string padding*/
+H5T_str_t str_pad; /*variable for string padding*/
H5T_cset_t str_cset; /*variable for string character set*/
hbool_t is_variable = 0; /*variable for variable-length string*/
size_t str_size; /*variable for string size*/
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 36dc734..814b351 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -544,7 +544,7 @@ static int test_generate(void)
int imax, jmax, kmax;
int n_elements;
float valex, xmin, xmax, value;
- FILE *f;
+ FILE *f = NULL;
const char *data_file = H5_get_srcdir_filename(DATA_FILE4);
int i;
int retval = FAIL;
@@ -636,7 +636,8 @@ static int test_generate(void)
fscanf( f, "%f ", &value );
data[i] = value;
}
- HDfclose( f );
+ HDfclose(f);
+ f = NULL;
/*-------------------------------------------------------------------------
* transform the data from floating point to unsigned char
@@ -746,6 +747,8 @@ out:
H5E_BEGIN_TRY {
H5Fclose(fid);
} H5E_END_TRY;
+ if(f)
+ HDfclose(f);
H5_FAILED();
return retval;
}
diff --git a/src/H5I.c b/src/H5I.c
index 21408af..2250255 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -838,7 +838,6 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
*/
if(type_ptr->wrapped) {
H5I_wrap_ud_t udata; /* User data for iteration */
- hid_t previd; /* Previous ID value */
herr_t iter_status; /* Iteration status */
/* Set up user data for iteration */
@@ -1173,7 +1172,7 @@ H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id)
HDassert(type_ptr);
/* Get the ID node for the ID */
- if(NULL == (curr_id = H5SL_remove(type_ptr->ids, &id)))
+ if(NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id)))
HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list")
/* (Casting away const OK -QAK) */
@@ -1206,7 +1205,6 @@ void *
H5I_remove(hid_t id)
{
H5I_id_type_t *type_ptr; /*ptr to the atomic type */
- H5I_id_info_t *curr_id; /*ptr to the current atom */
H5I_type_t type; /*atom's atomic type */
void * ret_value; /*return value */
@@ -1304,7 +1302,7 @@ H5I_dec_ref(hid_t id)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
/* General lookup of the ID */
- if(NULL == (id_ptr = H5SL_search(type_ptr->ids, &id)))
+ if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID")
/*
@@ -1505,7 +1503,7 @@ H5I_inc_ref(hid_t id, hbool_t app_ref)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* General lookup of the ID */
- if(NULL == (id_ptr = H5SL_search(type_ptr->ids, &id)))
+ if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID")
/* Adjust reference counts */
@@ -1590,7 +1588,7 @@ H5I_get_ref(hid_t id, hbool_t app_ref)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* General lookup of the ID */
- if(NULL == (id_ptr = H5SL_search(type_ptr->ids, &id)))
+ if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID")
/* Set return value */
@@ -2108,7 +2106,7 @@ H5I__find_id(hid_t id)
HGOTO_DONE(NULL);
/* Locate the ID node for the ID */
- ret_value = H5SL_search(type_ptr->ids, &id);
+ ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 5901c61..b91a51a 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -455,30 +455,32 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
hbool_t flag_printed = FALSE;
if(oh->mesg[i].flags & H5O_MSG_FLAG_SHARED) {
- HDfprintf(stream, "%s%s", (flag_printed ? ", " : "<"), "S");
+ HDfprintf(stream, "<S");
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_CONSTANT) {
- HDfprintf(stream, "%s%s", (flag_printed ? ", " : "<"), "C");
+ HDfprintf(stream, "%sC", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_DONTSHARE) {
- HDfprintf(stream, "%s%s", (flag_printed ? ", " : "<"), "DS");
+ HDfprintf(stream, "%sDS", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN) {
- HDfprintf(stream, "%s%s", (flag_printed ? ", " : "<"), "FIU");
+ HDfprintf(stream, "%sFIU", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) {
- HDfprintf(stream, "%s%s", (flag_printed ? ", " : "<"), "MIU");
+ HDfprintf(stream, "%sMIU", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_WAS_UNKNOWN) {
HDassert(oh->mesg[i].flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN);
- HDfprintf(stream, "%s%s", (flag_printed ? ", " : "<"), "WU");
+ HDfprintf(stream, "%sWU", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
+ if(!flag_printed)
+ HDfprintf(stream, "-");
HDfprintf(stream, ">\n");
if(oh->mesg[i].flags & ~H5O_MSG_FLAG_BITS)
HDfprintf(stream, "%*s%-*s 0x%02x\n", indent + 3,"", MAX(0, fwidth - 3),
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 4dda5fe..184f6b9 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -484,6 +484,9 @@ H5O_link_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity check */
+ HDcompile_assert(sizeof(uint64_t) >= sizeof(size_t));
+
/* Get name's length */
name_len = (uint64_t)HDstrlen(lnk->name);
@@ -500,7 +503,7 @@ H5O_link_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg)
/* Set return value */
ret_value = 1 + /* Version */
1 + /* Link encoding flags */
- (lnk->type != H5L_TYPE_HARD ? 1 : 0) + /* Link type */
+ (lnk->type != H5L_TYPE_HARD ? (size_t)1 : 0) + /* Link type */
(lnk->corder_valid ? 8 : 0) + /* Creation order */
(lnk->cset != H5T_CSET_ASCII ? 1 : 0) + /* Character set */
name_size + /* Name length */
diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c
index f318c2f..82ad1ba 100644
--- a/src/H5Zdeflate.c
+++ b/src/H5Zdeflate.c
@@ -51,7 +51,7 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{
H5Z_filter_deflate, /* The actual filter function */
}};
-#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*1.001)+12)
+#define H5Z_DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * (double)1.001f) + 12)
/*-------------------------------------------------------------------------
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c
index 90509b0..4a67839 100644
--- a/src/H5Zshuffle.c
+++ b/src/H5Zshuffle.c
@@ -81,7 +81,7 @@ H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get datatype */
- if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ if(NULL == (type = (const H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Get the filter's current parameters */
diff --git a/test/cache_api.c b/test/cache_api.c
index 85b2407..66f8143 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -883,7 +883,6 @@ mdc_api_call_smoke_check(int express_test)
hid_t properties;
char dset_name[64];
int i, j, k, l, m, n;
- int progress_counter;
herr_t status;
hsize_t dims[2];
hsize_t a_size[2];
@@ -1164,7 +1163,6 @@ mdc_api_call_smoke_check(int express_test)
/* initialize all datasets on a round robin basis */
i = 0;
- progress_counter = 0;
while ( ( pass ) && ( i < DSET_SIZE ) )
{
@@ -1249,7 +1247,6 @@ mdc_api_call_smoke_check(int express_test)
/* do random reads on all datasets */
n = 0;
- progress_counter = 0;
while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) )
{
m = rand() % NUM_DSETS;
@@ -1376,7 +1373,6 @@ mdc_api_call_smoke_check(int express_test)
/* do random reads on data set 0 only */
m = 0;
n = 0;
- progress_counter = 0;
while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) )
{
i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE;
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index 26bfb84..2d0d732 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -125,7 +125,7 @@ main(void)
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if((H5Pset_chunk(dcpl, 2, &chunk_size)) < 0)
+ if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0)
FAIL_STACK_ERROR
if((H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE)) < 0)
diff --git a/test/fillval.c b/test/fillval.c
index 9271f80..fc44f86 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -289,7 +289,7 @@ static int
test_getset_vl(hid_t fapl)
{
hsize_t dims[1] = {2};
- hid_t fileid = (-1), spaceid = (-1), typeid = (-1), datasetid = (-1), plistid = (-1);
+ hid_t fileid = (-1), spaceid = (-1), dtypeid = (-1), datasetid = (-1), plistid = (-1);
char fill_value[] = "aaaa";
char orig_fill_value[] = "aaaa";
char *f1 = fill_value;
@@ -299,18 +299,18 @@ test_getset_vl(hid_t fapl)
TESTING("property lists, with variable-length datatype");
/* Create string type. */
- if((typeid = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if(H5Tset_size(typeid, H5T_VARIABLE) < 0) TEST_ERROR
+ if((dtypeid = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
+ if(H5Tset_size(dtypeid, H5T_VARIABLE) < 0) TEST_ERROR
/* Set up dataset creation property list, with fill value */
if((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_fill_value(plistid, typeid, &f1) < 0) TEST_ERROR
+ if(H5Pset_fill_value(plistid, dtypeid, &f1) < 0) TEST_ERROR
/* Modify original fill value string */
fill_value[0] = 'b';
/* Retrieve fill value from property */
- if(H5Pget_fill_value(plistid, typeid, &f2) < 0) TEST_ERROR
+ if(H5Pget_fill_value(plistid, dtypeid, &f2) < 0) TEST_ERROR
/* Verify that the fill value is the original value */
if(HDstrcmp(f2, orig_fill_value)) TEST_ERROR
@@ -324,7 +324,7 @@ test_getset_vl(hid_t fapl)
/* Write an dataset of this type. */
if((spaceid = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
- if((datasetid = H5Dcreate2(fileid, "Dataset", typeid, spaceid, H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((datasetid = H5Dcreate2(fileid, "Dataset", dtypeid, spaceid, H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close IDs (except datatype) */
if(H5Dclose(datasetid) < 0) TEST_ERROR
@@ -341,7 +341,7 @@ test_getset_vl(hid_t fapl)
if((plistid = H5Dget_create_plist(datasetid)) < 0) TEST_ERROR
/* Query fill value */
- if(H5Pget_fill_value(plistid, typeid, &f2) < 0) TEST_ERROR
+ if(H5Pget_fill_value(plistid, dtypeid, &f2) < 0) TEST_ERROR
/* Verify that the fill value is the original value */
if(HDstrcmp(f2, orig_fill_value)) TEST_ERROR
@@ -353,7 +353,7 @@ test_getset_vl(hid_t fapl)
if(H5Dclose(datasetid) < 0) TEST_ERROR
if(H5Fclose(fileid) < 0) TEST_ERROR
if(H5Pclose(plistid) < 0) TEST_ERROR
- if(H5Tclose(typeid) < 0) TEST_ERROR
+ if(H5Tclose(dtypeid) < 0) TEST_ERROR
PASSED();
return 0;
diff --git a/test/freespace.c b/test/freespace.c
index 14b0f9a..9ab0d75 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -191,7 +191,7 @@ typedef struct {
hsize_t tot_sect_count;
} TEST_iter_ud_t;
-static herr_t TEST_sects_cb(const H5FS_section_info_t *_sect, void *_udata);
+static herr_t TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata);
/*
@@ -340,9 +340,9 @@ error:
* iteration callback
*/
static herr_t
-TEST_sects_cb(const H5FS_section_info_t *_sect, void *_udata)
+TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata)
{
- const TEST_free_section_t *sect = (const TEST_free_section_t *)_sect;
+ TEST_free_section_t *sect = (TEST_free_section_t *)_sect;
TEST_iter_ud_t *udata = (TEST_iter_ud_t *)_udata;
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/test/gen_cross.c b/test/gen_cross.c
index bdc2835..3b0a56f 100644
--- a/test/gen_cross.c
+++ b/test/gen_cross.c
@@ -24,6 +24,7 @@
* under hdf5/test/ directory.
*/
+#include <stdio.h>
#include "h5test.h"
#define H5FILE_NAME "data.h5"
@@ -70,7 +71,9 @@ int create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid);
int create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid);
int create_fletcher_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
+#ifdef H5_HAVE_FILTER_SZIP
int create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
+#endif /* H5_HAVE_FILTER_SZIP */
int create_shuffle_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
int create_nbit_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
@@ -1016,6 +1019,7 @@ error:
#endif /* H5_HAVE_FILTER_DEFLATE */
}
+#ifdef H5_HAVE_FILTER_SZIP
/*-------------------------------------------------------------------------
* Function: create_szip_dsets_float
@@ -1035,7 +1039,6 @@ error:
int
create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
{
-#ifdef H5_HAVE_FILTER_SZIP
hid_t dataset; /* dataset handles */
hid_t dcpl;
float data[NX][NY]; /* data to write */
@@ -1097,15 +1100,8 @@ create_szip_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
if(H5Pclose(dcpl) < 0)
TEST_ERROR
-#else /* H5_HAVE_FILTER_SZIP */
- const char *not_supported= "Szip filter is not enabled. Can't create the dataset.";
-
- puts(not_supported);
-#endif /* H5_HAVE_FILTER_SZIP */
-
return 0;
-#ifdef H5_HAVE_FILTER_SZIP
error:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
@@ -1113,8 +1109,8 @@ error:
} H5E_END_TRY;
return -1;
-#endif /* H5_HAVE_FILTER_SZIP */
}
+#endif /* H5_HAVE_FILTER_SZIP */
/*-------------------------------------------------------------------------
@@ -1426,9 +1422,13 @@ main (void)
if(create_deflate_dsets_float(file, filespace, memspace) < 0)
{H5_FAILED(); AT(); return 1;}
+#ifdef H5_HAVE_FILTER_SZIP
/* Create a dataset of FLOAT with szip filter */
if(create_szip_dsets_float(file, filespace, memspace) < 0)
{H5_FAILED(); AT(); return 1;}
+#else /* H5_HAVE_FILTER_SZIP */
+ puts("Szip filter is not enabled. Can't create the dataset.");
+#endif /* H5_HAVE_FILTER_SZIP */
/* Create a dataset of FLOAT with shuffle filter */
if(create_shuffle_dsets_float(file, filespace, memspace) < 0)
diff --git a/test/istore.c b/test/istore.c
index 217dfc4..d088fe8 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -318,7 +318,7 @@ test_extend(hid_t f, const char *prefix,
nelmts = 1;
} else {
for (i=0, nelmts=1; i<(size_t)ndims; i++) {
- if (ctr % ndims == i) {
+ if (ctr % (size_t)ndims == i) {
offset[i] = max_corner[i];
size[i] = MIN(1, whole_size[i] - offset[i]);
} else {
diff --git a/test/tselect.c b/test/tselect.c
index 8ca3c24..fed405c 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -2734,7 +2734,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
hid_t dset_type, hid_t xfer_plist)
{
hbool_t data_ok;
- hbool_t start_in_checker[5];
hid_t fapl; /* File access property list */
hid_t fid; /* HDF5 File IDs */
hid_t full_small_cube_sid; /* Dataspace for small cube w/all selection */
@@ -2955,7 +2954,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
* large cube.
*/
- start_in_checker[0] = TRUE;
u = 0;
do {
if(small_rank_offset > 0)
@@ -3063,7 +3061,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
sel_start);
- start_in_checker[0] = TRUE;
u = 0;
do {
if(0 < small_rank_offset)
@@ -3207,7 +3204,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
small_rank,
sel_start);
- start_in_checker[0] = TRUE;
u = 0;
do {
if(small_rank_offset > 0)
@@ -3340,7 +3336,6 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_
small_rank,
sel_start);
- start_in_checker[0] = TRUE;
u = 0;
do {
if(small_rank_offset > 0)
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 82e36db..20fcf73 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -8643,7 +8643,7 @@ static void gent_compound_int_array(void) {
herr_t status; /* Error checking variable */
hsize_t dim[] = { F76_LENGTH }; /* Dataspace dimensions */
- int m, n, o; /* Array init loop vars */
+ int m, n; /* Array init loop vars */
/* Initialize the data in the arrays/datastructure */
for (m = 0; m < F76_LENGTH; m++) {
@@ -8853,7 +8853,6 @@ static void gent_compound_int_array(void) {
static void gent_compound_ints(void) {
hid_t fid, dataset, space;
- hsize_t dims[1];
uint8_t valu8bits = (uint8_t) ~0u; /* all 1s */
uint16_t valu16bits = (uint16_t) ~0u; /* all 1s */
uint32_t valu32bits = (uint32_t) ~0u; /* all 1s */
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 7108491..2e05024 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -193,8 +193,6 @@ int do_copy_refobjs(hid_t fidin,
goto error;
if(options->verbose)
{
-
-
printf(FORMAT_OBJ,"dset",travt->objs[i].name );
printf("object <%s> object reference created to <%s>\n",
travt->objs[i].name,
@@ -468,7 +466,7 @@ static int copy_refs_attr(hid_t loc_in,
hbool_t is_ref=0, is_ref_vlen=0, is_ref_array=0, is_ref_comp=0;
void *refbuf = NULL;
void *buf = NULL;
- const char* refname;
+ const char* refname = NULL;
int *ref_comp_index = NULL;
size_t *ref_comp_size = NULL;
int ref_comp_field_n = 0;
@@ -477,8 +475,7 @@ static int copy_refs_attr(hid_t loc_in,
if(H5Oget_info(loc_in, &oinfo) < 0)
goto error;
- for(u = 0; u < (unsigned)oinfo.num_attrs; u++)
- {
+ for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0;
/* open attribute */
@@ -499,56 +496,55 @@ static int copy_refs_attr(hid_t loc_in,
is_ref = (type_class == H5T_REFERENCE);
- if (type_class == H5T_VLEN ) {
- hid_t base_type = -1;
- base_type = H5Tget_super(ftype_id);
- is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE);
- msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ if(type_class == H5T_VLEN ) {
+ hid_t base_type;
+
+ base_type = H5Tget_super(ftype_id);
+ is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE);
+ msize = H5Tget_size(base_type);
+ H5Tclose(base_type);
}
+ else if(type_class == H5T_ARRAY ) {
+ hid_t base_type;
- if (type_class == H5T_ARRAY ) {
- hid_t base_type = -1;
- base_type = H5Tget_super(ftype_id);
- is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE);
- msize = H5Tget_size(base_type);
- H5Tclose(base_type);
+ base_type = H5Tget_super(ftype_id);
+ is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE);
+ msize = H5Tget_size(base_type);
+ H5Tclose(base_type);
}
+ else if(type_class == H5T_COMPOUND) {
+ int nmembers = H5Tget_nmembers(ftype_id) ;
- if (type_class == H5T_COMPOUND) {
- int nmembers = H5Tget_nmembers(ftype_id) ;
- if (nmembers < 1)
- goto error;
+ if (nmembers < 1)
+ goto error;
ref_comp_index = (int *)HDmalloc(nmembers*sizeof (int));
ref_comp_size = (size_t *)HDmalloc(nmembers*sizeof(ref_comp_size));
ref_comp_field_n = 0;
- for (i=0; i<(unsigned)nmembers; i++) {
- hid_t mtid = H5Tget_member_type( ftype_id, i );
- if ((H5Tget_class(mtid)==H5T_REFERENCE)) {
- ref_comp_index[ref_comp_field_n] = i;
- ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
- ref_comp_field_n++;
- }
- H5Tclose(mtid);
- }
+ for (i=0; i<(unsigned)nmembers; i++) {
+ hid_t mtid = H5Tget_member_type( ftype_id, i );
+
+ if ((H5Tget_class(mtid)==H5T_REFERENCE)) {
+ ref_comp_index[ref_comp_field_n] = i;
+ ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
+ ref_comp_field_n++;
+ }
+ H5Tclose(mtid);
+ }
/* if compound don't contain reference type member, free the above
* mallocs. Otherwise there can be memory leaks by the 'continue'
* statement below. */
- if (!ref_comp_field_n)
- {
- if (ref_comp_index)
- {
- HDfree(ref_comp_index);
- ref_comp_index = NULL;
+ if (!ref_comp_field_n) {
+ if (ref_comp_index) {
+ HDfree(ref_comp_index);
+ ref_comp_index = NULL;
}
- if (ref_comp_size)
- {
+ if (ref_comp_size) {
HDfree(ref_comp_size);
- ref_comp_size = NULL;
+ ref_comp_size = NULL;
}
}
}
@@ -556,10 +552,10 @@ static int copy_refs_attr(hid_t loc_in,
is_ref_comp = (ref_comp_field_n > 0);
if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) {
- H5Tclose(mtype_id);
- H5Tclose(ftype_id);
- H5Aclose(attr_id);
- continue;
+ H5Tclose(mtype_id);
+ H5Tclose(ftype_id);
+ H5Aclose(attr_id);
+ continue;
}
/* get name */
@@ -584,32 +580,30 @@ static int copy_refs_attr(hid_t loc_in,
nelmts *= dims[j];
if (is_ref_array) {
- unsigned array_rank = 0;
- hsize_t array_size = 1;
- hsize_t array_dims[H5S_MAX_RANK];
- hid_t base_type = -1;
- base_type = H5Tget_super(ftype_id);
- msize = H5Tget_size(base_type);
- H5Tclose(base_type);
-
- array_rank = H5Tget_array_ndims(mtype_id);
- H5Tget_array_dims2(mtype_id, array_dims);
+ unsigned array_rank = 0;
+ hsize_t array_size = 1;
+ hsize_t array_dims[H5S_MAX_RANK];
+ hid_t base_type;
+
+ base_type = H5Tget_super(ftype_id);
+ msize = H5Tget_size(base_type);
+ H5Tclose(base_type);
+
+ array_rank = H5Tget_array_ndims(mtype_id);
+ H5Tget_array_dims2(mtype_id, array_dims);
for(j = 0; j <array_rank; j++)
array_size *= array_dims[j];
nelmts *= array_size;
- }
+ }
if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- if (nelmts>0)
- {
+ if (nelmts>0) {
/* handle object references */
- if((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE==msize))
- {
+ if((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE==msize)) {
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL)
- {
+ if(buf == NULL) {
printf("cannot read into memory\n");
goto error;
} /* end if */
@@ -617,26 +611,23 @@ static int copy_refs_attr(hid_t loc_in,
goto error;
refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
- if(refbuf == NULL)
- {
- printf( "cannot allocate memory\n" );
+ if(refbuf == NULL) {
+ printf("cannot allocate memory\n");
goto error;
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++)
- {
+ for(i = 0; i < (unsigned)nelmts; i++) {
if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0)
- continue;
+ continue;
if(options->verbose)
printf("object <%s> reference created to <%s>\n", name, refname);
- } /* k */
- }/*H5T_STD_REF_OBJ*/
+ } /* i */
+ } /* H5T_STD_REF_OBJ */
/* handle region references */
- else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize))
- {
+ else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) {
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL)
- {
+
+ if(buf == NULL) {
printf( "cannot read into memory\n" );
goto error;
} /* end if */
@@ -648,16 +639,14 @@ static int copy_refs_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
- if(refbuf == NULL)
- {
+ if(refbuf == NULL) {
printf( "cannot allocate memory\n" );
goto error;
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++)
- {
+ for(i = 0; i < (unsigned)nelmts; i++) {
if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0)
- continue;
+ continue;
if(options->verbose)
printf("object <%s> region reference created to <%s>\n", name, refname);
}
@@ -668,8 +657,7 @@ static int copy_refs_attr(hid_t loc_in,
buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t)));
refbuf = buf; /* reuse the read buffer for write */
- if(buf == NULL)
- {
+ if(buf == NULL) {
printf( "cannot read into memory\n" );
goto error;
} /* end if */
@@ -677,28 +665,31 @@ static int copy_refs_attr(hid_t loc_in,
if(H5Aread(attr_id, mtype_id, buf) < 0)
goto error;
- if (H5R_OBJ_REF_BUF_SIZE==msize) {
- hobj_ref_t ref_out;
- for (i=0; i<(unsigned)nelmts; i++) {
- hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p;
- for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
- if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0)
- continue;
- HDmemcpy(&(ptr[j]), &ref_out, msize);
- }
- } /* for (i=0; i<nelems; i++) */
- } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
-
- hdset_reg_ref_t ref_out;
- for (i=0; i<(unsigned)nelmts; i++) {
- hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p;
- for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
- if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0)
- continue;
- HDmemcpy(&(ptr[j]), &ref_out, msize);
- }
- } /* for (i=0; i<nelems; i++) */
- }
+ if (H5R_OBJ_REF_BUF_SIZE==msize) {
+ hobj_ref_t ref_out;
+
+ for (i=0; i<(unsigned)nelmts; i++) {
+ hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p;
+
+ for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
+ if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(&(ptr[j]), &ref_out, msize);
+ }
+ } /* for (i=0; i<nelems; i++) */
+ } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
+ hdset_reg_ref_t ref_out;
+
+ for (i=0; i<(unsigned)nelmts; i++) {
+ hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p;
+
+ for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(&(ptr[j]), &ref_out, msize);
+ }
+ } /* for (i=0; i<nelems; i++) */
+ }
} /* else if (is_ref_vlen) */
else if (is_ref_comp) {
/* handle ref fields in a compound */
@@ -822,9 +813,9 @@ MapIdToName(hid_t refobj_id, trav_table_t *travt)
/* linear search */
for(u = 0; u < travt->nobjs; u++) {
- if(travt->objs[u].type == H5O_TYPE_DATASET ||
- travt->objs[u].type == H5O_TYPE_GROUP ||
- travt->objs[u].type == H5O_TYPE_NAMED_DATATYPE) {
+ if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* obtain information to identify the referenced object uniquely */