summaryrefslogtreecommitdiffstats
path: root/hl/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-07-07 18:54:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-07-07 18:54:11 (GMT)
commitec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6 (patch)
treebd27f9b92053818b5d83de373dfcadbbbc892ee2 /hl/test
parent3e5a61c9ff7a22589dbb2fc71f95f32f919c8b54 (diff)
downloadhdf5-ec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6.zip
hdf5-ec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6.tar.gz
hdf5-ec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6.tar.bz2
[svn-r30158] Description:
More warning cleanups. This brings us down to ~1300 warnings in 167 files Tested on: MacOSX/64 10.11.5 (amazon) w/serial & parallel (h5committest forthcoming)
Diffstat (limited to 'hl/test')
-rw-r--r--hl/test/test_packet_vlen.c282
1 files changed, 142 insertions, 140 deletions
diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c
index 82c8d1c..f1e4e00 100644
--- a/hl/test/test_packet_vlen.c
+++ b/hl/test/test_packet_vlen.c
@@ -60,7 +60,7 @@ static int test_VLof_atomic(void)
hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -69,15 +69,15 @@ static int test_VLof_atomic(void)
TESTING3(" with vlen of atomic");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(unsigned int));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++)
- ((unsigned int *)writeBuf[ii].p)[jj] = ii * 10 + jj;
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++)
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
@@ -119,12 +119,12 @@ static int test_VLof_atomic(void)
if (ret < 0)
goto error;
- for (ii = 0; ii < NRECORDS; ii++)
- for (jj=0; jj<(ii+1); jj++)
+ for (uu = 0; uu < NRECORDS; uu++)
+ for (vv = 0; vv < (uu + 1); vv++)
{
- if (((unsigned int *)readBuf[ii].p)[jj] != ((unsigned int *)writeBuf[ii].p)[jj]) {
- printf("Packet %d's value should be %d\n", ii, ((unsigned int *)writeBuf[ii].p)[jj]);
- printf("Packet %d's value in readBuf is %d\n", ii, ((unsigned int *)readBuf[ii].p)[jj]);
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
}
}
@@ -168,7 +168,7 @@ static int test_VLof_comptype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
} VLcomp_t;
hid_t fid=H5I_INVALID_HID; /* Test file identifier */
@@ -178,23 +178,23 @@ static int test_VLof_comptype(void)
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret;
TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(VLcomp_t));
- if(writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
+ if(writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++) {
- ((VLcomp_t *)writeBuf[ii].p)[jj].i = ii+jj;
- ((VLcomp_t *)writeBuf[ii].p)[jj].f = (float)((ii+jj)/3.0F);
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++) {
+ ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
+ ((VLcomp_t *)writeBuf[uu].p)[vv].f = (float)(uu + vv) / 3.0F;
} /* end for */
} /* end for */
@@ -209,7 +209,7 @@ static int test_VLof_comptype(void)
goto error;
/* Insert fields */
- ret = H5Tinsert(cmptype, "i", HOFFSET(VLcomp_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
@@ -251,15 +251,15 @@ static int test_VLof_comptype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].len != readBuf[ii].len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].len=%d, readBuf[%d].len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].len,(int)ii,(int)readBuf[ii].len);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].len != readBuf[uu].len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len);
continue;
} /* write len != read len */
- for (jj=0; jj<(ii+1); jj++) {
- if (((unsigned int *)writeBuf[ii].p)[jj] != ((unsigned int *)readBuf[ii].p)[jj] ) {
- fprintf(stderr, "VL data values don't match!, writeBuf[ii].p[%d]=%d, readBuf[ii].p[%d]=%d\n",(int)jj, (int)((unsigned int *)writeBuf[ii].p)[jj], (int)jj, (int)((unsigned int *)readBuf[ii].p)[jj]);
+ for (vv = 0; vv < (uu + 1); vv++) {
+ if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
+ fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]);
continue;
} /* write value != read value */
}
@@ -306,7 +306,7 @@ static int test_compound_VL_VLtype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
hvl_t v;
} compVLVL_t;
@@ -322,32 +322,32 @@ static int test_compound_VL_VLtype(void)
compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
hvl_t *t1, *t2;
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret; /* Returned status from a callee */
TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].i = ii*10;
- writeBuf[ii].f = (float)((ii*20)/3.0F);
- writeBuf[ii].v.p = HDmalloc((ii+L1_INCM)*sizeof(hvl_t));
- if (writeBuf[ii].v.p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].u = uu * 10;
+ writeBuf[uu].f = (float)(uu * 20) / 3.0F;
+ writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
+ if (writeBuf[uu].v.p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].v.len=ii+L1_INCM;
- for (t1=(hvl_t *)((writeBuf[ii].v).p), jj=0; jj<(ii+L1_INCM); jj++, t1++)
+ writeBuf[uu].v.len = uu + L1_INCM;
+ for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
{
- t1->p = HDmalloc((jj+L2_INCM)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+L2_INCM;
- for (kk=0; kk<jj+L2_INCM; kk++)
- ((unsigned int*)t1->p)[kk] = ii*100 + jj*10 + kk;
+ t1->len = vv + L2_INCM;
+ for (ww = 0; ww < vv + L2_INCM; ww++)
+ ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
}
} /* end for */
@@ -377,7 +377,7 @@ static int test_compound_VL_VLtype(void)
goto error;
/* Insert fields: atomic, atomic, vlen */
- ret = H5Tinsert(comp_vlvl, "i", HOFFSET(compVLVL_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
@@ -417,29 +417,29 @@ static int test_compound_VL_VLtype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].i != readBuf[ii].i) {
- fprintf(stderr, "Integer components don't match!, writeBuf[%d].i=%d, readBuf[%d].i=%d\n",(int)ii,(int)writeBuf[ii].i,(int)ii,(int)readBuf[ii].i);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].u != readBuf[uu].u) {
+ fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
- if (!H5_FLT_ABS_EQUAL(writeBuf[ii].f,readBuf[ii].f)) {
- fprintf(stderr, "Float components don't match!, writeBuf[%d].f=%f, readBuf[%d].f=%f\n",(int)ii,(double)writeBuf[ii].f,(int)ii,(double)readBuf[ii].f);
+ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f,readBuf[uu].f)) {
+ fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
- if (writeBuf[ii].v.len != readBuf[ii].v.len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%d, readBuf[%d].v.len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].v.len,(int)ii,(int)readBuf[ii].v.len);
+ if (writeBuf[uu].v.len != readBuf[uu].v.len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
- for (t1=(hvl_t *)(writeBuf[ii].v.p), t2=(hvl_t *)(readBuf[ii].v.p), jj=0; (size_t)jj<readBuf[ii].v.len; jj++, t1++, t2++) {
+ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- fprintf(stderr, "%d: VL data length don't match!, ii=%d, jj=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)ii,(int)jj,(int)t1->len,(int)t2->len);
+ fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
- for (kk=0; (size_t)kk<t2->len; kk++) {
- if (((unsigned int *)t1->p)[kk] != ((unsigned int *)t2->p)[kk] ) {
- fprintf(stderr, "VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)kk, (int)((unsigned int *)t1->p)[kk], (int)kk, (int)((unsigned int *)t2->p)[kk]);
+ for (ww = 0; (size_t)ww < t2->len; ww++) {
+ if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
+ fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
} /* end for */
@@ -497,7 +497,7 @@ static int test_VLof_VLtype(void)
hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
hsize_t count; /* Number of records in the table */
hvl_t *t1; /* pointer to advance */
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -506,23 +506,23 @@ static int test_VLof_VLtype(void)
TESTING3(" with vlen datatype of vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii< NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(hvl_t));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
} /* end if */
- writeBuf[ii].len = ii+1;
- for (t1=(hvl_t *)(writeBuf[ii].p), jj=0; jj<(ii+1); jj++, t1++)
+ writeBuf[uu].len = uu + 1;
+ for (t1=(hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
{
- t1->p = HDmalloc((jj+1)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+1;
- for (kk=0; kk<(jj+1); kk++)
- ((unsigned int *)t1->p)[kk] = ii*100+jj*10+kk;
+ t1->len = vv * 1;
+ for (ww = 0; ww < (vv * 1); ww++)
+ ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
} /* end for */
} /* end for */
@@ -958,6 +958,8 @@ static herr_t verify_accessors(const char *table_name, herr_t expected_value)
/* 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;
VERIFY(HDstrcmp(buf, table_name), "Names of dataset and packet table don't match");
/* Get the packet table's datatype ID */
@@ -1059,7 +1061,7 @@ static int testfl_VLof_atomic(void)
hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */
hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -1068,15 +1070,15 @@ static int testfl_VLof_atomic(void)
TESTING3(" with vlen of atomic");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(unsigned int));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++)
- ((unsigned int *)writeBuf[ii].p)[jj] = ii * 10 + jj;
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++)
+ ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv;
} /* end for */
/* Open the file */
@@ -1118,12 +1120,12 @@ static int testfl_VLof_atomic(void)
if (ret < 0)
goto error;
- for (ii = 0; ii < NRECORDS; ii++)
- for (jj=0; jj<(ii+1); jj++)
+ for (uu = 0; uu < NRECORDS; uu++)
+ for (vv = 0; vv < (uu + 1); vv++)
{
- if (((unsigned int *)readBuf[ii].p)[jj] != ((unsigned int *)writeBuf[ii].p)[jj]) {
- printf("Packet %d's value should be %d\n", ii, ((unsigned int *)writeBuf[ii].p)[jj]);
- printf("Packet %d's value in readBuf is %d\n", ii, ((unsigned int *)readBuf[ii].p)[jj]);
+ if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) {
+ printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]);
+ printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]);
}
}
@@ -1167,7 +1169,7 @@ static int testfl_VLof_comptype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
} VLcomp_t;
hid_t fid=H5I_INVALID_HID; /* Test file identifier */
@@ -1177,23 +1179,23 @@ static int testfl_VLof_comptype(void)
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
hsize_t count; /* Number of records in the table */
- int ii, jj; /* Loop variables */
+ unsigned uu, vv; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret;
TESTING3(" with vlen of compound datatypes");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(VLcomp_t));
- if(writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t));
+ if(writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].len = ii+1;
- for (jj=0; jj<(ii+1); jj++) {
- ((VLcomp_t *)writeBuf[ii].p)[jj].i = ii+jj;
- ((VLcomp_t *)writeBuf[ii].p)[jj].f = (float)((ii+jj)/3.0F);
+ writeBuf[uu].len = uu + 1;
+ for (vv = 0; vv < (uu + 1); vv++) {
+ ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv;
+ ((VLcomp_t *)writeBuf[uu].p)[vv].f = (float)(uu + vv) / 3.0F;
} /* end for */
} /* end for */
@@ -1208,7 +1210,7 @@ static int testfl_VLof_comptype(void)
goto error;
/* Insert fields */
- ret = H5Tinsert(cmptype, "i", HOFFSET(VLcomp_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT);
@@ -1250,15 +1252,15 @@ static int testfl_VLof_comptype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].len != readBuf[ii].len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].len=%d, readBuf[%d].len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].len,(int)ii,(int)readBuf[ii].len);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].len != readBuf[uu].len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len);
continue;
} /* write len != read len */
- for (jj=0; jj<(ii+1); jj++) {
- if (((unsigned int *)writeBuf[ii].p)[jj] != ((unsigned int *)readBuf[ii].p)[jj] ) {
- fprintf(stderr, "VL data values don't match!, writeBuf[ii].p[%d]=%d, readBuf[ii].p[%d]=%d\n",(int)jj, (int)((unsigned int *)writeBuf[ii].p)[jj], (int)jj, (int)((unsigned int *)readBuf[ii].p)[jj]);
+ for (vv = 0; vv < (uu + 1); vv++) {
+ if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) {
+ fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]);
continue;
} /* write value != read value */
}
@@ -1305,7 +1307,7 @@ static int testfl_compound_VL_VLtype(void)
{
/* Struct that the VL sequences are composed of */
typedef struct {
- int i;
+ unsigned u;
float f;
hvl_t v;
} compVLVL_t;
@@ -1321,32 +1323,32 @@ static int testfl_compound_VL_VLtype(void)
compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */
compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */
hvl_t *t1, *t2;
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
char msg[80]; /* For error message */
herr_t ret; /* Returned status from a callee */
TESTING3(" with compound datatype containing vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii<NRECORDS; ii++) {
- writeBuf[ii].i = ii*10;
- writeBuf[ii].f = (float)((ii*20)/3.0F);
- writeBuf[ii].v.p = HDmalloc((ii+L1_INCM)*sizeof(hvl_t));
- if (writeBuf[ii].v.p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].u = uu * 10;
+ writeBuf[uu].f = (float)(uu * 20) / 3.0F;
+ writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t));
+ if (writeBuf[uu].v.p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- writeBuf[ii].v.len=ii+L1_INCM;
- for (t1=(hvl_t *)((writeBuf[ii].v).p), jj=0; jj<(ii+L1_INCM); jj++, t1++)
+ writeBuf[uu].v.len = uu + L1_INCM;
+ for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++)
{
- t1->p = HDmalloc((jj+L2_INCM)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+L2_INCM;
- for (kk=0; kk<jj+L2_INCM; kk++)
- ((unsigned int*)t1->p)[kk] = ii*100 + jj*10 + kk;
+ t1->len = vv + L2_INCM;
+ for (ww = 0; ww < vv + L2_INCM; ww++)
+ ((unsigned int*)t1->p)[ww] = uu * 100 + vv * 10 + ww;
}
} /* end for */
@@ -1376,7 +1378,7 @@ static int testfl_compound_VL_VLtype(void)
goto error;
/* Insert fields: atomic, atomic, vlen */
- ret = H5Tinsert(comp_vlvl, "i", HOFFSET(compVLVL_t, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT);
if (ret < 0)
goto error;
ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT);
@@ -1416,29 +1418,29 @@ static int testfl_compound_VL_VLtype(void)
goto error;
/* Compare data read in */
- for (ii = 0; ii < NRECORDS; ii++) {
- if (writeBuf[ii].i != readBuf[ii].i) {
- fprintf(stderr, "Integer components don't match!, writeBuf[%d].i=%d, readBuf[%d].i=%d\n",(int)ii,(int)writeBuf[ii].i,(int)ii,(int)readBuf[ii].i);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ if (writeBuf[uu].u != readBuf[uu].u) {
+ fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u);
continue;
} /* end if */
- if (!H5_FLT_ABS_EQUAL(writeBuf[ii].f,readBuf[ii].f)) {
- fprintf(stderr, "Float components don't match!, writeBuf[%d].f=%f, readBuf[%d].f=%f\n",(int)ii,(double)writeBuf[ii].f,(int)ii,(double)readBuf[ii].f);
+ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) {
+ fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f);
continue;
} /* end if */
- if (writeBuf[ii].v.len != readBuf[ii].v.len) {
- fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%d, readBuf[%d].v.len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].v.len,(int)ii,(int)readBuf[ii].v.len);
+ if (writeBuf[uu].v.len != readBuf[uu].v.len) {
+ fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len);
continue;
} /* end if */
- for (t1=(hvl_t *)(writeBuf[ii].v.p), t2=(hvl_t *)(readBuf[ii].v.p), jj=0; (size_t)jj<readBuf[ii].v.len; jj++, t1++, t2++) {
+ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) {
if (t1->len != t2->len) {
- fprintf(stderr, "%d: VL data length don't match!, ii=%d, jj=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)ii,(int)jj,(int)t1->len,(int)t2->len);
+ fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len);
continue;
} /* end if */
- for (kk=0; (size_t)kk<t2->len; kk++) {
- if (((unsigned int *)t1->p)[kk] != ((unsigned int *)t2->p)[kk] ) {
- fprintf(stderr, "VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)kk, (int)((unsigned int *)t1->p)[kk], (int)kk, (int)((unsigned int *)t2->p)[kk]);
+ for (ww = 0; (size_t)ww < t2->len; ww++) {
+ if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) {
+ fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]);
continue;
} /* end if */
} /* end for */
@@ -1496,7 +1498,7 @@ static int testfl_VLof_VLtype(void)
hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */
hsize_t count; /* Number of records in the table */
hvl_t *t1; /* pointer to advance */
- int ii, jj, kk; /* Loop variables */
+ unsigned uu, vv, ww; /* Loop variables */
hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */
hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */
char msg[80]; /* For error message */
@@ -1505,23 +1507,23 @@ static int testfl_VLof_VLtype(void)
TESTING3(" with vlen datatype of vlen datatype");
/* Allocate and initialize VL data to write (copied from C test) */
- for (ii=0; ii< NRECORDS; ii++) {
- writeBuf[ii].p = HDmalloc((ii+1)*sizeof(hvl_t));
- if (writeBuf[ii].p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ for (uu = 0; uu < NRECORDS; uu++) {
+ writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t));
+ if (writeBuf[uu].p == NULL) {
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
} /* end if */
- writeBuf[ii].len = ii+1;
- for (t1=(hvl_t *)(writeBuf[ii].p), jj=0; jj<(ii+1); jj++, t1++)
+ writeBuf[uu].len = uu + 1;
+ for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++)
{
- t1->p = HDmalloc((jj+1)*sizeof(unsigned int));
+ t1->p = HDmalloc((vv + 1) * sizeof(unsigned int));
if (t1->p == NULL) {
- fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii);
+ fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu);
goto error;
}
- t1->len = jj+1;
- for (kk=0; kk<(jj+1); kk++)
- ((unsigned int *)t1->p)[kk] = ii*100+jj*10+kk;
+ t1->len = vv + 1;
+ for (ww = 0; ww < (vv + 1); ww++)
+ ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww;
} /* end for */
} /* end for */