From 14dcb6db33f88011c3499d439c53890ab09d1ba2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 8 Oct 2006 23:18:18 -0500 Subject: [svn-r12736] Description: Add "use the latest format" support for dataspace object header encode/ decode routines and clean up format a bit for the latest format (new to 1.8.x releases) Remove storing 'perm' parameter for array datatypes in memory and the file, and add test to make certain that if any user applications are attempting to store them, we get some reports back. (Should be unlikely, since the RefMan says that the parameter is not implemented and is unsupported). Carry those changes into the tests, etc. Clean up a bunch more compiler warnings. Tested on: FreeBSD/32 4.11 (sleipnir) w/threadsafe Linux/32 2.4 (heping) w/FORTRAN & C++ Linux/64 2.4 (mir) w/enable-1.6-compat --- src/H5Odtype.c | 139 ++++++++--------- src/H5Osdspace.c | 251 +++++++++++++++++------------- src/H5T.c | 15 +- src/H5Tarray.c | 172 +++++++++------------ src/H5Tconv.c | 69 ++++----- src/H5Tnative.c | 38 ++--- src/H5Tpkg.h | 9 +- src/H5Tpublic.h | 5 +- test/cmpd_dset.c | 8 +- test/dsets.c | 10 +- test/dt_arith.c | 14 +- test/dtypes.c | 34 +++-- test/flush1.c | 3 +- test/flush2.c | 6 +- test/ntypes.c | 12 +- test/reserved.c | 12 +- test/tarray.c | 54 +++---- test/th5o.c | 4 +- test/th5s.c | 2 - tools/h5diff/h5diffgentest.c | 12 +- tools/h5dump/h5dump.c | 29 ++-- tools/h5dump/h5dumpgentest.c | 131 ++++++++-------- tools/h5ls/h5ls.c | 17 +-- tools/h5repack/h5repack.c | 8 +- tools/h5repack/h5repack.h | 12 +- tools/h5repack/h5repack_copy.c | 6 +- tools/h5repack/h5repack_filters.c | 1 - tools/h5repack/h5repack_list.c | 4 +- tools/h5repack/h5repack_main.c | 2 +- tools/h5repack/testh5repack_attr.c | 6 +- tools/h5repack/testh5repack_dset.c | 6 +- tools/h5repack/testh5repack_main.c | 92 +++++------ tools/lib/h5diff_array.c | 9 +- tools/lib/h5tools.c | 2 +- tools/lib/h5tools_str.c | 117 +++++++------- tools/lib/h5tools_str.h | 1 - tools/lib/talign.c | 255 ++++++++++++++++--------------- tools/misc/h5stat.c | 3 +- tools/testfiles/tarray1.h5.xml | 2 +- tools/testfiles/tarray2.h5.xml | 6 +- tools/testfiles/tarray3.h5.xml | 6 +- tools/testfiles/tarray6.h5.xml | 2 +- tools/testfiles/tarray7.h5.xml | 4 +- tools/testfiles/tcompound.h5.xml | 6 +- tools/testfiles/tcompound2.h5.xml | 6 +- tools/testfiles/tcompound_complex.h5.xml | 8 +- tools/testfiles/tempty-dtd-2.h5.xml | 2 +- tools/testfiles/tempty-dtd-uri.h5.xml | 2 +- tools/testfiles/tempty-dtd.h5.xml | 2 +- tools/testfiles/tempty-nons-2.h5.xml | 2 +- tools/testfiles/tempty-nons-uri.h5.xml | 2 +- tools/testfiles/tempty-nons.h5.xml | 2 +- tools/testfiles/tempty-ns-2.h5.xml | 2 +- tools/testfiles/tempty-ns.h5.xml | 2 +- tools/testfiles/tempty.h5.xml | 2 +- tools/testfiles/tmany.h5.xml | 24 +-- tools/testfiles/tnestedcomp.h5.xml | 2 +- tools/testfiles/tsaf.h5.xml | 8 +- tools/testfiles/tstr.h5.xml | 8 +- 59 files changed, 815 insertions(+), 855 deletions(-) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 645f547..0a8671b 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -111,7 +111,7 @@ static herr_t H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) { unsigned flags, version; - unsigned i, j; + unsigned i; size_t z; herr_t ret_value = SUCCEED; /* Return value */ @@ -215,6 +215,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) case H5T_COMPOUND: { unsigned offset_nbytes; /* Size needed to encode member offsets */ + unsigned j; /* Compute the # of bytes required to store a member offset */ offset_nbytes = (H5V_log2_gen((hsize_t)dt->shared->size) + 7) / 8; @@ -232,8 +233,6 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { unsigned ndims = 0; /* Number of dimensions of the array field */ hsize_t dim[H5O_LAYOUT_NDIMS]; /* Dimensions of the array */ - int perm[H5O_LAYOUT_NDIMS]; /* Dimension permutations */ - unsigned perm_word = 0; /* Dimension permutation information */ H5T_t *array_dt; /* Temporary pointer to the array datatype */ H5T_t *temp_type; /* Temporary pointer to the field's datatype */ @@ -264,8 +263,8 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) HDassert(ndims <= 4); *pp += 3; /*reserved bytes */ - /* Decode dimension permutation (unused currently) */ - UINT32DECODE(*pp, perm_word); + /* Skip dimension permutation */ + *pp += 4; /* Skip reserved bytes */ *pp += 4; @@ -291,12 +290,8 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) if(version == H5O_DTYPE_VERSION_1) { /* Check if this member is an array field */ if(ndims > 0) { - /* Set up the permutation vector for the array create */ - for(j = 0; j < ndims; j++) - perm[j]=(perm_word >> (j * 8)) & 0xff; - /* Create the array datatype for the field */ - if((array_dt = H5T_array_create(temp_type, (int)ndims, dim, perm)) == NULL) { + if((array_dt = H5T_array_create(temp_type, ndims, dim)) == NULL) { for(j = 0; j <= i; j++) H5MM_xfree(dt->shared->u.compnd.memb[j].name); H5MM_xfree(dt->shared->u.compnd.memb); @@ -441,25 +436,26 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) UINT16DECODE(*pp, dt->shared->u.atomic.prec); break; - case H5T_ARRAY: /* Array datatypes... */ + case H5T_ARRAY: /* Array datatypes */ /* Decode the number of dimensions */ dt->shared->u.array.ndims = *(*pp)++; /* Double-check the number of dimensions */ - assert(dt->shared->u.array.ndims <= H5S_MAX_RANK); + HDassert(dt->shared->u.array.ndims <= H5S_MAX_RANK); - /* Skip reserved bytes */ - *pp += 3; + /* Skip reserved bytes, if version has them */ + if(version < H5O_DTYPE_VERSION_3) + *pp += 3; /* Decode array dimension sizes & compute number of elements */ - for(j = 0, dt->shared->u.array.nelem = 1; j < (unsigned)dt->shared->u.array.ndims; j++) { - UINT32DECODE(*pp, dt->shared->u.array.dim[j]); - dt->shared->u.array.nelem *= dt->shared->u.array.dim[j]; + for(i = 0, dt->shared->u.array.nelem = 1; i < (unsigned)dt->shared->u.array.ndims; i++) { + UINT32DECODE(*pp, dt->shared->u.array.dim[i]); + dt->shared->u.array.nelem *= dt->shared->u.array.dim[i]; } /* end for */ - /* Decode array dimension permutations (even though they are unused currently) */ - for(j = 0; j < (unsigned)dt->shared->u.array.ndims; j++) - UINT32DECODE(*pp, dt->shared->u.array.perm[j]); + /* Skip array dimension permutations, if version has them */ + if(version < H5O_DTYPE_VERSION_3) + *pp += dt->shared->u.array.ndims * 4; /* Decode base type of array */ if(NULL == (dt->shared->parent = H5T_alloc())) @@ -856,25 +852,31 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) UINT16ENCODE(*pp, dt->shared->u.atomic.prec); break; - case H5T_ARRAY: /* Array datatypes... */ + case H5T_ARRAY: /* Array datatypes */ /* Double-check the number of dimensions */ HDassert(dt->shared->u.array.ndims <= H5S_MAX_RANK); /* Encode the number of dimensions */ *(*pp)++ = dt->shared->u.array.ndims; - /* Reserved */ - *(*pp)++ = '\0'; - *(*pp)++ = '\0'; - *(*pp)++ = '\0'; + /* Drop this information for Version 3 of the format */ + if(!use_latest_format) { + /* Reserved */ + *(*pp)++ = '\0'; + *(*pp)++ = '\0'; + *(*pp)++ = '\0'; + } /* end if */ /* Encode array dimensions */ for(i = 0; i < (unsigned)dt->shared->u.array.ndims; i++) UINT32ENCODE(*pp, dt->shared->u.array.dim[i]); - /* Encode array dimension permutations */ - for(i = 0; i < (unsigned)dt->shared->u.array.ndims; i++) - UINT32ENCODE(*pp, dt->shared->u.array.perm[i]); + /* Drop this information for Version 3 of the format */ + if(!use_latest_format) { + /* Encode 'fake' array dimension permutations */ + for(i = 0; i < (unsigned)dt->shared->u.array.ndims; i++) + UINT32ENCODE(*pp, i); + } /* end if */ /* Encode base type of array's information */ if(H5O_dtype_encode_helper(f, pp, dt->shared->parent) < 0) @@ -890,8 +892,9 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) /* (unless the "use the latest format" flag is set, which can "upgrade" the * format of certain encodings) */ - if(has_vax || - (use_latest_format && (dt->shared->type == H5T_ENUM || dt->shared->type == H5T_COMPOUND))) + if(use_latest_format) + version = H5O_DTYPE_VERSION_LATEST; + else if(has_vax) version = H5O_DTYPE_VERSION_3; else if(has_array) version = H5O_DTYPE_VERSION_2; @@ -1069,15 +1072,19 @@ done: static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg) { - const H5T_t *dt = (const H5T_t *)_mesg; - unsigned i; /* Local index variable */ - size_t ret_value; + const H5T_t *dt = (const H5T_t *)_mesg; + hbool_t use_latest_format; /* Flag indicating the new group format should be used */ + unsigned u; /* Local index variable */ + size_t ret_value; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_dtype_size) HDassert(f); HDassert(dt); + /* Get the file's 'use the latest version of the format' flag */ + use_latest_format = H5F_USE_LATEST_FORMAT(f); + /* Set the common size information */ ret_value = 4 + /* Type, class & flags */ 4; /* Size of datatype */ @@ -1103,25 +1110,21 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) case H5T_COMPOUND: { htri_t has_array; /* Whether a compound datatype has an array inside it */ - hbool_t use_latest_format; /* Flag indicating the new group format should be used */ unsigned offset_nbytes; /* Size needed to encode member offsets */ /* Check for an array datatype somewhere within the compound type */ has_array = H5T_detect_class(dt, H5T_ARRAY); HDassert(has_array >= 0); - /* Get the file's 'use the latest version of the format' flag */ - use_latest_format = H5F_USE_LATEST_FORMAT(f); - /* Compute the # of bytes required to store a member offset */ offset_nbytes = (H5V_log2_gen((hsize_t)dt->shared->size) + 7) / 8; /* Compute the total size needed to encode compound datatype */ - for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { + for(u = 0; u < dt->shared->u.compnd.nmembs; u++) { size_t name_len; /* Length of field's name */ /* Get length of field's name */ - name_len = HDstrlen(dt->shared->u.compnd.memb[i].name); + name_len = HDstrlen(dt->shared->u.compnd.memb[u].name); /* Newer versions of the format don't pad out the name */ if(use_latest_format) @@ -1142,33 +1145,26 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) 4 + /*permutation*/ 4 + /*reserved*/ 16; /*dimensions*/ - ret_value += H5O_dtype_size(f, dt->shared->u.compnd.memb[i].type); + ret_value += H5O_dtype_size(f, dt->shared->u.compnd.memb[u].type); } /* end for */ } break; case H5T_ENUM: - { - hbool_t use_latest_format; /* Flag indicating the new group format should be used */ - - /* Get the file's 'use the latest version of the format' flag */ - use_latest_format = H5F_USE_LATEST_FORMAT(f); - - ret_value += H5O_dtype_size(f, dt->shared->parent); - for(i = 0; i < dt->shared->u.enumer.nmembs; i++) { - size_t name_len; /* Length of field's name */ + ret_value += H5O_dtype_size(f, dt->shared->parent); + for(u = 0; u < dt->shared->u.enumer.nmembs; u++) { + size_t name_len; /* Length of field's name */ - /* Get length of field's name */ - name_len = HDstrlen(dt->shared->u.enumer.name[i]); + /* Get length of field's name */ + name_len = HDstrlen(dt->shared->u.enumer.name[u]); - /* Newer versions of the format don't pad out the name */ - if(use_latest_format) - ret_value += name_len + 1; - else - ret_value += ((name_len + 8) / 8) * 8; - } /* end for */ - ret_value += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size; - } + /* Newer versions of the format don't pad out the name */ + if(use_latest_format) + ret_value += name_len + 1; + else + ret_value += ((name_len + 8) / 8) * 8; + } /* end for */ + ret_value += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size; break; case H5T_VLEN: @@ -1180,9 +1176,12 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) break; case H5T_ARRAY: - ret_value += 4; /* ndims & reserved bytes*/ + ret_value += 1; /* ndims */ + if(!use_latest_format) + ret_value += 3; /* reserved bytes*/ ret_value += 4 * dt->shared->u.array.ndims; /* dimensions */ - ret_value += 4 * dt->shared->u.array.ndims; /* dimension permutations */ + if(!use_latest_format) + ret_value += 4 * dt->shared->u.array.ndims; /* dimension permutations */ ret_value += H5O_dtype_size(f, dt->shared->parent); break; @@ -1534,22 +1533,16 @@ H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, } fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Location:", s); - } else if (H5T_ARRAY==dt->shared->type) { + } else if(H5T_ARRAY == dt->shared->type) { fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Rank:", dt->shared->u.array.ndims); - fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); - for (i=0; i<(unsigned)dt->shared->u.array.ndims; i++) { - fprintf (stream, "%s%u", i?", ":"", (unsigned)dt->shared->u.array.dim[i]); - } - fprintf (stream, "}\n"); - fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Permutation:"); - for (i=0; i<(unsigned)dt->shared->u.array.ndims; i++) { - fprintf (stream, "%s%d", i?", ":"", dt->shared->u.array.perm[i]); - } - fprintf (stream, "}\n"); + fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); + for(i = 0; i < dt->shared->u.array.ndims; i++) + fprintf(stream, "%s%u", (i ? ", " : ""), (unsigned)dt->shared->u.array.dim[i]); + fprintf(stream, "}\n"); fprintf(stream, "%*s%s\n", indent, "", "Base type:"); - H5O_dtype_debug(f, dxpl_id, dt->shared->parent, stream, indent+3, MAX(0, fwidth-3)); + H5O_dtype_debug(f, dxpl_id, dt->shared->parent, stream, indent + 3, MAX(0, fwidth - 3)); } else { switch (dt->shared->u.atomic.order) { case H5T_ORDER_LE: diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index f6be82b..32be4bc 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -55,11 +55,19 @@ const H5O_msg_class_t H5O_MSG_SDSPACE[1] = {{ H5O_sdspace_debug /* debug the message */ }}; -/* Initial version of the "old" data space information */ -#define H5O_SDSPACE_VERSION 1 -/* Initial version of the "new" data space information */ +/* Initial version of the dataspace information */ +#define H5O_SDSPACE_VERSION_1 1 + +/* This version adds support for "null" dataspaces, encodes the type of the + * dataspace in the message and eliminated the rest of the "reserved" + * bytes. + */ #define H5O_SDSPACE_VERSION_2 2 +/* The latest version of the format. Look through the 'encode' + * and 'size' callbacks for places to change when updating this. */ +#define H5O_SDSPACE_VERSION_LATEST H5O_SDSPACE_VERSION_2 + /* Declare external the free list for H5S_extent_t's */ H5FL_EXTERN(H5S_extent_t); @@ -107,83 +115,87 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p) unsigned i; /* local counting variable */ unsigned flags, version; - FUNC_ENTER_NOAPI_NOINIT(H5O_sdspace_decode); + FUNC_ENTER_NOAPI_NOINIT(H5O_sdspace_decode) /* check args */ - assert(f); - assert(p); + HDassert(f); + HDassert(p); /* decode */ - if ((sdim = H5FL_CALLOC(H5S_extent_t)) != NULL) { - /* Check version */ - version = *p++; - if (version!=H5O_SDSPACE_VERSION && version!=H5O_SDSPACE_VERSION_2) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "wrong version number in data space message"); - - /* Get rank */ - sdim->rank = *p++; - if (sdim->rank>H5S_MAX_RANK) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "simple data space dimensionality is too large"); - - /* Get dataspace flags for later */ - flags = *p++; - - /* Get the type of the extent */ - if(version>=H5O_SDSPACE_VERSION_2) - sdim->type = (H5S_class_t)*p++; - else { - /* Set the dataspace type to be simple or scalar as appropriate */ - if(sdim->rank>0) - sdim->type = H5S_SIMPLE; - else - sdim->type = H5S_SCALAR; - - /* Increment past reserved byte */ - p++; - } /* end else */ - + if(NULL == (sdim = H5FL_CALLOC(H5S_extent_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, NULL, "dataspace structure allocation failed") + + /* Check version */ + version = *p++; + if(version < H5O_SDSPACE_VERSION_1 || version > H5O_SDSPACE_VERSION_2) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "wrong version number in dataspace message") + + /* Get rank */ + sdim->rank = *p++; + if(sdim->rank > H5S_MAX_RANK) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "simple dataspace dimensionality is too large") + + /* Get dataspace flags for later */ + flags = *p++; + + /* Get or determine the type of the extent */ + if(version >= H5O_SDSPACE_VERSION_2) + sdim->type = (H5S_class_t)*p++; + else { + /* Set the dataspace type to be simple or scalar as appropriate */ + if(sdim->rank > 0) + sdim->type = H5S_SIMPLE; + else + sdim->type = H5S_SCALAR; + + /* Increment past reserved byte */ + p++; + } /* end else */ + + /* Only Version 1 has these reserved bytes */ + if(version == H5O_SDSPACE_VERSION_1) p += 4; /*reserved*/ - if(sdim->rank > 0) { - if(NULL == (sdim->size = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - for(i = 0; i < sdim->rank; i++) { - H5F_DECODE_LENGTH (f, p, sdim->size[i]); + /* Decode dimension sizes */ + if(sdim->rank > 0) { + if(NULL == (sdim->size = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + for(i = 0; i < sdim->rank; i++) { + H5F_DECODE_LENGTH(f, p, sdim->size[i]); #ifndef H5_HAVE_LARGE_HSIZET - /* Rudimentary check for overflow of the dimension size */ - if(sdim->size[i] == 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, NULL, "invalid size detected"); + /* Rudimentary check for overflow of the dimension size */ + if(sdim->size[i] == 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, NULL, "invalid size detected") #endif /* H5_HAVE_LARGE_HSIZET */ - } /* end for */ + } /* end for */ - if(flags & H5S_VALID_MAX) { - if(NULL == (sdim->max = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - for(i = 0; i < sdim->rank; i++) - H5F_DECODE_LENGTH (f, p, sdim->max[i]); - } - } + if(flags & H5S_VALID_MAX) { + if(NULL == (sdim->max = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + for(i = 0; i < sdim->rank; i++) + H5F_DECODE_LENGTH (f, p, sdim->max[i]); + } /* end if */ + } /* end if */ - /* Compute the number of elements in the extent */ - if(sdim->type == H5S_NULL) - sdim->nelem = 0; - else { - for(i=0, sdim->nelem=1; irank; i++) - sdim->nelem*=sdim->size[i]; - } - } + /* Compute the number of elements in the extent */ + if(sdim->type == H5S_NULL) + sdim->nelem = 0; + else { + for(i = 0, sdim->nelem = 1; i < sdim->rank; i++) + sdim->nelem *= sdim->size[i]; + } /* end else */ /* Set return value */ ret_value = (void*)sdim; /*success*/ done: - if (!ret_value && sdim) { + if(!ret_value && sdim) { H5S_extent_release(sdim); - H5FL_FREE(H5S_extent_t,sdim); + H5FL_FREE(H5S_extent_t, sdim); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_sdspace_decode() */ /*-------------------------------------------------------------------------- @@ -218,50 +230,64 @@ done: --------------------------------------------------------------------------*/ static herr_t -H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg) +H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) { - const H5S_extent_t *sdim = (const H5S_extent_t *) mesg; - unsigned u; /* Local counting variable */ + const H5S_extent_t *sdim = (const H5S_extent_t *)_mesg; unsigned flags = 0; + unsigned version; + hbool_t use_latest_format; /* Flag indicating the new group format should be used */ + unsigned u; /* Local counting variable */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_encode); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_encode) /* check args */ - assert(f); - assert(p); - assert(sdim); - - /* set flags */ - if (sdim->max) - flags |= H5S_VALID_MAX; - - /* encode */ - if(sdim->type!=H5S_NULL) - *p++ = H5O_SDSPACE_VERSION; + HDassert(f); + HDassert(p); + HDassert(sdim); + + /* Get the file's 'use the latest version of the format' flag */ + use_latest_format = H5F_USE_LATEST_FORMAT(f); + + /* Version */ + if(use_latest_format) + version = H5O_SDSPACE_VERSION_LATEST; + else if(sdim->type == H5S_NULL || use_latest_format) + version = H5O_SDSPACE_VERSION_2; else - *p++ = H5O_SDSPACE_VERSION_2; + version = H5O_SDSPACE_VERSION_1; + *p++ = version; + + /* Rank */ *p++ = sdim->rank; + + /* Flags */ + if(sdim->max) + flags |= H5S_VALID_MAX; *p++ = flags; - if(sdim->type!=H5S_NULL) - *p++ = 0; /*reserved*/ - else - *p++ = sdim->type; - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - *p++ = 0; /*reserved*/ - if (sdim->rank > 0) { - for (u = 0; u < sdim->rank; u++) - H5F_ENCODE_LENGTH (f, p, sdim->size[u]); - if (flags & H5S_VALID_MAX) { - for (u = 0; u < sdim->rank; u++) - H5F_ENCODE_LENGTH (f, p, sdim->max[u]); - } - } + /* Dataspace type */ + if(version > H5O_SDSPACE_VERSION_1) + *p++ = sdim->type; + else { + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + *p++ = 0; /*reserved*/ + } /* end else */ + + /* Current & maximum dimensions */ + if(sdim->rank > 0) { + for(u = 0; u < sdim->rank; u++) + H5F_ENCODE_LENGTH(f, p, sdim->size[u]); + if(flags & H5S_VALID_MAX) { + for(u = 0; u < sdim->rank; u++) + H5F_ENCODE_LENGTH(f, p, sdim->max[u]); + } /* end if */ + } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_sdspace_encode() */ /*-------------------------------------------------------------------------- @@ -332,25 +358,32 @@ done: instead of just four bytes. --------------------------------------------------------------------------*/ static size_t -H5O_sdspace_size(const H5F_t *f, const void *mesg) +H5O_sdspace_size(const H5F_t *f, const void *_mesg) { - const H5S_extent_t *space = (const H5S_extent_t *) mesg; + const H5S_extent_t *space = (const H5S_extent_t *)_mesg; + hbool_t use_latest_format; /* Flag indicating the new group format should be used */ + size_t ret_value; - /* - * All dimensionality messages are at least 8 bytes long. - */ - size_t ret_value = 8; + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_size) - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_size); + /* Get the file's 'use the latest version of the format' flag */ + use_latest_format = H5F_USE_LATEST_FORMAT(f); - /* add in the dimension sizes */ - ret_value += space->rank * H5F_SIZEOF_SIZE (f); + /* Basic information for all dataspace messages */ + ret_value = 1 + /* Version */ + 1 + /* Rank */ + 1 + /* Flags */ + 1 + /* Dataspace type/reserved */ + (use_latest_format ? 0 : 4); /* Eliminated/reserved */ - /* add in the space for the maximum dimensions, if they are present */ - ret_value += space->max ? space->rank * H5F_SIZEOF_SIZE (f) : 0; + /* Add in the dimension sizes */ + ret_value += space->rank * H5F_SIZEOF_SIZE(f); - FUNC_LEAVE_NOAPI(ret_value); -} + /* Add in the space for the maximum dimensions, if they are present */ + ret_value += space->max ? (space->rank * H5F_SIZEOF_SIZE(f)) : 0; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_sdspace_size() */ /*------------------------------------------------------------------------- diff --git a/src/H5T.c b/src/H5T.c index 7acf1e9..aebeb57 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1006,7 +1006,7 @@ H5T_init_interface(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (vlen = H5T_vlen_create(native_int))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - if (NULL == (array = H5T_array_create(native_int,1,dim,NULL))) + if (NULL == (array = H5T_array_create(native_int, 1, dim))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); status = 0; @@ -4047,17 +4047,10 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) if (dt1->shared->u.array.ndims > dt2->shared->u.array.ndims) HGOTO_DONE(1); - for (j=0; jshared->u.array.ndims; j++) { - if (dt1->shared->u.array.dim[j] < dt2->shared->u.array.dim[j]) + for (u=0; ushared->u.array.ndims; u++) { + if (dt1->shared->u.array.dim[u] < dt2->shared->u.array.dim[u]) HGOTO_DONE(-1); - if (dt1->shared->u.array.dim[j] > dt2->shared->u.array.dim[j]) - HGOTO_DONE(1); - } - - for (j=0; jshared->u.array.ndims; j++) { - if (dt1->shared->u.array.perm[j] < dt2->shared->u.array.perm[j]) - HGOTO_DONE(-1); - if (dt1->shared->u.array.perm[j] > dt2->shared->u.array.perm[j]) + if (dt1->shared->u.array.dim[u] > dt2->shared->u.array.dim[u]) HGOTO_DONE(1); } diff --git a/src/H5Tarray.c b/src/H5Tarray.c index 71c80b8..3fdf3a5 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -57,57 +57,54 @@ H5T_init_array_interface(void) * 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. - * PERM is currently unimplemented and unused, but is designed to contain - * the dimension permutation from C order. * 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 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t -H5Tarray_create(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], - const int perm[/* ndims */]) +H5Tarray_create(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */], + const int UNUSED perm[/* ndims */]) { - H5T_t *base = NULL; /* base data type */ - H5T_t *dt = NULL; /* new array data type */ - int i; /* local index variable */ - hid_t ret_value; /* return value */ + 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","iIs*h*Is",base_id,ndims,dim,perm); + FUNC_ENTER_API(H5Tarray_create, FAIL) + H5TRACE3("i","iIs*h",base_id,ndims,dim); /* Check args */ - if (ndims<1 || ndims>H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dimensionality"); - if (ndims>0 && !dim) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified"); - for(i=0; i0)) - 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(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 < 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") + 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,perm))==NULL) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to create datatype"); + if((dt = H5T_array_create(base, 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"); + 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); + FUNC_LEAVE_API(ret_value) } /* end H5Tarray_create */ @@ -116,34 +113,29 @@ done: * * Purpose: Internal routine to 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. PERM is currently unimplemented - * and unused, but is designed to contain the dimension permutation from - * C order. Array datatypes are currently limited to H5S_MAX_RANK number - * of * dimensions. + * and the size of the array is DIMS. + * Array datatypes are currently limited to H5S_MAX_RANK number + * of dimensions. * * Return: Success: ID of new array data type - * * Failure: Negative * * Programmer: Quincey Koziol * Thursday, Oct 26, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_t * -H5T_array_create(H5T_t *base, int ndims, const hsize_t dim[/* ndims */], - const int perm[/* ndims */]) +H5T_array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]) { - H5T_t *ret_value = NULL; /*new array data type */ - int i; /* local index variable */ + H5T_t *ret_value; /* new array data type */ + unsigned u; /* local index variable */ - FUNC_ENTER_NOAPI(H5T_array_create, NULL); + FUNC_ENTER_NOAPI(H5T_array_create, NULL) - assert(base); - assert(ndims>0 && ndims<=H5S_MAX_RANK); - assert(dim); + HDassert(base); + HDassert(ndims <= H5S_MAX_RANK); + HDassert(dim); /* Build new type */ if(NULL == (ret_value = H5T_alloc())) @@ -157,26 +149,22 @@ H5T_array_create(H5T_t *base, int ndims, const hsize_t dim[/* ndims */], ret_value->shared->u.array.ndims = ndims; /* Copy the array dimensions & compute the # of elements in the array */ - for(i=0, ret_value->shared->u.array.nelem=1; ishared->u.array.dim[i],dim[i],hsize_t,size_t); - ret_value->shared->u.array.nelem *= (size_t)dim[i]; + for(u = 0, ret_value->shared->u.array.nelem = 1; u < ndims; u++) { + H5_ASSIGN_OVERFLOW(ret_value->shared->u.array.dim[u], dim[u], hsize_t, size_t); + ret_value->shared->u.array.nelem *= (size_t)dim[u]; } /* end for */ - /* Copy the dimension permutations */ - for(i=0; ishared->u.array.perm[i] = perm ? perm[i] : i; - /* Set the array's size (number of elements * element datatype's size) */ ret_value->shared->size = ret_value->shared->parent->shared->size * ret_value->shared->u.array.nelem; /* * Set the "force conversion" flag if the base datatype indicates */ - if(base->shared->force_conv==TRUE) - ret_value->shared->force_conv=TRUE; + if(base->shared->force_conv == TRUE) + ret_value->shared->force_conv = TRUE; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_array_create */ @@ -191,30 +179,28 @@ done: * Programmer: Quincey Koziol * Monday, November 6, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5Tget_array_ndims(hid_t type_id) { - H5T_t *dt = NULL; /* pointer to array data type */ + H5T_t *dt; /* pointer to array data type */ int ret_value; /* return value */ - FUNC_ENTER_API(H5Tget_array_ndims, FAIL); + FUNC_ENTER_API(H5Tget_array_ndims, FAIL) H5TRACE1("Is","i",type_id); /* 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"); + 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 number of dimensions */ ret_value = H5T_get_array_ndims(dt); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Tget_array_ndims */ @@ -230,25 +216,18 @@ done: * Programmer: Raymond Lu * October 10, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5T_get_array_ndims(H5T_t *dt) { - int ret_value; /* return value */ - - FUNC_ENTER_NOAPI(H5T_get_array_ndims, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_get_array_ndims) - assert(dt); - assert(dt->shared->type==H5T_ARRAY); + HDassert(dt); + HDassert(dt->shared->type == H5T_ARRAY); /* Retrieve the number of dimensions */ - ret_value=dt->shared->u.array.ndims; - -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(dt->shared->u.array.ndims) } /* end H5T_get_array_ndims */ @@ -263,30 +242,28 @@ done: * Programmer: Quincey Koziol * Monday, November 6, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ int -H5Tget_array_dims(hid_t type_id, hsize_t dims[], int perm[]) +H5Tget_array_dims(hid_t type_id, hsize_t dims[], int UNUSED perm[]) { - H5T_t *dt = NULL; /* pointer to array data type */ + 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_dims, FAIL) + H5TRACE2("Is","i*h",type_id,dims); /* 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"); + 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, perm))<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes"); + 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); + FUNC_LEAVE_API(ret_value) } /* end H5Tget_array_dims */ @@ -302,35 +279,28 @@ done: * Programmer: Raymond Lu * October 10, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ int -H5T_get_array_dims(H5T_t *dt, hsize_t dims[], int perm[]) +H5T_get_array_dims(H5T_t *dt, hsize_t dims[]) { + unsigned u; /* Local index variable */ int ret_value; /* return value */ - int i; /* Local index variable */ - FUNC_ENTER_NOAPI(H5T_get_array_dims, FAIL); + FUNC_ENTER_NOAPI(H5T_get_array_dims, FAIL) - assert(dt); - assert(dt->shared->type==H5T_ARRAY); + HDassert(dt); + HDassert(dt->shared->type == H5T_ARRAY); /* Retrieve the sizes of the dimensions */ if(dims) - for(i=0; ishared->u.array.ndims; i++) - dims[i]=dt->shared->u.array.dim[i]; - - /* Retrieve the dimension permutations */ - if(perm) - for(i=0; ishared->u.array.ndims; i++) - perm[i]=dt->shared->u.array.perm[i]; + for(u = 0; u < dt->shared->u.array.ndims; u++) + dims[u] = dt->shared->u.array.dim[u]; /* Pass along the array rank as the return value */ - ret_value=dt->shared->u.array.ndims; + ret_value = dt->shared->u.array.ndims; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_array_dims */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 575dda7..a40287a 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2980,12 +2980,12 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t src_delta, dst_delta; /*source & destination stride */ int direction; /*direction of traversal */ size_t elmtno; /*element number counter */ - int i; /* local index variable */ + unsigned u; /* local index variable */ void *bkg_buf=NULL; /*temporary background buffer */ size_t bkg_buf_size=0; /*size of background buffer in bytes */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_conv_array, FAIL); + FUNC_ENTER_NOAPI(H5T_conv_array, FAIL) switch (cdata->command) { case H5T_CONV_INIT: @@ -2996,23 +2996,17 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * information that remains (almost) constant for this * conversion path. */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - assert (H5T_ARRAY==src->shared->type); - assert (H5T_ARRAY==dst->shared->type); + if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HDassert(H5T_ARRAY==src->shared->type); + HDassert(H5T_ARRAY==dst->shared->type); /* Check the number and sizes of the dimensions */ - if(src->shared->u.array.ndims!=dst->shared->u.array.ndims) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same number of dimensions"); - for(i=0; ishared->u.array.ndims; i++) - if(src->shared->u.array.dim[i]!=dst->shared->u.array.dim[i]) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same sizes of dimensions"); -#ifdef LATER - for(i=0; ishared->u.array.ndims; i++) - if(src->shared->u.array.perm[i]!=dst->shared->u.array.perm[i]) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same dimension permutations"); -#endif /* LATER */ + if(src->shared->u.array.ndims != dst->shared->u.array.ndims) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same number of dimensions") + for(u = 0; u < src->shared->u.array.ndims; u++) + if(src->shared->u.array.dim[u] != dst->shared->u.array.dim[u]) + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same sizes of dimensions") /* Array datatypes don't need a background buffer */ cdata->need_bkg = H5T_BKG_NO; @@ -3027,22 +3021,21 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Conversion. */ - if (NULL == (src = H5I_object(src_id)) || - NULL == (dst = H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") /* * Do we process the values from beginning to end or vice * versa? Also, how many of the elements have the source and * destination areas overlapping? */ - if (src->shared->size>=dst->shared->size || buf_stride>0) { + if(src->shared->size >= dst->shared->size || buf_stride > 0) { sp = dp = (uint8_t*)_buf; direction = 1; } else { - sp = (uint8_t*)_buf + (nelmts-1) * + sp = (uint8_t*)_buf + (nelmts - 1) * (buf_stride ? buf_stride : src->shared->size); - dp = (uint8_t*)_buf + (nelmts-1) * + dp = (uint8_t*)_buf + (nelmts - 1) * (buf_stride ? buf_stride : dst->shared->size); direction = -1; } @@ -3054,24 +3047,24 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, dst_delta = direction * (buf_stride ? buf_stride : dst->shared->size); /* Set up conversion path for base elements */ - if (NULL==(tpath=H5T_path_find(src->shared->parent, dst->shared->parent, NULL, NULL, dxpl_id, FALSE))) { - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes"); + if(NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent, NULL, NULL, dxpl_id, FALSE))) { + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes") } else if (!H5T_path_noop(tpath)) { - if ((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->shared->parent, H5T_COPY_ALL)))<0 || - (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->shared->parent, H5T_COPY_ALL)))<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); + if((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->shared->parent, H5T_COPY_ALL))) < 0 || + (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->shared->parent, H5T_COPY_ALL))) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") } /* Check if we need a background buffer for this conversion */ if(tpath->cdata.need_bkg) { /* Allocate background buffer */ - bkg_buf_size=src->shared->u.array.nelem*MAX(src->shared->size,dst->shared->size); - if ((bkg_buf=H5FL_BLK_CALLOC(array_seq,bkg_buf_size))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); + bkg_buf_size = src->shared->u.array.nelem * MAX(src->shared->size, dst->shared->size); + if((bkg_buf = H5FL_BLK_CALLOC(array_seq, bkg_buf_size)) == NULL) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ /* Perform the actual conversion */ - for (elmtno=0; elmtnoshared->size); @@ -3082,16 +3075,16 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Advance the source & destination pointers */ sp += src_delta; dp += dst_delta; - } + } /* end for */ /* Release the background buffer, if we have one */ - if(bkg_buf!=NULL) - H5FL_BLK_FREE(array_seq,bkg_buf); + if(bkg_buf != NULL) + H5FL_BLK_FREE(array_seq, bkg_buf); /* Release the temporary datatype IDs used */ - if (tsrc_id >= 0) + if(tsrc_id >= 0) H5I_dec_ref(tsrc_id); - if (tdst_id >= 0) + if(tdst_id >= 0) H5I_dec_ref(tdst_id); break; @@ -3100,7 +3093,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_conv_array() */ diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 56694c2..fb525dc 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -167,10 +167,10 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig assert(dtype); - if((h5_class = H5T_get_class(dtype, FALSE))==H5T_NO_CLASS) + if((h5_class = H5T_get_class(dtype, FALSE)) == H5T_NO_CLASS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class") - if((size = H5T_get_size(dtype))==0) + if((size = H5T_get_size(dtype)) == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid size") switch(h5_class) { @@ -336,9 +336,9 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Don't need to do anything special for alignment, offset since the ENUM type usually is integer. */ - /* Retrieve base type for enumarate type */ + /* Retrieve base type for enumerated type */ if((super_type=H5T_get_super(dtype))==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumarate type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumerate type") if((nat_super_type = H5T_get_native_type(super_type, direction, struct_align, offset, comp_size))==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed") @@ -359,7 +359,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Retrieve member info and insert members into new enum type */ if((snmemb = H5T_get_nmembers(dtype))<=0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumarate data type doesn't have any member") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumerate data type doesn't have any member") H5_ASSIGN_OVERFLOW(nmemb,snmemb,int,unsigned); for(i=0; i=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_create(H5T_STD_REF_OBJ, rank, dims, NULL)) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(atom_arr_id,H5T_ARRAY)!=TRUE) TEST_ERROR @@ -687,7 +699,7 @@ test_compound_2(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt=H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL); + array_dt = H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL); 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 || @@ -697,7 +709,7 @@ test_compound_2(void) goto error; H5Tclose(array_dt); - array_dt=H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL); + array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); 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 || @@ -804,7 +816,7 @@ test_compound_3(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); + array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); 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 || @@ -814,7 +826,7 @@ test_compound_3(void) goto error; H5Tclose(array_dt); - array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); + array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); 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 || @@ -922,7 +934,7 @@ test_compound_4(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); + array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); 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 || @@ -932,7 +944,7 @@ test_compound_4(void) goto error; H5Tclose(array_dt); - array_dt=H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); + array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); 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 || @@ -1040,12 +1052,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_create(H5T_NATIVE_SHORT, 1, dims, NULL); 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_create(H5T_NATIVE_INT, 1, dims, NULL); H5Tinsert(int_array, "_", 0, array_dt); H5Tclose(array_dt); @@ -1794,7 +1806,7 @@ test_compound_10(void) } /* end if */ /* Create the array data type for c_string data */ - if((arr_tid = H5Tarray_create(cmpd_tid,1,arr_dim, NULL))<0) { + if((arr_tid = H5Tarray_create(cmpd_tid, 1, arr_dim, NULL)) < 0) { H5_FAILED(); AT(); printf("Can't create array type\n"); goto error; diff --git a/test/flush1.c b/test/flush1.c index 9adf06d..50601fe 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -49,7 +49,8 @@ static double the_data[100][100]; * *------------------------------------------------------------------------- */ -hid_t create_file(char* name, hid_t fapl) +static hid_t +create_file(char* name, hid_t fapl) { hid_t file, dcpl, space, dset, groups, grp; hsize_t ds_size[2] = {100, 100}; diff --git a/test/flush2.c b/test/flush2.c index 0156961..6c6ad85 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -47,7 +47,8 @@ static double the_data[100][100]; * *------------------------------------------------------------------------- */ -int check_dset(hid_t file, const char* name) +static int +check_dset(hid_t file, const char* name) { hid_t space, dset; hsize_t ds_size[2] = {100, 100}; @@ -103,7 +104,8 @@ error: * *------------------------------------------------------------------------- */ -int check_file(char* filename, hid_t fapl, int flag) +static int +check_file(char* filename, hid_t fapl, int flag) { hid_t file, groups, grp; char name[1024]; diff --git a/test/ntypes.c b/test/ntypes.c index 881d34b..f491b55 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -752,7 +752,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_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ if((tid=H5Tcreate(H5T_COMPOUND, 29))<0) TEST_ERROR; @@ -767,7 +767,7 @@ test_compound_dtype3(hid_t file) 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_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ if((tid_m=H5Tcreate(H5T_COMPOUND, sizeof(s1)))<0) TEST_ERROR; @@ -1275,7 +1275,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_create(tid2, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create the dataset */ if ((dataset = H5Dcreate(file, DSET_ARRAY_NAME, tid, space, @@ -1288,7 +1288,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_create(tid3, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Write the data to the dataset */ if (H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0) @@ -1403,14 +1403,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_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; /* Create the dataset */ if ((dataset = H5Dcreate(file, DSET_ARRAY2_NAME, tid, space, 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_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 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/reserved.c b/test/reserved.c index 0b64d3f..769cfb5 100755 --- a/test/reserved.c +++ b/test/reserved.c @@ -14,6 +14,7 @@ #include "h5test.h" +#ifdef BROKEN const char *FILENAME[] = { "rsrv_heap", "rsrv_ohdr", @@ -402,6 +403,7 @@ rsrv_vlen(void) } H5E_END_TRY return 1; } +#endif /* BROKEN */ /*------------------------------------------------------------------------- * Function: main @@ -422,14 +424,14 @@ rsrv_vlen(void) int main(void) { - int num_errs=0; - hid_t fapl; - const char *envval = NULL; - /* This test is currently not working properly; it should be revisted * when we have time. */ #ifdef BROKEN + int num_errs=0; + hid_t fapl; + const char *envval = NULL; + envval = HDgetenv("HDF5_DRIVER"); if (envval == NULL) envval = "nomatch"; @@ -451,7 +453,7 @@ main(void) { puts("All address space reservation tests skippped - Incompatible with current Virtual File Driver"); } -#endif +#endif /* BROKEN */ SKIPPED(); return 0; diff --git a/test/tarray.c b/test/tarray.c index 22fb02b..14dfcd8 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -92,7 +92,7 @@ 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); + tid1 = H5Tarray_create(H5T_NATIVE_INT, ARRAY1_RANK, tdims1, NULL); CHECK(tid1, FAIL, "H5Tarray_create"); /* Create a dataset */ @@ -137,7 +137,7 @@ test_array_atomic_1d(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid1,rdims1,NULL); + ret=H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -194,7 +194,7 @@ 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); + type = H5Tarray_create(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1, NULL); CHECK(type, FAIL, "H5Tarray_create"); size=H5Tget_precision(type); @@ -274,7 +274,7 @@ 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); + tid = H5Tarray_create(H5T_NATIVE_INT, ARRAY2_RANK, tdims2, NULL); CHECK(tid, FAIL, "H5Tarray_create"); /* Create a dataset */ @@ -319,7 +319,7 @@ test_array_atomic_3d(void) VERIFY(ndims,ARRAY2_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid,rdims2,NULL); + ret = H5Tget_array_dims(tid, rdims2, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -406,11 +406,11 @@ 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); + tid2 = H5Tarray_create(H5T_NATIVE_INT, ARRAY3_RANK, tdims2, NULL); CHECK(tid2, FAIL, "H5Tarray_create"); /* Create a 1-D datatype to refer to */ - tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); + tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); CHECK(tid1, FAIL, "H5Tarray_create"); /* Create a dataset */ @@ -453,11 +453,11 @@ test_array_array_atomic(void) CHECK(tid1, FAIL, "H5Dget_type"); /* Check the 1-D array rank */ - ndims1=H5Tget_array_ndims(tid1); + ndims1 = H5Tget_array_ndims(tid1); VERIFY(ndims1,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the 1-D array dimensions */ - ret=H5Tget_array_dims(tid1,rdims1,NULL); + ret = H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -476,7 +476,7 @@ 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); + ret = H5Tget_array_dims(tid2, rdims2, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -582,7 +582,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Tinsert"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); + tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); CHECK(tid1, FAIL, "H5Tarray_create"); /* Close compound datatype */ @@ -631,7 +631,7 @@ test_array_compound_atomic(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid1,rdims1,NULL); + ret = H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -784,7 +784,7 @@ 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); + tid3 = H5Tarray_create(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1, NULL); CHECK(tid3, FAIL, "H5Tarray_create"); /* Insert float array field */ @@ -796,7 +796,7 @@ test_array_compound_array(void) CHECK(ret, FAIL, "H5Tclose"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); + tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); CHECK(tid1, FAIL, "H5Tarray_create"); /* Close compound datatype */ @@ -845,7 +845,7 @@ test_array_compound_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid1,rdims1,NULL); + ret = H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -906,7 +906,7 @@ test_array_compound_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(mtid,rdims1,NULL); + ret = H5Tget_array_dims(mtid, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -1079,7 +1079,7 @@ test_array_vlen_atomic(void) CHECK(tid2, FAIL, "H5Tcreate"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); + tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); CHECK(tid1, FAIL, "H5Tarray_create"); /* Close VL datatype */ @@ -1132,7 +1132,7 @@ test_array_vlen_atomic(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid1,rdims1,NULL); + ret = H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -1287,7 +1287,7 @@ 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); + tid3 = H5Tarray_create(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1, NULL); CHECK(tid3, FAIL, "H5Tcreate"); /* Create a VL datatype of 1-D arrays to refer to */ @@ -1299,7 +1299,7 @@ test_array_vlen_array(void) CHECK(ret, FAIL, "H5Tclose"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); + tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); CHECK(tid1, FAIL, "H5Tarray_create"); /* Close VL datatype */ @@ -1352,7 +1352,7 @@ test_array_vlen_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid1,rdims1,NULL); + ret = H5Tget_array_dims(tid1, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -1383,7 +1383,7 @@ test_array_vlen_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(tid3,rdims1,NULL); + ret = H5Tget_array_dims(tid3, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -1522,7 +1522,7 @@ test_array_bkg(void) hsize_t dima[] = {ALEN}; int i, j; - int ndims[3] = {1,1,1}; + unsigned ndims[3] = {1,1,1}; typedef struct { @@ -1606,7 +1606,7 @@ test_array_bkg(void) /* -------------------------------------- */ for ( i = 0; i < dtsinfo.nsubfields; i++) { - array_dt = H5Tarray_create (dtsinfo.datatype[i], ndims[i], dima, NULL); + array_dt = H5Tarray_create(dtsinfo.datatype[i], ndims[i], dima, NULL); CHECK(array_dt, FAIL, "H5Tarray_create"); status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt); @@ -1683,7 +1683,7 @@ 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); + array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dima, NULL); CHECK(array_dt, FAIL, "H5Tarray_create"); status = H5Tinsert (type, "Two", HOFFSET(fld_t, b), array_dt); @@ -2005,7 +2005,7 @@ test_compat(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(mtid,rdims1,NULL); + ret = H5Tget_array_dims(mtid, rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ @@ -2050,7 +2050,7 @@ test_compat(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret=H5Tget_array_dims(mtid,rdims1,NULL); + ret = H5Tget_array_dims(mtid,rdims1, NULL); CHECK(ret, FAIL, "H5Tget_array_dims"); /* Check the array dimensions */ diff --git a/test/th5o.c b/test/th5o.c index fde15c7..019dda2 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -46,7 +46,7 @@ test_h5o_open(void) hid_t grp, dset, dtype, dspace; /* Object identifiers */ hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - hsize_t num_objs=-1; /* Number of objects in the group */ + hsize_t num_objs = 0; /* Number of objects in the group */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ @@ -248,7 +248,7 @@ test_h5o_open_by_addr(void) haddr_t dtype_addr; hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - hsize_t num_objs=-1; /* Number of objects in the group */ + hsize_t num_objs = 0; /* Number of objects in the group */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ diff --git a/test/th5s.c b/test/th5s.c index 1d1b1dd..9fbe35f 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -544,8 +544,6 @@ test_h5s_encode(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Dataspace Encoding and Decoding\n")); - H5open(); - /*------------------------------------------------------------------------- * Test encoding and decoding of simple dataspace and hyperslab selection. *------------------------------------------------------------------------- diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index ac2fb65..1f78b68 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -675,7 +675,7 @@ void write_dset_in(hid_t loc_id, } } - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,1,dims,"array",tid,buf6); status = H5Tclose(tid); @@ -824,7 +824,7 @@ void write_dset_in(hid_t loc_id, } - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,2,dims2,"array2D",tid,buf62); status = H5Tclose(tid); @@ -1008,7 +1008,7 @@ void write_dset_in(hid_t loc_id, } } - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,3,dims3,"array3D",tid,buf63); status = H5Tclose(tid); @@ -1334,7 +1334,7 @@ position array of array of difference [ 1 ] 5 0 5 [ 1 ] 6 0 6 */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_attr(loc_id,1,dims,"array",tid,buf6); status = H5Tclose(tid); @@ -1613,7 +1613,7 @@ position array2D of array2D of difference [ 2 1 ] 17 0 17 [ 2 1 ] 18 0 18 */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_attr(loc_id,2,dims2,"array2D",tid,buf62); status = H5Tclose(tid); @@ -2001,7 +2001,7 @@ etc etc */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_attr(loc_id,3,dims3,"array3D",tid,buf63); status = H5Tclose(tid); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 979ddc9..fdee5d1 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -686,7 +686,6 @@ print_datatype(hid_t type,unsigned in_group) char *fname; hid_t mtype, str_type; unsigned nmembers; - int perm[H5DUMP_MAX_RANK]; unsigned ndims; unsigned i; size_t size=0; @@ -1062,7 +1061,7 @@ done: /* Get array information */ ndims = H5Tget_array_ndims(type); - H5Tget_array_dims(type, dims, perm); + H5Tget_array_dims(type, dims, NULL); /* Print array dimensions */ for (i = 0; i < ndims; i++) @@ -2100,7 +2099,7 @@ dump_subsetting_header(struct subset_t *sset, int dims) *------------------------------------------------------------------------- */ static void -dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_ai) +dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) { h5tool_format_t *outputformat = &dataformat; int status = -1; @@ -2115,7 +2114,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_ai) outputformat->line_ncols = nCols; outputformat->do_escape=display_escape; /* print the matrix indices */ - outputformat->pindex=display_ai; + outputformat->pindex=display_index; if (outputformat->pindex) { outputformat->idx_fmt = "(%s): "; outputformat->idx_n_fmt = "%lu"; @@ -4282,7 +4281,6 @@ xml_print_datatype(hid_t type, unsigned in_group) char *fname; hid_t mtype; unsigned nmembers; - int perm[H5DUMP_MAX_RANK]; unsigned ndims; unsigned i; size_t size; @@ -4608,24 +4606,15 @@ xml_print_datatype(hid_t type, unsigned in_group) printf("%u\">\n", ndims); /* Get array information */ - H5Tget_array_dims(type, dims, perm); + H5Tget_array_dims(type, dims, NULL); /* list of dimensions */ indent += COL; - if (perm != NULL) { - /* for each dimension, list */ - for (i = 0; i < ndims; i++) { - indentation(indent); - printf("<%sArrayDimension DimSize=\"%u\" DimPerm=\"%u\"/>\n", - xmlnsprefix,(int) dims[i], (int) perm[i]); - } - } else { - for (i = 0; i < ndims; i++) { - indentation(indent); - printf("<%sArrayDimension DimSize=\"%u\" DimPerm=\"0\"/>\n", - xmlnsprefix, - (int) dims[i]); - } + for (i = 0; i < ndims; i++) { + indentation(indent); + printf("<%sArrayDimension DimSize=\"%u\"/>\n", + xmlnsprefix, + (int) dims[i]); } indent -= COL; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 45142e3..e6454a8 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -548,7 +548,8 @@ static void gent_compound_dt(void) { /* test compound data type */ } dset5_t; dset5_t dset5[5]; - int i, j, k, l, ndims; + int i, j, k, l; + unsigned ndims; hsize_t dim[2]; hsize_t sdim = 5; @@ -612,21 +613,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_create(H5T_STD_I32BE, ndims, dim, NULL); 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_create(H5T_NATIVE_INT, ndims, dim, NULL); 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_create(H5T_IEEE_F32BE, ndims, dim, NULL); 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_create(H5T_NATIVE_FLOAT, ndims, dim, NULL); H5Tinsert(type2, "float_array", HOFFSET(dset3_t, b), array_dt); H5Tclose(array_dt); @@ -735,8 +736,8 @@ static void gent_compound_dt2(void) { /* test compound data type */ } dset5_t; dset5_t dset5[10]; - int i, ndims; - const int perm[2]={0,1}; + int i; + unsigned ndims; hsize_t dim[2]; hsize_t sdim, maxdim; @@ -819,12 +820,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,perm); + array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL); 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,perm); + array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL); H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt); H5Tclose(array_dt); @@ -1102,8 +1103,6 @@ static void gent_many(void) dset1_t dset1[6]; hsize_t dim[4]; - int idx[4] = {0,1,2,3}; /* normal indicies */ - const int perm[4] = {0,1,2,3}; /* the 0'th and the 3'rd indices are permuted */ herr_t ret; fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1121,29 +1120,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,perm); + array_dt = H5Tarray_create(H5T_STD_I32BE, 4, dim, NULL); H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt); H5Tclose(array_dt); - array_dt=H5Tarray_create(H5T_IEEE_F64BE,4,dim,perm); + array_dt = H5Tarray_create(H5T_IEEE_F64BE, 4, dim, NULL); H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt); H5Tclose(array_dt); - array_dt=H5Tarray_create(H5T_IEEE_F64BE,4,dim,perm); + array_dt = H5Tarray_create(H5T_IEEE_F64BE, 4, dim, NULL); 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,perm); + array_dt = H5Tarray_create(H5T_NATIVE_INT, 4, dim, NULL); H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt); H5Tclose(array_dt); - array_dt=H5Tarray_create(H5T_NATIVE_DOUBLE,4,dim,perm); + array_dt = H5Tarray_create(H5T_NATIVE_DOUBLE,4,dim, NULL); H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt); H5Tclose(array_dt); - array_dt=H5Tarray_create(H5T_NATIVE_DOUBLE,4,dim,perm); + array_dt = H5Tarray_create(H5T_NATIVE_DOUBLE, 4, dim, NULL); H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt); H5Tclose(array_dt); @@ -1174,33 +1173,29 @@ static void gent_many(void) dims[0] = 10; space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate (dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT); - for (i = 0; i < 10; i++) d[i] = 0.1 * i; + for (i = 0; i < 10; i++) + d[i] = 0.1 * i; H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space2); H5Aclose(attr); - for (j=0; j<(int)sdim; j++) { - for (i3 = 0; i3 < 2; i3++) { - idx[perm[3]] = i3; - for (i2 = 0; i2 < 2; i2++) { - idx[perm[2]] = i2; - for (i1 = 0; i1 < 2; i1++) { - idx[perm[1]] = i1; - for (i0 = 0; i0 < 2; i0++) { - idx[perm[0]] = i0; - - dset1[j].a[idx[3]][idx[2]][idx[1]][idx[0]] = i0+j; - dset1[j].b[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j); + for (j=0; j<(int)sdim; j++) { + for (i3 = 0; i3 < 2; i3++) { + for (i2 = 0; i2 < 2; i2++) { + for (i1 = 0; i1 < 2; i1++) { + for (i0 = 0; i0 < 2; i0++) { + dset1[j].a[i3][i2][i1][i0] = i0+j; + dset1[j].b[i3][i2][i1][i0] = (double)(i0+j); #ifdef WIN32 - dset1[j].c[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j+(signed __int64)sdim); + dset1[j].c[i3][i2][i1][i0] = (double)(i0+j+(signed __int64)sdim); #else - dset1[j].c[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j+sdim); + dset1[j].c[i3][i2][i1][i0] = (double)(i0+j+sdim); #endif - } - } - } - } - } + } + } + } + } + } H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); @@ -1388,24 +1383,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_create(H5T_STD_I32BE, 2, mdims, NULL); 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_create(H5T_NATIVE_INT, 2, mdims, NULL); 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_create(str_type, 2, mdims, NULL); 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_create(str_type, 2, mdims, NULL); H5Tinsert(f_type2, "string", HOFFSET(compound_t, s), array_dt); H5Tclose(array_dt); H5Tclose(str_type); @@ -1859,7 +1854,7 @@ static void gent_nestcomp(void) hid_t char_id; /* Handle for the string datatype */ hid_t array_dt; hsize_t array_dims[] = {2}; /* Dataspace dimensions */ - int ndims = 1; /* Number of dimensions in the array field */ + unsigned ndims = 1; /* Number of dimensions in the array field */ s2_t s1[10]; hid_t s2_tid; /* File datatype identifier */ @@ -1907,7 +1902,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_create(H5T_NATIVE_FLOAT, ndims, array_dims, NULL); H5Tinsert(cmp_tid, "array_name", HOFFSET(cmp_t, b), array_dt); H5Tclose(array_dt); @@ -2416,7 +2411,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_create(H5T_NATIVE_INT, ARRAY1_RANK, tdims1, NULL); /* Create a dataset */ dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT); @@ -2462,7 +2457,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_create(H5T_NATIVE_INT, ARRAY2_RANK, tdims2, NULL); /* Create a dataset */ dataset=H5Dcreate(fid,"Dataset1",tid,sid,H5P_DEFAULT); @@ -2510,10 +2505,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_create(H5T_NATIVE_INT, ARRAY3_RANK, tdims2, NULL); /* Create a 1-D datatype to refer to */ - tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); + tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); /* Create a dataset */ dataset=H5Dcreate(fid,"Dataset1",tid1,sid,H5P_DEFAULT); @@ -2577,7 +2572,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_create(tid2, ARRAY1_RANK, tdims1, NULL); /* Close compound datatype */ ret=H5Tclose(tid2); @@ -2641,7 +2636,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_create(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1, NULL); /* Insert float array field */ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3); @@ -2652,7 +2647,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_create(tid2, ARRAY1_RANK, tdims1, NULL); /* Close compound datatype */ ret=H5Tclose(tid2); @@ -2708,7 +2703,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_create(tid2, ARRAY1_RANK, tdims1, NULL); /* Close VL datatype */ ret=H5Tclose(tid2); @@ -2767,7 +2762,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_create(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1, NULL); /* Create a VL datatype of 1-D arrays to refer to */ tid2 = H5Tvlen_create(tid3); @@ -2777,7 +2772,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_create(tid2, ARRAY1_RANK, tdims1, NULL); /* Close VL datatype */ ret=H5Tclose(tid2); @@ -2842,7 +2837,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_create(H5T_NATIVE_INT, SPACE1_RANK, dims, NULL); dset = H5Dcreate(file, "Dataset4.0", type, space, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); @@ -3326,7 +3321,7 @@ static void write_attr_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_attr(loc_id,1,dims,"array",tid,buf6); status = H5Tclose(tid); @@ -3436,7 +3431,7 @@ static void write_attr_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_attr(loc_id,2,dims2,"array2D",tid,buf62); status = H5Tclose(tid); @@ -3575,7 +3570,7 @@ static void write_attr_in(hid_t loc_id, } } - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_attr(loc_id,3,dims3,"array3D",tid,buf63); status = H5Tclose(tid); @@ -3768,7 +3763,7 @@ static void write_dset_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,1,dims,"array",tid,buf6); status = H5Tclose(tid); @@ -3878,7 +3873,7 @@ static void write_dset_in(hid_t loc_id, * H5T_ARRAY *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,2,dims2,"array2D",tid,buf62); status = H5Tclose(tid); @@ -4030,7 +4025,7 @@ static void write_dset_in(hid_t loc_id, } } - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,3,dims3,"array3D",tid,buf63); status = H5Tclose(tid); @@ -4289,8 +4284,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_create(array_tid, F41_ARRAY_RANK, array_dimb, NULL); assert (str_array_id >= 0); /* Copy the array data type for the character array */ @@ -4302,13 +4296,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_create(H5T_NATIVE_SHORT, F41_ARRAY_RANKd, array_dimd, NULL); 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_create(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK, array_dimf, NULL); assert (array4_tid >= 0); /* Create the memory data type */ @@ -5232,7 +5224,7 @@ static void gent_fvalues(void) * dataset with a H5T_ARRAY fill value *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(fid,1,dims,"fill_array",tid,buf4); ret = H5Tclose(tid); @@ -5568,7 +5560,8 @@ error: * *------------------------------------------------------------------------- */ -static void gent_binary() +static void +gent_binary(void) { hid_t fid, sid, did, tid; hsize_t dims[1] = {6}; @@ -5606,7 +5599,7 @@ static void gent_binary() * array *------------------------------------------------------------------------- */ - tid = H5Tarray_create(H5T_NATIVE_INT,1,dims,NULL); + tid = H5Tarray_create(H5T_NATIVE_INT, 1, dims, NULL); sid = H5Screate_simple(1, dimarray, NULL); did = H5Dcreate(fid, "array", tid, sid, 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 978baf2..04a9371 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1057,34 +1057,21 @@ static hbool_t display_array_type(hid_t type, int ind) { hid_t super; - int ndims, i, *perm=NULL, identity; + int ndims, i; hsize_t *dims=NULL; if (H5T_ARRAY!=H5Tget_class(type)) return FALSE; ndims = H5Tget_array_ndims(type); if (ndims) { dims = malloc(ndims*sizeof(dims[0])); - perm = malloc(ndims*sizeof(perm[0])); - H5Tget_array_dims(type, dims, perm); + H5Tget_array_dims(type, dims, NULL); /* Print dimensions */ for (i=0; iobjs[i].name,rank,dims,dcpl_out,mtype_id,options)<0) + if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options)<0) goto error; } diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 75ca771..60a0336 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -190,7 +190,6 @@ int apply_filters(const char* name, /* object name from traverse list */ int rank, /* rank of dataset */ hsize_t *dims, /* dimensions of dataset */ hid_t dcpl_id, /* dataset creation property list */ - hid_t type_id, /* dataset datatype */ pack_opt_t *options) /* repack options */ { int nfilters; /* number of filters in DCPL */ diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 32cbc24..9912732 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -36,9 +36,7 @@ extern char *progname; *------------------------------------------------------------------------- */ int check_objects(const char* fname, - pack_opt_t *options, - int argc, - const char *argv[]) + pack_opt_t *options) { hid_t fid; int i; diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 92433f9..074f937 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -120,7 +120,7 @@ int main(int argc, char **argv) } /* pack it */ - ret=h5repack(infile,outfile,&options,argc,argv); + ret=h5repack(infile,outfile,&options); /* free tables */ h5repack_end(&options); diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c index 7635cf2..5064aa1 100644 --- a/tools/h5repack/testh5repack_attr.c +++ b/tools/h5repack/testh5repack_attr.c @@ -319,7 +319,7 @@ position array of array of difference [ 1 ] 5 0 5 [ 1 ] 6 0 6 */ - type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); make_attr(loc_id,1,dims,"array",type_id,buf6); status = H5Tclose(type_id); @@ -598,7 +598,7 @@ position array2D of array2D of difference [ 2 1 ] 17 0 17 [ 2 1 ] 18 0 18 */ - type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); make_attr(loc_id,2,dims2,"array2D",type_id,buf62); status = H5Tclose(type_id); @@ -986,7 +986,7 @@ etc etc */ - type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); make_attr(loc_id,3,dims3,"array3D",type_id,buf63); status = H5Tclose(type_id); diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index 244aaae..0e6fbc2 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -255,7 +255,7 @@ void write_dset_in(hid_t loc_id, } } - type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,1,dims,"array",type_id,buf6); status = H5Tclose(type_id); @@ -404,7 +404,7 @@ void write_dset_in(hid_t loc_id, } - type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,2,dims2,"array2D",type_id,buf62); status = H5Tclose(type_id); @@ -587,7 +587,7 @@ void write_dset_in(hid_t loc_id, } } - type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); + type_id = H5Tarray_create(H5T_NATIVE_INT, 1, dimarray, NULL); write_dset(loc_id,3,dims3,"array3D",type_id,buf63); status = H5Tclose(type_id); diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index e219497..9ecef36 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -69,7 +69,7 @@ int main (int argc, const char *argv[]) TESTING(" copy of datasets (fill values)"); if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME0,FNAME0OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME0,FNAME0OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -90,7 +90,7 @@ int main (int argc, const char *argv[]) TESTING(" copy of datasets (all datatypes)"); if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME1,FNAME1OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -109,7 +109,7 @@ int main (int argc, const char *argv[]) TESTING(" copy of datasets (attributes)"); if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME2,FNAME2OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME2,FNAME2OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -129,7 +129,7 @@ int main (int argc, const char *argv[]) TESTING(" copy of datasets (hardlinks)"); if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME3,FNAME3OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME3,FNAME3OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -149,7 +149,7 @@ int main (int argc, const char *argv[]) TESTING(" copy of allocation early file"); if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME5,FNAME5OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME5,FNAME5OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -183,7 +183,7 @@ int main (int argc, const char *argv[]) TEST_ERROR; if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -211,7 +211,7 @@ int main (int argc, const char *argv[]) TEST_ERROR; if (h5repack_addlayout("CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -249,7 +249,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset2:CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -279,7 +279,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("SZIP=8,NN",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -312,7 +312,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -341,7 +341,7 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; if (h5repack_addlayout("CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -372,7 +372,7 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -402,7 +402,7 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; if (h5repack_addlayout("CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -451,7 +451,7 @@ if (szip_can_encode) { TEST_ERROR; #endif - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -474,7 +474,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -494,7 +494,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("CHUNK=20x10",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -515,7 +515,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset1:CONTI",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -536,7 +536,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("CONTI",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -558,7 +558,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset1:COMPA",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -579,7 +579,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("COMPA",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -601,7 +601,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_compact:CONTI",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -621,7 +621,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -641,7 +641,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_compact:COMPA",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -660,7 +660,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -679,7 +679,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -699,7 +699,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -718,7 +718,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_chunk:COMPA",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -738,7 +738,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_chunk:CONTI",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -757,7 +757,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME4,FNAME4OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -785,7 +785,7 @@ if (szip_can_encode) { if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME7,FNAME7OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -810,7 +810,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_szip:NONE",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME7,FNAME7OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -833,7 +833,7 @@ if (szip_can_encode) { #ifdef H5_HAVE_FILTER_DEFLATE if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -855,7 +855,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_deflate:NONE",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME8,FNAME8OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -876,7 +876,7 @@ if (szip_can_encode) { #ifdef H5_HAVE_FILTER_SHUFFLE if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME9,FNAME9OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -897,7 +897,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_shuffle:NONE",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME9,FNAME9OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -916,7 +916,7 @@ if (szip_can_encode) { #ifdef H5_HAVE_FILTER_FLETCHER32 if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME10,FNAME10OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -937,7 +937,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME10,FNAME10OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -957,7 +957,7 @@ if (szip_can_encode) { #ifdef H5_HAVE_FILTER_NBIT if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -978,7 +978,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_nbit:NONE",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -999,7 +999,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_int31:NBIT",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME12,FNAME12OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -1017,7 +1017,7 @@ if (szip_can_encode) { #ifdef H5_HAVE_FILTER_SCALEOFFSET if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -1038,7 +1038,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -1060,7 +1060,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME13,FNAME13OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -1096,7 +1096,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -1124,7 +1124,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; @@ -1156,7 +1156,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_addfilter("NONE",&pack_options)<0) TEST_ERROR; - if (h5repack(FNAME11,FNAME11OUT,&pack_options,argc,argv)<0) + if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0) TEST_ERROR; if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 62975d9..9929b05 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -1915,15 +1915,18 @@ hsize_t diff_region(hid_t obj1_id, for (i = 0; i < npoints1; i++) { hsize_t pt1, pt2; - int diff=0; + int diff_data = 0; for (j = 0; j < ndims1; j++) { pt1 = ptdata1[i * ndims1 + j]; pt2 = ptdata2[i * ndims1 + j]; if (pt1 != pt2) - diff=1; + { + diff_data = 1; + break; + } } - if (diff) + if (diff_data) { parallel_print("point #%d", i); print_points(i, ptdata1, ndims1); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 013cecf..362b070 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1434,7 +1434,7 @@ int render_bin_output(FILE *stream, hid_t tid, void *_mem) } else { - s = mem; + s = (char *)mem; size = H5Tget_size(tid); } for (i=0; istr_locale == ESCAPE_HTML) { if (ch <= ' ' || ch > '~') h5tools_str_append(str, "%%%02x", ch); else - h5tools_str_append(str, "%c", (char)ch); + h5tools_str_append(str, "%c", ch); } else { switch (ch) { - case '"': - if (!info->do_escape) - h5tools_str_append(str, "\""); - else - h5tools_str_append(str, "\\\""); - break; - case '\\': - if (!info->do_escape) - h5tools_str_append(str, "\\"); - else - h5tools_str_append(str, "\\\\"); - break; - case '\b': - if (!info->do_escape) - h5tools_str_append(str, "\b"); - else - h5tools_str_append(str, "\\b"); - break; - case '\f': - if (!info->do_escape) - h5tools_str_append(str, "\f"); - else - h5tools_str_append(str, "\\f"); - break; - case '\n': - if (!info->do_escape) { - h5tools_str_append(str, "\n"); - h5tools_str_append(str, " "); - } - else - h5tools_str_append(str, "\\n"); - break; - case '\r': - if (!info->do_escape) { - h5tools_str_append(str, "\r"); - h5tools_str_append(str, " "); - } - else - h5tools_str_append(str, "\\r"); - break; - case '\t': - if (!info->do_escape) - h5tools_str_append(str, "\t"); - else - h5tools_str_append(str, "\\t"); - break; - default: - if (isprint(ch)) - h5tools_str_append(str, "%c", (char)ch); - else - h5tools_str_append(str, "\\%03o", ch); - - break; + case '"': + if (!info->do_escape) + h5tools_str_append(str, "\""); + else + h5tools_str_append(str, "\\\""); + break; + case '\\': + if (!info->do_escape) + h5tools_str_append(str, "\\"); + else + h5tools_str_append(str, "\\\\"); + break; + case '\b': + if (!info->do_escape) + h5tools_str_append(str, "\b"); + else + h5tools_str_append(str, "\\b"); + break; + case '\f': + if (!info->do_escape) + h5tools_str_append(str, "\f"); + else + h5tools_str_append(str, "\\f"); + break; + case '\n': + if (!info->do_escape) { + h5tools_str_append(str, "\n"); + h5tools_str_append(str, " "); + } + else + h5tools_str_append(str, "\\n"); + break; + case '\r': + if (!info->do_escape) { + h5tools_str_append(str, "\r"); + h5tools_str_append(str, " "); + } + else + h5tools_str_append(str, "\\r"); + break; + case '\t': + if (!info->do_escape) + h5tools_str_append(str, "\t"); + else + h5tools_str_append(str, "\\t"); + break; + default: + if (isprint(ch)) + h5tools_str_append(str, "%c", ch); + else + h5tools_str_append(str, "\\%03o", ch); + + break; } } } @@ -632,7 +633,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai #endif } else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) { - h5tools_print_char(str, info, (unsigned char)(*ucp_vp)); + h5tools_print_char(str, info, (char)(*ucp_vp)); } else if (H5T_STRING == H5Tget_class(type)) { unsigned int i; char quote = '\0'; @@ -686,7 +687,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* Print the character */ - h5tools_print_char(str, info, (unsigned char)(s[i])); + h5tools_print_char(str, info, s[i]); /* Print the repeat count */ if (info->str_repeat && j > info->str_repeat) { diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 19872a1..b2d1c37 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -35,7 +35,6 @@ extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *in hsize_t elmtno, int ndims, hsize_t min_idx[], hsize_t max_idx[], h5tools_context_t *ctx); extern int h5tools_str_dump_region(h5tools_str_t *, hid_t, const h5tool_format_t *); -extern void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, unsigned char ch); extern char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, hid_t type, void *vp, h5tools_context_t *ctx); diff --git a/tools/lib/talign.c b/tools/lib/talign.c index f8b5c87..80e83b4 100644 --- a/tools/lib/talign.c +++ b/tools/lib/talign.c @@ -36,154 +36,155 @@ const char *setname = "align"; int main(void) { - hid_t fil,spc,set; - hid_t cs6, cmp, fix; - hid_t cmp1, cmp2, cmp3; - hid_t plist; - hid_t array_dt; + hid_t fil,spc,set; + hid_t cs6, cmp, fix; + hid_t cmp1, cmp2, cmp3; + hid_t plist; + hid_t array_dt; - hsize_t dim[2]; - hsize_t cdim[4]; + hsize_t dim[2]; + hsize_t cdim[4]; - char string5[5]; - float fok[2] = {1234., 2341.}; - float fnok[2] = {5678., 6785.}; - float *fptr; + char string5[5]; + float fok[2] = {1234., 2341.}; + float fnok[2] = {5678., 6785.}; + float *fptr; - char *data; - char *mname; + char *data; + char *mname; - int result = 0; + int result = 0; - printf("%-70s", "Testing alignment in compound datatypes"); + printf("%-70s", "Testing alignment in compound datatypes"); - strcpy(string5, "Hi!"); - HDunlink(fname); - fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + strcpy(string5, "Hi!"); + HDunlink(fname); + fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fil < 0) { - puts("*FAILED*"); - return 1; - } + if (fil < 0) { + puts("*FAILED*"); + return 1; + } - H5E_BEGIN_TRY { - H5Gunlink(fil, setname); - } H5E_END_TRY; + H5E_BEGIN_TRY { + H5Gunlink(fil, setname); + } H5E_END_TRY; - cs6 = H5Tcopy(H5T_C_S1); - H5Tset_size(cs6, sizeof(string5)); - H5Tset_strpad(cs6, H5T_STR_NULLPAD); + cs6 = H5Tcopy(H5T_C_S1); + H5Tset_size(cs6, sizeof(string5)); + H5Tset_strpad(cs6, H5T_STR_NULLPAD); - cmp = H5Tcreate(H5T_COMPOUND, sizeof(fok) + sizeof(string5) + sizeof(fnok)); - H5Tinsert(cmp, "Awkward length", 0, cs6); + cmp = H5Tcreate(H5T_COMPOUND, sizeof(fok) + sizeof(string5) + sizeof(fnok)); + H5Tinsert(cmp, "Awkward length", 0, cs6); - cdim[0] = sizeof(fok) / sizeof(float); - array_dt=H5Tarray_create(H5T_NATIVE_FLOAT,1,cdim,NULL); - H5Tinsert(cmp, "Ok", sizeof(string5), array_dt); + cdim[0] = sizeof(fok) / sizeof(float); + array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + 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); - H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt); + cdim[0] = sizeof(fnok) / sizeof(float); + array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt); H5Tclose(array_dt); - fix=h5tools_get_native_type(cmp); + fix=h5tools_get_native_type(cmp); - cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok)); + cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok)); - cdim[0] = sizeof(fok) / sizeof(float); - array_dt=H5Tarray_create(H5T_NATIVE_FLOAT,1,cdim,NULL); - H5Tinsert(cmp1, "Ok", 0, array_dt); + cdim[0] = sizeof(fok) / sizeof(float); + array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + H5Tinsert(cmp1, "Ok", 0, array_dt); H5Tclose(array_dt); - cmp2 = H5Tcreate(H5T_COMPOUND, sizeof(string5)); - H5Tinsert(cmp2, "Awkward length", 0, cs6); + cmp2 = H5Tcreate(H5T_COMPOUND, sizeof(string5)); + H5Tinsert(cmp2, "Awkward length", 0, cs6); - cmp3 = H5Tcreate(H5T_COMPOUND, sizeof(fnok)); + cmp3 = H5Tcreate(H5T_COMPOUND, sizeof(fnok)); - cdim[0] = sizeof(fnok) / sizeof(float); - array_dt=H5Tarray_create(H5T_NATIVE_FLOAT,1,cdim,NULL); - H5Tinsert(cmp3, "Not Ok", 0, array_dt); + cdim[0] = sizeof(fnok) / sizeof(float); + array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, cdim, NULL); + H5Tinsert(cmp3, "Not Ok", 0, array_dt); H5Tclose(array_dt); - plist = H5Pcreate(H5P_DATASET_XFER); - H5Pset_preserve(plist, 1); - - /* - * Create a small dataset, and write data into it we write each field - * in turn so that we are avoid alignment issues at this point - */ - dim[0] = 1; - spc = H5Screate_simple(1, dim, NULL); - set = H5Dcreate(fil, setname, cmp, spc, H5P_DEFAULT); - - H5Dwrite(set, cmp1, spc, H5S_ALL, plist, fok); - H5Dwrite(set, cmp2, spc, H5S_ALL, plist, string5); - H5Dwrite(set, cmp3, spc, H5S_ALL, plist, fnok); - - H5Dclose(set); - - /* Now open the set, and read it back in */ - data = malloc(H5Tget_size(fix)); - - if (!data) { - perror("malloc() failed"); - abort(); - } - - set = H5Dopen(fil, setname); - - H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - - if (fok[0] != fptr[0] || fok[1] != fptr[1] - || fnok[0] != fptr[2] || fnok[1] != fptr[3]) { - result = 1; - printf("%14s (%2d) %6s = %s\n", - mname = H5Tget_member_name(fix, 0), (int)H5Tget_member_offset(fix,0), - string5, (char *)(data + H5Tget_member_offset(fix, 0))); - free(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - printf("Data comparison:\n" - "%14s (%2d) %6f = %f\n" - " %6f = %f\n", - mname = H5Tget_member_name(fix, 1), (int)H5Tget_member_offset(fix,1), - fok[0], fptr[0], - fok[1], fptr[1]); - free(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 2)); - printf("%14s (%2d) %6f = %f\n" - " %6f = %6f\n", - mname = H5Tget_member_name(fix, 2), (int)H5Tget_member_offset(fix,2), - fnok[0], fptr[0], - fnok[1], fptr[1]); - free(mname); - - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); - printf("\n" - "Short circuit\n" - " %6f = %f\n" - " %6f = %f\n" - " %6f = %f\n" - " %6f = %f\n", - fok[0], fptr[0], - fok[1], fptr[1], - fnok[0], fptr[2], - fnok[1], fptr[3]); - puts("*FAILED*"); - } else { - puts(" PASSED"); - } - - free(data); - H5Sclose(spc); - H5Tclose(cmp); - H5Tclose(cmp1); - H5Tclose(cmp2); - H5Tclose(cmp3); - H5Pclose(plist); - H5Fclose(fil); - unlink(fname); - fflush(stdout); - return result; + plist = H5Pcreate(H5P_DATASET_XFER); + H5Pset_preserve(plist, 1); + + /* + * Create a small dataset, and write data into it we write each field + * in turn so that we are avoid alignment issues at this point + */ + dim[0] = 1; + spc = H5Screate_simple(1, dim, NULL); + set = H5Dcreate(fil, setname, cmp, spc, H5P_DEFAULT); + + H5Dwrite(set, cmp1, spc, H5S_ALL, plist, fok); + H5Dwrite(set, cmp2, spc, H5S_ALL, plist, string5); + H5Dwrite(set, cmp3, spc, H5S_ALL, plist, fnok); + + H5Dclose(set); + + /* Now open the set, and read it back in */ + data = malloc(H5Tget_size(fix)); + + if (!data) { + perror("malloc() failed"); + abort(); + } + + set = H5Dopen(fil, setname); + + H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); + fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + + if (fok[0] != fptr[0] || fok[1] != fptr[1] + || fnok[0] != fptr[2] || fnok[1] != fptr[3]) { + result = 1; + printf("%14s (%2d) %6s = %s\n", + mname = H5Tget_member_name(fix, 0), (int)H5Tget_member_offset(fix,0), + string5, (char *)(data + H5Tget_member_offset(fix, 0))); + free(mname); + fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + printf("Data comparison:\n" + "%14s (%2d) %6f = %f\n" + " %6f = %f\n", + mname = H5Tget_member_name(fix, 1), (int)H5Tget_member_offset(fix,1), + fok[0], fptr[0], + fok[1], fptr[1]); + free(mname); + fptr = (float *)(data + H5Tget_member_offset(fix, 2)); + printf("%14s (%2d) %6f = %f\n" + " %6f = %6f\n", + mname = H5Tget_member_name(fix, 2), (int)H5Tget_member_offset(fix,2), + fnok[0], fptr[0], + fnok[1], fptr[1]); + free(mname); + + fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + printf("\n" + "Short circuit\n" + " %6f = %f\n" + " %6f = %f\n" + " %6f = %f\n" + " %6f = %f\n", + fok[0], fptr[0], + fok[1], fptr[1], + fnok[0], fptr[2], + fnok[1], fptr[3]); + puts("*FAILED*"); + } else { + puts(" PASSED"); + } + + free(data); + H5Sclose(spc); + H5Tclose(cmp); + H5Tclose(cmp1); + H5Tclose(cmp2); + H5Tclose(cmp3); + H5Pclose(plist); + H5Fclose(fil); + unlink(fname); + fflush(stdout); + return result; } + diff --git a/tools/misc/h5stat.c b/tools/misc/h5stat.c index 7d4045e..4577fe9 100644 --- a/tools/misc/h5stat.c +++ b/tools/misc/h5stat.c @@ -12,7 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include #include #include "H5private.h" /* Generic Functions */ @@ -99,7 +98,9 @@ static int display_group = FALSE; static int display_dset_metadata = FALSE; static int display_dset = FALSE; static int display_dtype_metadata = FALSE; +#ifdef NOT_YET static int display_dtype = FALSE; +#endif /* NOT_YET */ static const char *s_opts ="FfhGgDdTV"; static struct long_options l_opts[] = { diff --git a/tools/testfiles/tarray1.h5.xml b/tools/testfiles/tarray1.h5.xml index 95e922e..b4d17ca 100644 --- a/tools/testfiles/tarray1.h5.xml +++ b/tools/testfiles/tarray1.h5.xml @@ -20,7 +20,7 @@ Expected output for 'h5dump --xml tarray1.h5' - + diff --git a/tools/testfiles/tarray2.h5.xml b/tools/testfiles/tarray2.h5.xml index 15bb8c6..ac5fe50 100644 --- a/tools/testfiles/tarray2.h5.xml +++ b/tools/testfiles/tarray2.h5.xml @@ -20,9 +20,9 @@ Expected output for 'h5dump --xml tarray2.h5' - - - + + + diff --git a/tools/testfiles/tarray3.h5.xml b/tools/testfiles/tarray3.h5.xml index 42ec1ad..d496a46 100644 --- a/tools/testfiles/tarray3.h5.xml +++ b/tools/testfiles/tarray3.h5.xml @@ -20,11 +20,11 @@ Expected output for 'h5dump --xml tarray3.h5' - + - - + + diff --git a/tools/testfiles/tarray6.h5.xml b/tools/testfiles/tarray6.h5.xml index ffbd849..cb9b853 100644 --- a/tools/testfiles/tarray6.h5.xml +++ b/tools/testfiles/tarray6.h5.xml @@ -20,7 +20,7 @@ Expected output for 'h5dump --xml tarray6.h5' - + diff --git a/tools/testfiles/tarray7.h5.xml b/tools/testfiles/tarray7.h5.xml index 8b0123f..f9c6611 100644 --- a/tools/testfiles/tarray7.h5.xml +++ b/tools/testfiles/tarray7.h5.xml @@ -20,12 +20,12 @@ Expected output for 'h5dump --xml tarray7.h5' - + - + diff --git a/tools/testfiles/tcompound.h5.xml b/tools/testfiles/tcompound.h5.xml index e2e43e2..698b3a4 100644 --- a/tools/testfiles/tcompound.h5.xml +++ b/tools/testfiles/tcompound.h5.xml @@ -50,7 +50,7 @@ Expected output for 'h5dump --xml tcompound.h5' - + @@ -62,8 +62,8 @@ Expected output for 'h5dump --xml tcompound.h5' - - + + diff --git a/tools/testfiles/tcompound2.h5.xml b/tools/testfiles/tcompound2.h5.xml index b6d5800..0abfc55 100644 --- a/tools/testfiles/tcompound2.h5.xml +++ b/tools/testfiles/tcompound2.h5.xml @@ -50,7 +50,7 @@ Expected output for 'h5dump --xml tcompound2.h5' - + @@ -62,8 +62,8 @@ Expected output for 'h5dump --xml tcompound2.h5' - - + + diff --git a/tools/testfiles/tcompound_complex.h5.xml b/tools/testfiles/tcompound_complex.h5.xml index e745046..8300deb 100644 --- a/tools/testfiles/tcompound_complex.h5.xml +++ b/tools/testfiles/tcompound_complex.h5.xml @@ -33,7 +33,7 @@ Expected output for 'h5dump --xml tcompound_complex.h5' - + @@ -52,8 +52,8 @@ Expected output for 'h5dump --xml tcompound_complex.h5' - - + + @@ -72,7 +72,7 @@ Expected output for 'h5dump --xml tcompound_complex.h5' - + diff --git a/tools/testfiles/tempty-dtd-2.h5.xml b/tools/testfiles/tempty-dtd-2.h5.xml index a5a9128..0b89823 100644 --- a/tools/testfiles/tempty-dtd-2.h5.xml +++ b/tools/testfiles/tempty-dtd-2.h5.xml @@ -101,7 +101,7 @@ Expected output for 'h5dump --xml -u tempty.h5' - + diff --git a/tools/testfiles/tempty-dtd-uri.h5.xml b/tools/testfiles/tempty-dtd-uri.h5.xml index 6b2c4bc..29c63bd 100644 --- a/tools/testfiles/tempty-dtd-uri.h5.xml +++ b/tools/testfiles/tempty-dtd-uri.h5.xml @@ -101,7 +101,7 @@ Expected output for 'h5dump --xml --use-dtd --xml-dtd=http://somewhere.net tempt - + diff --git a/tools/testfiles/tempty-dtd.h5.xml b/tools/testfiles/tempty-dtd.h5.xml index 7d20d8d..aa1fa36 100644 --- a/tools/testfiles/tempty-dtd.h5.xml +++ b/tools/testfiles/tempty-dtd.h5.xml @@ -101,7 +101,7 @@ Expected output for 'h5dump --xml --use-dtd tempty.h5' - + diff --git a/tools/testfiles/tempty-nons-2.h5.xml b/tools/testfiles/tempty-nons-2.h5.xml index 31c35fb..528c4d3 100644 --- a/tools/testfiles/tempty-nons-2.h5.xml +++ b/tools/testfiles/tempty-nons-2.h5.xml @@ -100,7 +100,7 @@ Expected output for 'h5dump --xml --xml-ns=: tempty.h5' - + diff --git a/tools/testfiles/tempty-nons-uri.h5.xml b/tools/testfiles/tempty-nons-uri.h5.xml index 8484406..05471e1 100644 --- a/tools/testfiles/tempty-nons-uri.h5.xml +++ b/tools/testfiles/tempty-nons-uri.h5.xml @@ -100,7 +100,7 @@ Expected output for 'h5dump --xml --xml-ns=: --xml-dtd=http://somewhere.net temp - + diff --git a/tools/testfiles/tempty-nons.h5.xml b/tools/testfiles/tempty-nons.h5.xml index e4efee8..64fe60a 100644 --- a/tools/testfiles/tempty-nons.h5.xml +++ b/tools/testfiles/tempty-nons.h5.xml @@ -100,7 +100,7 @@ Expected output for 'h5dump --xml -X : tempty.h5' - + diff --git a/tools/testfiles/tempty-ns-2.h5.xml b/tools/testfiles/tempty-ns-2.h5.xml index 1523fbc..0c7d153 100644 --- a/tools/testfiles/tempty-ns-2.h5.xml +++ b/tools/testfiles/tempty-ns-2.h5.xml @@ -100,7 +100,7 @@ Expected output for 'h5dump --xml --xml-ns=thing: tempty.h5' - + diff --git a/tools/testfiles/tempty-ns.h5.xml b/tools/testfiles/tempty-ns.h5.xml index ec8ca91..200c60a 100644 --- a/tools/testfiles/tempty-ns.h5.xml +++ b/tools/testfiles/tempty-ns.h5.xml @@ -100,7 +100,7 @@ Expected output for 'h5dump --xml -X thing: tempty.h5' - + diff --git a/tools/testfiles/tempty.h5.xml b/tools/testfiles/tempty.h5.xml index 1c7f589..703c395 100644 --- a/tools/testfiles/tempty.h5.xml +++ b/tools/testfiles/tempty.h5.xml @@ -100,7 +100,7 @@ Expected output for 'h5dump --xml tempty.h5' - + diff --git a/tools/testfiles/tmany.h5.xml b/tools/testfiles/tmany.h5.xml index 3bf1021..87f2c15 100644 --- a/tools/testfiles/tmany.h5.xml +++ b/tools/testfiles/tmany.h5.xml @@ -29,10 +29,10 @@ Expected output for 'h5dump --xml tmany.h5' - - - - + + + + @@ -44,10 +44,10 @@ Expected output for 'h5dump --xml tmany.h5' - - - - + + + + @@ -59,10 +59,10 @@ Expected output for 'h5dump --xml tmany.h5' - - - - + + + + diff --git a/tools/testfiles/tnestedcomp.h5.xml b/tools/testfiles/tnestedcomp.h5.xml index 96a5092..1670180 100644 --- a/tools/testfiles/tnestedcomp.h5.xml +++ b/tools/testfiles/tnestedcomp.h5.xml @@ -54,7 +54,7 @@ Expected output for 'h5dump --xml tnestedcomp.h5' - + diff --git a/tools/testfiles/tsaf.h5.xml b/tools/testfiles/tsaf.h5.xml index 4959366..bd73334 100644 --- a/tools/testfiles/tsaf.h5.xml +++ b/tools/testfiles/tsaf.h5.xml @@ -1329,7 +1329,7 @@ Expected output for 'h5dump --xml tsaf.h5' - + @@ -1347,7 +1347,7 @@ Expected output for 'h5dump --xml tsaf.h5' - + @@ -1365,7 +1365,7 @@ Expected output for 'h5dump --xml tsaf.h5' - + @@ -1882,7 +1882,7 @@ Expected output for 'h5dump --xml tsaf.h5' - + diff --git a/tools/testfiles/tstr.h5.xml b/tools/testfiles/tstr.h5.xml index 8c2f2a7..c82bbc6 100644 --- a/tools/testfiles/tstr.h5.xml +++ b/tools/testfiles/tstr.h5.xml @@ -24,8 +24,8 @@ Expected output for 'h5dump --xml tstr.h5' - - + + @@ -37,8 +37,8 @@ Expected output for 'h5dump --xml tstr.h5' - - + + -- cgit v0.12