Merge pull request #2541 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:develop_minor to develop

* commit 'c03ee563f46013d22f36a1895664a9ba876558e9':
  Further updates to the tools warnings fixes from code review.
  Updates to tools warning PR from code review.
  Fixes for warnings in the tools code.
This commit is contained in:
Dana Robinson 2020-04-27 10:51:58 -05:00
commit 9a598477c6
17 changed files with 763 additions and 424 deletions

View File

@ -125,6 +125,65 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define H5_FILEACCESS_VFD 0x01
#define H5_FILEACCESS_LIBVER 0x02
/* Macros to create and fill 2D arrays with a single heap allocation.
* These can be used to replace large stack and global arrays which raise
* warnings.
*
* The macros make a single heap allocation large enough to hold all the
* pointers and the data elements. The first part of the allocation holds
* the pointers, and the second part holds the data as a contiguous block
* in row-major order.
*
* To pass the data block to calls like H5Dread(), pass a pointer to the
* first array element as the data pointer (e.g., array[0] in a 2D array).
*
* The fill macro just fills the array with an increasing count value.
*
* Usage:
*
* int **array;
*
* H5TEST_ALLOCATE_2D_ARRAY(array, int, 5, 10);
*
* H5TEST_FILL_2D_ARRAY(array, int, 5, 10);
*
* (do stuff)
*
* HDfree(array);
*/
#define H5TEST_ALLOCATE_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
do { \
/* Prefix with h5taa to avoid shadow warnings */ \
size_t h5taa_pointers_size = 0; \
size_t h5taa_data_size = 0; \
int h5taa_i; \
\
h5taa_pointers_size = (DIMS_I) * sizeof(TYPE *); \
h5taa_data_size = (DIMS_I) * (DIMS_J) * sizeof(TYPE); \
\
ARR = (TYPE **)HDmalloc(h5taa_pointers_size + h5taa_data_size); \
\
ARR[0] = (TYPE *)(ARR + (DIMS_I)); \
\
for (h5taa_i = 1; h5taa_i < (DIMS_I); h5taa_i++) \
ARR[h5taa_i] = ARR[h5taa_i-1] + (DIMS_J); \
} while(0)
#define H5TEST_FILL_2D_ARRAY(ARR, TYPE, DIMS_I, DIMS_J) \
do { \
/* Prefix with h5tfa to avoid shadow warnings */ \
int h5tfa_i = 0; \
int h5tfa_j = 0; \
TYPE h5tfa_count = 0; \
\
for (h5tfa_i = 0; h5tfa_i < (DIMS_I); h5tfa_i++) \
for (h5tfa_j = 0; h5tfa_j < (DIMS_J); h5tfa_j++) { \
ARR[h5tfa_i][h5tfa_j] = h5tfa_count; \
h5tfa_count++; \
} \
} while(0)
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -53,9 +53,9 @@ typedef struct {
*/
/* linked list to keep exclude path list */
struct exclude_path_list {
char *obj_path;
h5trav_type_t obj_type;
struct exclude_path_list * next;
const char *obj_path;
h5trav_type_t obj_type;
struct exclude_path_list *next;
};
/* Enumeration value for keeping track of whether an error occurred or differences were found */

View File

@ -197,7 +197,7 @@ void parse_command_line(int argc,
}
/* init */
exclude_node->obj_path = (char*)opt_arg;
exclude_node->obj_path = opt_arg;
exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
exclude_prev = exclude_head;
@ -207,7 +207,7 @@ void parse_command_line(int argc,
}
else {
while(NULL != exclude_prev->next)
exclude_prev=exclude_prev->next;
exclude_prev = exclude_prev->next;
exclude_node->next = NULL;
exclude_prev->next = exclude_node;
@ -215,14 +215,14 @@ void parse_command_line(int argc,
break;
case 'd':
opts->d=1;
opts->d = 1;
if (check_d_input(opt_arg) == - 1) {
HDprintf("<-d %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
opts->delta = atof(opt_arg);
opts->delta = HDatof(opt_arg);
/* -d 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
@ -230,13 +230,13 @@ void parse_command_line(int argc,
break;
case 'p':
opts->p=1;
opts->p = 1;
if (check_p_input(opt_arg) == -1) {
HDprintf("<-p %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
opts->percent = atof(opt_arg);
opts->percent = HDatof(opt_arg);
/* -p 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
@ -244,7 +244,7 @@ void parse_command_line(int argc,
break;
case 'n':
opts->n=1;
opts->n = 1;
if ( check_n_input(opt_arg) == -1) {
HDprintf("<-n %s> is not a valid option\n", opt_arg);
usage();
@ -427,7 +427,7 @@ check_p_input( const char *str )
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
x = atof(str);
x = HDatof(str);
if (x < 0)
return -1;
@ -461,7 +461,7 @@ check_d_input( const char *str )
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
x = atof(str);
x = HDatof(str);
if (x < 0)
return -1;

View File

@ -732,15 +732,15 @@ xml_escape_the_name(const char *str)
* Programmer: REMcG
*-------------------------------------------------------------------------
*/
static char *
static char *
xml_escape_the_string(const char *str, int slen)
{
size_t extra;
size_t len;
size_t i;
const char *cp;
char *ncp;
char *rcp;
const char *cp = NULL;
char *ncp = NULL;
char *rcp = NULL;
size_t ncp_len;
if (!str)
@ -792,20 +792,24 @@ xml_escape_the_string(const char *str, int slen)
esc_len = 1;
}
else if (*cp == '\'') {
HDstrncpy(ncp, apos, ncp_len);
ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(apos);
HDstrncpy(ncp, apos, esc_len);
}
else if (*cp == '<') {
HDstrncpy(ncp, lt, ncp_len);
ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(lt);
HDstrncpy(ncp, lt, esc_len);
}
else if (*cp == '>') {
HDstrncpy(ncp, gt, ncp_len);
ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(gt);
HDstrncpy(ncp, gt, esc_len);
}
else if (*cp == '&') {
HDstrncpy(ncp, amp, ncp_len);
ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(amp);
HDstrncpy(ncp, amp, esc_len);
}
else {
*ncp = *cp;

View File

@ -148,7 +148,7 @@ parse_command_line (int argc, const char *argv[])
int opt = FALSE;
/* parse command line options */
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
{

View File

@ -35,7 +35,7 @@ endif ()
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (h5dumpgentest STATIC)
target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools)

View File

@ -19,7 +19,7 @@
include $(top_srcdir)/config/commence.am
# Include files in /src directory and /tools/lib directory
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
# Test programs and scripts
TEST_PROG=h5dumpgentest

View File

@ -22,7 +22,7 @@
*/
#include "hdf5.h"
#include "H5private.h"
#include "h5test.h"
#include "h5tools.h"
#define FILE1 "tgroup.h5"
@ -7209,19 +7209,43 @@ gent_dataset_idx(void)
static void
gent_packedbits(void)
{
hid_t fid, dataset, space;
hid_t fid = H5I_INVALID_HID;
hid_t dataset = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hsize_t dims[2];
uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
double dsetdbl[F66_XDIM][F66_YDIM8];
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;
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
int8_t val8bits;
int16_t val16bits;
int32_t val32bits;
int64_t val64bits;
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);
fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@ -7237,7 +7261,7 @@ gent_packedbits(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7254,7 +7278,7 @@ gent_packedbits(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7271,7 +7295,7 @@ gent_packedbits(void)
valu32bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7288,7 +7312,7 @@ gent_packedbits(void)
valu64bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7305,7 +7329,7 @@ gent_packedbits(void)
val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7322,7 +7346,7 @@ gent_packedbits(void)
val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7339,7 +7363,7 @@ gent_packedbits(void)
val32bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7356,7 +7380,7 @@ gent_packedbits(void)
val64bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -7369,11 +7393,21 @@ gent_packedbits(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
HDfree(dsetu8);
HDfree(dsetu16);
HDfree(dsetu32);
HDfree(dsetu64);
HDfree(dset8);
HDfree(dset16);
HDfree(dset32);
HDfree(dset64);
HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@ -7390,19 +7424,44 @@ gent_packedbits(void)
static void
gent_attr_intsize(void)
{
hid_t fid, attr, space, root;
hid_t fid = H5I_INVALID_HID;
hid_t attr = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t root = H5I_INVALID_HID;
hsize_t dims[2];
uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
double dsetdbl[F66_XDIM][F66_YDIM8];
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;
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
int8_t val8bits;
int16_t val16bits;
int32_t val32bits;
int64_t val64bits;
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);
fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
@ -7420,7 +7479,7 @@ gent_attr_intsize(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8);
H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7438,7 +7497,7 @@ gent_attr_intsize(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16);
H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7456,7 +7515,7 @@ gent_attr_intsize(void)
valu32bits <<= 1;
}
H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32);
H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7474,7 +7533,7 @@ gent_attr_intsize(void)
valu64bits <<= 1;
}
H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64);
H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7492,7 +7551,7 @@ gent_attr_intsize(void)
val8bits = (int8_t)(val8bits << 1);
}
H5Awrite(attr, H5T_NATIVE_INT8, dset8);
H5Awrite(attr, H5T_NATIVE_INT8, dset8[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7510,7 +7569,7 @@ gent_attr_intsize(void)
val16bits = (int16_t)(val16bits << 1);
}
H5Awrite(attr, H5T_NATIVE_INT16, dset16);
H5Awrite(attr, H5T_NATIVE_INT16, dset16[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7528,7 +7587,7 @@ gent_attr_intsize(void)
val32bits <<= 1;
}
H5Awrite(attr, H5T_NATIVE_INT32, dset32);
H5Awrite(attr, H5T_NATIVE_INT32, dset32[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7546,7 +7605,7 @@ gent_attr_intsize(void)
val64bits <<= 1;
}
H5Awrite(attr, H5T_NATIVE_INT64, dset64);
H5Awrite(attr, H5T_NATIVE_INT64, dset64[0]);
H5Sclose(space);
H5Aclose(attr);
@ -7559,13 +7618,23 @@ gent_attr_intsize(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl);
H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl[0]);
H5Sclose(space);
H5Aclose(attr);
H5Gclose(root);
H5Fclose(fid);
HDfree(dsetu8);
HDfree(dsetu16);
HDfree(dsetu32);
HDfree(dsetu64);
HDfree(dset8);
HDfree(dset16);
HDfree(dset32);
HDfree(dset64);
HDfree(dsetdbl);
}
static void
@ -8407,19 +8476,44 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
static void
gent_intscalars(void)
{
hid_t fid, dataset, space, tid;
hid_t fid = H5I_INVALID_HID;
hid_t dataset = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
double dsetdbl[F73_XDIM][F73_YDIM8];
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;
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
int8_t val8bits;
int16_t val16bits;
int32_t val32bits;
int64_t val64bits;
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);
fid = H5Fcreate(FILE73, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@ -8437,7 +8531,7 @@ gent_intscalars(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8456,7 +8550,7 @@ gent_intscalars(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8475,7 +8569,7 @@ gent_intscalars(void)
valu32bits <<= 1;
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8494,7 +8588,7 @@ gent_intscalars(void)
valu64bits <<= 1;
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8513,7 +8607,7 @@ gent_intscalars(void)
val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8532,7 +8626,7 @@ gent_intscalars(void)
val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8551,7 +8645,7 @@ gent_intscalars(void)
val32bits <<= 1;
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8570,7 +8664,7 @@ gent_intscalars(void)
val64bits <<= 1;
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
H5Sclose(space);
H5Dclose(dataset);
@ -8584,11 +8678,21 @@ gent_intscalars(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
HDfree(dsetu8);
HDfree(dsetu16);
HDfree(dsetu32);
HDfree(dsetu64);
HDfree(dset8);
HDfree(dset16);
HDfree(dset32);
HDfree(dset64);
HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@ -8605,19 +8709,46 @@ gent_intscalars(void)
static void
gent_attr_intscalars(void)
{
hid_t fid, attr, space, root, tid;
hid_t fid = H5I_INVALID_HID;
hid_t attr = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t root = H5I_INVALID_HID;
hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
double dsetdbl[F73_XDIM][F73_YDIM8];
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;
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
int8_t val8bits;
int16_t val16bits;
int32_t val32bits;
int64_t val64bits;
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);
fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
root = H5Gopen2(fid, "/", H5P_DEFAULT);
@ -8636,7 +8767,7 @@ gent_attr_intscalars(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
H5Awrite(attr, tid, dsetu8);
H5Awrite(attr, tid, dsetu8[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8655,7 +8786,7 @@ gent_attr_intscalars(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
H5Awrite(attr, tid, dsetu16);
H5Awrite(attr, tid, dsetu16[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8674,7 +8805,7 @@ gent_attr_intscalars(void)
valu32bits <<= 1;
}
H5Awrite(attr, tid, dsetu32);
H5Awrite(attr, tid, dsetu32[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8693,7 +8824,7 @@ gent_attr_intscalars(void)
valu64bits <<= 1;
}
H5Awrite(attr, tid, dsetu64);
H5Awrite(attr, tid, dsetu64[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8712,7 +8843,7 @@ gent_attr_intscalars(void)
val8bits = (int8_t)(val8bits << 1);
}
H5Awrite(attr, tid, dset8);
H5Awrite(attr, tid, dset8[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8731,7 +8862,7 @@ gent_attr_intscalars(void)
val16bits = (int16_t)(val16bits << 1);
}
H5Awrite(attr, tid, dset16);
H5Awrite(attr, tid, dset16[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8750,7 +8881,7 @@ gent_attr_intscalars(void)
val32bits <<= 1;
}
H5Awrite(attr, tid, dset32);
H5Awrite(attr, tid, dset32[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8769,7 +8900,7 @@ gent_attr_intscalars(void)
val64bits <<= 1;
}
H5Awrite(attr, tid, dset64);
H5Awrite(attr, tid, dset64[0]);
H5Sclose(space);
H5Aclose(attr);
@ -8783,13 +8914,23 @@ gent_attr_intscalars(void)
for(j = 0; j < dims[1]; j++)
dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, tid, dsetdbl);
H5Awrite(attr, tid, dsetdbl[0]);
H5Sclose(space);
H5Aclose(attr);
H5Gclose(root);
H5Fclose(fid);
HDfree(dsetu8);
HDfree(dsetu16);
HDfree(dsetu32);
HDfree(dsetu64);
HDfree(dset8);
HDfree(dset16);
HDfree(dset32);
HDfree(dset64);
HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@ -9344,19 +9485,45 @@ static void gent_compound_ints(void) {
static void
gent_intattrscalars(void)
{
hid_t fid, attr, dataset, space, tid;
hid_t fid = H5I_INVALID_HID;
hid_t attr = H5I_INVALID_HID;
hid_t dataset = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t tid = H5I_INVALID_HID;
hsize_t dims[2];
uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
double dsetdbl[F73_XDIM][F73_YDIM8];
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;
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
int8_t val8bits;
int16_t val16bits;
int32_t val32bits;
int64_t val64bits;
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);
fid = H5Fcreate(FILE78, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@ -9377,7 +9544,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);
H5Awrite(attr, tid, dsetu8[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9400,7 +9567,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);
H5Awrite(attr, tid, dsetu16[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9423,7 +9590,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);
H5Awrite(attr, tid, dsetu32[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9446,7 +9613,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);
H5Awrite(attr, tid, dsetu64[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9469,7 +9636,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);
H5Awrite(attr, tid, dset8[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9492,7 +9659,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);
H5Awrite(attr, tid, dset16[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9515,7 +9682,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);
H5Awrite(attr, tid, dset32[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9538,7 +9705,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);
H5Awrite(attr, tid, dset64[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
@ -9556,11 +9723,22 @@ gent_intattrscalars(void)
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);
H5Awrite(attr, tid, dsetdbl[0]);
H5Aclose(attr);
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
HDfree(dsetu8);
HDfree(dsetu16);
HDfree(dsetu32);
HDfree(dsetu64);
HDfree(dset8);
HDfree(dset16);
HDfree(dset32);
HDfree(dset64);
HDfree(dsetdbl);
}
/*-------------------------------------------------------------------------
@ -9576,19 +9754,66 @@ gent_intattrscalars(void)
static void
gent_intsattrs(void)
{
hid_t fid, attr, dataset, space, aspace;
hid_t fid = H5I_INVALID_HID;
hid_t attr = H5I_INVALID_HID;
hid_t dataset = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t aspace = H5I_INVALID_HID;
hsize_t dims[2], adims[1];
uint8_t dsetu8[F66_XDIM][F66_YDIM8], asetu8[F66_XDIM*F66_YDIM8], valu8bits;
uint16_t dsetu16[F66_XDIM][F66_YDIM16], asetu16[F66_XDIM*F66_YDIM16], valu16bits;
uint32_t dsetu32[F66_XDIM][F66_YDIM32], asetu32[F66_XDIM*F66_YDIM32], valu32bits;
uint64_t dsetu64[F66_XDIM][F66_YDIM64], asetu64[F66_XDIM*F66_YDIM64], valu64bits;
int8_t dset8[F66_XDIM][F66_YDIM8], aset8[F66_XDIM*F66_YDIM8], val8bits;
int16_t dset16[F66_XDIM][F66_YDIM16], aset16[F66_XDIM*F66_YDIM16], val16bits;
int32_t dset32[F66_XDIM][F66_YDIM32], aset32[F66_XDIM*F66_YDIM32], val32bits;
int64_t dset64[F66_XDIM][F66_YDIM64], aset64[F66_XDIM*F66_YDIM64], val64bits;
double dsetdbl[F66_XDIM][F66_YDIM8], asetdbl[F66_XDIM*F66_YDIM8];
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;
uint8_t *asetu8 = NULL;
uint16_t *asetu16 = NULL;
uint32_t *asetu32 = NULL;
uint64_t *asetu64 = NULL;
int8_t *aset8 = NULL;
int16_t *aset16 = NULL;
int32_t *aset32 = NULL;
int64_t *aset64 = NULL;
double *asetdbl = NULL;
uint8_t valu8bits;
uint16_t valu16bits;
uint32_t valu32bits;
uint64_t valu64bits;
int8_t val8bits;
int16_t val16bits;
int32_t val32bits;
int64_t val64bits;
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);
asetu8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(uint8_t));
asetu16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(uint16_t));
asetu32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(uint32_t));
asetu64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(uint64_t));
aset8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(int8_t));
aset16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(int16_t));
aset32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(int32_t));
aset64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(int64_t));
asetdbl = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(double));
fid = H5Fcreate(FILE79, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* Dataset of 8 bits unsigned int */
@ -9607,7 +9832,7 @@ gent_intsattrs(void)
valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8[0]);
/* Attribute of 8 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM8;
aspace = H5Screate_simple(1, adims, NULL);
@ -9634,7 +9859,7 @@ gent_intsattrs(void)
valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16[0]);
/* Attribute of 16 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM16;
aspace = H5Screate_simple(1, adims, NULL);
@ -9661,7 +9886,7 @@ gent_intsattrs(void)
valu32bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32[0]);
/* Attribute of 32 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM32;
aspace = H5Screate_simple(1, adims, NULL);
@ -9688,7 +9913,7 @@ gent_intsattrs(void)
valu64bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64[0]);
/* Attribute of 64 bits unsigned int */
adims[0] = F66_XDIM * F66_YDIM64;
aspace = H5Screate_simple(1, adims, NULL);
@ -9715,7 +9940,7 @@ gent_intsattrs(void)
val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8[0]);
/* Attribute of 8 bits signed int */
adims[0] = F66_XDIM * F66_YDIM8;
aspace = H5Screate_simple(1, adims, NULL);
@ -9742,7 +9967,7 @@ gent_intsattrs(void)
val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16[0]);
/* Attribute of 16 bits signed int */
adims[0] = F66_XDIM * F66_YDIM16;
aspace = H5Screate_simple(1, adims, NULL);
@ -9769,7 +9994,7 @@ gent_intsattrs(void)
val32bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32[0]);
/* Attribute of 32 bits signed int */
adims[0] = F66_XDIM * F66_YDIM32;
aspace = H5Screate_simple(1, adims, NULL);
@ -9796,7 +10021,7 @@ gent_intsattrs(void)
val64bits <<= 1;
}
H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64[0]);
/* Attribute of 64 bits signed int */
adims[0] = F66_XDIM * F66_YDIM64;
aspace = H5Screate_simple(1, adims, NULL);
@ -9818,7 +10043,7 @@ gent_intsattrs(void)
asetdbl[i*dims[1]+j] = dsetdbl[i][j];
}
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl[0]);
/* Attribute of double */
adims[0] = F66_XDIM * F66_YDIM8;
aspace = H5Screate_simple(1, adims, NULL);
@ -9829,6 +10054,26 @@ gent_intsattrs(void)
H5Sclose(space);
H5Dclose(dataset);
H5Fclose(fid);
HDfree(dsetu8);
HDfree(dsetu16);
HDfree(dsetu32);
HDfree(dsetu64);
HDfree(dset8);
HDfree(dset16);
HDfree(dset32);
HDfree(dset64);
HDfree(dsetdbl);
HDfree(asetu8);
HDfree(asetu16);
HDfree(asetu32);
HDfree(asetu64);
HDfree(aset8);
HDfree(aset16);
HDfree(aset32);
HDfree(aset64);
HDfree(asetdbl);
}
static void gent_bitnopaquefields(void)

View File

@ -68,13 +68,12 @@ main(void)
double rowi8 = 1.0F, coli8 = 2.0F, plni8 = 5.0F;
/* Initialize machine endian */
volatile uint32_t ibyte=0x01234567;
volatile uint32_t ibyte = 0x01234567;
/* 0 for big endian, 1 for little endian. */
if ((*((uint8_t*)(&ibyte))) == 0x67)
HDstrncpy(machine_order, "LE", 2);
if ((*((volatile uint8_t *)(&ibyte))) == 0x67)
HDstrcpy(machine_order, "LE");
else
HDstrncpy(machine_order, "BE", 2);
HDstrcpy(machine_order, "BE");
/*
* initialize the row, column, and plane vectors

View File

@ -28,7 +28,7 @@ set (REPACK_COMMON_SOURCES
)
add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c)
target_include_directories (h5repacktest
PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5repacktest STATIC)

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
#add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repart_gentest>)
add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c)
target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5clear_gentest STATIC)
target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})

View File

@ -21,7 +21,7 @@ include $(top_srcdir)/config/commence.am
SUBDIRS=vds
# Include src directory
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
#test scripts and programs
TEST_PROG=h5repart_gentest h5clear_gentest talign

View File

@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "hdf5.h"
#include "H5private.h"
#include "h5test.h"
/* The HDF5 test files */
const char *FILENAME[] = {
@ -62,13 +62,21 @@ gen_cache_image_file(const char *fname)
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[2]; /* Dimension sizes */
hsize_t chunks[2]; /* Chunked dimension sizes */
int buf[50][100]; /* Buffer for data to write */
int i, j; /* Local index variables */
int **buf = NULL; /* Buffer for data to write */
H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */
{ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
TRUE, FALSE,
H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
/* Create and fill array */
H5TEST_ALLOCATE_2D_ARRAY(buf, int, 50, 100);
if (NULL == buf)
goto error;
for(i = 0; i < 50; i++)
for(j = 0; j < 100; j++)
buf[i][j] = i * j;
/* Create a copy of file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
@ -91,11 +99,6 @@ gen_cache_image_file(const char *fname)
if((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto error;
/* Initialize buffer for writing to dataset */
for(i = 0; i < 50; i++)
for(j = 0; j < 100; j++)
buf[i][j] = i * j;
/* Set up to create a chunked dataset */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
@ -107,7 +110,7 @@ gen_cache_image_file(const char *fname)
goto error;
/* Write to the dataset */
if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
/* Closing */
@ -121,6 +124,9 @@ gen_cache_image_file(const char *fname)
goto error;
if(H5Fclose(fid) < 0)
goto error;
HDfree(buf);
return 0;
error:
@ -132,6 +138,9 @@ error:
H5Pclose(fapl);
H5Pclose(dcpl);
} H5E_END_TRY;
HDfree(buf);
return 1;
} /* gen_cache_image_file() */

View File

@ -300,7 +300,7 @@ typedef struct _minmax {
/* local functions */
static off_t parse_size_directive(const char *size);
static struct options *parse_command_line(int argc, char *argv[]);
static struct options *parse_command_line(int argc, const char *argv[]);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
@ -327,7 +327,7 @@ static off_t squareo(off_t);
* Modifications:
*/
int
main(int argc, char **argv)
main(int argc, const char *argv[])
{
int ret;
int exit_value = EXIT_SUCCESS;
@ -1262,7 +1262,7 @@ report_parameters(struct options *opts)
* Added 2D testing (Christian Chilan, 10. August 2005)
*/
static struct options *
parse_command_line(int argc, char *argv[])
parse_command_line(int argc, const char *argv[])
{
register int opt;
struct options *cl_opts;
@ -1291,7 +1291,7 @@ parse_command_line(int argc, char *argv[])
cl_opts->h5_write_only = FALSE; /* Do both read and write by default */
cl_opts->verify = FALSE; /* No Verify data correctness by default */
while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'a':
cl_opts->h5_alignment = parse_size_directive(opt_arg);

View File

@ -303,7 +303,7 @@ typedef struct _minmax {
/* local functions */
static hsize_t parse_size_directive(const char *size);
static struct options *parse_command_line(int argc, char *argv[]);
static struct options *parse_command_line(int argc, const char *argv[]);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
@ -324,7 +324,7 @@ static void report_parameters(struct options *opts);
* Modifications:
*/
int
main(int argc, char **argv)
main(int argc, const char *argv[])
{
int exit_value = EXIT_SUCCESS;
struct options *opts = NULL;
@ -944,7 +944,7 @@ report_parameters(struct options *opts)
* Added multidimensional testing (Christian Chilan, April, 2008)
*/
static struct options *
parse_command_line(int argc, char *argv[])
parse_command_line(int argc, const char *argv[])
{
int opt;
struct options *cl_opts;
@ -984,7 +984,7 @@ parse_command_line(int argc, char *argv[])
cl_opts->h5_extendable = FALSE; /* Use extendable dataset */
cl_opts->verify = FALSE; /* No Verify data correctness by default */
while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'a':
cl_opts->h5_alignment = parse_size_directive(opt_arg);

View File

@ -552,7 +552,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
* Modifications:
*/
int
main(int argc, char **argv)
main(int argc, const char *argv[])
{
unsigned long min_buf_size = 128 * ONE_KB, max_buf_size = ONE_MB;
unsigned long file_size = 64 * ONE_MB;
@ -563,7 +563,7 @@ main(int argc, char **argv)
/* Initialize h5tools lib */
h5tools_init();
while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) > 0) {
while ((opt = get_option(argc, argv, s_opts, l_opts)) > 0) {
switch ((char)opt) {
case '0': case '1': case '2':
case '3': case '4': case '5':