summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
Diffstat (limited to 'hl')
-rw-r--r--hl/test/test_dset_opt.c2
-rw-r--r--hl/test/test_packet_vlen.c77
-rw-r--r--hl/tools/h5watch/extend_dset.c60
3 files changed, 68 insertions, 71 deletions
diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c
index 4b5fa19..383a87a 100644
--- a/hl/test/test_dset_opt.c
+++ b/hl/test/test_dset_opt.c
@@ -47,7 +47,7 @@
#define CHUNK_NX 4
#define CHUNK_NY 4
-#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12)
+#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0))
/* Temporary filter IDs used for testing */
#define H5Z_FILTER_BOGUS1 305
diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c
index 35bd43a..1d6231e 100644
--- a/hl/test/test_packet_vlen.c
+++ b/hl/test/test_packet_vlen.c
@@ -928,64 +928,60 @@ error: /* An error has occurred. Clean up and exit. */
* 2016/01/27 -BMR
*-------------------------------------------------------------------------
*/
-static herr_t verify_accessors(hid_t fid, const char *table_name, herr_t expected_value)
+static herr_t verify_accessors(hid_t fid, const char *table_name, hbool_t uses_vlen_type)
{
- hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
- hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */
- hid_t dtype_id=H5I_INVALID_HID; /* Dataset identifier */
+ hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */
+ hid_t dset_id = H5I_INVALID_HID; /* Dataset associated with the pt */
+ hid_t dtype_id = H5I_INVALID_HID; /* Dataset identifier */
char buf[NAME_BUF_SIZE];
ssize_t name_size;
- herr_t is_varlen = 0;
- herr_t ret = FAIL; /* Returned status from a callee */
+ htri_t vlen_check_result = -1;
/* Open the named packet table. */
- ptable = H5PTopen(fid, table_name);
- if (ptable < 0)
- goto error;
+ if((ptable = H5PTopen(fid, table_name)) < 0)
+ goto error;
/* Get the associated dataset ID. */
- dset_id = H5PTget_dataset(ptable);
- if (dset_id < 0)
- goto error;
+ if((dset_id = H5PTget_dataset(ptable)) < 0)
+ goto error;
/* Check if the packet table's name matches its associated dataset's. */
*buf = '\0';
- name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE);
- if (name_size < 0)
- goto error;
+ if((name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE)) < 0)
+ goto error;
VERIFY(HDstrcmp(buf, table_name), "Names of dataset and packet table don't match");
/* Get the packet table's datatype ID */
- dtype_id = H5PTget_type(ptable);
- if (dtype_id < 0)
- goto error;
+ if((dtype_id = H5PTget_type(ptable)) < 0)
+ goto error;
/* Check if the type class matches that of the packet table. */
- is_varlen = H5Tdetect_class(dtype_id, H5T_VLEN);
- if (is_varlen == FAIL) /* failure occurred */
- goto error;
- else if (is_varlen == expected_value) /* length types match */
- ret = SUCCEED;
- else /* length types don't match */
- {
- /* Give lengthtype "fixed-length" or "variable-length" depending on the
- expected_value passed in, then print the error message. */
- char lenthtype[20];
- HDstrcpy(lenthtype, "fixed-length");
- if (expected_value == 1)
- HDstrcpy(lenthtype, "variable-length");
- fprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype);
- ret = FAIL;
+ if((vlen_check_result = H5Tdetect_class(dtype_id, H5T_VLEN)) < 0)
+ goto error;
+
+ /* Check if length types match */
+ if (vlen_check_result != (htri_t)uses_vlen_type) {
+ /* Give lengthtype "fixed-length" or "variable-length" depending on the
+ * expected_value passed in, then print the error message.
+ */
+ char lenthtype[20];
+ if (uses_vlen_type == TRUE)
+ HDstrcpy(lenthtype, "variable-length");
+ else
+ HDstrcpy(lenthtype, "fixed-length");
+ HDfprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype);
+ goto error;
}
/* Close the packet table */
if (H5PTclose(ptable) < 0)
- goto error;
+ goto error;
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (H5PTis_valid(ptable) > 0) H5PTclose(ptable);
+ if (H5PTis_valid(ptable) > 0)
+ H5PTclose(ptable);
H5_FAILED();
return FAIL;
} /* verify_accessors */
@@ -1010,25 +1006,26 @@ static int test_accessors(void)
/* Open the file */
fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
if (fid < 0)
- goto error;
+ goto error;
ret = verify_accessors(fid, PT_VLEN_ATOMIC, TRUE);
if (ret < 0)
- goto error;
+ goto error;
ret = verify_accessors(fid, PT_FIXED_LEN, FALSE);
if (ret < 0)
- goto error;
+ goto error;
/* Close the file */
if (H5Fclose(fid) < 0)
- goto error;
+ goto error;
PASSED();
return SUCCEED;
error: /* An error has occurred. Clean up and exit. */
- if (fid > 0) H5Fclose(fid);
+ if (fid > 0)
+ H5Fclose(fid);
H5_FAILED();
return FAIL;
} /* test_accessors */
diff --git a/hl/tools/h5watch/extend_dset.c b/hl/tools/h5watch/extend_dset.c
index 957db10..4299586 100644
--- a/hl/tools/h5watch/extend_dset.c
+++ b/hl/tools/h5watch/extend_dset.c
@@ -78,7 +78,7 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
hid_t sid = -1; /* dataspace id */
hid_t dtid = -1; /* dataset's datatype id */
int ndims; /* # of dimension sizes */
- unsigned i, j; /* local index variable */
+ unsigned i; /* local index variable */
hsize_t ext_dims[2]; /* new dimension sizes after extension */
hsize_t cur_dims[2]; /* current dimension sizes */
size_t dtype_size; /* size of the dataset's datatype */
@@ -144,23 +144,23 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
goto error;
num_elmts = 1;
- for(j = 0; j < (unsigned)ndims; j++)
- num_elmts *= (unsigned)ext_dims[j];
+ for(i = 0; i < (unsigned)ndims; i++)
+ num_elmts *= (unsigned)ext_dims[i];
/* Compound type */
if(!HDstrcmp(dname, DSET_CMPD_TWO)) {
HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- for(j = 0; j < num_elmts; j++) {
- cbuf[j].field1 = action1;
- cbuf[j].field2.a = action1;
- cbuf[j].field2.c = action1;
- cbuf[j].field2.b.a = action1;
- cbuf[j].field2.b.b = action1;
- cbuf[j].field2.b.c = action1;
- cbuf[j].field3 = action1;
- cbuf[j].field4.a = action1;
- cbuf[j].field4.b = action1;
+ for(i = 0; i < num_elmts; i++) {
+ cbuf[i].field1 = action1;
+ cbuf[i].field2.a = action1;
+ cbuf[i].field2.c = action1;
+ cbuf[i].field2.b.a = action1;
+ cbuf[i].field2.b.b = action1;
+ cbuf[i].field2.b.c = action1;
+ cbuf[i].field3 = action1;
+ cbuf[i].field4.a = action1;
+ cbuf[i].field4.b = action1;
} /* end for */
/* Write to the dataset */
@@ -169,8 +169,8 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
} else { /* Integer type */
HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
- for(j = 0; j < num_elmts; j++)
- ibuf[j] = action1;
+ for(i = 0; i < num_elmts; i++)
+ ibuf[i] = action1;
/* Write to the dataset */
if(H5Dwrite(did, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0)
@@ -225,7 +225,7 @@ extend_dset_one(const char *file, char *dname, int action)
hid_t dtid = -1; /* dataset's datatype id */
hid_t sid = -1; /* dataspace id */
hid_t mid = -1; /* memory space id */
- unsigned i, j; /* local index variable */
+ unsigned i; /* local index variable */
hsize_t cur_dims[1]; /* current dimension sizes */
hsize_t ext_dims[1]; /* new dimension sizes after extension */
hsize_t offset[1]; /* starting offsets of appended data */
@@ -304,18 +304,18 @@ extend_dset_one(const char *file, char *dname, int action)
if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
- for(j = 0; j < (unsigned)action; j++) {
- cbuf[j].field1 = j + 1;
- cbuf[j].field2.a = j + 2;
- cbuf[j].field2.b.a = j + 2;
- cbuf[j].field2.b.b = j + 2;
- cbuf[j].field2.b.c = j + 2;
- cbuf[j].field2.c = j + 2;
-
- cbuf[j].field3 = j + 3;
-
- cbuf[j].field4.a = j + 4;
- cbuf[j].field4.b = j + 4;
+ for(i = 0; i < (unsigned)action; i++) {
+ cbuf[i].field1 = i + 1;
+ cbuf[i].field2.a = i + 2;
+ cbuf[i].field2.b.a = i + 2;
+ cbuf[i].field2.b.b = i + 2;
+ cbuf[i].field2.b.c = i + 2;
+ cbuf[i].field2.c = i + 2;
+
+ cbuf[i].field3 = i + 3;
+
+ cbuf[i].field4.a = i + 4;
+ cbuf[i].field4.b = i + 4;
} /* end for */
/* Write to the extended region of the dataset */
@@ -324,8 +324,8 @@ extend_dset_one(const char *file, char *dname, int action)
} else { /* Integer type */
HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
- for(j = 0; j < (unsigned)action; j++)
- ibuf[j] = (int)j;
+ for(i = 0; i < (unsigned)action; i++)
+ ibuf[i] = (int)i;
/* Write to the extended region of the dataset */
if(H5Dwrite(did, dtid, mid, sid, H5P_DEFAULT, ibuf) < 0)