summaryrefslogtreecommitdiffstats
path: root/test/tvltypes.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-08-22 21:48:46 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-08-22 21:48:46 (GMT)
commitc48649abd8010095c013ac005d1ea4094f1c76b9 (patch)
tree0906f70eff022b41e6b2f128f4ffeee0c21a49c9 /test/tvltypes.c
parent92d6292b1082f7696b3bbfc4ed3c5ff7727a8763 (diff)
downloadhdf5-c48649abd8010095c013ac005d1ea4094f1c76b9.zip
hdf5-c48649abd8010095c013ac005d1ea4094f1c76b9.tar.gz
hdf5-c48649abd8010095c013ac005d1ea4094f1c76b9.tar.bz2
OESS-29 Fix shared MPI builds, more HD prefix
Diffstat (limited to 'test/tvltypes.c')
-rw-r--r--test/tvltypes.c301
1 files changed, 154 insertions, 147 deletions
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 2147ac7..60720a0 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -13,7 +13,7 @@
/***********************************************************
*
-* Test program: tvltypes
+* Test program: tvltypes
*
* Test the Variable-Length Datatype functionality
*
@@ -21,24 +21,23 @@
#include "testhdf5.h"
-#include "hdf5.h"
#include "H5Dprivate.h"
#define FILENAME "tvltypes.h5"
/* 1-D dataset with fixed dimensions */
-#define SPACE1_RANK 1
+#define SPACE1_RANK 1
#define SPACE1_DIM1 4
/* 1-D dataset with fixed dimensions */
-#define SPACE3_RANK 1
+#define SPACE3_RANK 1
#define SPACE3_DIM1 128
#define L1_INCM 16
#define L2_INCM 8
#define L3_INCM 3
/* 1-D dataset with fixed dimensions */
-#define SPACE4_RANK 1
+#define SPACE4_RANK 1
#define SPACE4_DIM_SMALL 128
#define SPACE4_DIM_LARGE (H5D_TEMP_BUF_SIZE / 64)
@@ -89,7 +88,7 @@ void test_vltypes_free_custom(void *_mem, void *mem_used)
*/
unsigned char *mem = ((unsigned char *)_mem) - extra; /* Pointer to actual block allocated */
- *(size_t *)mem_used -= *(size_t *)mem;
+ *(size_t *)mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
} /* end if */
}
@@ -104,7 +103,7 @@ static void
test_vltypes_dataset_create(void)
{
hid_t fid1; /* HDF5 File IDs */
- hid_t dcpl; /* Dataset Property list */
+ hid_t dcpl; /* Dataset Property list */
hid_t dataset; /* Dataset ID */
hsize_t dims1[] = {SPACE1_DIM1};
hid_t sid1; /* Dataspace ID */
@@ -136,7 +135,7 @@ test_vltypes_dataset_create(void)
/* Create a dataset, supposed to fail */
H5E_BEGIN_TRY {
- dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT);
} H5E_END_TRY;
VERIFY(dataset, FAIL, "H5Dcreate2");
@@ -167,7 +166,7 @@ static void
test_vltypes_funcs(void)
{
hid_t type; /* Datatype ID */
- int size;
+ size_t size;
H5T_pad_t inpad;
H5T_norm_t norm;
H5T_cset_t cset;
@@ -181,16 +180,16 @@ test_vltypes_funcs(void)
type = H5Tvlen_create (H5T_IEEE_F32BE);
CHECK(type, FAIL, "H5Tvlen_create");
- size=H5Tget_precision(type);
- CHECK(size, FAIL, "H5Tget_precision");
+ size = H5Tget_precision(type);
+ CHECK(size, 0, "H5Tget_precision");
- size=H5Tget_size(type);
- CHECK(size, FAIL, "H5Tget_size");
+ size = H5Tget_size(type);
+ CHECK(size, 0, "H5Tget_size");
- size=H5Tget_ebias(type);
- CHECK(size, FAIL, "H5Tget_ebias");
+ size = H5Tget_ebias(type);
+ CHECK(size, 0, "H5Tget_ebias");
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
inpad = H5Tget_inpad(type);
@@ -230,18 +229,18 @@ test_vltypes_vlen_atomic(void)
hvl_t wdata2[SPACE1_DIM1]; /* Information to write */
hvl_t rdata[SPACE1_DIM1]; /* Information read in */
hvl_t fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
hid_t sid2; /* ID of bad dataspace (no extent set) */
- hid_t tid1; /* Datatype ID */
+ hid_t tid1; /* Datatype ID */
hid_t dcpl_pid; /* Dataset creation property list ID */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Atomic VL Datatype Functionality\n"));
@@ -468,7 +467,7 @@ test_vltypes_vlen_atomic(void)
/* Try to call H5Dvlen_get_buf with bad dataspace */
H5E_BEGIN_TRY {
- ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size);
} H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_get_buf_size");
@@ -500,7 +499,7 @@ test_vltypes_vlen_atomic(void)
/* Try to reclaim read data using "bad" dataspace with no extent
* Should fail */
H5E_BEGIN_TRY {
- ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata);
+ ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata);
} H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_reclaim");
@@ -556,7 +555,7 @@ rewrite_vltypes_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -709,16 +708,16 @@ test_vltypes_vlen_compound(void)
} s1;
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hvl_t rdata[SPACE1_DIM1]; /* Information read in */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Basic Compound VL Datatype Functionality\n"));
@@ -728,8 +727,8 @@ test_vltypes_vlen_compound(void)
wdata[i].p=HDmalloc((i+1)*sizeof(s1));
wdata[i].len=i+1;
for(j=0; j<(i+1); j++) {
- ((s1 *)wdata[i].p)[j].i=i*10+j;
- ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -796,7 +795,7 @@ test_vltypes_vlen_compound(void)
TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
+ if(!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f);
continue;
} /* end if */
@@ -863,7 +862,7 @@ rewrite_vltypes_vlen_compound(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -874,8 +873,8 @@ rewrite_vltypes_vlen_compound(void)
wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
wdata[i].len = i + increment;
for(j = 0; j < (i + increment); j++) {
- ((s1 *)wdata[i].p)[j].i = i * 40 + j;
- ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -941,7 +940,7 @@ rewrite_vltypes_vlen_compound(void)
TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
+ if(!H5_FLT_ABS_EQUAL(((s1 *)wdata[i].p)[j].f,((s1 *)rdata[i].p)[j].f)) {
TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f);
continue;
} /* end if */
@@ -999,32 +998,36 @@ test_vltypes_compound_vlen_vlen(void)
float f;
hvl_t v;
} s1;
- s1 wdata[SPACE3_DIM1]; /* data to write */
- s1 rdata[SPACE3_DIM1]; /* data to read */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2, tid3; /* Datatype IDs */
- hsize_t dims1[] = {SPACE3_DIM1};
+ s1 *wdata; /* data to write */
+ s1 *rdata; /* data to read */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2, tid3; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE3_DIM1};
unsigned i,j,k; /* counting variables */
hvl_t *t1, *t2; /* Temporary pointer to VL information */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE3_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t));
- wdata[i].v.len=i+L1_INCM;
- for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) {
- t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int));
- t1->len=j+L2_INCM;
- for(k=0; k<j+L2_INCM; k++)
- ((unsigned int*)t1->p)[k] = i*100 + j*10 + k;
- }
+ wdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1);
+ CHECK_PTR(wdata, "HDmalloc");
+ rdata = (s1 *)HDmalloc(sizeof(s1) * SPACE3_DIM1);
+ CHECK_PTR(rdata, "HDmalloc");
+ for(i = 0; i < SPACE3_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t));
+ wdata[i].v.len = i + L1_INCM;
+ for(t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) {
+ t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int));
+ t1->len = j + L2_INCM;
+ for(k = 0; k < j + L2_INCM; k++)
+ ((unsigned int*)t1->p)[k] = i * 100 + j * 10 + k;
+ } /* end for */
} /* end for */
/* Create file */
@@ -1090,7 +1093,7 @@ test_vltypes_compound_vlen_vlen(void)
TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
+ if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
continue;
} /* end if */
@@ -1100,7 +1103,7 @@ test_vltypes_compound_vlen_vlen(void)
continue;
} /* end if */
- for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) {
+ for(t1=(hvl_t *)(wdata[i].v.p), t2=(hvl_t *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) {
if(t1->len != t2->len) {
TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
continue;
@@ -1145,6 +1148,10 @@ test_vltypes_compound_vlen_vlen(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+
+ /* Release buffers */
+ HDfree(wdata);
+ HDfree(rdata);
} /* end test_vltypes_compound_vlen_vlen() */
/****************************************************************
@@ -1159,13 +1166,13 @@ static void
test_vltypes_compound_vlstr(void)
{
typedef enum {
- red,
- blue,
- green
+ red,
+ blue,
+ green
} e1;
typedef struct {
char *string;
- e1 color;
+ e1 color;
} s2;
typedef struct { /* Struct that the compound type are composed of */
hvl_t v;
@@ -1174,21 +1181,21 @@ test_vltypes_compound_vlstr(void)
s1 wdata2[SPACE1_DIM1]; /* data to write */
s1 rdata[SPACE1_DIM1]; /* data to read */
s1 rdata2[SPACE1_DIM1]; /* data to read */
- char str[64] = "a\0";
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, dset2; /* Dataset ID */
- hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */
- hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */
- hid_t cparms;
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t chunk_dims[] = {SPACE1_DIM1/2};
- hsize_t maxdims[] = {H5S_UNLIMITED};
- hsize_t size[] = {SPACE1_DIM1};
- hsize_t offset[] = {0};
+ char str[64] = "a\0";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t sid1, sid2, filespace, filespace2; /* Dataspace ID */
+ hid_t tid1, tid2, tid3, tid4, tid5; /* Datatype IDs */
+ hid_t cparms;
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t chunk_dims[] = {SPACE1_DIM1/2};
+ hsize_t maxdims[] = {H5S_UNLIMITED};
+ hsize_t size[] = {SPACE1_DIM1};
+ hsize_t offset[] = {0};
unsigned i,j; /* counting variables */
s2 *t1, *t2; /* Temporary pointer to VL information */
- int val;
- herr_t ret; /* Generic return value */
+ int val;
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL Datatype of Compound Datatype with VL String Functionality\n"));
@@ -1197,12 +1204,12 @@ test_vltypes_compound_vlstr(void)
for(i=0; i<SPACE1_DIM1; i++) {
wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2));
wdata[i].v.len=i+L3_INCM;
- for(t1=(wdata[i].v).p, j=0; j<(i+L3_INCM); j++, t1++) {
- strcat(str, "m");
- t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1);
- strcpy(t1->string, str);
- /*t1->color = red;*/
- t1->color = blue;
+ for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) {
+ HDstrcat(str, "m");
+ t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1);
+ HDstrcpy(t1->string, str);
+ /*t1->color = red;*/
+ t1->color = blue;
}
} /* end for */
@@ -1340,8 +1347,8 @@ test_vltypes_compound_vlstr(void)
continue;
} /* end if */
- for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) {
- if( strcmp(t1->string, t2->string) ) {
+ for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) {
+ if(HDstrcmp(t1->string, t2->string)) {
TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
continue;
} /* end if */
@@ -1361,15 +1368,15 @@ test_vltypes_compound_vlstr(void)
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Use this part for new data */
- strcpy(str, "bbbbbbbb\0");
+ HDstrcpy(str, "bbbbbbbb\0");
for(i=0; i<SPACE1_DIM1; i++) {
wdata2[i].v.p=(s2*)HDmalloc((i+1)*sizeof(s2));
wdata2[i].v.len=i+1;
for(t1=(s2*)(wdata2[i].v).p, j=0; j<i+1; j++, t1++) {
- strcat(str, "pp");
- t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1);
- strcpy(t1->string, str);
- t1->color = green;
+ HDstrcat(str, "pp");
+ t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1);
+ HDstrcpy(t1->string, str);
+ t1->color = green;
}
} /* end for */
@@ -1398,8 +1405,8 @@ test_vltypes_compound_vlstr(void)
continue;
} /* end if */
- for(t1=wdata2[i].v.p, t2=rdata2[i].v.p, j=0; j<rdata2[i].v.len; j++, t1++, t2++) {
- if( strcmp(t1->string, t2->string) ) {
+ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; j<rdata2[i].v.len; j++, t1++, t2++) {
+ if(HDstrcmp(t1->string, t2->string)) {
TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
continue;
} /* end if */
@@ -1459,29 +1466,29 @@ test_vltypes_compound_vlen_atomic(void)
s1 wdata[SPACE1_DIM1]; /* Information to write */
s1 rdata[SPACE1_DIM1]; /* Information read in */
s1 fill; /* Fill value */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
hid_t xfer_pid; /* Dataset transfer property list ID */
hid_t dcpl_pid; /* Dataset creation property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].v.len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].v.p)[j]=i*10+j;
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + 1)*sizeof(unsigned int));
+ wdata[i].v.len = i + 1;
+ for(j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
/* Create file */
@@ -1544,7 +1551,7 @@ test_vltypes_compound_vlen_atomic(void)
TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
+ if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
continue;
} /* end if */
@@ -1593,8 +1600,8 @@ test_vltypes_compound_vlen_atomic(void)
/* Check data read in */
for(i = 0; i < SPACE1_DIM1; i++)
- if(rdata[i].i != 0 || !FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p);
+ if(rdata[i].i != 0 || !H5_FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,(double)rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p);
/* Write dataset to disk */
ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
@@ -1610,7 +1617,7 @@ test_vltypes_compound_vlen_atomic(void)
TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
+ if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
continue;
} /* end if */
@@ -1663,9 +1670,9 @@ test_vltypes_compound_vlen_atomic(void)
/****************************************************************
**
** rewrite_vltypes_compound_vlen_atomic(): Check memory leak for
-** basic VL datatype code.
+** basic VL datatype code.
** Check memory leak for compound datatypes with VL datatypes
-** of atomic datatypes.
+** of atomic datatypes.
**
****************************************************************/
static void
@@ -1686,7 +1693,7 @@ rewrite_vltypes_compound_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1694,8 +1701,8 @@ rewrite_vltypes_compound_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].i = i * 40;
- wdata[i].f = (float)((i * 50) / 3.0F);
+ wdata[i].i = (int)(i * 40);
+ wdata[i].f = (float)(i * 50) / 3.0F;
wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].v.len = i + increment;
for(j = 0; j < (i + increment); j++)
@@ -1762,7 +1769,7 @@ rewrite_vltypes_compound_vlen_atomic(void)
TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i);
continue;
} /* end if */
- if(!FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
+ if(!H5_FLT_ABS_EQUAL(wdata[i].f,rdata[i].f)) {
TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f);
continue;
} /* end if */
@@ -1847,16 +1854,16 @@ test_vltypes_vlen_vlen_atomic(void)
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hvl_t rdata[SPACE1_DIM1]; /* Information read in */
hvl_t *t1, *t2; /* Temporary pointer to VL information */
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset; /* Dataset ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1, tid2; /* Datatype IDs */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
hid_t xfer_pid; /* Dataset transfer property list ID */
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing VL Datatypes with VL Atomic Datatype Component Functionality\n"));
@@ -1869,7 +1876,7 @@ test_vltypes_vlen_vlen_atomic(void)
return;
} /* end if */
wdata[i].len=i+1;
- for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) {
+ for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+1); j++, t1++) {
t1->p=HDmalloc((j+1)*sizeof(unsigned int));
if(t1->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
@@ -1958,7 +1965,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -1967,7 +1974,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -1975,7 +1982,7 @@ test_vltypes_vlen_vlen_atomic(void)
TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
continue;
} /* end if */
- for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) {
+ for(t1=(hvl_t *)wdata[i].p, t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) {
if(t1->len!=t2->len) {
TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
continue;
@@ -2041,12 +2048,12 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
hid_t sid1; /* Dataspace ID */
- hid_t tid2; /* Datatype IDs */
+ hid_t tid2; /* Datatype IDs */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2060,7 +2067,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
return;
} /* end if */
wdata[i].len = i + increment;
- for(t1 = wdata[i].p, j = 0; j < (i + increment); j++, t1++) {
+ for(t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) {
t1->p = HDmalloc((j + 1) * sizeof(unsigned int));
if(t1->p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j);
@@ -2155,7 +2162,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
continue;
} /* end if */
- for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) {
+ for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) {
if(t1->len!=t2->len) {
TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
continue;
@@ -2222,7 +2229,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2236,7 +2243,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
return;
} /* end if */
wdata[i].len=i+increment;
- for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) {
+ for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+increment); j++, t1++) {
t1->p=HDmalloc((j+1)*sizeof(unsigned int));
if(t1->p==NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
@@ -2314,7 +2321,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
@@ -2323,7 +2330,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int)),"H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -2331,7 +2338,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len);
continue;
} /* end if */
- for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) {
+ for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) {
if(t1->len!=t2->len) {
TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len);
continue;
@@ -2494,8 +2501,8 @@ test_vltypes_fill_value(void)
/* Allocate space for the buffer to read data */
- rbuf = HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct));
- CHECK(rbuf, NULL, "HDmalloc");
+ rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct));
+ CHECK_PTR(rbuf, "HDmalloc");
/* Create the small & large dataspaces to use */
@@ -2536,7 +2543,7 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fcreate");
/* Create datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
+ for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
unsigned test_loop; /* Loop over datasets */
@@ -2646,7 +2653,7 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fopen");
/* Read empty datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
+ for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
unsigned test_loop; /* Loop over datasets */
@@ -2841,7 +2848,7 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fopen");
/* Write one element & fill values to datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
+ for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
unsigned test_loop; /* Loop over datasets */
@@ -3145,15 +3152,15 @@ test_vltypes(void)
/* These next tests use the same file */
test_vltypes_dataset_create(); /* Check dataset of VL when fill value
- * won't be rewritten to it.*/
+ * won't be rewritten to it.*/
test_vltypes_funcs(); /* Test functions with VL types */
test_vltypes_vlen_atomic(); /* Test VL atomic datatypes */
- rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */
+ rewrite_vltypes_vlen_atomic(); /* Check VL memory leak */
test_vltypes_vlen_compound(); /* Test VL compound datatypes */
- rewrite_vltypes_vlen_compound(); /* Check VL memory leak */
+ rewrite_vltypes_vlen_compound(); /* Check VL memory leak */
test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */
- rewrite_vltypes_compound_vlen_atomic();/* Check VL memory leak */
- test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */
+ rewrite_vltypes_compound_vlen_atomic();/* Check VL memory leak */
+ test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */
rewrite_longer_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of longer sequence*/
rewrite_shorter_vltypes_vlen_vlen_atomic(); /*overwrite with VL data of shorted sequence*/
test_vltypes_compound_vlen_vlen();/* Test compound datatypes with VL atomic components */
@@ -3161,15 +3168,15 @@ test_vltypes(void)
test_vltypes_fill_value(); /* Test fill value for VL data */
} /* test_vltypes() */
-
+
/*-------------------------------------------------------------------------
- * Function: cleanup_vltypes
+ * Function: cleanup_vltypes
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: none
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* June 8, 1999
*
* Modifications: