diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-18 22:02:19 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-18 22:02:19 (GMT) |
commit | a5984f59f71739531fb78c3933a726e73dd54328 (patch) | |
tree | 839fdd36b93e7976c97b9a351e3937266d1dd7b3 | |
parent | cf56cd041d119914d7a9bee79c22e59a8ce85059 (diff) | |
download | hdf5-a5984f59f71739531fb78c3933a726e73dd54328.zip hdf5-a5984f59f71739531fb78c3933a726e73dd54328.tar.gz hdf5-a5984f59f71739531fb78c3933a726e73dd54328.tar.bz2 |
[svn-r14212] Description:
Make H5Tarray_create() and H5Tget_array_dims() versioned, and drop the
"perm" parameter from the '2' versions.
Shift internal library usage to '2' versions.
Add simple regression tests for '1' versions.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
-rw-r--r-- | c++/src/H5ArrayType.cpp | 18 | ||||
-rw-r--r-- | examples/h5_shared_mesg.c | 4 | ||||
-rw-r--r-- | fortran/src/H5Tf.c | 80 | ||||
-rw-r--r-- | hl/src/H5LT.c | 2 | ||||
-rw-r--r-- | hl/src/H5LTparse.c | 2 | ||||
-rw-r--r-- | hl/src/H5LTparse.y | 2 | ||||
-rw-r--r-- | hl/test/test_lite.c | 2 | ||||
-rw-r--r-- | src/H5T.c | 6 | ||||
-rw-r--r-- | src/H5Tarray.c | 121 | ||||
-rw-r--r-- | src/H5Tcommit.c | 2 | ||||
-rw-r--r-- | src/H5Tpublic.h | 11 | ||||
-rw-r--r-- | src/H5vers.txt | 2 | ||||
-rw-r--r-- | src/H5version.h | 30 | ||||
-rw-r--r-- | test/cmpd_dset.c | 32 | ||||
-rw-r--r-- | test/dsets.c | 20 | ||||
-rw-r--r-- | test/dtypes.c | 106 | ||||
-rw-r--r-- | test/gen_new_array.c | 12 | ||||
-rw-r--r-- | test/ntypes.c | 12 | ||||
-rw-r--r-- | test/tarray.c | 100 | ||||
-rw-r--r-- | test/tsohm.c | 8 | ||||
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 24 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 4 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 108 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 74 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 2 | ||||
-rw-r--r-- | tools/lib/talign.c | 8 |
29 files changed, 462 insertions, 336 deletions
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 49be361..852658b 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -60,11 +60,9 @@ ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) // Get the dimensions of the existing array and store it in this array dimensions = new hsize_t[rank]; //hsize_t rdims2[H5S_MAX_RANK]; - int ret_value = H5Tget_array_dims(id, dimensions, NULL); + int ret_value = H5Tget_array_dims2(id, dimensions); if (ret_value < 0) - { - throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims failed"); - } + throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); } //-------------------------------------------------------------------------- @@ -92,11 +90,9 @@ ArrayType::ArrayType( const ArrayType& original ) : DataType( original ) //-------------------------------------------------------------------------- ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType() { - hid_t new_type_id = H5Tarray_create(base_type.getId(), ndims, dims, NULL); + hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims); if (new_type_id < 0) - { - throw DataTypeIException("ArrayType constructor", "H5Tarray_create failed"); - } + throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed"); id = new_type_id; rank = ndims; dimensions = new hsize_t[rank]; @@ -139,11 +135,9 @@ int ArrayType::getArrayDims(hsize_t* dims) // if the array's dimensions have not been stored, retrieve them via C API if (dimensions == NULL) { - int ndims = H5Tget_array_dims(id, dims, NULL); + int ndims = H5Tget_array_dims2(id, dims); if (ndims < 0) - { - throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims failed"); - } + throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); // store the array's info in memory rank = ndims; dimensions = new hsize_t[rank]; diff --git a/examples/h5_shared_mesg.c b/examples/h5_shared_mesg.c index 41a23a2..6528994 100644 --- a/examples/h5_shared_mesg.c +++ b/examples/h5_shared_mesg.c @@ -261,9 +261,9 @@ create_standard_file(const char *filename, hid_t fcpl_id) * disk, so this type will be an array type rather than an atomic type. * However, any type can be shared. */ - temp_type_id = H5Tarray_create(H5T_NATIVE_INT, 10, dims, NULL); + temp_type_id = H5Tarray_create2(H5T_NATIVE_INT, 10, dims); if(temp_type_id < 0) goto error; - type_id = H5Tarray_create(temp_type_id, 10, dims, NULL); + type_id = H5Tarray_create2(temp_type_id, 10, dims); if(type_id < 0) goto error; ret = H5Tclose(temp_type_id); if(ret < 0) goto error; diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c index 1bd5212..7c3befc 100644 --- a/fortran/src/H5Tf.c +++ b/fortran/src/H5Tf.c @@ -1070,7 +1070,7 @@ nh5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f * offset) /*---------------------------------------------------------------------------- * Name: h5tget_array_dims_c - * Purpose: Call H5Tget_array_dims to get + * Purpose: Call H5Tget_array_dims2 to get * dimensions of array datatype * Inputs: type_id - identifier of the array datatype * Outputs: dims - dimensions(sizes of dimensions) of the array @@ -1083,33 +1083,23 @@ nh5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f * offset) int_f nh5tget_array_dims_c ( hid_t_f *type_id , hsize_t_f * dims) { - int ret_value = -1; - hid_t c_type_id; - hsize_t * c_dims; - int rank, i; - herr_t status; + hsize_t c_dims[H5S_MAX_RANK]; + int rank, i; + int ret_value = -1; - rank = H5Tget_array_ndims((hid_t)*type_id); - if (rank < 0) return ret_value; - c_dims = (hsize_t*)malloc(sizeof(hsize_t)*rank); - if(!c_dims) return ret_value; + if((rank = H5Tget_array_ndims((hid_t)*type_id)) < 0) + goto DONE; - c_type_id = (hid_t)*type_id; - status = H5Tget_array_dims(c_type_id, c_dims, NULL); - if (status < 0) { - HDfree(c_dims); - return ret_value; - } + if(H5Tget_array_dims2((hid_t)*type_id, c_dims) < 0) + goto DONE; - for(i =0; i < rank; i++) - { - dims[rank-i-1] = (hsize_t_f)c_dims[i]; - } + for(i = 0; i < rank; i++) + dims[(rank - i) - 1] = (hsize_t_f)c_dims[i]; - ret_value = 0; - HDfree(c_dims); + ret_value = 0; - return ret_value; +DONE: + return ret_value; } /*---------------------------------------------------------------------------- @@ -1296,7 +1286,7 @@ nh5tpack_c(hid_t_f * type_id) /*---------------------------------------------------------------------------- * Name: h5tarray_create_c - * Purpose: Call H5Tarray_create to create array datatype + * Purpose: Call H5Tarray_create2 to create array datatype * Inputs: base_id - identifier of array base datatype * rank - array's rank * dims - Size of new member array @@ -1309,38 +1299,26 @@ nh5tpack_c(hid_t_f * type_id) int_f nh5tarray_create_c(hid_t_f * base_id, int_f *rank, hsize_t_f* dims, hid_t_f* type_id) { - int ret_value = -1; - hid_t c_base_id; - hid_t c_type_id; - int c_rank; - hsize_t *c_dims; - int i; - - c_dims = (hsize_t*)malloc(sizeof(hsize_t)*(*rank)); - if(!c_dims) return ret_value; + hsize_t c_dims[H5S_MAX_RANK]; + hid_t c_type_id; + unsigned u; /* Local index variable */ + int ret_value = -1; - /* - * Transpose dimension arrays because of C-FORTRAN storage order - */ - for (i = 0; i < *rank ; i++) { - c_dims[i] = (hsize_t)dims[*rank - i - 1]; - } - - c_base_id = (hid_t)*base_id; - c_rank = (int)*rank; - c_type_id = H5Tarray_create(c_base_id, c_rank, c_dims, NULL); + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + for(u = 0; u < (unsigned)*rank ; u++) + c_dims[u] = (hsize_t)dims[(*rank - u) - 1]; - if(c_type_id < 0) { - HDfree(c_dims); - return ret_value; - } + if((c_type_id = H5Tarray_create2((hid_t)*base_id, (unsigned)*rank, c_dims)) < 0) + goto DONE; - *type_id = (hid_t_f)c_type_id; - ret_value = 0; - HDfree(c_dims); - return ret_value; + *type_id = (hid_t_f)c_type_id; + ret_value = 0; +DONE: + return ret_value; } diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index e226f89..ca56d69 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2173,7 +2173,7 @@ next: /* Get array information */ if((ndims = H5Tget_array_ndims(dtype)) < 0) goto out; - if(H5Tget_array_dims(dtype, dims, NULL) < 0) + if(H5Tget_array_dims2(dtype, dims) < 0) goto out; /* Print array dimensions */ diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index b146046..35c4670 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -888,7 +888,7 @@ break; case 57: #line 213 "H5LTparse.y" { - yyval.ival = H5Tarray_create(yyvsp[-1].ival, arr_stack[asindex].ndims, arr_stack[asindex].dims, NULL); + yyval.ival = H5Tarray_create2(yyvsp[-1].ival, arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; H5Tclose(yyvsp[-1].ival); diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index a508c95..7866add 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -211,7 +211,7 @@ offset : NUMBER array_type : H5T_ARRAY_TOKEN { asindex++; /*pushd onto the stack*/ } '{' dim_list ddl_type '}' { - $<ival>$ = H5Tarray_create($<ival>5, arr_stack[asindex].ndims, arr_stack[asindex].dims, NULL); + $<ival>$ = H5Tarray_create2($<ival>5, arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; H5Tclose($<ival>5); diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index d8aeb99..239ad60 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1420,7 +1420,7 @@ static int test_arrays(void) if(ndims != 3) goto out; - if(H5Tget_array_dims(dtype, dims, NULL) < 0) + if(H5Tget_array_dims2(dtype, dims) < 0) goto out; if(dims[0] != 5 || dims[1] != 7 || dims[2] != 13) goto out; @@ -3017,7 +3017,7 @@ H5T_create(H5T_class_t type, size_t size) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tvlen_create()"); case H5T_ARRAY: /* Array datatype */ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create()"); + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()"); default: HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class"); @@ -4712,7 +4712,7 @@ done: H5O_loc_t * H5T_oloc(H5T_t *dt) { - H5O_loc_t *ret_value; + H5O_loc_t *ret_value = NULL; FUNC_ENTER_NOAPI(H5T_oloc, NULL) @@ -4751,7 +4751,7 @@ done: H5G_name_t * H5T_nameof(H5T_t *dt) { - H5G_name_t *ret_value; + H5G_name_t *ret_value = NULL; FUNC_ENTER_NOAPI(H5T_nameof, NULL) diff --git a/src/H5Tarray.c b/src/H5Tarray.c index cef8f66..00f1177 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -53,7 +53,7 @@ H5T_init_array_interface(void) /*------------------------------------------------------------------------- - * Function: H5Tarray_create + * Function: H5Tarray_create2 * * Purpose: Create a new array data type based on the specified BASE_TYPE. * The type is an array with NDIMS dimensionality and the size of the @@ -67,21 +67,20 @@ H5T_init_array_interface(void) * Failure: Negative * * Programmer: Quincey Koziol - * Thursday, Oct 26, 2000 + * Thursday, Oct 17, 2007 * *------------------------------------------------------------------------- */ hid_t -H5Tarray_create(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */], - const int UNUSED perm[/* ndims */]) +H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */]) { H5T_t *base; /* base data type */ H5T_t *dt; /* new array data type */ unsigned u; /* local index variable */ hid_t ret_value; /* return value */ - FUNC_ENTER_API(H5Tarray_create, FAIL) - H5TRACE4("i", "iIu*h*Is", base_id, ndims, dim, perm); + FUNC_ENTER_API(H5Tarray_create2, FAIL) + H5TRACE3("i", "iIu*h", base_id, ndims, dim); /* Check args */ if(ndims < 1 || ndims > H5S_MAX_RANK) @@ -93,8 +92,6 @@ H5Tarray_create(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */], HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero-sized dimension specified") if(NULL == (base = H5I_object_verify(base_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") - if(perm) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimension permutations not supported") /* Create the actual array datatype */ if((dt = H5T_array_create(base, ndims, dim)) == NULL) @@ -106,7 +103,7 @@ H5Tarray_create(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */], done: FUNC_LEAVE_API(ret_value) -} /* end H5Tarray_create */ +} /* end H5Tarray_create2() */ /*------------------------------------------------------------------------- @@ -234,7 +231,7 @@ H5T_get_array_ndims(const H5T_t *dt) /*------------------------------------------------------------------------- - * Function: H5Tget_array_dims + * Function: H5Tget_array_dims2 * * Purpose: Query the sizes of dimensions for an array datatype. * @@ -242,18 +239,18 @@ H5T_get_array_ndims(const H5T_t *dt) * Failure: Negative * * Programmer: Quincey Koziol - * Monday, November 6, 2000 + * Thursday, October 17, 2007 * *------------------------------------------------------------------------- */ int -H5Tget_array_dims(hid_t type_id, hsize_t dims[], int UNUSED perm[]) +H5Tget_array_dims2(hid_t type_id, hsize_t dims[]) { H5T_t *dt; /* pointer to array data type */ int ret_value; /* return value */ - FUNC_ENTER_API(H5Tget_array_dims, FAIL) - H5TRACE3("Is", "i*h*Is", type_id, dims, perm); + FUNC_ENTER_API(H5Tget_array_dims2, FAIL) + H5TRACE2("Is", "i*h", type_id, dims); /* Check args */ if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) @@ -266,7 +263,7 @@ H5Tget_array_dims(hid_t type_id, hsize_t dims[], int UNUSED perm[]) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes") done: FUNC_LEAVE_API(ret_value) -} /* end H5Tget_array_dims */ +} /* end H5Tget_array_dims2() */ /*------------------------------------------------------------------------- @@ -306,3 +303,97 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_array_dims */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/*------------------------------------------------------------------------- + * Function: H5Tarray_create1 + * + * Purpose: Create a new array data type based on the specified BASE_TYPE. + * The type is an array with NDIMS dimensionality and the size of the + * array is DIMS. The total member size should be relatively small. + * Array datatypes are currently limited to H5S_MAX_RANK number of + * dimensions and must have the number of dimensions set greater than + * 0. (i.e. 0 > ndims <= H5S_MAX_RANK) All dimensions sizes must be greater + * than 0 also. + * + * Return: Success: ID of new array data type + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Oct 26, 2000 + * + *------------------------------------------------------------------------- + */ +hid_t +H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], + const int UNUSED perm[/* ndims */]) +{ + H5T_t *base; /* base data type */ + H5T_t *dt; /* new array data type */ + unsigned u; /* local index variable */ + hid_t ret_value; /* return value */ + + FUNC_ENTER_API(H5Tarray_create1, FAIL) + H5TRACE4("i", "iIs*h*Is", base_id, ndims, dim, perm); + + /* Check args */ + if(ndims < 1 || ndims > H5S_MAX_RANK) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dimensionality") + if(!dim) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") + for(u = 0; u < (unsigned)ndims; u++) + if(!(dim[u] > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero-sized dimension specified") + if(NULL == (base = H5I_object_verify(base_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + + /* Create the actual array datatype */ + if((dt = H5T_array_create(base, (unsigned)ndims, dim)) == NULL) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to create datatype") + + /* Atomize the type */ + if((ret_value = H5I_register(H5I_DATATYPE, dt)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Tarray_create1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Tget_array_dims1 + * + * Purpose: Query the sizes of dimensions for an array datatype. + * + * Return: Success: Number of dimensions of the array type + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, November 6, 2000 + * + *------------------------------------------------------------------------- + */ +int +H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int UNUSED perm[]) +{ + H5T_t *dt; /* pointer to array data type */ + int ret_value; /* return value */ + + FUNC_ENTER_API(H5Tget_array_dims1, FAIL) + H5TRACE3("Is", "i*h*Is", type_id, dims, perm); + + /* Check args */ + if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(dt->shared->type != H5T_ARRAY) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype") + + /* Retrieve the sizes of the dimensions */ + if((ret_value = H5T_get_array_dims(dt, dims)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes") +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Tget_array_dims1() */ + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index dba5524..9739668 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -139,7 +139,7 @@ H5T_commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, { H5O_obj_create_t ocrt_info; /* Information for object creation */ H5T_obj_create_t tcrt_info; /* Information for named datatype creation */ - H5T_state_t old_state; /* The state of the datatype before H5T_commit. */ + H5T_state_t old_state = H5T_STATE_TRANSIENT; /* The state of the datatype before H5T_commit. */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5T_commit_named, FAIL) diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 97862b5..40a2a4d 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -528,11 +528,10 @@ H5_DLL herr_t H5Tenum_valueof(hid_t type, const char *name, H5_DLL hid_t H5Tvlen_create(hid_t base_id); /* Operations defined on array datatypes */ -H5_DLL hid_t H5Tarray_create(hid_t base_id, unsigned ndims, - const hsize_t dim[/* ndims */], - const int perm[/* ndims */]); +H5_DLL hid_t H5Tarray_create2(hid_t base_id, unsigned ndims, + const hsize_t dim[/* ndims */]); H5_DLL int H5Tget_array_ndims(hid_t type_id); -H5_DLL int H5Tget_array_dims(hid_t type_id, hsize_t dims[], int perm[]); +H5_DLL int H5Tget_array_dims2(hid_t type_id, hsize_t dims[]); /* Operations defined on opaque datatypes */ H5_DLL herr_t H5Tset_tag(hid_t type, const char *tag); @@ -607,6 +606,10 @@ H5_DLL herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, /* Function prototypes */ H5_DLL herr_t H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id); H5_DLL hid_t H5Topen1(hid_t loc_id, const char *name); +H5_DLL hid_t H5Tarray_create1(hid_t base_id, int ndims, + const hsize_t dim[/* ndims */], + const int perm[/* ndims */]); +H5_DLL int H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int perm[]); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5vers.txt b/src/H5vers.txt index 4ef22d2..fb268c1 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -64,7 +64,9 @@ FUNCTION: H5Pget_filter_by_id; ; v16, v18 FUNCTION: H5Pinsert; ; v14, v18 FUNCTION: H5Pregister; ; v14, v18 FUNCTION: H5Rget_obj_type; ; v16, v18 +FUNCTION: H5Tarray_create; ; v14, v18 FUNCTION: H5Tcommit; ; v10, v18 +FUNCTION: H5Tget_array_dims; ; v14, v18 FUNCTION: H5Topen; ; v10, v18 # API typedefs diff --git a/src/H5version.h b/src/H5version.h index a9843bc..938279d 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -114,10 +114,18 @@ #define H5Rget_obj_type_vers 1 #endif /* !defined(H5Rget_obj_type_vers) */ +#if !defined(H5Tarray_create_vers) +#define H5Tarray_create_vers 1 +#endif /* !defined(H5Tarray_create_vers) */ + #if !defined(H5Tcommit_vers) #define H5Tcommit_vers 1 #endif /* !defined(H5Tcommit_vers) */ +#if !defined(H5Tget_array_dims_vers) +#define H5Tget_array_dims_vers 1 +#endif /* !defined(H5Tget_array_dims_vers) */ + #if !defined(H5Topen_vers) #define H5Topen_vers 1 #endif /* !defined(H5Topen_vers) */ @@ -358,6 +366,17 @@ #error "H5Rget_obj_type_vers set to invalid value" #endif /* H5Rget_obj_type_vers */ +#if !defined(H5Tarray_create_vers) || H5Tarray_create_vers == 2 +#ifndef H5Tarray_create_vers +#define H5Tarray_create_vers 2 +#endif /* H5Tarray_create_vers */ +#define H5Tarray_create H5Tarray_create2 +#elif H5Tarray_create_vers == 1 +#define H5Tarray_create H5Tarray_create1 +#else /* H5Tarray_create_vers */ +#error "H5Tarray_create_vers set to invalid value" +#endif /* H5Tarray_create_vers */ + #if !defined(H5Tcommit_vers) || H5Tcommit_vers == 2 #ifndef H5Tcommit_vers #define H5Tcommit_vers 2 @@ -369,6 +388,17 @@ #error "H5Tcommit_vers set to invalid value" #endif /* H5Tcommit_vers */ +#if !defined(H5Tget_array_dims_vers) || H5Tget_array_dims_vers == 2 +#ifndef H5Tget_array_dims_vers +#define H5Tget_array_dims_vers 2 +#endif /* H5Tget_array_dims_vers */ +#define H5Tget_array_dims H5Tget_array_dims2 +#elif H5Tget_array_dims_vers == 1 +#define H5Tget_array_dims H5Tget_array_dims1 +#else /* H5Tget_array_dims_vers */ +#error "H5Tget_array_dims_vers set to invalid value" +#endif /* H5Tget_array_dims_vers */ + #if !defined(H5Topen_vers) || H5Topen_vers == 2 #ifndef H5Topen_vers #define H5Topen_vers 2 diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 85c2318..66993e0 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -231,7 +231,7 @@ test_compound (char *filename, hid_t fapl) /* Create the memory data type */ if((s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if(H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "c", HOFFSET(s1_t, c), array_dt) < 0 || @@ -261,7 +261,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s2 */ if ((s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s2_tid, "a", HOFFSET(s2_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s2_tid, "b", HOFFSET(s2_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s2_tid, "c", HOFFSET(s2_t,c), array_dt) < 0 || @@ -303,7 +303,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s3 */ if ((s3_tid = H5Tcreate (H5T_COMPOUND, sizeof(s3_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s3_tid, "a", HOFFSET(s3_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s3_tid, "b", HOFFSET(s3_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s3_tid, "c", HOFFSET(s3_t,c), array_dt) < 0 || @@ -380,7 +380,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s5 */ if ((s5_tid = H5Tcreate (H5T_COMPOUND, sizeof(s5_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s5_tid, "a", HOFFSET(s5_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s5_tid, "b", HOFFSET(s5_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s5_tid, "c", HOFFSET(s5_t,c), array_dt) < 0 || @@ -452,7 +452,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s6 */ if ((s6_tid = H5Tcreate (H5T_COMPOUND, sizeof(s6_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s6_tid, "a", HOFFSET(s6_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s6_tid, "b", HOFFSET(s6_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s6_tid, "c", HOFFSET(s6_t,c), array_dt) < 0 || @@ -1034,12 +1034,12 @@ create_stype1(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) + if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype1))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype1))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype1, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype1, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype1, c), array_dt1) < 0 || @@ -1090,12 +1090,12 @@ create_stype2(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) + if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype2))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype2))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype2, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype2, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype2, c), array_dt1) < 0 || @@ -1149,10 +1149,10 @@ create_stype3(void) const hsize_t eight = 8; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype3))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype3))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype3, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype3, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype3, c), array_dt1) < 0 || @@ -1192,12 +1192,12 @@ create_stype4(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) + if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype4))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype4))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype4, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype4, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype4, c), array_dt1) < 0 || diff --git a/test/dsets.c b/test/dsets.c index 0f3b330..d7bfe8f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -830,9 +830,9 @@ test_conv_buffer(hid_t fid) /* Create the memory data type */ if((ctype1 = H5Tcreate(H5T_COMPOUND, sizeof (CmpField))) < 0) goto error; - if((arr_type1 = H5Tarray_create(H5T_NATIVE_INT, 3, dimsa, NULL)) < 0) goto error; - if((arr_type2 = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dimsb, NULL)) < 0) goto error; - if((arr_type3 = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, dimsc, NULL)) < 0) goto error; + if((arr_type1 = H5Tarray_create2(H5T_NATIVE_INT, 3, dimsa)) < 0) goto error; + if((arr_type2 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error; + if((arr_type3 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error; if(H5Tinsert(ctype1, "A", HOFFSET(CmpField, a), arr_type1) < 0) goto error; if(H5Tinsert (ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0) goto error; @@ -844,8 +844,8 @@ test_conv_buffer(hid_t fid) if((ctype2 = H5Tcreate(H5T_COMPOUND, sizeof (CmpFieldR))) < 0) goto error; - if((arr_type4 = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dimsb, NULL)) < 0) goto error; - if((arr_type5 = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, dimsc, NULL)) < 0) goto error; + if((arr_type4 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error; + if((arr_type5 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error; if(H5Tinsert (ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0) goto error; if(H5Tinsert (ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error; @@ -2959,10 +2959,10 @@ test_nbit_array(hid_t file) if(H5Tset_order(base_datatype, H5T_ORDER_BE) < 0) goto error; /* Create dataset array datatype */ - array_datatype = H5Tarray_create(base_datatype, 2, adims, NULL); + array_datatype = H5Tarray_create2(base_datatype, 2, adims); /* Create memory array datatype */ - mem_array_datatype = H5Tarray_create(mem_base_datatype, 2, adims, NULL); + mem_array_datatype = H5Tarray_create2(mem_base_datatype, 2, adims); /* Create the data space */ if((space = H5Screate_simple(2, size, NULL)) < 0) goto error; @@ -3370,11 +3370,11 @@ test_nbit_compound_2(hid_t file) base_tid = H5Tcopy(H5T_NATIVE_CHAR); if(H5Tset_precision(base_tid,precision[4]) < 0) goto error; if(H5Tset_offset(base_tid,offset[4]) < 0) goto error; - array_tid = H5Tarray_create(base_tid, 2, array_dims, NULL); + array_tid = H5Tarray_create2(base_tid, 2, array_dims); /* Create the complex memory and dataset array datatype */ - array_cmplx_tid = H5Tarray_create(cmpd_tid1, 2, array_dims, NULL); - mem_array_cmplx_tid = H5Tarray_create(mem_cmpd_tid1, 2, array_dims, NULL); + array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims); + mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims); /* Create a memory complex compound datatype before setting the order */ mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex)); diff --git a/test/dtypes.c b/test/dtypes.c index e527757..bf98761 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -327,10 +327,10 @@ test_detect(void) hid_t atom_arr_id; /* Atomic Array datatype */ hid_t atom_vlf_id; /* Atomic VL datatype of float */ hid_t atom_vlc_id; /* Atomic VL datatype of char */ - hid_t atom_vls_id; /* Atomic VL string datatype */ + hid_t atom_vls_id; /* Atomic VL string datatype */ hid_t cplx_cmpd_id; /* Complex Compound datatype */ - unsigned rank = 2; /* Rank for array datatype */ - hsize_t dims[2]={3,3}; /* Dimensions for array datatype */ + unsigned rank = 2; /* Rank for array datatype */ + hsize_t dims[2] = {3,3}; /* Dimensions for array datatype */ TESTING("H5Tdetect_class()"); @@ -367,20 +367,8 @@ test_detect(void) /*-------------------------------------------------------------------------------- * Test class of some complex types. *------------------------------------------------------------------------------*/ - /* Try to create array datatype with a dimension permutation (should fail) */ - H5E_BEGIN_TRY { - int perm[2]={0,1}; /* Dimensions permutations for array datatype */ - - atom_arr_id = H5Tarray_create(H5T_STD_REF_OBJ, rank, dims, perm); - } H5E_END_TRY; - if(atom_arr_id>=0) { - H5_FAILED(); - printf("Dimension permutation accepted?\n"); - goto error; - } /* end if */ - /* Create an array datatype with an atomic base type */ - if((atom_arr_id = H5Tarray_create(H5T_STD_REF_OBJ, rank, dims, NULL)) < 0) TEST_ERROR + if((atom_arr_id = H5Tarray_create2(H5T_STD_REF_OBJ, rank, dims)) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(atom_arr_id,H5T_ARRAY)!=TRUE) TEST_ERROR @@ -699,8 +687,8 @@ test_compound_2(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt = H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT,1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || @@ -709,8 +697,8 @@ test_compound_2(void) goto error; H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || @@ -816,8 +804,8 @@ test_compound_3(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || @@ -826,8 +814,8 @@ test_compound_3(void) goto error; H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0) @@ -934,8 +922,8 @@ test_compound_4(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || @@ -944,8 +932,8 @@ test_compound_4(void) goto error; H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT) < 0 || H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || @@ -1052,12 +1040,12 @@ test_compound_5(void) /* Build datatypes */ short_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(short)); - array_dt = H5Tarray_create(H5T_NATIVE_SHORT, 1, dims, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims); H5Tinsert(short_array, "_", 0, array_dt); H5Tclose(array_dt); int_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(int)); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, dims, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, dims); H5Tinsert(int_array, "_", 0, array_dt); H5Tclose(array_dt); @@ -1803,7 +1791,7 @@ test_compound_10(void) } /* end if */ /* Create the array datatype for c_string data */ - if((arr_tid = H5Tarray_create(cmpd_tid, 1, arr_dim, NULL)) < 0) { + if((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) { H5_FAILED(); AT(); printf("Can't create array type\n"); goto error; @@ -4683,7 +4671,7 @@ error: /*------------------------------------------------------------------------- - * Function: test_compat + * Function: test_deprec * * Purpose: Tests deprecated API routines for datatypes. * @@ -4697,15 +4685,63 @@ error: */ #ifndef H5_NO_DEPRECATED_SYMBOLS static int -test_compat(hid_t fapl) +test_deprec(hid_t fapl) { hid_t file = -1; /* File ID */ hid_t type = -1; /* Datatype ID */ + unsigned rank = 2; /* Rank for array datatype */ + hsize_t dims[2] = {3, 3}; /* Dimensions for array datatype */ + int perm[2] = {0, 1}; /* Dimensions permutations for array datatype */ + hsize_t rdims[2]= {0, 0}; /* Dimensions for querying array datatype */ + int rperm[2] = {-2, -2}; /* Dimensions permutations for array datatype */ + hbool_t dim_mismatch; /* Whether any dimensions didn't match */ char filename[1024]; + unsigned u; /* Local index variable */ herr_t status; /* Generic routine value */ TESTING("deprected API routines for datatypes"); + /* Create an array datatype with an atomic base type */ + /* (dimension permutations allowed, but not stored) */ + if((type = H5Tarray_create1(H5T_NATIVE_INT, rank, dims, perm)) < 0) + FAIL_STACK_ERROR + + /* Make certain that the correct classes can be detected */ + if(H5Tdetect_class(type, H5T_ARRAY) != TRUE) + FAIL_STACK_ERROR + if(H5Tdetect_class(type, H5T_INTEGER) != TRUE) + FAIL_STACK_ERROR + + /* Get the array dimensions */ + /* (Query the dimension permutations, which is allowed, but ignored) */ + if(H5Tget_array_dims1(type, rdims, rperm) < 0) + FAIL_STACK_ERROR + + /* Check the array dimensions */ + dim_mismatch = FALSE; + for(u = 0; u < rank; u++) + if(rdims[u] != dims[u]) { + TestErrPrintf("Array dimension information doesn't match!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, (int)rdims[u], u, (int)dims[u]); + dim_mismatch = TRUE; + } /* end if */ + if(dim_mismatch) + FAIL_PUTS_ERROR(" Dimensions didn't match!") + + /* Check the array dimension permutations */ + dim_mismatch = FALSE; + for(u = 0; u < rank; u++) + if(rperm[u] != -2) { + TestErrPrintf("Array dimension permutation information was modified!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, rperm[u], u, perm[u]); + dim_mismatch = TRUE; + } /* end if */ + if(dim_mismatch) + FAIL_PUTS_ERROR(" Dimension permutations modified!") + + /* Close the datatype */ + if(H5Tclose(type) < 0) + FAIL_STACK_ERROR + + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -4760,7 +4796,7 @@ error: H5Fclose(file); } H5E_END_TRY; return 1; -} /* end test_compat() */ +} /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -4807,7 +4843,7 @@ main(void) nerrors += test_latest(); nerrors += test_int_float_except(); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += test_compat(fapl); + nerrors += test_deprec(fapl); #endif /* H5_NO_DEPRECATED_SYMBOLS */ h5_cleanup(FILENAME, fapl); /*must happen before first reset*/ reset_hdf5(); diff --git a/test/gen_new_array.c b/test/gen_new_array.c index 3f54e79..c78644d 100644 --- a/test/gen_new_array.c +++ b/test/gen_new_array.c @@ -93,8 +93,8 @@ main(void) printf("field 1 insert<0!\n"); /* Creat the array datatype */ - arr_type=H5Tarray_create(H5T_NATIVE_FLOAT,ARRAY1_RANK,tdims1,NULL); - if(arr_type<0) + arr_type = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1); + if(arr_type < 0) printf("arr_type<0!\n"); /* Insert float array field */ @@ -108,8 +108,8 @@ main(void) printf("field 3 array close<0!\n"); /* Creat the array datatype */ - arr_type=H5Tarray_create(H5T_NATIVE_LONG,ARRAY1_RANK,tdims1,NULL); - if(arr_type<0) + arr_type = H5Tarray_create2(H5T_NATIVE_LONG, ARRAY1_RANK, tdims1); + if(arr_type < 0) printf("arr_type<0!\n"); /* Insert long array field */ @@ -137,8 +137,8 @@ main(void) H5Tclose(type); /* Create the compound datatype with array fields */ - type = H5Tarray_create(H5T_NATIVE_INT, ARRAY1_RANK, tdims1, NULL); - if(type<0) + type = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1); + if(type < 0) printf("type<0!\n"); /* Create the dataset with array datatype */ diff --git a/test/ntypes.c b/test/ntypes.c index 2f5dd5d..4bbbf01 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -747,7 +747,7 @@ test_compound_dtype3(hid_t file) if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create array datatype */ - if((tid2 = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid2 = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ if((tid = H5Tcreate(H5T_COMPOUND, 29)) < 0) TEST_ERROR; @@ -762,7 +762,7 @@ test_compound_dtype3(hid_t file) H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype */ - if((tid_m2 = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid_m2 = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ if((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; @@ -1268,7 +1268,7 @@ test_array_dtype(hid_t file) if(H5Tinsert(tid2, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create array datatype for disk storage */ - if((tid = H5Tarray_create(tid2, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid = H5Tarray_create2(tid2, 1, array_dims)) < 0) TEST_ERROR; /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_ARRAY_NAME, tid, space, @@ -1281,7 +1281,7 @@ test_array_dtype(hid_t file) if(H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Create array datatype for memory */ - if((tid_m = H5Tarray_create(tid3, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid_m = H5Tarray_create2(tid3, 1, array_dims)) < 0) TEST_ERROR; /* Write the data to the dataset */ if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) @@ -1396,14 +1396,14 @@ test_array_dtype2(hid_t file) if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR; /* Create array datatype for disk storage */ - if((tid = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0) TEST_ERROR; /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_ARRAY2_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype for memory */ - if((tid_m = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid_m = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0) TEST_ERROR; /* Write the data to the dataset */ if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3) < 0) diff --git a/test/tarray.c b/test/tarray.c index b4ec846..8d739b9 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -93,8 +93,8 @@ test_array_atomic_1d(void) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a datatype to refer to */ - tid1 = H5Tarray_create(H5T_NATIVE_INT, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -138,8 +138,8 @@ test_array_atomic_1d(void) VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims; i++) @@ -192,8 +192,8 @@ test_array_funcs(void) herr_t ret; /* Generic return value */ /* Create a datatype to refer to */ - type = H5Tarray_create(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1, NULL); - CHECK(type, FAIL, "H5Tarray_create"); + type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1); + CHECK(type, FAIL, "H5Tarray_create2"); size=H5Tget_precision(type); CHECK(size, FAIL, "H5Tget_precision"); @@ -272,8 +272,8 @@ test_array_atomic_3d(void) CHECK(sid, FAIL, "H5Screate_simple"); /* Create a datatype to refer to */ - tid = H5Tarray_create(H5T_NATIVE_INT, ARRAY2_RANK, tdims2, NULL); - CHECK(tid, FAIL, "H5Tarray_create"); + tid = H5Tarray_create2(H5T_NATIVE_INT, ARRAY2_RANK, tdims2); + CHECK(tid, FAIL, "H5Tarray_create2"); /* Create a dataset */ dataset = H5Dcreate2(fid, "Dataset1", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -317,8 +317,8 @@ test_array_atomic_3d(void) VERIFY(ndims, ARRAY2_RANK, "H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid, rdims2, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid, rdims2); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims; i++) @@ -400,12 +400,12 @@ test_array_array_atomic(void) CHECK(sid, FAIL, "H5Screate_simple"); /* Create a 2-D datatype to refer to */ - tid2 = H5Tarray_create(H5T_NATIVE_INT, ARRAY3_RANK, tdims2, NULL); - CHECK(tid2, FAIL, "H5Tarray_create"); + tid2 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY3_RANK, tdims2); + CHECK(tid2, FAIL, "H5Tarray_create2"); /* Create a 1-D datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Create a dataset */ dataset = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -451,8 +451,8 @@ test_array_array_atomic(void) VERIFY(ndims1, ARRAY1_RANK, "H5Tget_array_ndims"); /* Get the 1-D array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims1; i++) @@ -470,8 +470,8 @@ test_array_array_atomic(void) VERIFY(ndims2, ARRAY3_RANK, "H5Tget_array_ndims"); /* Get the 2-D array dimensions */ - ret = H5Tget_array_dims(tid2, rdims2, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid2, rdims2); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims2; i++) @@ -571,8 +571,8 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Tinsert"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close compound datatype */ ret = H5Tclose(tid2); @@ -620,8 +620,8 @@ test_array_compound_atomic(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims; i++) @@ -771,8 +771,8 @@ test_array_compound_array(void) CHECK(ret, FAIL, "H5Tinsert"); /* Create an array of floats datatype */ - tid3 = H5Tarray_create(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1, NULL); - CHECK(tid3, FAIL, "H5Tarray_create"); + tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1); + CHECK(tid3, FAIL, "H5Tarray_create2"); /* Insert float array field */ ret = H5Tinsert(tid2, "f", HOFFSET(s1_t, f), tid3); @@ -783,8 +783,8 @@ test_array_compound_array(void) CHECK(ret, FAIL, "H5Tclose"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close compound datatype */ ret = H5Tclose(tid2); @@ -832,8 +832,8 @@ test_array_compound_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -893,8 +893,8 @@ test_array_compound_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(mtid, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(mtid, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1066,8 +1066,8 @@ test_array_vlen_atomic(void) CHECK(tid2, FAIL, "H5Tcreate"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close VL datatype */ ret = H5Tclose(tid2); @@ -1119,8 +1119,8 @@ test_array_vlen_atomic(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1274,8 +1274,8 @@ test_array_vlen_array(void) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create the nested array datatype to refer to */ - tid3 = H5Tarray_create(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1, NULL); - CHECK(tid3, FAIL, "H5Tcreate"); + tid3 = H5Tarray_create2(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1); + CHECK(tid3, FAIL, "H5Tarray_create2"); /* Create a VL datatype of 1-D arrays to refer to */ tid2 = H5Tvlen_create(tid3); @@ -1286,8 +1286,8 @@ test_array_vlen_array(void) CHECK(ret, FAIL, "H5Tclose"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close VL datatype */ ret = H5Tclose(tid2); @@ -1339,8 +1339,8 @@ test_array_vlen_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1370,8 +1370,8 @@ test_array_vlen_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid3, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid3, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1593,8 +1593,8 @@ test_array_bkg(void) /* -------------------------------------- */ for ( i = 0; i < dtsinfo.nsubfields; i++) { - array_dt = H5Tarray_create(dtsinfo.datatype[i], ndims[i], dima, NULL); - CHECK(array_dt, FAIL, "H5Tarray_create"); + array_dt = H5Tarray_create2(dtsinfo.datatype[i], ndims[i], dima); + CHECK(array_dt, FAIL, "H5Tarray_create2"); status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt); CHECK(status, FAIL, "H5Tinsert"); @@ -1670,8 +1670,8 @@ test_array_bkg(void) type = H5Tcreate(H5T_COMPOUND, sizeof(fld_t)); CHECK(type, FAIL, "H5Tcreate"); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dima, NULL); - CHECK(array_dt, FAIL, "H5Tarray_create"); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dima); + CHECK(array_dt, FAIL, "H5Tarray_create2"); status = H5Tinsert (type, "Two", HOFFSET(fld_t, b), array_dt); CHECK(status, FAIL, "H5Tinsert"); @@ -1992,8 +1992,8 @@ test_compat(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(mtid, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(mtid, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -2037,8 +2037,8 @@ test_compat(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(mtid,rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(mtid, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) diff --git a/test/tsohm.c b/test/tsohm.c index 94ffe11..bcf0432 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -487,10 +487,10 @@ make_dtype_2(void) } /* Create arrays of arrays of arrays of enums */ - if((dtype2_id = H5Tarray_create(enum_id, 3, dims, NULL)) < 0) TEST_ERROR - if((dtype2_id = H5Tarray_create(dtype2_id, 4, dims, NULL)) < 0) TEST_ERROR - if((dtype2_id = H5Tarray_create(dtype2_id, 2, dims, NULL)) < 0) TEST_ERROR - if((dtype2_id = H5Tarray_create(dtype2_id, 1, dims, NULL)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(enum_id, 3, dims)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(dtype2_id, 4, dims)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(dtype2_id, 2, dims)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(dtype2_id, 1, dims)) < 0) TEST_ERROR if(H5Tclose(enum_id) < 0) TEST_ERROR if(H5Tclose(int_id) < 0) TEST_ERROR diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 436e7fd..de2c1ff 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -1010,8 +1010,8 @@ position array of </g1> array of </g1> difference [ 1 ] 5 0 5 [ 1 ] 6 0 6 */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_attr(loc_id,1,dims,"array",tid,buf6); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -1289,8 +1289,8 @@ position array2D of </g1> array2D of </g1> difference [ 2 1 ] 17 0 17 [ 2 1 ] 18 0 18 */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_attr(loc_id,2,dims2,"array2D",tid,buf62); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 2, dims2, "array2D", tid, buf62); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -1675,8 +1675,8 @@ etc etc */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_attr(loc_id,3,dims3,"array3D",tid,buf63); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 3, dims3, "array3D", tid, buf63); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -1947,8 +1947,8 @@ void write_dset_in(hid_t loc_id, } } - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,1,dims,"array",tid,buf6); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -2098,8 +2098,8 @@ void write_dset_in(hid_t loc_id, } - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,2,dims2,"array2D",tid,buf62); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 2, dims2, "array2D", tid, buf62); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -2282,8 +2282,8 @@ void write_dset_in(hid_t loc_id, } } - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,3,dims3,"array3D",tid,buf63); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 3, dims3, "array3D", tid, buf63); status = H5Tclose(tid); /*------------------------------------------------------------------------- diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index a46054d..712d133 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1075,7 +1075,7 @@ print_datatype(hid_t type,unsigned in_group) /* Get array information */ ndims = H5Tget_array_ndims(type); - H5Tget_array_dims(type, dims, NULL); + H5Tget_array_dims2(type, dims); /* Print array dimensions */ for (i = 0; i < ndims; i++) @@ -4790,7 +4790,7 @@ xml_print_datatype(hid_t type, unsigned in_group) printf("%u\">\n", ndims); /* Get array information */ - H5Tget_array_dims(type, dims, NULL); + H5Tget_array_dims2(type, dims); /* list of dimensions */ indent += COL; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 029f20c..d0cb5f8 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -624,21 +624,21 @@ static void gent_compound_dt(void) { /* test compound data type */ ndims = 1; dim[0] = 4; - array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL); + array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim); H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt); H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, ndims, dim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, ndims, dim); H5Tinsert(type2, "int_array", HOFFSET(dset3_t, a), array_dt); H5Tclose(array_dt); ndims = 2; dim[0] = 5; dim[1] = 6; - array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL); + array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim); H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt); H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, ndims, dim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, ndims, dim); H5Tinsert(type2, "float_array", HOFFSET(dset3_t, b), array_dt); H5Tclose(array_dt); @@ -829,12 +829,12 @@ static void gent_compound_dt2(void) { /* test compound data type */ type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); ndims = 1; dim[0] = 4; - array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL); + array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim); H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt); H5Tclose(array_dt); ndims = 2; dim[0] = 5; dim[1] = 6; - array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL); + array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim); H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt); H5Tclose(array_dt); @@ -1128,29 +1128,29 @@ static void gent_many(void) type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); dim[0] = dim[1] = dim[2] = dim[3] = 2; - array_dt = H5Tarray_create(H5T_STD_I32BE, 4, dim, NULL); + array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim); H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt); H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_IEEE_F64BE, 4, dim, NULL); + array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim); H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt); H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_IEEE_F64BE, 4, dim, NULL); + array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim); H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt); H5Tclose(array_dt); type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 4, dim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim); H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt); H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_DOUBLE,4,dim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim); H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt); H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_DOUBLE, 4, dim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim); H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt); H5Tclose(array_dt); @@ -1391,24 +1391,24 @@ static void gent_str(void) { mdims[0] = 8; mdims[1] = 10; - array_dt = H5Tarray_create(H5T_STD_I32BE, 2, mdims, NULL); + array_dt = H5Tarray_create2(H5T_STD_I32BE, 2, mdims); H5Tinsert(f_type, "int_array", HOFFSET(compound_t, a), array_dt); H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 2, mdims, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 2, mdims); H5Tinsert(f_type2, "int_array", HOFFSET(compound_t, a), array_dt); H5Tclose(array_dt); mdims[0] = 3; mdims[1] = 4; str_type = mkstr(32, H5T_STR_SPACEPAD); - array_dt = H5Tarray_create(str_type, 2, mdims, NULL); + array_dt = H5Tarray_create2(str_type, 2, mdims); H5Tinsert(f_type, "string", HOFFSET(compound_t, s), array_dt); H5Tclose(array_dt); H5Tclose(str_type); str_type = mkstr(33, H5T_STR_NULLTERM); - array_dt = H5Tarray_create(str_type, 2, mdims, NULL); + array_dt = H5Tarray_create2(str_type, 2, mdims); H5Tinsert(f_type2, "string", HOFFSET(compound_t, s), array_dt); H5Tclose(array_dt); H5Tclose(str_type); @@ -1909,7 +1909,7 @@ static void gent_nestcomp(void) H5Tset_strpad(char_id, H5T_STR_NULLTERM); H5Tinsert(cmp_tid, "char_name", HOFFSET(cmp_t, a), char_id); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, ndims, array_dims, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, ndims, array_dims); H5Tinsert(cmp_tid, "array_name", HOFFSET(cmp_t, b), array_dt); H5Tclose(array_dt); @@ -2420,7 +2420,7 @@ static void gent_array1(void) sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL); /* Create a datatype to refer to */ - tid1 = H5Tarray_create(H5T_NATIVE_INT, ARRAY1_RANK, tdims1, NULL); + tid1 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2466,7 +2466,7 @@ static void gent_array2(void) sid = H5Screate_simple(SPACE1_RANK, sdims1, NULL); /* Create a datatype to refer to */ - tid = H5Tarray_create(H5T_NATIVE_INT, ARRAY2_RANK, tdims2, NULL); + tid = H5Tarray_create2(H5T_NATIVE_INT, ARRAY2_RANK, tdims2); /* Create a dataset */ dataset = H5Dcreate2(fid, "Dataset1", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2514,10 +2514,10 @@ static void gent_array3(void) sid = H5Screate_simple(SPACE1_RANK, sdims1, NULL); /* Create a 2-D datatype to refer to */ - tid2 = H5Tarray_create(H5T_NATIVE_INT, ARRAY3_RANK, tdims2, NULL); + tid2 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY3_RANK, tdims2); /* Create a 1-D datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Create a dataset */ dataset = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2581,7 +2581,7 @@ static void gent_array4(void) assert(ret >= 0); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close compound datatype */ ret = H5Tclose(tid2); @@ -2645,7 +2645,7 @@ static void gent_array5(void) assert(ret >= 0); /* Create an array of floats datatype */ - tid3 = H5Tarray_create(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1, NULL); + tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1); /* Insert float array field */ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3); @@ -2656,7 +2656,7 @@ static void gent_array5(void) assert(ret >= 0); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close compound datatype */ ret = H5Tclose(tid2); @@ -2712,7 +2712,7 @@ static void gent_array6(void) tid2 = H5Tvlen_create(H5T_NATIVE_UINT); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close VL datatype */ ret = H5Tclose(tid2); @@ -2771,7 +2771,7 @@ static void gent_array7(void) sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL); /* Create the nested array datatype to refer to */ - tid3 = H5Tarray_create(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1, NULL); + tid3 = H5Tarray_create2(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1); /* Create a VL datatype of 1-D arrays to refer to */ tid2 = H5Tvlen_create(tid3); @@ -2781,7 +2781,7 @@ static void gent_array7(void) assert(ret >= 0); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close VL datatype */ ret = H5Tclose(tid2); @@ -2846,7 +2846,7 @@ static void gent_empty(void) assert(ret >= 0); /* write out an empty array dataset */ - type = H5Tarray_create(H5T_NATIVE_INT, SPACE1_RANK, dims, NULL); + type = H5Tarray_create2(H5T_NATIVE_INT, SPACE1_RANK, dims); dset = H5Dcreate2(file, "Dataset4.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); @@ -3335,16 +3335,16 @@ static void write_attr_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_attr(loc_id,1,dims,"array",tid,buf6); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - write_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - write_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); + write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); /*------------------------------------------------------------------------- @@ -3446,16 +3446,16 @@ static void write_attr_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_attr(loc_id,2,dims2,"array2D",tid,buf62); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 2, dims2, "array2D", tid, buf62); status = H5Tclose(tid); /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); - write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); + write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72); + write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); /*------------------------------------------------------------------------- @@ -3579,15 +3579,13 @@ static void write_attr_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - n=1; - for(i = 0; i < 24; i++) { - for(j = 0; j < (int)dimarray[0]; j++) { - buf63[i][j]=n++; - } - } + n = 1; + for(i = 0; i < 24; i++) + for(j = 0; j < (int)dimarray[0]; j++) + buf63[i][j] = n++; - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_attr(loc_id,3,dims3,"array3D",tid,buf63); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 3, dims3, "array3D", tid, buf63); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -3779,8 +3777,8 @@ static void write_dset_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,1,dims,"array",tid,buf6); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 1, dims, "array", tid, buf6); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -3889,7 +3887,7 @@ static void write_dset_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); write_dset(loc_id, 2, dims2, "array2D", tid, buf62); status = H5Tclose(tid); @@ -4040,8 +4038,8 @@ static void write_dset_in(hid_t loc_id, } } - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,3,dims3,"array3D",tid,buf63); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 3, dims3, "array3D", tid, buf63); status = H5Tclose(tid); /*------------------------------------------------------------------------- @@ -4299,7 +4297,7 @@ static void gent_compound_complex(void) assert(status >= 0); /* Create the array data type for the string array */ - str_array_id = H5Tarray_create(array_tid, F41_ARRAY_RANK, array_dimb, NULL); + str_array_id = H5Tarray_create2(array_tid, F41_ARRAY_RANK, array_dimb); assert(str_array_id >= 0); /* Copy the array data type for the character array */ @@ -4311,11 +4309,11 @@ static void gent_compound_complex(void) assert(status >= 0); /* Create the array data type for the character array */ - array2_tid = H5Tarray_create(H5T_NATIVE_SHORT, F41_ARRAY_RANKd, array_dimd, NULL); + array2_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F41_ARRAY_RANKd, array_dimd); assert(array2_tid >= 0); /* Create the array data type for the character array */ - array4_tid = H5Tarray_create(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK, array_dimf, NULL); + array4_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK, array_dimf); assert(array4_tid >= 0); /* Create the memory data type */ @@ -5232,8 +5230,8 @@ static void gent_fvalues(void) * dataset with a H5T_ARRAY fill value *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(fid,1,dims,"fill_array",tid,buf4); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(fid, 1, dims, "fill_array", tid, buf4); ret = H5Tclose(tid); @@ -5588,7 +5586,7 @@ gent_binary(void) * array *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT, 1, dims, NULL); + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dims); sid = H5Screate_simple(1, dimarray, NULL); did = H5Dcreate2(fid, "array", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, abuf); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index f98a84b..3d9cf87 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1067,7 +1067,7 @@ display_array_type(hid_t type, int ind) ndims = H5Tget_array_ndims(type); if (ndims) { dims = malloc(ndims*sizeof(dims[0])); - H5Tget_array_dims(type, dims, NULL); + H5Tget_array_dims2(type, dims); /* Print dimensions */ for (i=0; i<ndims; i++) diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 59cbbf6..de04685 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -3137,8 +3137,8 @@ void write_dset_in(hid_t loc_id, } } - type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,1,dims,"array",type_id,buf6); + type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 1, dims, "array", type_id, buf6); status = H5Tclose(type_id); /*------------------------------------------------------------------------- @@ -3284,8 +3284,8 @@ void write_dset_in(hid_t loc_id, } - type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,2,dims2,"array2D",type_id,buf62); + type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 2, dims2, "array2D", type_id, buf62); status = H5Tclose(type_id); /*------------------------------------------------------------------------- @@ -3454,16 +3454,16 @@ void write_dset_in(hid_t loc_id, */ - n=1; - for (i = 0; i < 24; i++) { - for (j = 0; j < (int)dimarray[0]; j++) { - if (make_diffs) buf63[i][j]=0; - else buf63[i][j]=n++; - } - } + n = 1; + for(i = 0; i < 24; i++) + for(j = 0; j < (int)dimarray[0]; j++) + if(make_diffs) + buf63[i][j] = 0; + else + buf63[i][j] = n++; - type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - write_dset(loc_id,3,dims3,"array3D",type_id,buf63); + type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 3, dims3, "array3D", type_id, buf63); status = H5Tclose(type_id); /*------------------------------------------------------------------------- @@ -3874,8 +3874,8 @@ position array of </g1> array of </g1> difference [ 1 ] 5 0 5 [ 1 ] 6 0 6 */ - type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - make_attr(loc_id,1,dims,"array",type_id,buf6); + type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + make_attr(loc_id, 1, dims, "array", type_id, buf6); status = H5Tclose(type_id); /*------------------------------------------------------------------------- @@ -3883,14 +3883,12 @@ position array of </g1> array of </g1> difference *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - { + if(make_diffs) + for(i = 0; i < 2; i++) { buf7[i]=0; buf8[i]=0; } - } + /* buf7[2]= {1,2}; buf8[2]= {1,2}; @@ -4153,8 +4151,8 @@ position array2D of </g1> array2D of </g1> difference [ 2 1 ] 17 0 17 [ 2 1 ] 18 0 18 */ - type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - make_attr(loc_id,2,dims2,"array2D",type_id,buf62); + type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + make_attr(loc_id, 2, dims2, "array2D", type_id, buf62); status = H5Tclose(type_id); /*------------------------------------------------------------------------- @@ -4162,10 +4160,9 @@ position array2D of </g1> array2D of </g1> difference *------------------------------------------------------------------------- */ - if (make_diffs) - { - memset(buf72,0,sizeof buf72); - memset(buf82,0,sizeof buf82); + if(make_diffs) { + HDmemset(buf72, 0, sizeof buf72); + HDmemset(buf82, 0, sizeof buf82); } /* Attribute: <integer2D> and <integer2D> @@ -4541,29 +4538,26 @@ etc etc */ - type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); - make_attr(loc_id,3,dims3,"array3D",type_id,buf63); + type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + make_attr(loc_id, 3, dims3, "array3D", type_id, buf63); status = H5Tclose(type_id); /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT *------------------------------------------------------------------------- */ - n=1; f=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) { - buf73[i][j][k]=0; - buf83[i][j][k]=0; + n = 1; f = 1; + for(i = 0; i < 4; i++) + for(j = 0; j < 3; j++) + for(k = 0; k < 2; k++) + if(make_diffs) { + buf73[i][j][k] = 0; + buf83[i][j][k] = 0; } else { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; + buf73[i][j][k] = n++; + buf83[i][j][k] = f++; } - } - } - } /* position integer3D of </g1> integer3D of </g1> difference diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index f6dbd2b..f852a2d 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -643,7 +643,7 @@ hsize_t diff_datum(void *_mem1, memb_type = H5Tget_super(m_type); size = H5Tget_size(memb_type); ndims = H5Tget_array_ndims(m_type); - H5Tget_array_dims(m_type, adims, NULL); + H5Tget_array_dims2(m_type, adims); assert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* calculate the number of array elements */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 44154cd..3d8c871 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1772,7 +1772,7 @@ int render_bin_output(FILE *stream, hid_t tid, void *_mem) memb = H5Tget_super(tid); size = H5Tget_size(memb); ndims = H5Tget_array_ndims(tid); - H5Tget_array_dims(tid, dims, NULL); + H5Tget_array_dims2(tid, dims); assert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* calculate the number of array elements */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index f877baa..66966d8 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -916,7 +916,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai memb = H5Tget_super(type); size = H5Tget_size(memb); ndims = H5Tget_array_ndims(type); - H5Tget_array_dims(type, dims, NULL); + H5Tget_array_dims2(type, dims); assert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* Calculate the number of array elements */ diff --git a/tools/lib/talign.c b/tools/lib/talign.c index 28b8075..25f0daa 100644 --- a/tools/lib/talign.c +++ b/tools/lib/talign.c @@ -79,12 +79,12 @@ int main(void) H5Tinsert(cmp, "Awkward length", 0, cs6); cdim[0] = sizeof(fok) / sizeof(float); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp, "Ok", sizeof(string5), array_dt); H5Tclose(array_dt); cdim[0] = sizeof(fnok) / sizeof(float); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt); H5Tclose(array_dt); @@ -93,7 +93,7 @@ int main(void) cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok)); cdim[0] = sizeof(fok) / sizeof(float); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp1, "Ok", 0, array_dt); H5Tclose(array_dt); @@ -103,7 +103,7 @@ int main(void) cmp3 = H5Tcreate(H5T_COMPOUND, sizeof(fnok)); cdim[0] = sizeof(fnok) / sizeof(float); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim); H5Tinsert(cmp3, "Not Ok", 0, array_dt); H5Tclose(array_dt); |