summaryrefslogtreecommitdiffstats
path: root/test/tvltypes.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/tvltypes.c')
-rw-r--r--test/tvltypes.c258
1 files changed, 129 insertions, 129 deletions
diff --git a/test/tvltypes.c b/test/tvltypes.c
index ac6e0e5..eeadc45 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -350,7 +350,7 @@ test_vltypes_vlen_atomic(void)
TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p);
/* Write data to disk */
- ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -375,8 +375,8 @@ test_vltypes_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Get dataspace for datasets */
sid1 = H5Dget_space(dataset);
@@ -387,21 +387,21 @@ test_vltypes_vlen_atomic(void)
CHECK(tid1, FAIL, "H5Dget_type");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size,((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
@@ -423,11 +423,11 @@ test_vltypes_vlen_atomic(void)
} /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
+ ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Dvlen_reclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -447,8 +447,8 @@ test_vltypes_vlen_atomic(void)
/* Open second dataset */
- dataset=H5Dopen(fid1,"Dataset2");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset2", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Get dataspace for datasets */
sid1 = H5Dget_space(dataset);
@@ -463,19 +463,19 @@ test_vltypes_vlen_atomic(void)
CHECK(sid2, FAIL, "H5Screate");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 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");
@@ -570,11 +570,11 @@ rewrite_vltypes_vlen_atomic(void)
MESSAGE(5, ("Check Memory Leak for Basic Atomic VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+increment)*sizeof(unsigned int));
- wdata[i].len=i+increment;
- for(j=0; j<(i+increment); j++)
- ((unsigned int *)wdata[i].p)[j]=i*20+j;
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(unsigned int));
+ wdata[i].len = i + increment;
+ for(j = 0; j < (i + increment); j++)
+ ((unsigned int *)wdata[i].p)[j] = i * 20 + j;
} /* end for */
/* Open file created in test_vltypes_vlen_atomic() */
@@ -582,8 +582,8 @@ rewrite_vltypes_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset created in test_vltypes_vlen_atomic() */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Open dataspace for dataset */
sid1 = H5Dget_space(dataset);
@@ -594,7 +594,7 @@ rewrite_vltypes_vlen_atomic(void)
CHECK(tid1, FAIL, "H5Dget_type");
/* Write dataset to disk */
- ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -619,8 +619,8 @@ rewrite_vltypes_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Get dataspace for datasets */
sid1 = H5Dget_space(dataset);
@@ -631,26 +631,26 @@ rewrite_vltypes_vlen_atomic(void)
CHECK(tid1, FAIL, "H5Dget_type");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 22 elements allocated = 4+5+6+7 elements for each array position */
- VERIFY(size,22*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+ VERIFY(size, 22 * sizeof(unsigned int), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
/* 22 elements allocated = 4+5+6+7 elements for each array position */
- VERIFY(mem_used,22*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, 22 * sizeof(unsigned int), "H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -877,12 +877,12 @@ rewrite_vltypes_vlen_compound(void)
MESSAGE(5, ("Check Memory Leak for Basic Compound VL Datatype Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- 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.0);
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ 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.0);
} /* end for */
} /* end for */
@@ -894,9 +894,9 @@ rewrite_vltypes_vlen_compound(void)
tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1));
CHECK(tid2, FAIL, "H5Tcreate");
- ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
/* Create a datatype to refer to */
@@ -904,30 +904,30 @@ rewrite_vltypes_vlen_compound(void)
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Create dataspace for datasets */
sid1 = H5Dget_space(dataset);
CHECK(sid1, FAIL, "H5Dget_space");
/* Write dataset to disk */
- ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dwrite");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 22 elements allocated = 4 + 5 + 6 + 7 elements for each array position */
- VERIFY(size,22*sizeof(s1),"H5Dvlen_get_buf_size");
+ VERIFY(size, 22 * sizeof(s1), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
@@ -1055,19 +1055,19 @@ test_vltypes_compound_vlen_vlen(void)
CHECK(tid2, FAIL, "H5Tcreate");
/* Insert fields */
- ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1);
+ ret = H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1);
CHECK(ret, FAIL, "H5Tinsert");
/* Create a dataset */
- dataset=H5Dcreate(fid1,"Dataset1",tid2,sid1,H5P_DEFAULT);
+ dataset = H5Dcreate(fid1, "Dataset1", tid2, sid1, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Write dataset to disk */
- ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -1084,16 +1084,16 @@ test_vltypes_compound_vlen_vlen(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Read dataset from disk */
- ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata);
+ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE3_DIM1; i++) {
- if(wdata[i].i!=rdata[i].i) {
+ for(i = 0; i < SPACE3_DIM1; i++) {
+ if(wdata[i].i != rdata[i].i) {
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 */
@@ -1102,13 +1102,13 @@ test_vltypes_compound_vlen_vlen(void)
continue;
} /* end if */
- if(wdata[i].v.len!=rdata[i].v.len) {
+ if(wdata[i].v.len != rdata[i].v.len) {
TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
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(t1->len!=t2->len) {
+ 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;
} /* end if */
@@ -1329,20 +1329,20 @@ test_vltypes_compound_vlstr(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
- dset2=H5Dopen(fid1,"Dataset1");
- CHECK(dset2, FAIL, "H5Dopen");
+ dset2 = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dset2, FAIL, "H5Dopen2");
/* Get the data type */
tid2 = H5Dget_type(dset2);
CHECK(tid2, FAIL, "H5Dget_type");
/* Read dataset from disk */
- ret=H5Dread(dset2,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,rdata);
+ ret = H5Dread(dset2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(wdata[i].v.len!=rdata[i].v.len) {
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ if(wdata[i].v.len != rdata[i].v.len) {
TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len);
continue;
} /* end if */
@@ -1700,13 +1700,13 @@ rewrite_vltypes_compound_vlen_atomic(void)
MESSAGE(5, ("Checking memory leak for compound datatype 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*40;
- wdata[i].f=(float)((i*50)/3.0);
- wdata[i].v.p=HDmalloc((i+increment)*sizeof(unsigned int));
- wdata[i].v.len=i+increment;
- for(j=0; j<(i+increment); j++)
- ((unsigned int *)wdata[i].v.p)[j]=i*60+j;
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = i * 40;
+ wdata[i].f = (float)((i * 50) / 3.0);
+ wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
+ wdata[i].v.len = i + increment;
+ for(j = 0; j < (i + increment); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 60 + j;
} /* end for */
/* Create file */
@@ -1714,7 +1714,7 @@ rewrite_vltypes_compound_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base compound type */
@@ -1722,34 +1722,34 @@ rewrite_vltypes_compound_vlen_atomic(void)
CHECK(tid2, FAIL, "H5Tcreate");
/* Insert fields */
- ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+ ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
+ ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
CHECK(ret, FAIL, "H5Tinsert");
- ret=H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1);
+ ret = H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1);
CHECK(ret, FAIL, "H5Tinsert");
/* Create a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Create dataspace for datasets */
sid1 = H5Dget_space(dataset);
CHECK(sid1, FAIL, "H5Dget_space");
/* Write dataset to disk */
- ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dwrite");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory will be used */
- ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 22 elements allocated = 4+5+6+7 elements for each array position */
@@ -1941,40 +1941,40 @@ test_vltypes_vlen_vlen_atomic(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a VL datatype to refer to */
- tid1 = H5Tvlen_create (H5T_NATIVE_UINT);
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
CHECK(tid1, FAIL, "H5Tvlen_create");
/* Create the base VL type */
- tid2 = H5Tvlen_create (tid1);
+ tid2 = H5Tvlen_create(tid1);
CHECK(tid2, FAIL, "H5Tvlen_create");
/* Open a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
- ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 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, ((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);
+ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* 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, ((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++) {
@@ -2060,22 +2060,22 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
MESSAGE(5, ("Check memory leak for VL Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+increment)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + increment) * sizeof(hvl_t));
+ if(wdata[i].p == NULL) {
TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i);
return;
} /* end if */
- wdata[i].len=i+increment;
- for(t1=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);
+ wdata[i].len = i + increment;
+ for(t1 = 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);
return;
} /* end if */
- t1->len=j+1;
- for(k=0; k<(j+1); k++)
- ((unsigned int *)t1->p)[k]=i*1000+j*100+k*10;
+ t1->len = j + 1;
+ for(k = 0; k < (j + 1); k++)
+ ((unsigned int *)t1->p)[k] = i * 1000 + j * 100 + k * 10;
} /* end for */
} /* end for */
@@ -2084,8 +2084,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Get dataspace for datasets */
sid1 = H5Dget_space(dataset);
@@ -2096,7 +2096,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
CHECK(tid2, FAIL, "H5Dget_type");
/* Write dataset to disk */
- ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -2121,8 +2121,8 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Get dataspace for datasets */
sid1 = H5Dget_space(dataset);
@@ -2133,22 +2133,22 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
CHECK(tid2, FAIL, "H5Dget_type");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
- ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 18 hvl_t elements allocated = 3 + 4 + 5 + 6 elements for each array position */
/* 52 unsigned int elements allocated = 6 + 10 + 15 + 21 elements */
- /*VERIFY(size,18*sizeof(hvl_t)+52*sizeof(unsigned int),"H5Dvlen_get_buf_size");*/
+ /*VERIFY(size, 18 * sizeof(hvl_t) + 52 * sizeof(unsigned int), "H5Dvlen_get_buf_size");*/
/* Read dataset from disk */
- ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
+ ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
CHECK(ret, FAIL, "H5Dread");
/* Make certain the correct amount of memory has been used */
@@ -2260,8 +2260,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Get dataspace for datasets */
sid1 = H5Dget_space(dataset);
@@ -2272,7 +2272,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
CHECK(tid2, FAIL, "H5Dget_type");
/* Write dataset to disk */
- ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
+ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -2297,8 +2297,8 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
CHECK(fid1, FAIL, "H5Fopen");
/* Open a dataset */
- dataset=H5Dopen(fid1,"Dataset1");
- CHECK(dataset, FAIL, "H5Dopen");
+ dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Get dataspace for datasets */
sid1 = H5Dget_space(dataset);
@@ -2309,19 +2309,19 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
CHECK(tid2, FAIL, "H5Dget_type");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATASET_XFER);
+ xfer_pid = H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
- ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
+ ret = H5Pset_vlen_mem_manager(xfer_pid, test_vltypes_alloc_custom, &mem_used, test_vltypes_free_custom, &mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
/* Make certain the correct amount of memory was used */
- ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size);
+ ret = H5Dvlen_get_buf_size(dataset, tid2, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
/* 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, ((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);
@@ -2709,8 +2709,8 @@ test_vltypes_fill_value(void)
} /* end switch */
/* Open first data set */
- dset_id = H5Dopen(file_id, dset_name1);
- CHECK(dset_id, FAIL, "H5Dopen");
+ dset_id = H5Dopen2(file_id, dset_name1, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dopen2");
/* Read in the entire 'empty' dataset of fill value */
ret = H5Dread(dset_id, dtype1_id, dset_dspace_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2774,8 +2774,8 @@ test_vltypes_fill_value(void)
/* Open the second data set to check the value of data */
- dset_id = H5Dopen(file_id, dset_name2);
- CHECK(dset_id, FAIL, "H5Dopen");
+ dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dopen2");
/* Read in the entire 'empty' dataset of fill value */
ret = H5Dread(dset_id, dtype1_id, dset_dspace_id, dset_dspace_id, xfer_pid, rbuf);
@@ -2913,8 +2913,8 @@ test_vltypes_fill_value(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Open first data set */
- dset_id = H5Dopen(file_id, dset_name1);
- CHECK(dset_id, FAIL, "H5Dopen");
+ dset_id = H5Dopen2(file_id, dset_name1, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dopen2");
/* Write one element in the dataset */
ret = H5Dwrite(dset_id, dtype1_id, scalar_dspace_id, single_dspace_id, xfer_pid, &wdata);
@@ -3009,8 +3009,8 @@ test_vltypes_fill_value(void)
/* Open the second data set to check the value of data */
- dset_id = H5Dopen(file_id, dset_name2);
- CHECK(dset_id, FAIL, "H5Dopen");
+ dset_id = H5Dopen2(file_id, dset_name2, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dopen2");
/* Write one element in the dataset */
ret = H5Dwrite(dset_id, dtype1_id, scalar_dspace_id, single_dspace_id, xfer_pid, &wdata);