summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/h5copygentest.c10
-rw-r--r--tools/h5dump/CMakeLists.txt6
-rw-r--r--tools/h5dump/h5dump.c20
-rw-r--r--tools/h5dump/h5dump_xml.c3
-rw-r--r--tools/h5dump/h5dump_xml.h8
-rw-r--r--tools/h5dump/h5dumpgentest.c64
-rw-r--r--tools/h5dump/testh5dump.sh.in4
-rw-r--r--tools/h5import/h5import.c369
-rw-r--r--tools/h5import/h5import.h35
-rw-r--r--tools/h5repack/CMakeLists.txt22
-rw-r--r--tools/h5repack/h5repack.c1
-rw-r--r--tools/h5repack/h5repack.sh.in21
-rw-r--r--tools/h5repack/h5repack_copy.c20
-rw-r--r--tools/h5repack/h5repacktst.c101
-rw-r--r--tools/h5repack/testfiles/h5repack_layout3.h5bin966904 -> 491840 bytes
-rw-r--r--tools/h5stat/testh5stat.sh.in14
-rw-r--r--tools/lib/h5diff_attr.c18
-rw-r--r--tools/lib/h5tools.h2
-rw-r--r--tools/lib/h5tools_dump.c50
-rw-r--r--tools/lib/h5tools_dump.h3
-rw-r--r--tools/misc/talign.c23
-rw-r--r--tools/testfiles/tscalarattrintsize.ddl18
-rw-r--r--tools/testfiles/tscalarattrintsize.h5bin12944 -> 12944 bytes
-rw-r--r--tools/testfiles/tscalarintsize.ddl18
-rw-r--r--tools/testfiles/tscalarintsize.h5bin15968 -> 15968 bytes
-rw-r--r--tools/testfiles/tscalarstring.ddl28
-rw-r--r--tools/testfiles/tscalarstring.h5bin0 -> 2208 bytes
27 files changed, 518 insertions, 340 deletions
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index ee98d7e..8fc7144 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -287,14 +287,14 @@ static void gent_nested_vl(hid_t loc_id)
/* allocate and initialize VL dataset to write */
buf[0].len = 1;
buf[0].p = malloc( 1 * sizeof(hvl_t));
- tvl = buf[0].p;
+ tvl = (hvl_t *)buf[0].p;
tvl->p = malloc( 1 * sizeof(int) );
tvl->len = 1;
((int *)tvl->p)[0]=1;
buf[1].len = 1;
buf[1].p = malloc( 1 * sizeof(hvl_t));
- tvl = buf[1].p;
+ tvl = (hvl_t *)buf[1].p;
tvl->p = malloc( 2 * sizeof(int) );
tvl->len = 2;
((int *)tvl->p)[0]=2;
@@ -645,7 +645,7 @@ out:
* Purpose: Testing with various objects
*
*------------------------------------------------------------------------*/
-static void Test_Obj_Copy()
+static void Test_Obj_Copy(void)
{
hid_t fid = (-1); /* File id */
hid_t fapl_new = (-1); /* File access property id */
@@ -699,7 +699,7 @@ out:
* Purpose: Testing with various references
*
*------------------------------------------------------------------------*/
-static void Test_Ref_Copy()
+static void Test_Ref_Copy(void)
{
hid_t fid=0;
herr_t status;
@@ -865,7 +865,7 @@ out:
* Purpose: gerenate external link files
*
*------------------------------------------------------------------------*/
-static void Test_Extlink_Copy()
+static void Test_Extlink_Copy(void)
{
hid_t fid1=0;
hid_t fid2=0;
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 8bd684e..e1ade89 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -160,6 +160,7 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.ddl
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tscaleoffset.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tshuffle.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink-1.ddl
@@ -263,6 +264,7 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.h5
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-m.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-r.h5
@@ -1023,6 +1025,8 @@ IF (BUILD_TESTING)
tscalarintsize.out.err
tscalarattrintsize.out
tscalarattrintsize.out.err
+ tscalarstring.out
+ tscalarstring.out.err
tscaleoffset.out
tscaleoffset.out.err
tshuffle.out
@@ -1094,6 +1098,8 @@ IF (BUILD_TESTING)
ADD_H5_TEST (tcmpdattrintsize 0 --enable-error-stack tcmpdattrintsize.h5)
# test for signed/unsigned scalar attributes
ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5)
+ # test for string scalar dataset and attribute
+ ADD_H5_TEST (tscalarstring 0 --enable-error-stack tscalarstring.h5)
# test for displaying groups
ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5)
# test for displaying the selected groups
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 2921fb9..34b8bc4 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -932,7 +932,7 @@ parse_mask_list(const char *h_list)
static void
free_handler(struct handler_t *hand, int len)
{
- register int i;
+ int i;
if(hand) {
for (i = 0; i < len; i++) {
@@ -997,7 +997,7 @@ parse_command_line(int argc, const char *argv[])
/* this will be plenty big enough to hold the info */
if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) {
- goto error;
+ goto error;
}
/* parse command line options */
@@ -1054,7 +1054,7 @@ parse_start:
break;
case 'w':
h5tools_nCols = HDatoi(opt_arg);
- if (h5tools_nCols==0) {
+ if (h5tools_nCols <= 0) {
h5tools_nCols = 65535;
}
last_was_dset = FALSE;
@@ -1293,7 +1293,7 @@ parse_start:
if (s->count.data) {
HDfree(s->count.data);
s->count.data = NULL;
- }
+ }
parse_hsize_list(opt_arg, &s->count);
break;
case 'k':
@@ -1356,6 +1356,7 @@ error:
return hand;
}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -1423,6 +1424,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
+
/* Disable tools error reporting */
H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
@@ -1449,28 +1451,28 @@ main(int argc, const char *argv[])
"to display selected objects");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_bb) {
error_msg("option \"%s\" not available for XML\n", "--boot-block");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_oid == 1) {
error_msg("option \"%s\" not available for XML\n", "--object-ids");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (display_char == TRUE) {
error_msg("option \"%s\" not available for XML\n", "--string");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if (usingdasho) {
error_msg("option \"%s\" not available for XML\n", "--output");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- }
+ }
else {
if (xml_dtd_uri) {
warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri);
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index 1a29659..28264e7 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/h5dump/h5dump_xml.c
@@ -3761,7 +3761,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
/* Print information about storage layout */
if (H5D_CHUNKED == H5Pget_layout(dcpl)) {
maxdims = H5Sget_simple_extent_ndims(space);
- chsize = (hsize_t *) HDmalloc(maxdims * sizeof(hsize_t));
+ HDassert(maxdims >= 0);
+ chsize = (hsize_t *)HDmalloc((size_t)maxdims * sizeof(hsize_t));
ctx.indent_level++;
dump_indent += COL;
diff --git a/tools/h5dump/h5dump_xml.h b/tools/h5dump/h5dump_xml.h
index 04d02c9..d4c8365 100644
--- a/tools/h5dump/h5dump_xml.h
+++ b/tools/h5dump/h5dump_xml.h
@@ -103,14 +103,6 @@ static h5tool_format_t xml_dataformat = {
extern "C" {
#endif
-/* internal functions used by XML option */
-static void xml_print_datatype(hid_t, unsigned);
-static void xml_print_enum(hid_t);
-static int xml_print_refs(hid_t, int);
-static int xml_print_strs(hid_t, int);
-static char *xml_escape_the_string(const char *, int);
-static char *xml_escape_the_name(const char *);
-
/* The dump functions of the dump_function_table */
/* XML format: same interface, alternative output */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 28fb4a4..d56fed5 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -105,6 +105,7 @@
#define FILE72 "tnestedcmpddt.h5"
#define FILE73 "tscalarintsize.h5"
#define FILE74 "tscalarattrintsize.h5"
+#define FILE75 "tscalarstring.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -8210,7 +8211,7 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
/*-------------------------------------------------------------------------
* Function: gent_intscalars
*
- * Purpose: Generate a file to be used in the h5dump tests.
+ * Purpose: Generate a file to be used in the h5dump scalar tests.
* Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
* Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
* Fill them with raw data such that no bit will be all zero in a dataset.
@@ -8390,7 +8391,7 @@ gent_intscalars(void)
/* Double Dummy set for failure tests */
dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_IEEE_F64BE, F73_ARRAY_RANK, dims);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < dims[0]; i++)
@@ -8405,9 +8406,9 @@ gent_intscalars(void)
}
/*-------------------------------------------------------------------------
- * Function: gent_attr_packedbits
+ * Function: gent_attr_intscalars
*
- * Purpose: Generate a file to be used in the h5dump packed bits tests.
+ * Purpose: Generate a file to be used in the h5dump attribute scalar tests.
* Four attributes of 1, 2, 4 and 8 bytes of unsigned int types are created.
* Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
* Fill them with raw data such that no bit will be all zero in a dataset.
@@ -8589,7 +8590,7 @@ gent_attr_intscalars(void)
/* Double Dummy set for failure tests */
dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
space = H5Screate(H5S_SCALAR);
- tid = H5Tarray_create2(H5T_IEEE_F64BE, F73_ARRAY_RANK, dims);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < dims[0]; i++)
@@ -8606,6 +8607,58 @@ gent_attr_intscalars(void)
}
/*-------------------------------------------------------------------------
+ * Function: gent_string_scalars
+ *
+ * Purpose: Generate a file to be used in the h5dump string scalar tests.
+ * A dataset of string types are created.
+ * An attribute of string types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_string_scalars(void)
+{
+ hid_t fid, attr, dataset, space, tid, root;
+ hsize_t dims[2];
+ char string[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* string scalar */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid, F73_XDIM * F73_YDIM8);
+
+ memset(string, ' ', F73_XDIM * F73_YDIM8);
+ for(i = 0; i < dims[0]; i++) {
+ string[i][0] = 'A' + i;
+ for(j = 1; j < dims[1]; j++) {
+ string[i][j] = string[i][j-1] + 1;
+ }
+ }
+ string[dims[0]-1][dims[1]-1] = 0;
+
+ /* Dataset of string scalar */
+ dataset = H5Dcreate2(fid, "the_str", tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, string);
+ H5Dclose(dataset);
+
+ /* attribute of string scalar */
+ attr = H5Acreate2(root, "attr_str", tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, string);
+
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
* Function: main
*
*-------------------------------------------------------------------------
@@ -8690,6 +8743,7 @@ int main(void)
gent_nested_compound_dt();
gent_intscalars();
gent_attr_intscalars();
+ gent_string_scalars();
return 0;
}
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index c90c364..8a2483b 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -145,6 +145,7 @@ $SRC_H5DUMP_TESTFILES/tordergr.h5
$SRC_H5DUMP_TESTFILES/tsaf.h5
$SRC_H5DUMP_TESTFILES/tscalarintsize.h5
$SRC_H5DUMP_TESTFILES/tscalarattrintsize.h5
+$SRC_H5DUMP_TESTFILES/tscalarstring.h5
$SRC_H5DUMP_TESTFILES/tslink.h5
$SRC_H5DUMP_TESTFILES/tsplit_file-m.h5
$SRC_H5DUMP_TESTFILES/tsplit_file-r.h5
@@ -281,6 +282,7 @@ $SRC_H5DUMP_TESTFILES/treference.ddl
$SRC_H5DUMP_TESTFILES/tsaf.ddl
$SRC_H5DUMP_TESTFILES/tscalarintsize.ddl
$SRC_H5DUMP_TESTFILES/tscalarattrintsize.ddl
+$SRC_H5DUMP_TESTFILES/tscalarstring.ddl
$SRC_H5DUMP_TESTFILES/tscaleoffset.ddl
$SRC_H5DUMP_TESTFILES/tshuffle.ddl
$SRC_H5DUMP_TESTFILES/tslink-1.ddl
@@ -690,6 +692,8 @@ TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5
TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5
# test for signed/unsigned scalar attributes
TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5
+# test for string scalar dataset attribute
+TOOLTEST tscalarstring.ddl --enable-error-stack tscalarstring.h5
# test for displaying groups
TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5
# test for displaying the selected groups
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 34870fb..9497e58 100644
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -32,6 +32,43 @@
#define READ_OPEN_FLAGS "r"
#endif
+/* Local function declarations */
+static int gtoken(char *s);
+static int process(struct Options *opt);
+static int processConfigurationFile(char *infile, struct Input *in);
+static int mapKeywordToIndex(char *key);
+static int parsePathInfo(struct path_info *path, char *strm);
+static int parseDimensions(struct Input *in, char *strm);
+static int getInputSize(struct Input *in, int ival);
+static int getInputClass(struct Input *in, char * strm);
+static int getInputClassType(struct Input *in, char * strm);
+static int InputClassStrToInt(char *temp);
+static int getRank(struct Input *in, FILE *strm);
+static int getDimensionSizes(struct Input *in, FILE *strm);
+static int getOutputSize(struct Input *in, FILE *strm);
+static int getOutputClass(struct Input *in, FILE *strm);
+static int OutputClassStrToInt(char *temp);
+static int getOutputArchitecture(struct Input *in, FILE *strm);
+static int OutputArchStrToInt(const char *temp);
+static int getOutputByteOrder(struct Input *in, FILE *strm);
+static int OutputByteOrderStrToInt(const char *temp);
+static int getChunkedDimensionSizes(struct Input *in, FILE *strm);
+static int getCompressionType(struct Input *in, FILE *strm);
+static int CompressionTypeStrToInt(char *temp);
+static int getCompressionParameter(struct Input *in, FILE *strm);
+static int getExternalFilename(struct Input *in, FILE *strm);
+static int getMaximumDimensionSizes(struct Input *in, FILE *strm);
+static int processDataFile(char *infile, struct Input *in, hid_t file_id);
+static int readIntegerData(FILE *strm, struct Input *in);
+static int readFloatData(FILE *strm, struct Input *in);
+static int allocateIntegerStorage(struct Input *in);
+static int allocateFloatStorage(struct Input *in);
+static int readUIntegerData(FILE *strm, struct Input *in);
+static int allocateUIntegerStorage(struct Input *in);
+static int validateConfigurationParameters(struct Input *in);
+static int processStrData(FILE *strm, struct Input *in, hid_t file_id);
+static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id);
+
int main(int argc, char *argv[])
{
struct Options opt;
@@ -301,7 +338,7 @@ static int gtoken(char *s)
static int processDataFile(char *infile, struct Input *in, hid_t file_id)
{
- FILE *strm;
+ FILE *strm = NULL;
const char *err1 = "Unable to open the input file %s for reading.\n";
const char *err2 = "Error in allocating integer data storage.\n";
const char *err3 = "Error in allocating floating-point data storage.\n";
@@ -311,6 +348,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
const char *err7 = "Error in reading unsigned integer data.\n";
const char *err10 = "Unrecognized input class type.\n";
const char *err11 = "Error in reading string data.\n";
+ int retval = -1;
/*-------------------------------------------------------------------------
* special case for opening binary classes in H5_HAVE_WIN32_API
@@ -323,7 +361,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
if ((strm = HDfopen(infile, READ_OPEN_FLAGS)) == NULL) {
(void) HDfprintf(stderr, err1, infile);
- return (-1);
+ goto error;
}
}
/*-------------------------------------------------------------------------
@@ -333,7 +371,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
else {
if ((strm = HDfopen(infile, "r")) == NULL) {
(void) HDfprintf(stderr, err1, infile);
- return (-1);
+ goto error;
}
}
@@ -342,14 +380,12 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
case 4: /* IN */
if (allocateIntegerStorage(in) == -1) {
(void) HDfprintf(stderr, err2, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (readIntegerData(strm, in) == -1) {
(void) HDfprintf(stderr, err4, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
break;
@@ -358,15 +394,13 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
case 3: /* FP */
if (allocateFloatStorage(in) == -1) {
(void) HDfprintf(stderr, err3, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (readFloatData(strm, in) == -1) {
(void) HDfprintf(stderr, err5, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
break;
@@ -374,15 +408,13 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
if (in->h5dumpInput) {
if (processStrHDFData(strm, in, file_id) == -1) {
(void) HDfprintf(stderr, err11, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
}
else {
if (processStrData(strm, in, file_id) == -1) {
(void) HDfprintf(stderr, err11, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
}
@@ -392,23 +424,26 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
case 7: /* UIN */
if (allocateUIntegerStorage(in) == -1) {
(void) HDfprintf(stderr, err6, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (readUIntegerData(strm, in) == -1) {
(void) HDfprintf(stderr, err7, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
break;
default:
(void) HDfprintf(stderr, "%s", err10);
- HDfclose(strm);
- return (-1);
+ goto error;
}
- HDfclose(strm);
- return (0);
+
+ /* Set success return value */
+ retval = 0;
+
+error:
+ if(strm)
+ HDfclose(strm);
+ return(retval);
}
static int readIntegerData(FILE *strm, struct Input *in)
@@ -1251,12 +1286,13 @@ static int allocateFloatStorage(struct Input *in)
static int processConfigurationFile(char *infile, struct Input *in)
{
- FILE *strm;
+ FILE *strm = NULL;
char key[255];
int kindex;
char temp[255];
int ival;
int scanret;
+ int retval = -1;
const char *err1 = "Unable to open the configuration file: %s for reading.\n";
const char *err2 = "Unknown keyword in configuration file: %s\n";
@@ -1303,7 +1339,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
if ((strm = HDfopen(infile, "r")) == NULL) {
(void) HDfprintf(stderr, err1, infile);
- return (-1);
+ goto error;
}
scanret = fscanf(strm, "%s", key);
@@ -1323,21 +1359,18 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (in->configOptionVector[PATH] == 1) {
(void) HDfprintf(stderr, err3a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASET %s found\n", temp);
#endif
if (parsePathInfo(&in->path, temp) == -1) {
(void) HDfprintf(stderr, err3b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[PATH] = 1;
scanret = fscanf(strm, "%s", temp); /* start bracket */
@@ -1351,22 +1384,19 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (in->configOptionVector[INPUT_CLASS] == 1) {
(void) HDfprintf(stderr, err4a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE %s found\n", temp);
#endif
if ((kindex = getInputClassType(in, temp)) == -1) {
(void) HDfprintf(stderr, err4b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE type %d inputClass\n", in->inputClass);
@@ -1396,23 +1426,20 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE STRING %s found\n", temp);
#endif
if (fscanf(strm, "%s", temp) != 1) { /* string properties */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
while (get_next_prop) {
if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err19);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE STRING STRSIZE %s found\n", temp);
@@ -1422,8 +1449,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
ival = HDstrtol(more, &more, 10);
if (getInputSize(in, ival) == -1) {
(void) HDfprintf(stderr, err5b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize);
@@ -1433,8 +1459,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */
if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE STRING STRPAD %s found\n", temp);
@@ -1443,8 +1468,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
else if(!HDstrcmp("CSET", key)) { /* CSET */
if (fscanf(strm, "%s", temp) != 1) { /* CSET type */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE STRING CSET %s found\n", temp);
@@ -1454,8 +1478,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */
if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE STRING CTYPE %s found\n", temp);
@@ -1463,8 +1486,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
} /* if(!HDstrcmp("CSET", key)) */
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATATYPE STRING %s found\n", temp);
@@ -1483,16 +1505,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if(!HDstrcmp("SCALAR", temp)) { /* SCALAR */
in->rank = 0;
} /* if(!HDstrcmp("SCALAR", key)) */
else if(!HDstrcmp("NULL", temp)) { /* NULL */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
} /* else if(!HDstrcmp("NULL", key)) */
else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */
int icount = 0;
@@ -1501,16 +1521,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
if (fscanf(strm, "%s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
@@ -1521,8 +1539,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
(void) HDfprintf(stderr, err16c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
@@ -1532,8 +1549,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
temp_dims[icount] = HDstrtoull(more, &more, 10);
if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
@@ -1547,15 +1563,13 @@ static int processConfigurationFile(char *infile, struct Input *in)
icount++;
if (icount > MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
- HDfclose(strm);
- return (-1);
+ goto error;
}
}
} /* while (get_next_dim) */
if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %d rank\n", in->rank);
@@ -1574,26 +1588,22 @@ static int processConfigurationFile(char *infile, struct Input *in)
} /* if(!HDstrcmp("(", key)) start paren */
else {
(void) HDfprintf(stderr, err5b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
if(!HDstrcmp("/", temp)) { /* / max dims */
if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
@@ -1607,8 +1617,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */
(void) HDfprintf(stderr, err16c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
@@ -1627,8 +1636,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */
(void) HDfprintf(stderr, err16c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump DATASPACE SIMPLE %s found\n", temp);
@@ -1640,8 +1648,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
i++;
if (i > MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
- HDfclose(strm);
- return (-1);
+ goto error;
}
}
} /* while (get_next_dim) */
@@ -1656,8 +1663,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
} /* if(!HDstrcmp("(", key)) start paren */
else {
(void) HDfprintf(stderr, err16c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
scanret = fscanf(strm, "%s", temp); /* end bracket */
#ifdef H5DEBUGIMPORT
@@ -1667,8 +1673,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
} /* else if(!HDstrcmp("SIMPLE", key)) */
else {
(void) HDfprintf(stderr, err5b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
} /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */
else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */
@@ -1677,16 +1682,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT %s found\n", temp);
#endif
if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT %s found\n", temp);
@@ -1694,12 +1697,11 @@ static int processConfigurationFile(char *infile, struct Input *in)
if(!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */
if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
(void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
@@ -1710,8 +1712,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
(void) HDfprintf(stderr, err16c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
@@ -1721,8 +1722,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10);
if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
@@ -1735,8 +1735,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
icount++;
if (icount > MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
- HDfclose(strm);
- return (-1);
+ goto error;
}
}
} /* while (get_next_dim) */
@@ -1751,13 +1750,11 @@ static int processConfigurationFile(char *infile, struct Input *in)
} /* if(!HDstrcmp("(", key)) start paren */
else {
(void) HDfprintf(stderr, err5b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) { /* SIZE */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
@@ -1765,8 +1762,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
if(!HDstrcmp("SIZE", temp)) { /* SIZE */
if (fscanf(strm, "%d", (&ival)) != 1) {
(void) HDfprintf(stderr, "%s", err19);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival);
@@ -1775,8 +1771,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
while (HDstrcmp("}", temp)) {
if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
@@ -1791,16 +1786,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS %s found\n", temp);
#endif
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS %s found\n", temp);
@@ -1811,32 +1804,28 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
if (fscanf(strm, "%d", (&ival)) != 1) {
(void) HDfprintf(stderr, "%s", err19);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival);
@@ -1844,8 +1833,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->compressionParam = ival;
if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS COMPRESSION %s found\n", temp);
@@ -1867,8 +1855,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
#ifdef H5DEBUGIMPORT
printf("h5dump FILTERS %s found\n", temp);
@@ -1909,25 +1896,21 @@ static int processConfigurationFile(char *infile, struct Input *in)
while (scanret == 1) {
if ((kindex = mapKeywordToIndex(key)) == -1) {
(void) HDfprintf(stderr, err2, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
switch (kindex) {
case 0: /* PATH */
if (in->configOptionVector[PATH] == 1) {
(void) HDfprintf(stderr, err3a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (parsePathInfo(&in->path, temp) == -1) {
(void) HDfprintf(stderr, err3b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[PATH] = 1;
break;
@@ -1935,19 +1918,16 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 1: /* INPUT-CLASS */
if (in->configOptionVector[INPUT_CLASS] == 1) {
(void) HDfprintf(stderr, err4a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (fscanf(strm, "%s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getInputClass(in, temp) == -1) {
(void) HDfprintf(stderr, err4b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[INPUT_CLASS] = 1;
@@ -1967,18 +1947,15 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 2: /* INPUT-SIZE */
if (in->configOptionVector[INPUT_SIZE] == 1) {
(void) HDfprintf(stderr, err5a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (fscanf(strm, "%d", (&ival)) != 1) {
(void) HDfprintf(stderr, "%s", err19);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getInputSize(in, ival) == -1) {
(void) HDfprintf(stderr, err5b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[INPUT_SIZE] = 1;
@@ -1990,14 +1967,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 3: /* RANK */
if (in->configOptionVector[RANK] == 1) {
(void) HDfprintf(stderr, err6a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getRank(in, strm) == -1) {
(void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[RANK] = 1;
break;
@@ -2005,19 +1980,16 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 4: /* DIMENSION-SIZES */
if (in->configOptionVector[DIM] == 1) {
(void) HDfprintf(stderr, err7a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (in->configOptionVector[RANK] == 0) {
(void) HDfprintf(stderr, err7b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getDimensionSizes(in, strm) == -1) {
(void) HDfprintf(stderr, err7c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[DIM] = 1;
break;
@@ -2025,14 +1997,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 5: /* OUTPUT-CLASS */
if (in->configOptionVector[OUTPUT_CLASS] == 1) {
(void) HDfprintf(stderr, err8a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getOutputClass(in, strm) == -1) {
(void) HDfprintf(stderr, err8b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[OUTPUT_CLASS] = 1;
break;
@@ -2040,14 +2010,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 6: /* OUTPUT-SIZE */
if (in->configOptionVector[OUTPUT_SIZE] == 1) {
(void) HDfprintf(stderr, err9a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getOutputSize(in, strm) == -1) {
(void) HDfprintf(stderr, err9b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[OUTPUT_SIZE] = 1;
break;
@@ -2055,14 +2023,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 7: /* OUTPUT-ARCHITECTURE */
if (in->configOptionVector[OUTPUT_ARCH] == 1) {
(void) HDfprintf(stderr, err10a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getOutputArchitecture(in, strm) == -1) {
(void) HDfprintf(stderr, err10b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[OUTPUT_ARCH] = 1;
break;
@@ -2070,14 +2036,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 8: /* OUTPUT-BYTE-ORDER */
if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
(void) HDfprintf(stderr, err11a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getOutputByteOrder(in, strm) == -1) {
(void) HDfprintf(stderr, err11b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[OUTPUT_B_ORDER] = 1;
break;
@@ -2085,20 +2049,17 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 9: /* CHUNKED-DIMENSION-SIZES */
if (in->configOptionVector[CHUNK] == 1) {
(void) HDfprintf(stderr, err12a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
/* cant appear before dimension sizes have been provided */
if (in->configOptionVector[DIM] == 0) {
(void) HDfprintf(stderr, err12b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getChunkedDimensionSizes(in, strm) == -1) {
(void) HDfprintf(stderr, err12c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[CHUNK] = 1;
break;
@@ -2106,14 +2067,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 10: /* COMPRESSION-TYPE */
if (in->configOptionVector[COMPRESS] == 1) {
(void) HDfprintf(stderr, err13a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getCompressionType(in, strm) == -1) {
(void) HDfprintf(stderr, err13b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[COMPRESS] = 1;
@@ -2126,14 +2085,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 11: /* COMPRESSION-PARAM */
if (in->configOptionVector[COMPRESS_PARAM] == 1) {
(void) HDfprintf(stderr, err14a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getCompressionParameter(in, strm) == -1) {
(void) HDfprintf(stderr, err14b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[COMPRESS_PARAM] = 1;
@@ -2146,14 +2103,12 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 12: /* EXTERNAL-STORAGE */
if (in->configOptionVector[EXTERNALSTORE] == 1) {
(void) HDfprintf(stderr, err15a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getExternalFilename(in, strm) == -1) {
(void) HDfprintf(stderr, err15b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[EXTERNALSTORE] = 1;
break;
@@ -2161,19 +2116,16 @@ static int processConfigurationFile(char *infile, struct Input *in)
case 13: /* MAXIMUM-DIMENSIONS */
if (in->configOptionVector[EXTEND] == 1) {
(void) HDfprintf(stderr, err16a, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
/* cant appear before dimension sizes have been provided */
if (in->configOptionVector[DIM] == 0) {
(void) HDfprintf(stderr, err16b, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
if (getMaximumDimensionSizes(in, strm) == -1) {
(void) HDfprintf(stderr, err16c, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
in->configOptionVector[EXTEND] = 1;
break;
@@ -2192,11 +2144,16 @@ static int processConfigurationFile(char *infile, struct Input *in)
if (validateConfigurationParameters(in) == -1) {
(void) HDfprintf(stderr, err17, infile);
- HDfclose(strm);
- return (-1);
+ goto error;
}
- HDfclose(strm);
- return (0);
+
+ /* Set success return value */
+ retval = 0;
+
+error:
+ if(strm)
+ HDfclose(strm);
+ return(retval);
}
static int validateConfigurationParameters(struct Input *in)
@@ -3279,7 +3236,7 @@ static int getOutputArchitecture(struct Input *in, FILE *strm)
return (0);
}
-static int OutputArchStrToInt(char *temp)
+static int OutputArchStrToInt(const char *temp)
{
int i;
char outputArchKeywordTable[8][15] = { "NATIVE", "STD", "IEEE", "INTEL",
@@ -3311,7 +3268,7 @@ static int getOutputByteOrder(struct Input *in, FILE *strm)
return (0);
}
-static int OutputByteOrderStrToInt(char *temp)
+static int OutputByteOrderStrToInt(const char *temp)
{
int i;
char outputByteOrderKeywordTable[2][15] = { "BE", "LE" };
@@ -3716,6 +3673,10 @@ hid_t createInputDataType(struct Input *in)
case 64:
new_type = H5Tcopy(H5T_NATIVE_LLONG);
break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
}
break;
@@ -3730,6 +3691,10 @@ hid_t createInputDataType(struct Input *in)
case 64:
new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
}
break;
@@ -3754,6 +3719,10 @@ hid_t createInputDataType(struct Input *in)
case 64:
new_type = H5Tcopy(H5T_NATIVE_ULLONG);
break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
}
break;
diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h
index c686624..c242483 100644
--- a/tools/h5import/h5import.h
+++ b/tools/h5import/h5import.h
@@ -191,43 +191,8 @@ void usage(char *);
void setDefaultValues(struct Input *in, int count);
void help(char *);
-static int gtoken(char *s);
-static int process(struct Options *opt);
-static int processConfigurationFile(char *infile, struct Input *in);
-static int mapKeywordToIndex(char *key);
-static int parsePathInfo(struct path_info *path, char *strm);
-static int parseDimensions(struct Input *in, char *strm);
-static int getInputSize(struct Input *in, int ival);
-static int getInputClass(struct Input *in, char * strm);
-static int getInputClassType(struct Input *in, char * strm);
-static int InputClassStrToInt(char *temp);
-static int getRank(struct Input *in, FILE *strm);
-static int getDimensionSizes(struct Input *in, FILE *strm);
-static int getOutputSize(struct Input *in, FILE *strm);
-static int getOutputClass(struct Input *in, FILE *strm);
-static int OutputClassStrToInt(char *temp);
-static int getOutputArchitecture(struct Input *in, FILE *strm);
-static int OutputArchStrToInt(char *temp);
-static int getOutputByteOrder(struct Input *in, FILE *strm);
-static int OutputByteOrderStrToInt(char *temp);
-static int getChunkedDimensionSizes(struct Input *in, FILE *strm);
-static int getCompressionType(struct Input *in, FILE *strm);
-static int CompressionTypeStrToInt(char *temp);
-static int getCompressionParameter(struct Input *in, FILE *strm);
-static int getExternalFilename(struct Input *in, FILE *strm);
-static int getMaximumDimensionSizes(struct Input *in, FILE *strm);
-static int processDataFile(char *infile, struct Input *in, hid_t file_id);
-static int readIntegerData(FILE *strm, struct Input *in);
-static int readFloatData(FILE *strm, struct Input *in);
-static int allocateIntegerStorage(struct Input *in);
-static int allocateFloatStorage(struct Input *in);
hid_t createOutputDataType(struct Input *in);
hid_t createInputDataType(struct Input *in);
-static int readUIntegerData(FILE *strm, struct Input *in);
-static int allocateUIntegerStorage(struct Input *in);
-static int validateConfigurationParameters(struct Input *in);
-static int processStrData(FILE *strm, struct Input *in, hid_t file_id);
-static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id);
#endif /* H5IMPORT_H__ */
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
index 3ee1cba..7351fd5 100644
--- a/tools/h5repack/CMakeLists.txt
+++ b/tools/h5repack/CMakeLists.txt
@@ -800,6 +800,28 @@ ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONT
ADD_H5_TEST (chunk2compa "TEST" h5repack_layout3.h5 -l chunk_unlimit1:COMPA)
ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK)
+#--------------------------------------------------------------------------
+# Test -f for some specific cases. Chunked dataset with unlimited max dims.
+# (HDFFV-8012)
+#--------------------------------------------------------------------------
+# - should not fail
+# - should not change max dims from unlimit
+
+# chunk dim is bigger than dataset dim. ( dset size < 64k )
+ADD_H5_TEST (error1 "TEST" h5repack_layout3.h5 -f chunk_unlimit1:NONE)
+ADD_H5_VERIFY_TEST (error1 "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED)
+
+# chunk dim is bigger than dataset dim. ( dset size > 64k )
+ADD_H5_TEST (error2 "TEST" h5repack_layout3.h5 -f chunk_unlimit2:NONE)
+ADD_H5_VERIFY_TEST (error2 "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED)
+
+# chunk dims are smaller than dataset dims. ( dset size < 64k )
+ADD_H5_TEST (error3 "TEST" h5repack_layout3.h5 -f chunk_unlimit3:NONE)
+ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED)
+
+# file input - should not fail
+ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE)
+
# Native option
# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
# report a difference.
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 42472b56..dda81cf 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -96,6 +96,7 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
options->min_comp = 1024;
options->verbose = verbose;
options->latest = latest;
+ options->layout_g = H5D_LAYOUT_ERROR;
for ( n = 0; n < H5_REPACK_MAX_NFILTERS; n++)
{
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 2614dd6..a732ffb 100644
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -818,6 +818,27 @@ VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CONTI
TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:COMPA
VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CHUNK
+#--------------------------------------------------------------------------
+# Test -f for some specific cases. Chunked dataset with unlimited max dims.
+# (HDFFV-8012)
+#--------------------------------------------------------------------------
+# - should not fail
+# - should not change max dims from unlimit
+
+# chunk dim is bigger than dataset dim. ( dset size < 64k )
+TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit1:NONE
+VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED
+# chunk dim is bigger than dataset dim. ( dset size > 64k )
+TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit2:NONE
+VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED
+
+# chunk dims are smaller than dataset dims. ( dset size < 64k )
+TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit3:NONE
+VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED
+
+# file input - should not fail
+TOOLTEST h5repack_layout3.h5 -f NONE
+
# Native option
# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
# report a difference.
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index cf55d7f..02337fd 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -773,6 +773,7 @@ int do_copy_objects(hid_t fidin,
void *hslab_buf=NULL; /* hyperslab buffer for raw data */
int has_filter; /* current object has a filter */
int req_filter; /* there was a request for a filter */
+ int req_obj_layout=0; /* request layout to current object */
unsigned crt_order_flags; /* group creation order flag */
unsigned i;
unsigned u;
@@ -904,6 +905,22 @@ int do_copy_objects(hid_t fidin,
}
}
+ /* check if layout change requested individual object */
+ if (options->layout_g != H5D_LAYOUT_ERROR)
+ {
+ pack_info_t *pckinfo;
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0)
+ {
+ /* check if object exist */
+ pckinfo = options_get_object (travt->objs[i].name, options->op_tbl);
+ if (pckinfo)
+ {
+ req_obj_layout = 1;
+ }
+ }
+ }
+
/* early detection of references */
if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
@@ -1023,6 +1040,9 @@ int do_copy_objects(hid_t fidin,
goto error;
}
+ /* only if layout change requested for entire file or
+ * individual obj */
+ if (options->all_layout > 0 || req_obj_layout == 1)
/*-------------------------------------------------
* Unset the unlimited max dims if convert to other
* than chunk layouts, because unlimited max dims
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 3926744..cc4e063 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -3153,65 +3153,119 @@ out:
*/
#define DIM1_L3 300
#define DIM2_L3 200
+/* small size */
+#define SDIM1_L3 4
+#define SDIM2_L3 50
static
int make_layout3(hid_t loc_id)
{
- hid_t dcpl=-1; /* dataset creation property list */
- hid_t sid=-1; /* dataspace ID */
- hsize_t dims[RANK]={DIM1_L3,DIM2_L3};
+ hid_t dcpl1=-1; /* dataset creation property list */
+ hid_t dcpl2=-1; /* dataset creation property list */
+ hid_t dcpl3=-1; /* dataset creation property list */
+ hid_t sid1=-1; /* dataspace ID */
+ hid_t sid2=-1; /* dataspace ID */
+ hsize_t dims1[RANK]={DIM1_L3,DIM2_L3};
+ hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3};
hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[RANK]={DIM1_L3*2,5};
- int buf[DIM1_L3][DIM2_L3];
+ hsize_t chunk_dims1[RANK]={DIM1_L3*2,5};
+ hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2};
+ hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2};
+ int buf1[DIM1_L3][DIM2_L3];
+ int buf2[SDIM1_L3][SDIM2_L3];
int i, j, n;
+ /* init buf1 */
for (i=n=0; i<DIM1_L3; i++)
{
for (j=0; j<DIM2_L3; j++)
{
- buf[i][j]=n++;
+ buf1[i][j]=n++;
+ }
+ }
+
+ /* init buf2 */
+ for (i=n=0; i<SDIM1_L3; i++)
+ {
+ for (j=0; j<SDIM2_L3; j++)
+ {
+ buf2[i][j]=n++;
}
}
/*-------------------------------------------------------------------------
- * make several dataset with several layout options
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size bigger than compact max (64K)
*-------------------------------------------------------------------------
*/
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ if((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
return -1;
/* create a dataset creation property list; the same DCPL is used for all dsets */
- if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
{
goto out;
}
+ if(H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
+ goto out;
+ if (make_dset(loc_id,"chunk_unlimit1",sid1,dcpl1,buf1) < 0)
+ {
+ goto out;
+ }
/*-------------------------------------------------------------------------
- * H5D_CHUNKED
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size smaller than compact (64K)
*-------------------------------------------------------------------------
*/
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+
+ /* create a space */
+ if((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
+ return -1;
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if (make_dset(loc_id,"chunk_unlimit1",sid,dcpl,buf) < 0)
- {
+
+ if(H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
goto out;
- }
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ if (make_dset(loc_id,"chunk_unlimit2",sid2,dcpl2,buf2) < 0)
goto out;
- if (make_dset(loc_id,"chunk_unlimit2",sid,dcpl,buf) < 0)
- {
+ /*-------------------------------------------------------------------------
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dims are smaller than dset dims
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+
+ if(H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
+ goto out;
+
+ if (make_dset(loc_id,"chunk_unlimit3",sid2,dcpl3,buf2) < 0)
goto out;
- }
/*-------------------------------------------------------------------------
* close space and dcpl
*-------------------------------------------------------------------------
*/
- if(H5Sclose(sid) < 0)
+ if(H5Sclose(sid1) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if(H5Sclose(sid2) < 0)
+ goto out;
+ if(H5Pclose(dcpl1) < 0)
+ goto out;
+ if(H5Pclose(dcpl2) < 0)
+ goto out;
+ if(H5Pclose(dcpl3) < 0)
goto out;
return 0;
@@ -3219,8 +3273,11 @@ int make_layout3(hid_t loc_id)
out:
H5E_BEGIN_TRY
{
- H5Pclose(dcpl);
- H5Sclose(sid);
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
+ H5Pclose(dcpl3);
} H5E_END_TRY;
return -1;
}
diff --git a/tools/h5repack/testfiles/h5repack_layout3.h5 b/tools/h5repack/testfiles/h5repack_layout3.h5
index 5319031..7351502 100644
--- a/tools/h5repack/testfiles/h5repack_layout3.h5
+++ b/tools/h5repack/testfiles/h5repack_layout3.h5
Binary files differ
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index 8d294be..8a3e8a2 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -135,6 +135,9 @@ TESTING() {
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
+# Source in the output filter function definitions.
+. $srcdir/../../bin/output_filter.sh
+
# Run a test and print PASS or *FAIL*. If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display the
# difference between the actual output and the expected output. The
@@ -147,6 +150,8 @@ TOOLTEST() {
expect="$TESTDIR/$1"
actual="$TESTDIR/`basename $1 .ddl`.out"
actual_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
shift
# Run test.
@@ -158,8 +163,13 @@ TOOLTEST() {
cd $TESTDIR
$RUNSERIAL $STAT_BIN $@
) >$actual 2>$actual_err
- cat $actual_err >> $actual
+ # save actual and actual_err in case they are needed later.
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ cp $actual_err $actual_err_sav
+ STDERR_FILTER $actual_err
+ cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -176,7 +186,7 @@ TOOLTEST() {
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 144159a..130a0d8 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -207,6 +207,12 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
table_lp->nattrs_only2++;
curr2++;
}
+
+ /* close for next turn */
+ H5Aclose(attr1_id);
+ attr1_id = -1;
+ H5Aclose(attr2_id);
+ attr2_id = -1;
} /* end while */
/* list1 did not end */
@@ -225,6 +231,10 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
table_attr_mark_exist(infile, name1, table_lp);
table_lp->nattrs_only1++;
curr1++;
+
+ /* close for next turn */
+ H5Aclose(attr1_id);
+ attr1_id = -1;
}
/* list2 did not end */
@@ -243,6 +253,9 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
table_attr_mark_exist(infile, name2, table_lp);
table_lp->nattrs_only2++;
curr2++;
+
+ /* close for next turn */
+ H5Aclose(attr2_id);
}
/*------------------------------------------------------
@@ -272,6 +285,11 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
return 0;
error:
+ if (0 < attr1_id)
+ H5Aclose(attr1_id);
+ if (0 < attr2_id)
+ H5Aclose(attr2_id);
+
return -1;
}
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 15e4e00..1a2b81c 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -443,7 +443,7 @@ typedef struct h5tool_format_t {
* indentlevel: a string that shows how far to indent if extra spacing
* is needed. dumper uses it.
*/
- int line_ncols; /*columns of output */
+ unsigned line_ncols; /*columns of output */
size_t line_per_line; /*max elements per line */
const char *line_pre; /*prefix at front of each line */
const char *line_1st; /*alternate pre. on first line */
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 2e6a99d..33fef3c 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -30,10 +30,6 @@
#include "h5tools_utils.h"
#include "H5private.h"
-#define SANITY_CHECK
-
-#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
-
h5tool_format_t h5tools_dataformat = {
0, /*raw */
@@ -215,6 +211,12 @@ hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
hsize_t *curr_pos/*total data element position*/,
size_t ncols, hsize_t region_elmt_counter/*element counter*/,
hsize_t elmt_counter);
+
+void h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims);
+
+void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx, struct subset_t *sset, int dims);
+
void
h5tools_dump_init(void)
{
@@ -628,7 +630,11 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
- HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+{
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+ HGOTO_DONE(dimension_break);
+ //HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+}
H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
@@ -689,7 +695,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, buffer, info, ctx, region_space);
+ h5tools_print_dataspace(buffer, region_space);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -1008,7 +1014,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
ctx->need_prefix = TRUE;
h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, buffer, info, ctx, region_space);
+ h5tools_print_dataspace(buffer, region_space);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -2215,7 +2221,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
/* Check C variable-length string first. Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_C_S1;");
- goto done;
+ goto found_string_type;
}
/* Change the endianness and see if they're equal. */
@@ -2227,7 +2233,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_C_S1;");
- goto done;
+ goto found_string_type;
}
/* If not equal to C variable-length string, check Fortran type. */
@@ -2242,7 +2248,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
/* Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto done;
+ goto found_string_type;
}
/* Change the endianness and see if they're equal. */
@@ -2254,13 +2260,13 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto done;
+ goto found_string_type;
}
/* Type doesn't match any of above. */
h5tools_str_append(buffer, "unknown_one_character_type;");
- done:
+ found_string_type:
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
ctx->indent_level--;
@@ -2311,7 +2317,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
ctx->indent_level++;
{
- char *ttag = H5Tget_tag(type);
+ char *ttag;
+
+ if(NULL == (ttag = H5Tget_tag(type)))
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed");
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, 0, 0);
@@ -2320,8 +2329,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag);
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
- if (ttag)
- HDfree(ttag);
+ HDfree(ttag);
}
ctx->indent_level--;
@@ -2482,8 +2490,7 @@ CATCH
*-------------------------------------------------------------------------
*/
int
-h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t space)
+h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
{
HERR_INIT(int, SUCCEED)
hsize_t size[H5TOOLS_DUMP_MAX_RANK];
@@ -2773,7 +2780,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info,
h5tools_str_append(&buffer, "%s ",
h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, &buffer, info, ctx, type);
+ h5tools_print_dataspace(&buffer, type);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -2845,7 +2852,6 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
{
size_t size;
hid_t n_type;
- hsize_t nelmts = 1;
void *buf = NULL;
n_type = h5tools_get_native_type(type_id);
@@ -3567,7 +3573,8 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims)
for (i = 0; i < dims; i++) {
h5tools_str_append(buffer, HSIZE_T_FORMAT, s[i]);
- if (i + 1 != dims) h5tools_str_append(buffer, ", ");
+ if (i + 1 != dims)
+ h5tools_str_append(buffer, ", ");
}
}
@@ -3870,7 +3877,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
buf = HDmalloc((size_t)alloc_size);
HDassert(buf);
- if (H5Aread(obj_id, p_type, buf) >= 0)
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
/*
* Print 1-byte integer data as an ASCII character string
@@ -3899,6 +3906,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
}
else
datactx.need_prefix = TRUE;
+ }
status = h5tools_dump_mem(stream, info, &datactx, obj_id, p_type, space, buf);
if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h
index 55e046b..86f9f99 100644
--- a/tools/lib/h5tools_dump.h
+++ b/tools/lib/h5tools_dump.h
@@ -67,8 +67,7 @@ H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer/*in,out*/,
const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
hid_t type, int object_search);
-H5TOOLS_DLL int h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer/*in,out*/,
- const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+H5TOOLS_DLL int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/,
hid_t space);
H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer/*in,out*/,
const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
diff --git a/tools/misc/talign.c b/tools/misc/talign.c
index b77d846..017eb55 100644
--- a/tools/misc/talign.c
+++ b/tools/misc/talign.c
@@ -23,6 +23,7 @@
#include "hdf5.h"
#include "H5private.h"
+#include "h5tools.h"
const char *fname = "talign.h5";
const char *setname = "align";
@@ -46,8 +47,8 @@ int main(void)
hsize_t cdim[4];
char string5[5];
- float fok[2] = {1234., 2341.};
- float fnok[2] = {5678., 6785.};
+ float fok[2] = {1234.0f, 2341.0f};
+ float fnok[2] = {5678.0f, 6785.0f};
float *fptr;
char *data = NULL;
@@ -125,7 +126,7 @@ int main(void)
H5Dclose(set);
/* Now open the set, and read it back in */
- data = malloc(H5Tget_size(fix));
+ data = (char *)malloc(H5Tget_size(fix));
if(!data) {
perror("malloc() failed");
@@ -159,8 +160,8 @@ out:
"%14s (%2d) %6f = %f\n"
" %6f = %f\n",
mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1),
- fok[0], fptr[0],
- fok[1], fptr[1]);
+ (double)fok[0], (double)fptr[0],
+ (double)fok[1], (double)fptr[1]);
if(mname)
free(mname);
@@ -169,8 +170,8 @@ out:
printf("%14s (%2d) %6f = %f\n"
" %6f = %6f\n",
mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2),
- fnok[0], fptr[0],
- fnok[1], fptr[1]);
+ (double)fnok[0], (double)fptr[0],
+ (double)fnok[1], (double)fptr[1]);
if(mname)
free(mname);
@@ -181,10 +182,10 @@ out:
" %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]);
+ (double)fok[0], (double)fptr[0],
+ (double)fok[1], (double)fptr[1],
+ (double)fnok[0], (double)fptr[2],
+ (double)fnok[1], (double)fptr[3]);
puts("*FAILED - compound type alignmnent problem*");
} else {
puts(" PASSED");
diff --git a/tools/testfiles/tscalarattrintsize.ddl b/tools/testfiles/tscalarattrintsize.ddl
index 4157859..46f3cef 100644
--- a/tools/testfiles/tscalarattrintsize.ddl
+++ b/tools/testfiles/tscalarattrintsize.ddl
@@ -113,17 +113,17 @@ GROUP "/" {
}
}
ATTRIBUTE "DummyDBL" {
- DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64BE }
+ DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64LE }
DATASPACE SCALAR
DATA {
- (0): [ 0, 1.17284e-90, 1.17284e-90, 1.05571e+165, 1.17284e-90, -3.23633e+292, 1.05571e+165, -3.55182e+37,
- 3.03865e-319, 3.71772e+239, -5.54961e+165, 8.81586e+91, -8.11368e+22, 1.28325e-51, -1.9407e-125, 2.0391e-194,
- 3.16202e-322, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247,
- 1.04347e-320, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247,
- 2.05531e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31,
- 2.56124e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31,
- 3.06716e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31,
- 3.57308e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31 ]
+ (0): [ 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007,
+ 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007,
+ 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007,
+ 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007,
+ 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007,
+ 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007,
+ 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007,
+ 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 ]
}
}
}
diff --git a/tools/testfiles/tscalarattrintsize.h5 b/tools/testfiles/tscalarattrintsize.h5
index acf87e8..df91f54 100644
--- a/tools/testfiles/tscalarattrintsize.h5
+++ b/tools/testfiles/tscalarattrintsize.h5
Binary files differ
diff --git a/tools/testfiles/tscalarintsize.ddl b/tools/testfiles/tscalarintsize.ddl
index b4d9c02..4b06a74 100644
--- a/tools/testfiles/tscalarintsize.ddl
+++ b/tools/testfiles/tscalarintsize.ddl
@@ -113,17 +113,17 @@ GROUP "/" {
}
}
DATASET "DummyDBL" {
- DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64BE }
+ DATATYPE H5T_ARRAY { [8][8] H5T_IEEE_F64LE }
DATASPACE SCALAR
DATA {
- (0): [ 0, 1.17284e-90, 1.17284e-90, 1.05571e+165, 1.17284e-90, -3.23633e+292, 1.05571e+165, -3.55182e+37,
- 3.03865e-319, 3.71772e+239, -5.54961e+165, 8.81586e+91, -8.11368e+22, 1.28325e-51, -1.9407e-125, 2.0391e-194,
- 3.16202e-322, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247,
- 1.04347e-320, 4.49083e-30, 3.71772e+239, -6.38938e-104, -5.54961e+165, 9.82903e-178, 8.81586e+91, -9.79926e-247,
- 2.05531e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31,
- 2.56124e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31,
- 3.06716e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31,
- 3.57308e-320, 2.30888e-169, 4.49083e-30, 1.26564e+105, 3.71772e+239, -3.43143e-243, -6.38938e-104, -1.85109e+31 ]
+ (0): [ 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007,
+ 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007,
+ 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007,
+ 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007,
+ 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007,
+ 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007,
+ 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007,
+ 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 ]
}
}
}
diff --git a/tools/testfiles/tscalarintsize.h5 b/tools/testfiles/tscalarintsize.h5
index 9433401..5a82378 100644
--- a/tools/testfiles/tscalarintsize.h5
+++ b/tools/testfiles/tscalarintsize.h5
Binary files differ
diff --git a/tools/testfiles/tscalarstring.ddl b/tools/testfiles/tscalarstring.ddl
new file mode 100644
index 0000000..4ba7093
--- /dev/null
+++ b/tools/testfiles/tscalarstring.ddl
@@ -0,0 +1,28 @@
+HDF5 "tscalarstring.h5" {
+GROUP "/" {
+ ATTRIBUTE "attr_str" {
+ DATATYPE H5T_STRING {
+ STRSIZE 64;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SCALAR
+ DATA {
+ (0): "ABCDEFGHBCDEFGHICDEFGHIJDEFGHIJKEFGHIJKLFGHIJKLMGHIJKLMNHIJKLMNO"
+ }
+ }
+ DATASET "the_str" {
+ DATATYPE H5T_STRING {
+ STRSIZE 64;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ }
+ DATASPACE SCALAR
+ DATA {
+ (0): "ABCDEFGHBCDEFGHICDEFGHIJDEFGHIJKEFGHIJKLFGHIJKLMGHIJKLMNHIJKLMNO"
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tscalarstring.h5 b/tools/testfiles/tscalarstring.h5
new file mode 100644
index 0000000..b0993ef
--- /dev/null
+++ b/tools/testfiles/tscalarstring.h5
Binary files differ