summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2016-07-12 17:18:06 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2016-07-12 17:18:06 (GMT)
commit3bd9ac725c8807150bf6ed8fe1cdd2f09d7a595e (patch)
treec2cb8576b787be37722e08e03e82a7bb098497bd /tools/h5dump
parentd6d7e62d0b0920c6f63f111b60a22f5a9a50eda5 (diff)
downloadhdf5-3bd9ac725c8807150bf6ed8fe1cdd2f09d7a595e.zip
hdf5-3bd9ac725c8807150bf6ed8fe1cdd2f09d7a595e.tar.gz
hdf5-3bd9ac725c8807150bf6ed8fe1cdd2f09d7a595e.tar.bz2
[svn-r30172] HDFFV-9953,9955: add new testfiles to h5dump (required for hdfview testing). These dataset types did not exist in other files.
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dumpgentest.c1045
1 files changed, 727 insertions, 318 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 10b59f9..058ea90 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -111,6 +111,8 @@
#define FILE79 "tintsattrs.h5"
#define FILE80 "tbitnopaque.h5"
#define FILE81 "tints4dims.h5"
+#define FILE82 "tcompound_complex2.h5"
+#define FILE83 "tvlenstr_array.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -263,20 +265,20 @@ typedef struct s1_t {
#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
/* "FILE66" macros and for FILE69 */
-#define F66_XDIM 8
+#define F66_XDIM 8
#define F66_DATASETU08 "DU08BITS"
#define F66_DATASETS08 "DS08BITS"
-#define F66_YDIM8 8
+#define F66_YDIM8 8
#define F66_DATASETU16 "DU16BITS"
#define F66_DATASETS16 "DS16BITS"
-#define F66_YDIM16 16
+#define F66_YDIM16 16
#define F66_DATASETU32 "DU32BITS"
#define F66_DATASETS32 "DS32BITS"
-#define F66_YDIM32 32
+#define F66_YDIM32 32
#define F66_DATASETU64 "DU64BITS"
#define F66_DATASETS64 "DS64BITS"
#define F66_YDIM64 64
-#define F66_DUMMYDBL "DummyDBL"
+#define F66_DUMMYDBL "DummyDBL"
/* "FILE70" macros and for FILE71 */
/* Name of dataset to create in datafile */
@@ -351,6 +353,28 @@ typedef struct s1_t {
#define F81_YDIM 6
#define F81_ZDIM 4
+/* "File 82" macros */
+/* Name of dataset to create in datafile */
+#define F82_DATASETNAME "CompoundComplex1D"
+#define F82_DATASETNAME2 "CompoundComplex2D"
+#define F82_DATASETNAME3 "CompoundComplex3D"
+#define F82_DATASETNAME4 "CompoundComplex4D"
+/* Dataset dimensions */
+#define F82_DIM32 32
+#define F82_RANK 1
+#define F82_RANK2 2
+#define F82_RANK3 3
+#define F82_RANK4 4
+
+/* "File 83" macros */
+/* Name of dataset to create in datafile */
+#define F83_DATASETNAME "ScalarArrayOfVlenStr"
+#define F83_DATASETNAME2 "CompoundArrayOfVlenStr"
+/* Dataset dimensions */
+#define F83_DIM 5
+#define F83_RANK 1
+#define F83_ARRAYDIM 3
+
static void
gent_group(void)
{
@@ -428,7 +452,7 @@ gent_dataset(void)
for(i = 0; i < 30; i++)
for(j = 0; j < 20; j++)
- dset2[i][j] = 0.0001F * j + i;
+ dset2[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -523,7 +547,7 @@ gent_attribute(void)
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++) d[i] = 0.1F * i;
+ for(i = 0; i < 10; i++) d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space);
@@ -567,7 +591,7 @@ static void gent_softlink(void)
* Function: gent_softlink2
*
* Purpose: Create soft links to various objects.
- * Return:
+ * Return:
* SUCCEED
* FAIL
* Programmer: Jonathan Kim
@@ -581,7 +605,7 @@ static int gent_softlink2(void)
hid_t gid1 = -1, gid2 = -1;
hid_t datatype = -1;
hid_t dset1 = -1, dset2 = -1;
- hid_t dataspace = -1;
+ hid_t dataspace = -1;
hsize_t dimsf[2]; /* dataset dimensions */
int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
@@ -625,7 +649,7 @@ static int gent_softlink2(void)
status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
{
- fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
+ fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
status = FAIL;
goto out;
}
@@ -951,16 +975,16 @@ static void gent_compound_dt(void) { /* test compound data type */
for(i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F/(i+1));
+ dset1[i].c = (float)(1.0F/(float)(i+1));
dset2[i].a = i;
- dset2[i].b = (float)(i+ i*0.1F);
+ dset2[i].b = (float)((float)i+ (float)i*0.1F);
dset4[i].a = i;
dset4[i].b = (float)(i+3);
dset5[i].a = i;
- dset5[i].b = (float)(i*0.1F);
+ dset5[i].b = (float)((float)i*0.1F);
}
@@ -1136,16 +1160,16 @@ static void gent_compound_dt2(void) { /* test compound data type */
for(i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F/(i+1));
+ dset1[i].c = (float)(1.0F / (float)(i+ 1));
dset2[i].a = i;
- dset2[i].b = (float)(i+ i*0.1F);
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset4[i].a = i;
- dset4[i].b = (float)(i*1.0F);
+ dset4[i].b = (float)((float)i * 1.0F);
dset5[i].a = i;
- dset5[i].b = (float)(i*1.0F);
+ dset5[i].b = (float)((float)i * 1.0F);
}
fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1385,7 +1409,7 @@ static void gent_all(void)
space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 10; i++)
- dset2_1[i] = (float)(i * 0.1F + 1);
+ dset2_1[i] = (float)((float)i * 0.1F + 1);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
H5Sclose(space);
H5Dclose(dataset);
@@ -1396,7 +1420,7 @@ static void gent_all(void)
dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 3; i++)
for(j = 0; j < 5; j++)
- dset2_2[i][j] = (float)((i + 1) * j * 0.1F);
+ dset2_2[i][j] = (float)((float)(i + 1) * (float)j * 0.1F);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
H5Sclose(space);
H5Dclose(dataset);
@@ -1564,7 +1588,7 @@ gent_many(void)
space2 = H5Screate_simple(1, dims, NULL);
attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 10; i++)
- d[i] = 0.1F * i;
+ d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space2);
H5Aclose(attr);
@@ -1574,9 +1598,9 @@ gent_many(void)
for(i2 = 0; i2 < 2; i2++) {
for(i1 = 0; i1 < 2; i1++) {
for(i0 = 0; i0 < 2; i0++) {
- dset1[j].a[i3][i2][i1][i0] = i0+j;
- dset1[j].b[i3][i2][i1][i0] = (double)(i0+j);
- dset1[j].c[i3][i2][i1][i0] = (double)(i0+j+sdim);
+ dset1[j].a[i3][i2][i1][i0] = i0 + j;
+ dset1[j].b[i3][i2][i1][i0] = (double)(i0 + j);
+ dset1[j].c[i3][i2][i1][i0] = (double)((hsize_t)i0 + (hsize_t)j + sdim);
}
}
}
@@ -1879,7 +1903,7 @@ static void gent_str2(void)
block[0]=1;
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1892,7 +1916,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1912,7 +1936,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0;(hsize_t) i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1926,7 +1950,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1945,7 +1969,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1959,7 +1983,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -2045,7 +2069,7 @@ static void gent_objref(void)
dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(tu32 = (uint32_t *)((void*)wbuf), i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = i * 3;
+ *tu32++ = (uint32_t)(i * 3);
/* Write selection to disk */
H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -2150,7 +2174,7 @@ static void gent_datareg(void)
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
- *tu8++=i*3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -2259,7 +2283,7 @@ static void gent_attrreg(void)
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
- *tu8++=i*3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -2377,8 +2401,8 @@ static void gent_nestcomp(void)
for(i = 0; i< 10; i++) {
s1[i].a = i;
s1[i].b = (float)(i*i);
- s1[i].c = 1.0F/(i+1);
- s1[i].d.a = 65 + i;
+ s1[i].c = 1.0F/(float)(i + 1);
+ s1[i].d.a = (char)(65 + i);
s1[i].d.b[0] = -100.0F;
s1[i].d.b[1] = 100.0F;
}
@@ -2449,8 +2473,8 @@ static void gent_opaque(void)
hsize_t dim = 2;
for(x = 0; x < 100; x++){
- test[x][0] = x;
- test[x][1] = 99 - x;
+ test[x][0] = (char)x;
+ test[x][1] = (char)(99 - x);
}
/*
@@ -2550,8 +2574,8 @@ static void gent_vldatatypes(void)
for(i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((i + 1) * sizeof(int));
- wdata[i].len = i + 1;
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ wdata[i].len = (size_t)(i + 1);
for(j = 0; j < i + 1; j++)
((int *)wdata[i].p)[j] = i * 10 + j;
@@ -2577,12 +2601,12 @@ static void gent_vldatatypes(void)
for(i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((i + 1) * sizeof(float));
- wdata[i].len = i + 1;
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float));
+ wdata[i].len = (size_t)(i + 1);
for(j = 0; j < i + 1; j++)
- ((float *)wdata[i].p)[j] = (float)(i * 10 + ((float)j) / 10.0F);
- }
+ ((float *)wdata[i].p)[j] = (float)((float)(i * 10) + ((float)j) / 10.0F);
+ } /* end for */
/* write out the floats in little-endian format */
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
@@ -2699,9 +2723,9 @@ gent_vldatatypes2(void)
static void gent_vldatatypes3(void)
{
typedef struct { /* Struct that the VL sequences are composed of */
- int i;
- float f;
- hvl_t v;
+ int i;
+ float f;
+ hvl_t v;
} s1;
s1 wdata[SPACE1_DIM1]; /* Information to write */
hid_t fid1; /* HDF5 File IDs */
@@ -2714,12 +2738,12 @@ static void gent_vldatatypes3(void)
/* 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;
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)((float)(i * 20)/3.0F);
+ wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
+ wdata[i].v.len = (size_t)(i + 1);
+ for(j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
/* Create file */
@@ -2769,8 +2793,8 @@ static void gent_vldatatypes3(void)
static void gent_vldatatypes4(void)
{
typedef struct { /* Struct that the VL sequences are composed of */
- int i;
- float f;
+ int i;
+ float f;
} s1;
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hid_t fid1; /* HDF5 File IDs */
@@ -2783,11 +2807,11 @@ static void gent_vldatatypes4(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- 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);
+ 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 = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)((float)(i * 20 + j) / 3.0F);
} /* end for */
} /* end for */
@@ -2852,10 +2876,10 @@ static void gent_vldatatypes5(void)
wdata[i].p=NULL;
} /* end if */
else {
- wdata[i].len=i+5;
- wdata[i].p=HDmalloc(sizeof(unsigned)*(i+5));
- for(j=0; j<i+5; j++)
- ((unsigned *)wdata[i].p)[j]=j*2;
+ wdata[i].len = (size_t)(i + 5);
+ wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5));
+ for(j = 0; j < i + 5; j++)
+ ((unsigned *)wdata[i].p)[j] = (unsigned)(j * 2);
} /* end else */
} /* end for */
@@ -2895,9 +2919,9 @@ static void gent_vldatatypes5(void)
}
/* This is big enough to make h5dump to use hyperslap to read
- from file and display portion by portion. This also prints out array indices
+ from file and display portion by portion. This also prints out array indices
via region reference for testing refion reference output.
- Note: this was added originally prepared for bug2092. before the fix h5dump didn't
+ Note: this was added originally prepared for bug2092. before the fix h5dump didn't
display array indices every 262 x N (N > 0) based on 2000x1000 dims.
*/
#define SPACE_ARRAY1BIG_DIM 2000
@@ -2944,7 +2968,7 @@ static void gent_array1_big(void)
fid1 = H5Fcreate(FILE25_BIG, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------
- * Array type dataset
+ * Array type dataset
*/
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
@@ -2960,7 +2984,7 @@ static void gent_array1_big(void)
HDassert(ret >= 0);
/*---------------------------
- * Region Reference dataset
+ * Region Reference dataset
*/
/* Create dataspace for the reference dataset */
sid2 = H5Screate_simple(SPACE1_RANK, dims2, NULL);
@@ -3157,8 +3181,8 @@ static void gent_array4(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].i=i*10+j;
- wdata[i][j].f=(float)(i*2.5F+j);
+ wdata[i][j].i = i * 10 + j;
+ wdata[i][j].f = (float)((float)i * 2.5F + (float)j);
} /* end for */
/* Create file */
@@ -3224,9 +3248,9 @@ static void gent_array5(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].i=i*10+j;
+ wdata[i][j].i = i * 10 + j;
for(k=0; k<ARRAY1_DIM1; k++)
- wdata[i][j].f[k]=(float)(i*10+j*2.5F+k);
+ wdata[i][j].f[k] = (float)((float)i * 10 + (float)j * 2.5F + (float)k);
} /* end for */
/* Create file */
@@ -3294,10 +3318,10 @@ static void gent_array6(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int));
- wdata[i][j].len=i+j+1;
- for(k=0; k<(i+j+1); k++)
- ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k;
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for(k = 0; k < (i + j + 1); k++)
+ ((unsigned int *)wdata[i][j].p)[k] = (unsigned)(i * 100 + j * 10 + k);
} /* end for */
/* Create file */
@@ -3355,11 +3379,11 @@ static void gent_array7(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1));
- wdata[i][j].len=i+j+1;
- for(k=0; k<(i+j+1); k++)
- for(l=0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l]=i*1000+j*100+k*10+l;
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for(k = 0; k < (i + j + 1); k++)
+ for(l = 0; l<ARRAY1_DIM1; l++)
+ ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] = (unsigned)(i * 1000+j * 100+k * 10 + l);
} /* end for */
/* Create file */
@@ -3417,15 +3441,15 @@ static void gent_array8(void)
herr_t status = -1;
hsize_t sdims[] = {F64_DIM0};
hsize_t tdims[] = {F64_DIM1};
- int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */
+ int wdata[F64_DIM1]; /* Write buffer */
unsigned int i;
/*
* Initialize data. i is the element in the dataspace, j and k the
* elements within the array datatype.
*/
- for (i=0; i<F64_DIM1; i++)
- wdata[i] = i;
+ for (i = 0; i < F64_DIM1; i++)
+ wdata[i] = (int)i;
/*
* Create a new file using the default properties.
@@ -3699,7 +3723,7 @@ void gent_multi(void)
sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
/*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/
- memb_addr[mt] = MAX(mt - 1,0) * (HADDR_MAX / 10);
+ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
}
memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER;
@@ -4086,8 +4110,8 @@ static void write_attr_in(hid_t loc_id,
for(j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
@@ -4143,7 +4167,7 @@ static void write_attr_in(hid_t loc_id,
for(i = 0; i < 4; i++) {
for(j = 0; j < 3; j++) {
for(k = 0; k < 2; k++) {
- buf23[i][j][k]=n++;
+ buf23[i][j][k] = (char)n++;
}
}
}
@@ -4169,7 +4193,7 @@ static void write_attr_in(hid_t loc_id,
for(i = 0; i < 4; i++) {
for(j = 0; j < 3; j++) {
for(k = 0; k < 2; k++) {
- buf33[i][j][k].a=n++;
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b=n++;
}
}
@@ -4218,8 +4242,8 @@ static void write_attr_in(hid_t loc_id,
for(k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
@@ -4528,8 +4552,8 @@ static void write_dset_in(hid_t loc_id,
for(j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
@@ -4594,13 +4618,10 @@ static void write_dset_in(hid_t loc_id,
*/
n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- buf23[i][j][k]=n++;
- }
- }
- }
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 3; j++)
+ for(k = 0; k < 2; k++)
+ buf23[i][j][k] = (char)n++;
tid = H5Tcopy(H5T_STD_B8LE);
write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23);
status = H5Tclose(tid);
@@ -4620,14 +4641,12 @@ static void write_dset_in(hid_t loc_id,
*/
n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 3; j++)
for(k = 0; k < 2; k++) {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
}
- }
- }
tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
@@ -4672,8 +4691,8 @@ static void write_dset_in(hid_t loc_id,
for(k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
@@ -4918,25 +4937,20 @@ static void gent_compound_complex(void)
for(m = 0; m< F41_LENGTH; m++) {
Array1[m].a = m;
- for(n = 0; n < F41_DIMb; n++) {
+ for(n = 0; n < F41_DIMb; n++)
Array1[m].b[n] = quote[n];
- }
- for(n = 0; n < F41_ARRAY_DIMc; n++) {
+ for(n = 0; n < F41_ARRAY_DIMc; n++)
Array1[m].c[n] = chararray[n];
- }
- for(n = 0; n < F41_ARRAY_DIMd1; n++) {
- for(o = 0; o < F41_ARRAY_DIMd2; o++){
- Array1[m].d[n][o] = m + n + o;
- }
- }
+ for(n = 0; n < F41_ARRAY_DIMd1; n++)
+ for(o = 0; o < F41_ARRAY_DIMd2; o++)
+ Array1[m].d[n][o] = (short)(m + n + o);
- Array1[m].e = (float)( m * 0.96F );
+ Array1[m].e = (float)((float)m * 0.96F );
- for(n = 0; n < F41_ARRAY_DIMf; n++) {
- Array1[m].f[n] = ( m * 1024.9637F );
- }
+ for(n = 0; n < F41_ARRAY_DIMf; n++)
+ Array1[m].f[n] = ((float)m * 1024.9637F );
Array1[m].g = 'm';
}
@@ -5209,7 +5223,7 @@ static void gent_zero_dim_size(void)
space = H5Screate_simple(SPACE3_RANK, dims1, NULL);
/* dataset */
- dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT,
+ dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
/* nothing should be written */
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
@@ -7022,10 +7036,9 @@ gent_packedbits(void)
valu8bits = (uint8_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
- }
- valu8bits <<= 1;
+ for(j = 1; j < dims[1]; j++)
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -7037,13 +7050,12 @@ gent_packedbits(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
+ valu16bits = (uint16_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
- for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
- }
- valu16bits <<= 1;
+ for(j = 1; j < dims[1]; j++)
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -7055,12 +7067,11 @@ gent_packedbits(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
+ valu32bits = (uint32_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu32[i][0] = valu32bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dsetu32[i][j] = dsetu32[i][j-1] << 1;
- }
valu32bits <<= 1;
}
@@ -7076,9 +7087,8 @@ gent_packedbits(void)
valu64bits = (uint64_t) ~0Lu; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu64[i][0] = valu64bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dsetu64[i][j] = dsetu64[i][j-1] << 1;
- }
valu64bits <<= 1;
}
@@ -7091,13 +7101,12 @@ gent_packedbits(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
+ val8bits = (int8_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
- for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
- }
- val8bits <<= 1;
+ for(j = 1; j < dims[1]; j++)
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -7109,13 +7118,12 @@ gent_packedbits(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
+ val16bits = (int16_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
- for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
- }
- val16bits <<= 1;
+ for(j = 1; j < dims[1]; j++)
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -7127,12 +7135,11 @@ gent_packedbits(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
+ val32bits = (int32_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset32[i][0] = val32bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dset32[i][j] = dset32[i][j-1] << 1;
- }
val32bits <<= 1;
}
@@ -7148,9 +7155,8 @@ gent_packedbits(void)
val64bits = (int64_t) ~0L; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset64[i][0] = val64bits;
- for(j = 1; j < dims[1]; j++) {
+ for(j = 1; j < dims[1]; j++)
dset64[i][j] = dset64[i][j-1] << 1;
- }
val64bits <<= 1;
}
@@ -7165,7 +7171,7 @@ gent_packedbits(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -7213,9 +7219,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8);
@@ -7231,9 +7237,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16);
@@ -7285,9 +7291,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Awrite(attr, H5T_NATIVE_INT8, dset8);
@@ -7303,9 +7309,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Awrite(attr, H5T_NATIVE_INT16, dset16);
@@ -7355,7 +7361,7 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl);
@@ -7466,33 +7472,33 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
}
valu32bits <<= 1;
@@ -7502,9 +7508,9 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
}
valu64bits <<= 1;
@@ -7514,33 +7520,33 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
}
val32bits <<= 1;
@@ -7550,9 +7556,9 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
}
val64bits <<= 1;
@@ -7561,9 +7567,9 @@ static void gent_compound_intsizes(void) {
/* Double Dummy set for failure tests */
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
- for(n = 0; n < dims[0]; n++)
- for(o = 0; o < dims[1]; o++)
- Array1[m].dsetdbl[n][o] = 0.0001F * o + n;
+ for(n = 0; n < (int)dims[0]; n++)
+ for(o = 0; o < (int)dims[1]; o++)
+ Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -7741,33 +7747,33 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
}
valu32bits <<= 1;
@@ -7777,9 +7783,9 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
}
valu64bits <<= 1;
@@ -7789,33 +7795,33 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
}
val32bits <<= 1;
@@ -7825,9 +7831,9 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
}
val64bits <<= 1;
@@ -7836,9 +7842,9 @@ static void gent_compound_attr_intsizes(void) {
/* Double Dummy set for failure tests */
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
- for(n = 0; n < dims[0]; n++)
- for(o = 0; o < dims[1]; o++)
- Array1[m].dsetdbl[n][o] = 0.0001F * o + n;
+ for(n = 0; n < (int)dims[0]; n++)
+ for(o = 0; o < (int)dims[1]; o++)
+ Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -8006,17 +8012,17 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
dset1[i].b = (float)(i*i);
dset2[i].a = i;
- dset2[i].b = (float)(i+i*0.1F);
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset2[i].c = GREEN;
for(j = 0; j < 5; j++) {
- dset3[i].a[j] = i*j;
+ dset3[i].a[j] = i * j;
for(k = 0; k < 6; k++) {
- dset3[i].b[j][k] = (float)(i*j*k*1.0F);
+ dset3[i].b[j][k] = (float)((float)i * (float)j * (float)k * 1.0F);
}
}
dset3[i].c.a = i;
- dset3[i].c.b = (float)(i*1.0F);
+ dset3[i].c.b = (float)((float)i * 1.0F);
}
fid = H5Fcreate(FILE72, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -8154,9 +8160,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -8173,9 +8179,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -8230,9 +8236,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -8249,9 +8255,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -8304,7 +8310,7 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -8353,9 +8359,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Awrite(attr, tid, dsetu8);
@@ -8372,9 +8378,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Awrite(attr, tid, dsetu16);
@@ -8429,9 +8435,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Awrite(attr, tid, dset8);
@@ -8448,9 +8454,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Awrite(attr, tid, dset16);
@@ -8503,7 +8509,7 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, tid, dsetdbl);
@@ -8542,9 +8548,9 @@ gent_string_scalars(void)
memset(string, ' ', F73_XDIM * F73_YDIM8);
for(i = 0; i < dims[0]; i++) {
- string[i][0] = 'A' + i;
+ string[i][0] = (char)('A' + i);
for(j = 1; j < dims[1]; j++) {
- string[i][j] = string[i][j-1] + 1;
+ string[i][j] = (char)(string[i][j-1] + 1);
}
}
string[dims[0]-1][dims[1]-1] = 0;
@@ -8617,26 +8623,26 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM8;
valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dsetu8[n] = valu8bits;
- valu8bits <<= 1;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu8[n] = valu8bits;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F76_DIM16;
valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dsetu16[n] = valu16bits;
- valu16bits <<= 1;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu16[n] = valu16bits;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F76_DIM32;
valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dsetu32[n] = valu32bits;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu32[n] = valu32bits;
valu32bits <<= 1;
}
@@ -8644,8 +8650,8 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM64;
valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dsetu64[n] = valu64bits;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu64[n] = valu64bits;
valu64bits <<= 1;
}
@@ -8653,26 +8659,26 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM8;
val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dset8[n] = val8bits;
- val8bits <<= 1;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset8[n] = val8bits;
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F76_DIM16;
val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dset16[n] = val16bits;
- val16bits <<= 1;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset16[n] = val16bits;
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F76_DIM32;
val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dset32[n] = val32bits;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset32[n] = val32bits;
val32bits <<= 1;
}
@@ -8680,16 +8686,16 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM64;
val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < dims[0]; n++){
- Cmpd1[m].dset64[n] = val64bits;
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset64[n] = val64bits;
val64bits <<= 1;
}
/* Double Dummy set for failure tests */
dims[0] = F76_DIM8;
- for(n = 0; n < dims[0]; n++)
- Cmpd1[m].dsetdbl[n] = 0.0001F + n;
+ for(n = 0; n < (int)dims[0]; n++)
+ Cmpd1[m].dsetdbl[n] = 0.0001F + (float)n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -8864,64 +8870,64 @@ static void gent_compound_ints(void) {
for (m = 0; m < F77_LENGTH; m++) {
/* Array of 8 bits unsigned int */
- if((m % F76_DIM8) == 0)
- valu8bits = (uint8_t) ~0u; /* all 1s */
- Cmpd1[m].dsetu8 = valu8bits;
- Cmpd2[m].dsetu8 = valu8bits;
- valu8bits <<= 1;
+ if((m % F76_DIM8) == 0)
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ Cmpd1[m].dsetu8 = valu8bits;
+ Cmpd2[m].dsetu8 = valu8bits;
+ valu8bits = (uint8_t)(valu8bits << 1);
/* Array of 16 bits unsigned int */
- if((m % F76_DIM16) == 0)
+ if((m % F76_DIM16) == 0)
valu16bits = (uint16_t) ~0u; /* all 1s */
- Cmpd1[m].dsetu16 = valu16bits;
- Cmpd2[m].dsetu16 = valu16bits;
- valu16bits <<= 1;
+ Cmpd1[m].dsetu16 = valu16bits;
+ Cmpd2[m].dsetu16 = valu16bits;
+ valu16bits = (uint16_t)(valu16bits << 1);
/* Array of 32 bits unsigned int */
- if((m % F76_DIM32) == 0)
+ if((m % F76_DIM32) == 0)
valu32bits = (uint32_t) ~0u; /* all 1s */
- Cmpd1[m].dsetu32 = valu32bits;
- Cmpd2[m].dsetu32 = valu32bits;
- valu32bits <<= 1;
+ Cmpd1[m].dsetu32 = valu32bits;
+ Cmpd2[m].dsetu32 = valu32bits;
+ valu32bits <<= 1;
/* Array of 64 bits unsigned int */
- if((m % F76_DIM64) == 0)
+ if((m % F76_DIM64) == 0)
valu64bits = (uint64_t) ~0Lu; /* all 1s */
- Cmpd1[m].dsetu64 = valu64bits;
- Cmpd2[m].dsetu64 = valu64bits;
- valu64bits <<= 1;
+ Cmpd1[m].dsetu64 = valu64bits;
+ Cmpd2[m].dsetu64 = valu64bits;
+ valu64bits <<= 1;
/* Array of 8 bits signed int */
- if((m % F76_DIM8) == 0)
+ if((m % F76_DIM8) == 0)
val8bits = (int8_t) ~0; /* all 1s */
- Cmpd1[m].dset8 = val8bits;
- Cmpd2[m].dset8 = val8bits;
- val8bits <<= 1;
+ Cmpd1[m].dset8 = val8bits;
+ Cmpd2[m].dset8 = val8bits;
+ val8bits = (int8_t)(val8bits << 1);
/* Array of 16 bits signed int */
- if((m % F76_DIM16) == 0)
+ if((m % F76_DIM16) == 0)
val16bits = (int16_t) ~0; /* all 1s */
- Cmpd1[m].dset16 = val16bits;
- Cmpd2[m].dset16 = val16bits;
- val16bits <<= 1;
+ Cmpd1[m].dset16 = val16bits;
+ Cmpd2[m].dset16 = val16bits;
+ val16bits = (int16_t)(val16bits << 1);
/* Array of 32 bits signed int */
- if((m % F76_DIM32) == 0)
+ if((m % F76_DIM32) == 0)
val32bits = (int32_t) ~0; /* all 1s */
- Cmpd1[m].dset32 = val32bits;
- Cmpd2[m].dset32 = val32bits;
- val32bits <<= 1;
+ Cmpd1[m].dset32 = val32bits;
+ Cmpd2[m].dset32 = val32bits;
+ val32bits <<= 1;
/* Array of 64 bits signed int */
- if((m % F76_DIM64) == 0)
+ if((m % F76_DIM64) == 0)
val64bits = (int64_t) ~0L; /* all 1s */
- Cmpd1[m].dset64 = val64bits;
- Cmpd2[m].dset64 = val64bits;
- val64bits <<= 1;
+ Cmpd1[m].dset64 = val64bits;
+ Cmpd2[m].dset64 = val64bits;
+ val64bits <<= 1;
/* Double Dummy set for failure tests */
- Cmpd1[m].dsetdbl = 0.0001F + m;
- Cmpd2[m].dsetdbl = 0.0001F + m;
+ Cmpd1[m].dsetdbl = 0.0001F + (float)m;
+ Cmpd2[m].dsetdbl = 0.0001F + (float)m;
}
/* Create the dataspace */
@@ -9076,9 +9082,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -9099,9 +9105,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -9168,9 +9174,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -9191,9 +9197,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -9258,7 +9264,7 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
/* Attribute of double */
@@ -9310,10 +9316,10 @@ gent_intsattrs(void)
dsetu8[i][0] = valu8bits;
asetu8[i*dims[1]] = dsetu8[i][0];
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
asetu8[i*dims[1]+j] = dsetu8[i][j];
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -9332,15 +9338,15 @@ gent_intsattrs(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu16bits = (uint16_t) ~0u; /* all 1s */
+ valu16bits = (uint16_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
asetu16[i*dims[1]] = dsetu16[i][0];
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
asetu16[i*dims[1]+j] = dsetu16[i][j];
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -9359,7 +9365,7 @@ gent_intsattrs(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- valu32bits = (uint32_t) ~0u; /* all 1s */
+ valu32bits = (uint32_t) ~0u; /* all 1s */
for(i = 0; i < dims[0]; i++){
dsetu32[i][0] = valu32bits;
asetu32[i*dims[1]] = dsetu32[i][0];
@@ -9413,15 +9419,15 @@ gent_intsattrs(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val8bits = (int8_t) ~0; /* all 1s */
+ val8bits = (int8_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
aset8[i*dims[1]] = dset8[i][0];
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
aset8[i*dims[1]+j] = dset8[i][j];
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -9440,15 +9446,15 @@ gent_intsattrs(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val16bits = (int16_t) ~0; /* all 1s */
+ val16bits = (int16_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
aset16[i*dims[1]] = dset16[i][0];
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
aset16[i*dims[1]+j] = dset16[i][j];
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -9467,7 +9473,7 @@ gent_intsattrs(void)
space = H5Screate_simple(2, dims, NULL);
dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- val32bits = (int32_t) ~0; /* all 1s */
+ val32bits = (int32_t) ~0; /* all 1s */
for(i = 0; i < dims[0]; i++){
dset32[i][0] = val32bits;
aset32[i*dims[1]] = dset32[i][0];
@@ -9523,7 +9529,7 @@ gent_intsattrs(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++) {
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
asetdbl[i*dims[1]+j] = dsetdbl[i][j];
}
@@ -9700,7 +9706,7 @@ static void gent_bitnopaquefields(void)
static void
gent_intsfourdims(void)
{
- hid_t fid, dataset, space, tid;
+ hid_t fid, dataset, space;
hsize_t dims[F81_RANK];
uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
unsigned int i, j, k, l;
@@ -9725,6 +9731,407 @@ gent_intsfourdims(void)
H5Fclose(fid);
}
+/*-------------------------------------------------------------------------
+ * Function: gent_compound_complex2
+ *
+ * Purpose: Generate a file to be used in testing compound datatypes of
+ * various sizes, dimensions, member types and nesting.
+ *-------------------------------------------------------------------------
+ */
+static void gent_compound_complex2(void)
+{
+ /* Third-level nested compound */
+ typedef struct {
+ short deep_nested_short[10];
+ int deep_nested_int[10];
+ long deep_nested_long[10];
+ double deep_nested_double[10];
+ float deep_nested_float[10];
+ } third_level_compound;
+
+ /* Second-level multiply-nested compounds */
+ typedef struct {
+ unsigned int multiple_nested_a[5];
+ int multiple_nested_b[5];
+ unsigned long multiple_nested_c[5];
+ long multiple_nested_d[5];
+ } further_nested;
+
+ typedef struct {
+ char further_nested_string[11];
+ char further_nested_string_array[4][13];
+ third_level_compound deep_nest;
+ } further_nested2;
+
+ /* First First-level nested compound */
+ typedef struct
+ {
+ double nested_a;
+ char nested_string[23];
+ char nested_string_array[4][12];
+ } nested_compound;
+
+ /* Second First-level nested compound */
+ typedef struct
+ {
+ float a;
+ further_nested b;
+ further_nested2 c;
+ } multiple_nested_compound;
+
+ /* Compound datatype with different member types */
+ typedef struct
+ {
+ /* Arrays nested inside compound */
+ unsigned int a[4];
+ int b[6];
+ float c[2][4];
+ nested_compound d; /* Compound inside compound */
+ multiple_nested_compound e; /* Compound inside compound with further nested compound */
+ } compound;
+
+ compound buf[F82_DIM32]; /* compound */
+
+ hid_t file, grp=-1, type=-1, space=-1, dset=-1;
+ hid_t dset_array_a, dset_array_b, dset_array_c;
+ hid_t cmpd_tid1, cmpd_tid2, cmpd_tid3;
+ size_t i;
+ size_t j, k;
+ unsigned dset_array_ndims;
+ hsize_t dset_array_a_dims[1], dset_array_b_dims[1], dset_array_c_dims[2];
+ hsize_t nelmts = F82_DIM32;
+
+ file = H5Fcreate(FILE82, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) {
+ /* CompoundComplex1D */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
+ /* Insert top-level array members */
+ dset_array_ndims = 1; dset_array_a_dims[0] = 4;
+ dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims);
+ H5Tinsert(type, "a", HOFFSET(compound, a), dset_array_a);
+ H5Tclose(dset_array_a);
+
+ dset_array_ndims = 1; dset_array_b_dims[0] = 6;
+ dset_array_b = H5Tarray_create2(H5T_STD_I32LE, dset_array_ndims, dset_array_b_dims);
+ H5Tinsert(type, "b", HOFFSET(compound, b), dset_array_b);
+ H5Tclose(dset_array_b);
+
+ dset_array_ndims = 2; dset_array_c_dims[0] = 2; dset_array_c_dims[1] = 4;
+ dset_array_c = H5Tarray_create2(H5T_IEEE_F32LE, dset_array_ndims, dset_array_c_dims);
+ H5Tinsert(type, "c", HOFFSET(compound, c), dset_array_c);
+ H5Tclose(dset_array_c);
+
+ /* Insert first nested compound */
+ hid_t str_type, array;
+ hsize_t dims[1];
+ cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(nested_compound));
+
+ H5Tinsert(cmpd_tid1, "nested_double", HOFFSET(nested_compound, nested_a), H5T_IEEE_F64LE);
+
+ dims[0] = 1;
+ str_type = mkstr(23, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(cmpd_tid1, "nested_string", HOFFSET(nested_compound, nested_string), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ dims[0] = 4;
+ str_type = mkstr(12, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(cmpd_tid1, "nested_string_array", HOFFSET(nested_compound, nested_string_array), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ H5Tinsert(type, "nested_compound", HOFFSET(compound, d), cmpd_tid1);
+
+ /* Insert second nested compound */
+ hid_t nest1, nest2;
+ cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(multiple_nested_compound));
+
+ H5Tinsert(cmpd_tid2, "nested_float", HOFFSET(multiple_nested_compound, a), H5T_IEEE_F32LE);
+
+ /* Add first further nested compound */
+ nest1 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested));
+
+ dims[0] = 5;
+ array = H5Tarray_create2(H5T_STD_U32LE, 1, dims);
+ H5Tinsert(nest1, "nested_unsigned_int", HOFFSET(further_nested, multiple_nested_a), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
+ H5Tinsert(nest1, "nested_int", HOFFSET(further_nested, multiple_nested_b), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_U64LE, 1, dims);
+ H5Tinsert(nest1, "nested_unsigned_long", HOFFSET(further_nested, multiple_nested_c), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I64LE, 1, dims);
+ H5Tinsert(nest1, "nested_long", HOFFSET(further_nested, multiple_nested_d), array);
+ H5Tclose(array);
+
+ H5Tinsert(cmpd_tid2, "further_nested_compoundA", HOFFSET(multiple_nested_compound, b), nest1);
+ H5Tclose(nest1);
+
+ /* Add second further nested compound */
+ nest2 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested2));
+
+ dims[0] = 1;
+ str_type = mkstr(11, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string", HOFFSET(further_nested2, further_nested_string), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ dims[0] = 4;
+ str_type = mkstr(13, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string_array", HOFFSET(further_nested2, further_nested_string_array), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ /* Add a final third-level nested compound to this second-level compound */
+ cmpd_tid3 = H5Tcreate(H5T_COMPOUND, sizeof(third_level_compound));
+
+ dims[0] = 10;
+ array = H5Tarray_create2(H5T_STD_I16LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_short", HOFFSET(third_level_compound, deep_nested_short), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_int", HOFFSET(third_level_compound, deep_nested_int), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I64LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_long", HOFFSET(third_level_compound, deep_nested_long), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_IEEE_F64LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_double", HOFFSET(third_level_compound, deep_nested_double), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_IEEE_F32LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_float", HOFFSET(third_level_compound, deep_nested_float), array);
+ H5Tclose(array);
+
+ H5Tinsert(nest2, "deep_nested_compound", HOFFSET(further_nested2, deep_nest), cmpd_tid3);
+
+ H5Tinsert(cmpd_tid2, "further_nested_compoundB", HOFFSET(multiple_nested_compound, c), nest2);
+ H5Tclose(nest2);
+
+ H5Tinsert(type, "multiple_nested_compound", HOFFSET(compound, e), cmpd_tid2);
+
+
+ if ((dset = H5Dcreate2(file, F82_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++) {
+ for (j = 0; j < dset_array_a_dims[0]; j++)
+ buf[i].a[j] = (unsigned int)(j + i*10);
+ for (j = 0; j < dset_array_b_dims[0]; j++)
+ buf[i].b[j] = (int)(j - i*10);
+ for (j = 0; j < dset_array_c_dims[0]; j++)
+ for (k = 0; k < dset_array_c_dims[1]; k++)
+ buf[i].c[j][k] = (float)(j + k + i*10) + (float)(j) * 0.1F;
+
+ /* Set up first nested compound */
+ buf[i].d.nested_a = (double) i;
+
+ strcpy(buf[i].d.nested_string, "This is a test string.");
+
+ for (j = 0; j < 4; j++)
+ strcpy(buf[i].d.nested_string_array[j], "String test");
+
+ /* Set up multiple nested compound */
+ buf[i].e.a = (float) i;
+
+ for (j = 0; j < 5; j++) {
+ buf[i].e.b.multiple_nested_a[j] = (unsigned int)(j + i*10);
+ buf[i].e.b.multiple_nested_b[j] = (int)(j - i*10);
+ buf[i].e.b.multiple_nested_c[j] = (unsigned long)(j + i*10);
+ buf[i].e.b.multiple_nested_d[j] = (long)(j - i*10);
+ }
+
+ strcpy(buf[i].e.c.further_nested_string, "1234567890");
+ for (j = 0; j < 4; j++)
+ strcpy(buf[i].e.c.further_nested_string_array[j], "STRING ARRAY");
+
+ for (j = 0; j < 10; j++) {
+ buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_int[j] = (int)(j - i*10);
+ buf[i].e.c.deep_nest.deep_nested_long[j] = (long)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_double[j] = (double)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_float[j] = (float)(j + i*10);
+ }
+ }
+
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ fprintf(stderr, "gent_tcompound_complex2 H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(type);
+ }
+ H5Tclose(cmpd_tid1);
+ H5Tclose(cmpd_tid2);
+ H5Tclose(cmpd_tid3);
+ H5Sclose(space);
+ }
+
+// /* CompoundComplex2D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK2, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+//
+// /* CompoundComplex3D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK3, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+//
+// /* CompoundComplex4D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK4, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+
+ H5Fclose(file);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_vlenstr_array
+ *
+ * Purpose: Generate a file to be used in testing Arrays of variable
+ * length strings.
+ *-------------------------------------------------------------------------
+ */
+static void gent_vlenstr_array(void)
+{
+ /* Compound datatype with different member types */
+ typedef struct compound
+ {
+ /* Array of variable-length strings*/
+ const char *vlen_array[F83_ARRAYDIM];
+ } compound;
+ compound buf[F83_DIM];
+
+ const char *test[F83_ARRAYDIM] = {
+ "This is a variable-length test string.",
+ "This test string is also variable-length.",
+ "A final test of variable-length strings. This string is longer than the others."
+ };
+ const char *buffer[F83_DIM*F83_ARRAYDIM];
+
+ hid_t file, type=-1, space=-1, dset=-1;
+ hid_t cmpd_tid1, array_tid;
+ int i, j;
+
+ hsize_t dims[] = {F83_DIM}, arraydim[] = {F83_ARRAYDIM};
+ /* Initialize scalar data */
+ for (i = 0; i < F83_DIM; i++)
+ for (j = 0; j < 3; j++)
+ buffer[j + 3*i] = test[j];
+
+ /* Initialize compound data */
+ for (i = 0; i < F83_DIM; i++)
+ for (j = 0; j < 3; j++)
+ buf[i].vlen_array[j] = test[j];
+
+ file = H5Fcreate(FILE83, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((space = H5Screate_simple(F83_RANK, dims, NULL)) >= 0) {
+ array_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(array_tid, H5T_VARIABLE);
+
+ /* ScalarArrayOfVlenStr */
+ if ((type = H5Tarray_create2(array_tid, F83_RANK, arraydim)) >= 0) {
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
+ fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(type);
+ }
+ H5Tclose(array_tid);
+ H5Sclose(space);
+ }
+
+ if ((space = H5Screate_simple(F83_RANK, dims, NULL)) >= 0) {
+ /* CompoundArrayOfVlenStr */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
+ cmpd_tid1 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(cmpd_tid1, H5T_VARIABLE);
+
+ array_tid = H5Tarray_create2(cmpd_tid1, F83_RANK, arraydim);
+ H5Tinsert(type, "vlen_str_array", HOFFSET(compound, vlen_array), array_tid);
+
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(cmpd_tid1);
+ H5Tclose(type);
+ }
+ H5Sclose(space);
+ }
+
+ H5Fclose(file);
+}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -9779,9 +10186,11 @@ int main(void)
gent_multi();
gent_large_objname();
gent_vlstr();
+ gent_vlenstr_array();
gent_char();
gent_attr_all();
gent_compound_complex();
+ gent_compound_complex2();
gent_named_dtype_attr();
gent_null_space();
gent_zero_dim_size();