diff options
Diffstat (limited to 'tools/test/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/test/h5dump/h5dumpgentest.c | 731 |
1 files changed, 425 insertions, 306 deletions
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 7efe53c..b62c3a8 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -7264,15 +7264,33 @@ gent_packedbits(void) hid_t space = H5I_INVALID_HID; hsize_t dims[2]; - uint8_t ** dsetu8 = NULL; - uint16_t **dsetu16 = NULL; - uint32_t **dsetu32 = NULL; - uint64_t **dsetu64 = NULL; - int8_t ** dset8 = NULL; - int16_t ** dset16 = NULL; - int32_t ** dset32 = NULL; - int64_t ** dset64 = NULL; - double ** dsetdbl = NULL; + struct { + uint8_t arr[F66_XDIM][F66_YDIM8]; + } * dsetu8; + struct { + uint16_t arr[F66_XDIM][F66_YDIM16]; + } * dsetu16; + struct { + uint32_t arr[F66_XDIM][F66_YDIM32]; + } * dsetu32; + struct { + uint64_t arr[F66_XDIM][F66_YDIM64]; + } * dsetu64; + struct { + int8_t arr[F66_XDIM][F66_YDIM8]; + } * dset8; + struct { + int16_t arr[F66_XDIM][F66_YDIM16]; + } * dset16; + struct { + int32_t arr[F66_XDIM][F66_YDIM32]; + } * dset32; + struct { + int64_t arr[F66_XDIM][F66_YDIM64]; + } * dset64; + struct { + double arr[F66_XDIM][F66_YDIM8]; + } * dsetdbl; uint8_t valu8bits; uint16_t valu16bits; @@ -7286,15 +7304,15 @@ gent_packedbits(void) unsigned int i, j; /* Create arrays */ - H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8); + dsetu8 = malloc(sizeof(*dsetu8)); + dsetu16 = malloc(sizeof(*dsetu16)); + dsetu32 = malloc(sizeof(*dsetu32)); + dsetu64 = malloc(sizeof(*dsetu64)); + dset8 = malloc(sizeof(*dset8)); + dset16 = malloc(sizeof(*dset16)); + dset32 = malloc(sizeof(*dset32)); + dset64 = malloc(sizeof(*dset64)); + dsetdbl = malloc(sizeof(*dsetdbl)); fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -7306,13 +7324,13 @@ gent_packedbits(void) valu8bits = (uint8_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu8[i][0] = valu8bits; + dsetu8->arr[i][0] = valu8bits; for (j = 1; j < dims[1]; j++) - dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1); + dsetu8->arr[i][j] = (uint8_t)(dsetu8->arr[i][j - 1] << 1); valu8bits = (uint8_t)(valu8bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); H5Sclose(space); H5Dclose(dataset); @@ -7324,13 +7342,13 @@ gent_packedbits(void) valu16bits = (uint16_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu16[i][0] = valu16bits; + dsetu16->arr[i][0] = valu16bits; for (j = 1; j < dims[1]; j++) - dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1); + dsetu16->arr[i][j] = (uint16_t)(dsetu16->arr[i][j - 1] << 1); valu16bits = (uint16_t)(valu16bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); H5Sclose(space); H5Dclose(dataset); @@ -7342,13 +7360,13 @@ gent_packedbits(void) valu32bits = (uint32_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu32[i][0] = valu32bits; + dsetu32->arr[i][0] = valu32bits; for (j = 1; j < dims[1]; j++) - dsetu32[i][j] = dsetu32[i][j - 1] << 1; + dsetu32->arr[i][j] = dsetu32->arr[i][j - 1] << 1; valu32bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); H5Sclose(space); H5Dclose(dataset); @@ -7360,13 +7378,13 @@ gent_packedbits(void) valu64bits = (uint64_t)~0Lu; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu64[i][0] = valu64bits; + dsetu64->arr[i][0] = valu64bits; for (j = 1; j < dims[1]; j++) - dsetu64[i][j] = dsetu64[i][j - 1] << 1; + dsetu64->arr[i][j] = dsetu64->arr[i][j - 1] << 1; valu64bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); H5Sclose(space); H5Dclose(dataset); @@ -7378,13 +7396,13 @@ gent_packedbits(void) val8bits = (int8_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset8[i][0] = val8bits; + dset8->arr[i][0] = val8bits; for (j = 1; j < dims[1]; j++) - dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1); + dset8->arr[i][j] = (int8_t)(dset8->arr[i][j - 1] << 1); val8bits = (int8_t)(val8bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]); + H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); H5Sclose(space); H5Dclose(dataset); @@ -7396,13 +7414,13 @@ gent_packedbits(void) val16bits = (int16_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset16[i][0] = val16bits; + dset16->arr[i][0] = val16bits; for (j = 1; j < dims[1]; j++) - dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1); + dset16->arr[i][j] = (int16_t)(dset16->arr[i][j - 1] << 1); val16bits = (int16_t)(val16bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]); + H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); H5Sclose(space); H5Dclose(dataset); @@ -7414,13 +7432,13 @@ gent_packedbits(void) val32bits = (int32_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset32[i][0] = val32bits; + dset32->arr[i][0] = val32bits; for (j = 1; j < dims[1]; j++) - dset32[i][j] = dset32[i][j - 1] << 1; + dset32->arr[i][j] = dset32->arr[i][j - 1] << 1; val32bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]); + H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); H5Sclose(space); H5Dclose(dataset); @@ -7432,13 +7450,13 @@ gent_packedbits(void) val64bits = (int64_t)~0L; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset64[i][0] = val64bits; + dset64->arr[i][0] = val64bits; for (j = 1; j < dims[1]; j++) - dset64[i][j] = dset64[i][j - 1] << 1; + dset64->arr[i][j] = dset64->arr[i][j - 1] << 1; val64bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]); + H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); H5Sclose(space); H5Dclose(dataset); @@ -7450,9 +7468,9 @@ gent_packedbits(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * (double)j + (double)i; + dsetdbl->arr[i][j] = 0.0001 * (double)j + (double)i; - H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]); + H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); H5Sclose(space); H5Dclose(dataset); @@ -7489,15 +7507,33 @@ gent_attr_intsize(void) hid_t root = H5I_INVALID_HID; hsize_t dims[2]; - uint8_t ** dsetu8 = NULL; - uint16_t **dsetu16 = NULL; - uint32_t **dsetu32 = NULL; - uint64_t **dsetu64 = NULL; - int8_t ** dset8 = NULL; - int16_t ** dset16 = NULL; - int32_t ** dset32 = NULL; - int64_t ** dset64 = NULL; - double ** dsetdbl = NULL; + struct { + uint8_t arr[F66_XDIM][F66_YDIM8]; + } * dsetu8; + struct { + uint16_t arr[F66_XDIM][F66_YDIM16]; + } * dsetu16; + struct { + uint32_t arr[F66_XDIM][F66_YDIM32]; + } * dsetu32; + struct { + uint64_t arr[F66_XDIM][F66_YDIM64]; + } * dsetu64; + struct { + int8_t arr[F66_XDIM][F66_YDIM8]; + } * dset8; + struct { + int16_t arr[F66_XDIM][F66_YDIM16]; + } * dset16; + struct { + int32_t arr[F66_XDIM][F66_YDIM64]; + } * dset32; + struct { + int64_t arr[F66_XDIM][F66_YDIM64]; + } * dset64; + struct { + double arr[F66_XDIM][F66_YDIM8]; + } * dsetdbl; uint8_t valu8bits; uint16_t valu16bits; @@ -7511,15 +7547,15 @@ gent_attr_intsize(void) unsigned int i, j; /* Create arrays */ - H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8); + dsetu8 = malloc(sizeof(*dsetu8)); + dsetu16 = malloc(sizeof(*dsetu16)); + dsetu32 = malloc(sizeof(*dsetu32)); + dsetu64 = malloc(sizeof(*dsetu64)); + dset8 = malloc(sizeof(*dset8)); + dset16 = malloc(sizeof(*dset16)); + dset32 = malloc(sizeof(*dset32)); + dset64 = malloc(sizeof(*dset64)); + dsetdbl = malloc(sizeof(*dsetdbl)); fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); root = H5Gopen2(fid, "/", H5P_DEFAULT); @@ -7532,14 +7568,14 @@ gent_attr_intsize(void) valu8bits = (uint8_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu8[i][0] = valu8bits; + dsetu8->arr[i][0] = valu8bits; for (j = 1; j < dims[1]; j++) { - dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1); + dsetu8->arr[i][j] = (uint8_t)(dsetu8->arr[i][j - 1] << 1); } valu8bits = (uint8_t)(valu8bits << 1); } - H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8[0]); + H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8); H5Sclose(space); H5Aclose(attr); @@ -7551,14 +7587,14 @@ gent_attr_intsize(void) valu16bits = (uint16_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu16[i][0] = valu16bits; + dsetu16->arr[i][0] = valu16bits; for (j = 1; j < dims[1]; j++) { - dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1); + dsetu16->arr[i][j] = (uint16_t)(dsetu16->arr[i][j - 1] << 1); } valu16bits = (uint16_t)(valu16bits << 1); } - H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16[0]); + H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16); H5Sclose(space); H5Aclose(attr); @@ -7570,14 +7606,14 @@ gent_attr_intsize(void) valu32bits = (uint32_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu32[i][0] = valu32bits; + dsetu32->arr[i][0] = valu32bits; for (j = 1; j < dims[1]; j++) { - dsetu32[i][j] = dsetu32[i][j - 1] << 1; + dsetu32->arr[i][j] = dsetu32->arr[i][j - 1] << 1; } valu32bits <<= 1; } - H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32[0]); + H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32); H5Sclose(space); H5Aclose(attr); @@ -7589,14 +7625,14 @@ gent_attr_intsize(void) valu64bits = (uint64_t)~0Lu; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu64[i][0] = valu64bits; + dsetu64->arr[i][0] = valu64bits; for (j = 1; j < dims[1]; j++) { - dsetu64[i][j] = dsetu64[i][j - 1] << 1; + dsetu64->arr[i][j] = dsetu64->arr[i][j - 1] << 1; } valu64bits <<= 1; } - H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64[0]); + H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64); H5Sclose(space); H5Aclose(attr); @@ -7608,14 +7644,14 @@ gent_attr_intsize(void) val8bits = (int8_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset8[i][0] = val8bits; + dset8->arr[i][0] = val8bits; for (j = 1; j < dims[1]; j++) { - dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1); + dset8->arr[i][j] = (int8_t)(dset8->arr[i][j - 1] << 1); } val8bits = (int8_t)(val8bits << 1); } - H5Awrite(attr, H5T_NATIVE_INT8, dset8[0]); + H5Awrite(attr, H5T_NATIVE_INT8, dset8); H5Sclose(space); H5Aclose(attr); @@ -7627,14 +7663,14 @@ gent_attr_intsize(void) val16bits = (int16_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset16[i][0] = val16bits; + dset16->arr[i][0] = val16bits; for (j = 1; j < dims[1]; j++) { - dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1); + dset16->arr[i][j] = (int16_t)(dset16->arr[i][j - 1] << 1); } val16bits = (int16_t)(val16bits << 1); } - H5Awrite(attr, H5T_NATIVE_INT16, dset16[0]); + H5Awrite(attr, H5T_NATIVE_INT16, dset16); H5Sclose(space); H5Aclose(attr); @@ -7646,14 +7682,14 @@ gent_attr_intsize(void) val32bits = (int32_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset32[i][0] = val32bits; + dset32->arr[i][0] = val32bits; for (j = 1; j < dims[1]; j++) { - dset32[i][j] = dset32[i][j - 1] << 1; + dset32->arr[i][j] = dset32->arr[i][j - 1] << 1; } val32bits <<= 1; } - H5Awrite(attr, H5T_NATIVE_INT32, dset32[0]); + H5Awrite(attr, H5T_NATIVE_INT32, dset32); H5Sclose(space); H5Aclose(attr); @@ -7665,14 +7701,14 @@ gent_attr_intsize(void) val64bits = (int64_t)~0L; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset64[i][0] = val64bits; + dset64->arr[i][0] = val64bits; for (j = 1; j < dims[1]; j++) { - dset64[i][j] = dset64[i][j - 1] << 1; + dset64->arr[i][j] = dset64->arr[i][j - 1] << 1; } val64bits <<= 1; } - H5Awrite(attr, H5T_NATIVE_INT64, dset64[0]); + H5Awrite(attr, H5T_NATIVE_INT64, dset64); H5Sclose(space); H5Aclose(attr); @@ -7684,9 +7720,9 @@ gent_attr_intsize(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * (double)j + (double)i; + dsetdbl->arr[i][j] = 0.0001 * (double)j + (double)i; - H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl[0]); + H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl); H5Sclose(space); H5Aclose(attr); @@ -8586,15 +8622,33 @@ gent_intscalars(void) hid_t tid = H5I_INVALID_HID; hsize_t dims[2]; - uint8_t ** dsetu8 = NULL; - uint16_t **dsetu16 = NULL; - uint32_t **dsetu32 = NULL; - uint64_t **dsetu64 = NULL; - int8_t ** dset8 = NULL; - int16_t ** dset16 = NULL; - int32_t ** dset32 = NULL; - int64_t ** dset64 = NULL; - double ** dsetdbl = NULL; + struct { + uint8_t arr[F73_XDIM][F73_YDIM8]; + } * dsetu8; + struct { + uint16_t arr[F73_XDIM][F73_YDIM16]; + } * dsetu16; + struct { + uint32_t arr[F73_XDIM][F73_YDIM32]; + } * dsetu32; + struct { + uint64_t arr[F73_XDIM][F73_YDIM64]; + } * dsetu64; + struct { + int8_t arr[F73_XDIM][F73_YDIM8]; + } * dset8; + struct { + int16_t arr[F73_XDIM][F73_YDIM16]; + } * dset16; + struct { + int32_t arr[F73_XDIM][F73_YDIM32]; + } * dset32; + struct { + int64_t arr[F73_XDIM][F73_YDIM64]; + } * dset64; + struct { + double arr[F73_XDIM][F73_YDIM8]; + } * dsetdbl; uint8_t valu8bits; uint16_t valu16bits; @@ -8608,15 +8662,15 @@ gent_intscalars(void) unsigned int i, j; /* Create arrays */ - H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8); + dsetu8 = malloc(sizeof(*dsetu8)); + dsetu16 = malloc(sizeof(*dsetu16)); + dsetu32 = malloc(sizeof(*dsetu32)); + dsetu64 = malloc(sizeof(*dsetu64)); + dset8 = malloc(sizeof(*dset8)); + dset16 = malloc(sizeof(*dset16)); + dset32 = malloc(sizeof(*dset32)); + dset64 = malloc(sizeof(*dset64)); + dsetdbl = malloc(sizeof(*dsetdbl)); fid = H5Fcreate(FILE73, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -8629,14 +8683,14 @@ gent_intscalars(void) valu8bits = (uint8_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu8[i][0] = valu8bits; + dsetu8->arr[i][0] = valu8bits; for (j = 1; j < dims[1]; j++) { - dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1); + dsetu8->arr[i][j] = (uint8_t)(dsetu8->arr[i][j - 1] << 1); } valu8bits = (uint8_t)(valu8bits << 1); } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); H5Sclose(space); H5Dclose(dataset); @@ -8649,14 +8703,14 @@ gent_intscalars(void) valu16bits = (uint16_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu16[i][0] = valu16bits; + dsetu16->arr[i][0] = valu16bits; for (j = 1; j < dims[1]; j++) { - dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1); + dsetu16->arr[i][j] = (uint16_t)(dsetu16->arr[i][j - 1] << 1); } valu16bits = (uint16_t)(valu16bits << 1); } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); H5Sclose(space); H5Dclose(dataset); @@ -8669,14 +8723,14 @@ gent_intscalars(void) valu32bits = (uint32_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu32[i][0] = valu32bits; + dsetu32->arr[i][0] = valu32bits; for (j = 1; j < dims[1]; j++) { - dsetu32[i][j] = dsetu32[i][j - 1] << 1; + dsetu32->arr[i][j] = dsetu32->arr[i][j - 1] << 1; } valu32bits <<= 1; } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); H5Sclose(space); H5Dclose(dataset); @@ -8689,14 +8743,14 @@ gent_intscalars(void) valu64bits = (uint64_t)~0Lu; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu64[i][0] = valu64bits; + dsetu64->arr[i][0] = valu64bits; for (j = 1; j < dims[1]; j++) { - dsetu64[i][j] = dsetu64[i][j - 1] << 1; + dsetu64->arr[i][j] = dsetu64->arr[i][j - 1] << 1; } valu64bits <<= 1; } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); H5Sclose(space); H5Dclose(dataset); @@ -8709,14 +8763,14 @@ gent_intscalars(void) val8bits = (int8_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset8[i][0] = val8bits; + dset8->arr[i][0] = val8bits; for (j = 1; j < dims[1]; j++) { - dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1); + dset8->arr[i][j] = (int8_t)(dset8->arr[i][j - 1] << 1); } val8bits = (int8_t)(val8bits << 1); } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); H5Sclose(space); H5Dclose(dataset); @@ -8729,14 +8783,14 @@ gent_intscalars(void) val16bits = (int16_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset16[i][0] = val16bits; + dset16->arr[i][0] = val16bits; for (j = 1; j < dims[1]; j++) { - dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1); + dset16->arr[i][j] = (int16_t)(dset16->arr[i][j - 1] << 1); } val16bits = (int16_t)(val16bits << 1); } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); H5Sclose(space); H5Dclose(dataset); @@ -8749,14 +8803,14 @@ gent_intscalars(void) val32bits = (int32_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset32[i][0] = val32bits; + dset32->arr[i][0] = val32bits; for (j = 1; j < dims[1]; j++) { - dset32[i][j] = dset32[i][j - 1] << 1; + dset32->arr[i][j] = dset32->arr[i][j - 1] << 1; } val32bits <<= 1; } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); H5Sclose(space); H5Dclose(dataset); @@ -8769,14 +8823,14 @@ gent_intscalars(void) val64bits = (int64_t)~0L; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset64[i][0] = val64bits; + dset64->arr[i][0] = val64bits; for (j = 1; j < dims[1]; j++) { - dset64[i][j] = dset64[i][j - 1] << 1; + dset64->arr[i][j] = dset64->arr[i][j - 1] << 1; } val64bits <<= 1; } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); H5Sclose(space); H5Dclose(dataset); @@ -8789,9 +8843,9 @@ gent_intscalars(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * (double)j + (double)i; + dsetdbl->arr[i][j] = 0.0001 * (double)j + (double)i; - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); H5Sclose(space); H5Dclose(dataset); @@ -8829,15 +8883,33 @@ gent_attr_intscalars(void) hid_t tid = H5I_INVALID_HID; hsize_t dims[2]; - uint8_t ** dsetu8 = NULL; - uint16_t **dsetu16 = NULL; - uint32_t **dsetu32 = NULL; - uint64_t **dsetu64 = NULL; - int8_t ** dset8 = NULL; - int16_t ** dset16 = NULL; - int32_t ** dset32 = NULL; - int64_t ** dset64 = NULL; - double ** dsetdbl = NULL; + struct { + uint8_t arr[F73_XDIM][F73_YDIM8]; + } * dsetu8; + struct { + uint16_t arr[F73_XDIM][F73_YDIM16]; + } * dsetu16; + struct { + uint32_t arr[F73_XDIM][F73_YDIM32]; + } * dsetu32; + struct { + uint64_t arr[F73_XDIM][F73_YDIM64]; + } * dsetu64; + struct { + int8_t arr[F73_XDIM][F73_YDIM8]; + } * dset8; + struct { + int16_t arr[F73_XDIM][F73_YDIM16]; + } * dset16; + struct { + int32_t arr[F73_XDIM][F73_YDIM32]; + } * dset32; + struct { + int64_t arr[F73_XDIM][F73_YDIM64]; + } * dset64; + struct { + double arr[F73_XDIM][F73_YDIM8]; + } * dsetdbl; uint8_t valu8bits; uint16_t valu16bits; @@ -8851,15 +8923,15 @@ gent_attr_intscalars(void) unsigned int i, j; /* Create arrays */ - H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8); + dsetu8 = malloc(sizeof(*dsetu8)); + dsetu16 = malloc(sizeof(*dsetu16)); + dsetu32 = malloc(sizeof(*dsetu32)); + dsetu64 = malloc(sizeof(*dsetu64)); + dset8 = malloc(sizeof(*dset8)); + dset16 = malloc(sizeof(*dset16)); + dset32 = malloc(sizeof(*dset32)); + dset64 = malloc(sizeof(*dset64)); + dsetdbl = malloc(sizeof(*dsetdbl)); fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); root = H5Gopen2(fid, "/", H5P_DEFAULT); @@ -8873,14 +8945,14 @@ gent_attr_intscalars(void) valu8bits = (uint8_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu8[i][0] = valu8bits; + dsetu8->arr[i][0] = valu8bits; for (j = 1; j < dims[1]; j++) { - dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1); + dsetu8->arr[i][j] = (uint8_t)(dsetu8->arr[i][j - 1] << 1); } valu8bits = (uint8_t)(valu8bits << 1); } - H5Awrite(attr, tid, dsetu8[0]); + H5Awrite(attr, tid, dsetu8); H5Sclose(space); H5Aclose(attr); @@ -8893,14 +8965,14 @@ gent_attr_intscalars(void) valu16bits = (uint16_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu16[i][0] = valu16bits; + dsetu16->arr[i][0] = valu16bits; for (j = 1; j < dims[1]; j++) { - dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1); + dsetu16->arr[i][j] = (uint16_t)(dsetu16->arr[i][j - 1] << 1); } valu16bits = (uint16_t)(valu16bits << 1); } - H5Awrite(attr, tid, dsetu16[0]); + H5Awrite(attr, tid, dsetu16); H5Sclose(space); H5Aclose(attr); @@ -8913,14 +8985,14 @@ gent_attr_intscalars(void) valu32bits = (uint32_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu32[i][0] = valu32bits; + dsetu32->arr[i][0] = valu32bits; for (j = 1; j < dims[1]; j++) { - dsetu32[i][j] = dsetu32[i][j - 1] << 1; + dsetu32->arr[i][j] = dsetu32->arr[i][j - 1] << 1; } valu32bits <<= 1; } - H5Awrite(attr, tid, dsetu32[0]); + H5Awrite(attr, tid, dsetu32); H5Sclose(space); H5Aclose(attr); @@ -8933,14 +9005,14 @@ gent_attr_intscalars(void) valu64bits = (uint64_t)~0Lu; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu64[i][0] = valu64bits; + dsetu64->arr[i][0] = valu64bits; for (j = 1; j < dims[1]; j++) { - dsetu64[i][j] = dsetu64[i][j - 1] << 1; + dsetu64->arr[i][j] = dsetu64->arr[i][j - 1] << 1; } valu64bits <<= 1; } - H5Awrite(attr, tid, dsetu64[0]); + H5Awrite(attr, tid, dsetu64); H5Sclose(space); H5Aclose(attr); @@ -8953,14 +9025,14 @@ gent_attr_intscalars(void) val8bits = (int8_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset8[i][0] = val8bits; + dset8->arr[i][0] = val8bits; for (j = 1; j < dims[1]; j++) { - dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1); + dset8->arr[i][j] = (int8_t)(dset8->arr[i][j - 1] << 1); } val8bits = (int8_t)(val8bits << 1); } - H5Awrite(attr, tid, dset8[0]); + H5Awrite(attr, tid, dset8); H5Sclose(space); H5Aclose(attr); @@ -8973,14 +9045,14 @@ gent_attr_intscalars(void) val16bits = (int16_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset16[i][0] = val16bits; + dset16->arr[i][0] = val16bits; for (j = 1; j < dims[1]; j++) { - dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1); + dset16->arr[i][j] = (int16_t)(dset16->arr[i][j - 1] << 1); } val16bits = (int16_t)(val16bits << 1); } - H5Awrite(attr, tid, dset16[0]); + H5Awrite(attr, tid, dset16); H5Sclose(space); H5Aclose(attr); @@ -8993,14 +9065,14 @@ gent_attr_intscalars(void) val32bits = (int32_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset32[i][0] = val32bits; + dset32->arr[i][0] = val32bits; for (j = 1; j < dims[1]; j++) { - dset32[i][j] = dset32[i][j - 1] << 1; + dset32->arr[i][j] = dset32->arr[i][j - 1] << 1; } val32bits <<= 1; } - H5Awrite(attr, tid, dset32[0]); + H5Awrite(attr, tid, dset32); H5Sclose(space); H5Aclose(attr); @@ -9013,14 +9085,14 @@ gent_attr_intscalars(void) val64bits = (int64_t)~0L; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset64[i][0] = val64bits; + dset64->arr[i][0] = val64bits; for (j = 1; j < dims[1]; j++) { - dset64[i][j] = dset64[i][j - 1] << 1; + dset64->arr[i][j] = dset64->arr[i][j - 1] << 1; } val64bits <<= 1; } - H5Awrite(attr, tid, dset64[0]); + H5Awrite(attr, tid, dset64); H5Sclose(space); H5Aclose(attr); @@ -9033,9 +9105,9 @@ gent_attr_intscalars(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * (double)j + (double)i; + dsetdbl->arr[i][j] = 0.0001 * (double)j + (double)i; - H5Awrite(attr, tid, dsetdbl[0]); + H5Awrite(attr, tid, dsetdbl); H5Sclose(space); H5Aclose(attr); @@ -9618,15 +9690,33 @@ gent_intattrscalars(void) hid_t tid = H5I_INVALID_HID; hsize_t dims[2]; - uint8_t ** dsetu8 = NULL; - uint16_t **dsetu16 = NULL; - uint32_t **dsetu32 = NULL; - uint64_t **dsetu64 = NULL; - int8_t ** dset8 = NULL; - int16_t ** dset16 = NULL; - int32_t ** dset32 = NULL; - int64_t ** dset64 = NULL; - double ** dsetdbl = NULL; + struct { + uint8_t arr[F73_XDIM][F73_YDIM8]; + } *dsetu8 = NULL; + struct { + uint16_t arr[F73_XDIM][F73_YDIM16]; + } *dsetu16 = NULL; + struct { + uint32_t arr[F73_XDIM][F73_YDIM32]; + } *dsetu32 = NULL; + struct { + uint64_t arr[F73_XDIM][F73_YDIM64]; + } *dsetu64 = NULL; + struct { + int8_t arr[F73_XDIM][F73_YDIM8]; + } *dset8 = NULL; + struct { + int16_t arr[F73_XDIM][F73_YDIM16]; + } *dset16 = NULL; + struct { + int32_t arr[F73_XDIM][F73_YDIM32]; + } *dset32 = NULL; + struct { + int64_t arr[F73_XDIM][F73_YDIM64]; + } *dset64 = NULL; + struct { + double arr[F73_XDIM][F73_YDIM8]; + } *dsetdbl = NULL; uint8_t valu8bits; uint16_t valu16bits; @@ -9640,15 +9730,15 @@ gent_intattrscalars(void) unsigned int i, j; /* Create arrays */ - H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F73_XDIM, F73_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F73_XDIM, F73_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F73_XDIM, F73_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F73_XDIM, F73_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F73_XDIM, F73_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F73_XDIM, F73_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F73_XDIM, F73_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F73_XDIM, F73_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F73_XDIM, F73_YDIM8); + dsetu8 = malloc(sizeof(*dsetu8)); + dsetu16 = malloc(sizeof(*dsetu16)); + dsetu32 = malloc(sizeof(*dsetu32)); + dsetu64 = malloc(sizeof(*dsetu64)); + dset8 = malloc(sizeof(*dset8)); + dset16 = malloc(sizeof(*dset16)); + dset32 = malloc(sizeof(*dset32)); + dset64 = malloc(sizeof(*dset64)); + dsetdbl = malloc(sizeof(*dsetdbl)); fid = H5Fcreate(FILE78, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -9661,9 +9751,9 @@ gent_intattrscalars(void) valu8bits = (uint8_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu8[i][0] = valu8bits; + dsetu8->arr[i][0] = valu8bits; for (j = 1; j < dims[1]; j++) { - dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1); + dsetu8->arr[i][j] = (uint8_t)(dsetu8->arr[i][j - 1] << 1); } valu8bits = (uint8_t)(valu8bits << 1); } @@ -9671,7 +9761,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); /* Attribute of 8 bits unsigned int */ attr = H5Acreate2(dataset, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dsetu8[0]); + H5Awrite(attr, tid, dsetu8); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9685,9 +9775,9 @@ gent_intattrscalars(void) valu16bits = (uint16_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu16[i][0] = valu16bits; + dsetu16->arr[i][0] = valu16bits; for (j = 1; j < dims[1]; j++) { - dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1); + dsetu16->arr[i][j] = (uint16_t)(dsetu16->arr[i][j - 1] << 1); } valu16bits = (uint16_t)(valu16bits << 1); } @@ -9695,7 +9785,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); /* Attribute of 16 bits unsigned int */ attr = H5Acreate2(dataset, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dsetu16[0]); + H5Awrite(attr, tid, dsetu16); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9709,9 +9799,9 @@ gent_intattrscalars(void) valu32bits = (uint32_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu32[i][0] = valu32bits; + dsetu32->arr[i][0] = valu32bits; for (j = 1; j < dims[1]; j++) { - dsetu32[i][j] = dsetu32[i][j - 1] << 1; + dsetu32->arr[i][j] = dsetu32->arr[i][j - 1] << 1; } valu32bits <<= 1; } @@ -9719,7 +9809,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); /* Attribute of 32 bits unsigned int */ attr = H5Acreate2(dataset, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dsetu32[0]); + H5Awrite(attr, tid, dsetu32); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9733,9 +9823,9 @@ gent_intattrscalars(void) valu64bits = (uint64_t)~0Lu; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu64[i][0] = valu64bits; + dsetu64->arr[i][0] = valu64bits; for (j = 1; j < dims[1]; j++) { - dsetu64[i][j] = dsetu64[i][j - 1] << 1; + dsetu64->arr[i][j] = dsetu64->arr[i][j - 1] << 1; } valu64bits <<= 1; } @@ -9743,7 +9833,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); /* Attribute of 64 bits unsigned int */ attr = H5Acreate2(dataset, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dsetu64[0]); + H5Awrite(attr, tid, dsetu64); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9757,9 +9847,9 @@ gent_intattrscalars(void) val8bits = (int8_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset8[i][0] = val8bits; + dset8->arr[i][0] = val8bits; for (j = 1; j < dims[1]; j++) { - dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1); + dset8->arr[i][j] = (int8_t)(dset8->arr[i][j - 1] << 1); } val8bits = (int8_t)(val8bits << 1); } @@ -9767,7 +9857,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); /* Attribute of 8 bits signed int */ attr = H5Acreate2(dataset, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dset8[0]); + H5Awrite(attr, tid, dset8); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9781,9 +9871,9 @@ gent_intattrscalars(void) val16bits = (int16_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset16[i][0] = val16bits; + dset16->arr[i][0] = val16bits; for (j = 1; j < dims[1]; j++) { - dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1); + dset16->arr[i][j] = (int16_t)(dset16->arr[i][j - 1] << 1); } val16bits = (int16_t)(val16bits << 1); } @@ -9791,7 +9881,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); /* Attribute of 16 bits signed int */ attr = H5Acreate2(dataset, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dset16[0]); + H5Awrite(attr, tid, dset16); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9805,9 +9895,9 @@ gent_intattrscalars(void) val32bits = (int32_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset32[i][0] = val32bits; + dset32->arr[i][0] = val32bits; for (j = 1; j < dims[1]; j++) { - dset32[i][j] = dset32[i][j - 1] << 1; + dset32->arr[i][j] = dset32->arr[i][j - 1] << 1; } val32bits <<= 1; } @@ -9815,7 +9905,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); /* Attribute of 32 bits signed int */ attr = H5Acreate2(dataset, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dset32[0]); + H5Awrite(attr, tid, dset32); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9829,9 +9919,9 @@ gent_intattrscalars(void) val64bits = (int64_t)~0L; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset64[i][0] = val64bits; + dset64->arr[i][0] = val64bits; for (j = 1; j < dims[1]; j++) { - dset64[i][j] = dset64[i][j - 1] << 1; + dset64->arr[i][j] = dset64->arr[i][j - 1] << 1; } val64bits <<= 1; } @@ -9839,7 +9929,7 @@ gent_intattrscalars(void) H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); /* Attribute of 64 bits signed int */ attr = H5Acreate2(dataset, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dset64[0]); + H5Awrite(attr, tid, dset64); H5Aclose(attr); H5Sclose(space); H5Dclose(dataset); @@ -9853,12 +9943,12 @@ gent_intattrscalars(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * (double)j + (double)i; + dsetdbl->arr[i][j] = 0.0001 * (double)j + (double)i; H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); /* Attribute of double */ attr = H5Acreate2(dataset, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT); - H5Awrite(attr, tid, dsetdbl[0]); + H5Awrite(attr, tid, dsetdbl); H5Aclose(attr); H5Sclose(space); @@ -9896,15 +9986,33 @@ gent_intsattrs(void) hid_t aspace = H5I_INVALID_HID; hsize_t dims[2], adims[1]; - uint8_t ** dsetu8 = NULL; - uint16_t **dsetu16 = NULL; - uint32_t **dsetu32 = NULL; - uint64_t **dsetu64 = NULL; - int8_t ** dset8 = NULL; - int16_t ** dset16 = NULL; - int32_t ** dset32 = NULL; - int64_t ** dset64 = NULL; - double ** dsetdbl = NULL; + struct { + uint8_t arr[F66_XDIM][F66_YDIM8]; + } * dsetu8; + struct { + uint16_t arr[F66_XDIM][F66_YDIM16]; + } * dsetu16; + struct { + uint32_t arr[F66_XDIM][F66_YDIM32]; + } * dsetu32; + struct { + uint64_t arr[F66_XDIM][F66_YDIM64]; + } * dsetu64; + struct { + int8_t arr[F66_XDIM][F66_YDIM8]; + } * dset8; + struct { + int16_t arr[F66_XDIM][F66_YDIM16]; + } * dset16; + struct { + int32_t arr[F66_XDIM][F66_YDIM32]; + } * dset32; + struct { + int64_t arr[F66_XDIM][F66_YDIM64]; + } * dset64; + struct { + double arr[F66_XDIM][F66_YDIM8]; + } * dsetdbl; uint8_t * asetu8 = NULL; uint16_t *asetu16 = NULL; @@ -9928,15 +10036,15 @@ gent_intsattrs(void) unsigned int i, j; /* Create arrays */ - H5TEST_ALLOCATE_2D_ARRAY(dsetu8, uint8_t, F66_XDIM, F66_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dsetu16, uint16_t, F66_XDIM, F66_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dsetu32, uint32_t, F66_XDIM, F66_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dsetu64, uint64_t, F66_XDIM, F66_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dset8, int8_t, F66_XDIM, F66_YDIM8); - H5TEST_ALLOCATE_2D_ARRAY(dset16, int16_t, F66_XDIM, F66_YDIM16); - H5TEST_ALLOCATE_2D_ARRAY(dset32, int32_t, F66_XDIM, F66_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dset64, int64_t, F66_XDIM, F66_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dsetdbl, double, F66_XDIM, F66_YDIM8); + dsetu8 = malloc(sizeof(*dsetu8)); + dsetu16 = malloc(sizeof(*dsetu16)); + dsetu32 = malloc(sizeof(*dsetu32)); + dsetu64 = malloc(sizeof(*dsetu64)); + dset8 = malloc(sizeof(*dset8)); + dset16 = malloc(sizeof(*dset16)); + dset32 = malloc(sizeof(*dset32)); + dset64 = malloc(sizeof(*dset64)); + dsetdbl = malloc(sizeof(*dsetdbl)); asetu8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(uint8_t)); asetu16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(uint16_t)); @@ -9958,16 +10066,16 @@ gent_intsattrs(void) valu8bits = (uint8_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu8[i][0] = valu8bits; - asetu8[i * dims[1]] = dsetu8[i][0]; + dsetu8->arr[i][0] = valu8bits; + asetu8[i * dims[1]] = dsetu8->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1); - asetu8[i * dims[1] + j] = dsetu8[i][j]; + dsetu8->arr[i][j] = (uint8_t)(dsetu8->arr[i][j - 1] << 1); + asetu8[i * dims[1] + j] = dsetu8->arr[i][j]; } valu8bits = (uint8_t)(valu8bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); /* Attribute of 8 bits unsigned int */ adims[0] = F66_XDIM * F66_YDIM8; aspace = H5Screate_simple(1, adims, NULL); @@ -9986,16 +10094,16 @@ gent_intsattrs(void) valu16bits = (uint16_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu16[i][0] = valu16bits; - asetu16[i * dims[1]] = dsetu16[i][0]; + dsetu16->arr[i][0] = valu16bits; + asetu16[i * dims[1]] = dsetu16->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dsetu16[i][j] = (uint16_t)(dsetu16[i][j - 1] << 1); - asetu16[i * dims[1] + j] = dsetu16[i][j]; + dsetu16->arr[i][j] = (uint16_t)(dsetu16->arr[i][j - 1] << 1); + asetu16[i * dims[1] + j] = dsetu16->arr[i][j]; } valu16bits = (uint16_t)(valu16bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); /* Attribute of 16 bits unsigned int */ adims[0] = F66_XDIM * F66_YDIM16; aspace = H5Screate_simple(1, adims, NULL); @@ -10014,16 +10122,16 @@ gent_intsattrs(void) valu32bits = (uint32_t)~0u; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu32[i][0] = valu32bits; - asetu32[i * dims[1]] = dsetu32[i][0]; + dsetu32->arr[i][0] = valu32bits; + asetu32[i * dims[1]] = dsetu32->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dsetu32[i][j] = dsetu32[i][j - 1] << 1; - asetu32[i * dims[1] + j] = dsetu32[i][j]; + dsetu32->arr[i][j] = dsetu32->arr[i][j - 1] << 1; + asetu32[i * dims[1] + j] = dsetu32->arr[i][j]; } valu32bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); /* Attribute of 32 bits unsigned int */ adims[0] = F66_XDIM * F66_YDIM32; aspace = H5Screate_simple(1, adims, NULL); @@ -10042,16 +10150,16 @@ gent_intsattrs(void) valu64bits = (uint64_t)~0Lu; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dsetu64[i][0] = valu64bits; - asetu64[i * dims[1]] = dsetu64[i][0]; + dsetu64->arr[i][0] = valu64bits; + asetu64[i * dims[1]] = dsetu64->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dsetu64[i][j] = dsetu64[i][j - 1] << 1; - asetu64[i * dims[1] + j] = dsetu64[i][j]; + dsetu64->arr[i][j] = dsetu64->arr[i][j - 1] << 1; + asetu64[i * dims[1] + j] = dsetu64->arr[i][j]; } valu64bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]); + H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); /* Attribute of 64 bits unsigned int */ adims[0] = F66_XDIM * F66_YDIM64; aspace = H5Screate_simple(1, adims, NULL); @@ -10070,16 +10178,16 @@ gent_intsattrs(void) val8bits = (int8_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset8[i][0] = val8bits; - aset8[i * dims[1]] = dset8[i][0]; + dset8->arr[i][0] = val8bits; + aset8[i * dims[1]] = dset8->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dset8[i][j] = (int8_t)(dset8[i][j - 1] << 1); - aset8[i * dims[1] + j] = dset8[i][j]; + dset8->arr[i][j] = (int8_t)(dset8->arr[i][j - 1] << 1); + aset8[i * dims[1] + j] = dset8->arr[i][j]; } val8bits = (int8_t)(val8bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]); + H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); /* Attribute of 8 bits signed int */ adims[0] = F66_XDIM * F66_YDIM8; aspace = H5Screate_simple(1, adims, NULL); @@ -10098,16 +10206,16 @@ gent_intsattrs(void) val16bits = (int16_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset16[i][0] = val16bits; - aset16[i * dims[1]] = dset16[i][0]; + dset16->arr[i][0] = val16bits; + aset16[i * dims[1]] = dset16->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dset16[i][j] = (int16_t)(dset16[i][j - 1] << 1); - aset16[i * dims[1] + j] = dset16[i][j]; + dset16->arr[i][j] = (int16_t)(dset16->arr[i][j - 1] << 1); + aset16[i * dims[1] + j] = dset16->arr[i][j]; } val16bits = (int16_t)(val16bits << 1); } - H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]); + H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); /* Attribute of 16 bits signed int */ adims[0] = F66_XDIM * F66_YDIM16; aspace = H5Screate_simple(1, adims, NULL); @@ -10126,16 +10234,16 @@ gent_intsattrs(void) val32bits = (int32_t)~0; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset32[i][0] = val32bits; - aset32[i * dims[1]] = dset32[i][0]; + dset32->arr[i][0] = val32bits; + aset32[i * dims[1]] = dset32->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dset32[i][j] = dset32[i][j - 1] << 1; - aset32[i * dims[1] + j] = dset32[i][j]; + dset32->arr[i][j] = dset32->arr[i][j - 1] << 1; + aset32[i * dims[1] + j] = dset32->arr[i][j]; } val32bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]); + H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); /* Attribute of 32 bits signed int */ adims[0] = F66_XDIM * F66_YDIM32; aspace = H5Screate_simple(1, adims, NULL); @@ -10154,16 +10262,16 @@ gent_intsattrs(void) val64bits = (int64_t)~0L; /* all 1s */ for (i = 0; i < dims[0]; i++) { - dset64[i][0] = val64bits; - aset64[i * dims[1]] = dset64[i][0]; + dset64->arr[i][0] = val64bits; + aset64[i * dims[1]] = dset64->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dset64[i][j] = dset64[i][j - 1] << 1; - aset64[i * dims[1] + j] = dset64[i][j]; + dset64->arr[i][j] = dset64->arr[i][j - 1] << 1; + aset64[i * dims[1] + j] = dset64->arr[i][j]; } val64bits <<= 1; } - H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]); + H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); /* Attribute of 64 bits signed int */ adims[0] = F66_XDIM * F66_YDIM64; aspace = H5Screate_simple(1, adims, NULL); @@ -10182,11 +10290,11 @@ gent_intsattrs(void) for (i = 0; i < dims[0]; i++) for (j = 0; j < dims[1]; j++) { - dsetdbl[i][j] = 0.0001 * (double)j + (double)i; - asetdbl[i * dims[1] + j] = dsetdbl[i][j]; + dsetdbl->arr[i][j] = 0.0001 * (double)j + (double)i; + asetdbl[i * dims[1] + j] = dsetdbl->arr[i][j]; } - H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]); + H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); /* Attribute of double */ adims[0] = F66_XDIM * F66_YDIM8; aspace = H5Screate_simple(1, adims, NULL); @@ -10238,9 +10346,15 @@ gent_floatsattrs(void) hid_t aspace = H5I_INVALID_HID; hsize_t dims[2], adims[1]; - float ** dset32 = NULL; - double ** dset64 = NULL; - long double **dset128 = NULL; + struct { + float arr[F89_XDIM][F89_YDIM32]; + } * dset32; + struct { + double arr[F89_XDIM][F89_YDIM64]; + } * dset64; + struct { + long double arr[F89_XDIM][F89_YDIM128]; + } * dset128; float * aset32 = NULL; double * aset64 = NULL; @@ -10253,9 +10367,9 @@ gent_floatsattrs(void) unsigned int i, j; /* Create arrays */ - H5TEST_ALLOCATE_2D_ARRAY(dset32, float, F89_XDIM, F89_YDIM32); - H5TEST_ALLOCATE_2D_ARRAY(dset64, double, F89_XDIM, F89_YDIM64); - H5TEST_ALLOCATE_2D_ARRAY(dset128, long double, F89_XDIM, F89_YDIM128); + dset32 = malloc(sizeof(*dset32)); + dset64 = malloc(sizeof(*dset64)); + dset128 = malloc(sizeof(*dset128)); aset32 = HDcalloc(F89_XDIM * F89_YDIM32, sizeof(float)); aset64 = HDcalloc(F89_XDIM * F89_YDIM64, sizeof(double)); @@ -10277,16 +10391,16 @@ gent_floatsattrs(void) val32bits = (float)F89_YDIM32; for (i = 0; i < dims[0]; i++) { - dset32[i][0] = val32bits; - aset32[i * dims[1]] = dset32[i][0]; + dset32->arr[i][0] = val32bits; + aset32[i * dims[1]] = dset32->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dset32[i][j] = (float)(j * dims[0] + i) / (float)F89_YDIM32; - aset32[i * dims[1] + j] = dset32[i][j]; + dset32->arr[i][j] = (float)(j * dims[0] + i) / (float)F89_YDIM32; + aset32[i * dims[1] + j] = dset32->arr[i][j]; } val32bits -= (float)1; } - H5Dwrite(dataset, H5T_IEEE_F32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]); + H5Dwrite(dataset, H5T_IEEE_F32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); /* Attribute of 32 bits float */ adims[0] = F89_XDIM * F89_YDIM32; aspace = H5Screate_simple(1, adims, NULL); @@ -10305,16 +10419,16 @@ gent_floatsattrs(void) val64bits = (double)F89_YDIM64; for (i = 0; i < dims[0]; i++) { - dset64[i][0] = val64bits; - aset64[i * dims[1]] = dset64[i][0]; + dset64->arr[i][0] = val64bits; + aset64[i * dims[1]] = dset64->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dset64[i][j] = (double)(j * dims[0] + i) / (double)F89_YDIM64; - aset64[i * dims[1] + j] = dset64[i][j]; + dset64->arr[i][j] = (double)(j * dims[0] + i) / (double)F89_YDIM64; + aset64[i * dims[1] + j] = dset64->arr[i][j]; } val64bits -= (double)1; } - H5Dwrite(dataset, H5T_IEEE_F64LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]); + H5Dwrite(dataset, H5T_IEEE_F64LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); /* Attribute of 64 bits double */ adims[0] = F89_XDIM * F89_YDIM64; aspace = H5Screate_simple(1, adims, NULL); @@ -10333,16 +10447,16 @@ gent_floatsattrs(void) val128bits = (long double)F89_YDIM128; for (i = 0; i < dims[0]; i++) { - dset128[i][0] = val128bits; - aset128[i * dims[1]] = dset128[i][0]; + dset128->arr[i][0] = val128bits; + aset128[i * dims[1]] = dset128->arr[i][0]; for (j = 1; j < dims[1]; j++) { - dset128[i][j] = (long double)(j * dims[0] + i) / (long double)F89_YDIM128; - aset128[i * dims[1] + j] = dset128[i][j]; + dset128->arr[i][j] = (long double)(j * dims[0] + i) / (long double)F89_YDIM128; + aset128[i * dims[1] + j] = dset128->arr[i][j]; } val128bits -= (long double)1; } - H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset128[0]); + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset128); /* Attribute of 128 bits long double */ adims[0] = F89_XDIM * F89_YDIM128; aspace = H5Screate_simple(1, adims, NULL); @@ -10534,13 +10648,17 @@ gent_bitnopaquefields(void) static void gent_intsfourdims(void) { - hid_t fid, dataset, space; - hsize_t dims[F81_RANK]; - uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM]; + hid_t fid, dataset, space; + hsize_t dims[F81_RANK]; + struct { + uint32_t arr[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM]; + } * dset1; unsigned int i, j, k, l; fid = H5Fcreate(FILE81, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + dset1 = malloc(sizeof(*dset1)); + /* Dataset of 32 bits unsigned int */ dims[0] = F81_ZDIM; dims[1] = F81_YDIM; @@ -10553,7 +10671,7 @@ gent_intsfourdims(void) for (j = 0; j < F81_YDIM; j++) for (k = 0; k < F81_XDIM; k++) for (l = 0; l < F81_WDIM; l++) - dset1[i][j][k][l] = + dset1->arr[i][j][k][l] = i * F81_YDIM * F81_XDIM * F81_WDIM + j * F81_XDIM * F81_WDIM + k * F81_WDIM + l; H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); @@ -10561,6 +10679,7 @@ gent_intsfourdims(void) H5Dclose(dataset); H5Fclose(fid); + free(dset1); } /*------------------------------------------------------------------------- |