summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/CMakeTests.cmake38
-rw-r--r--tools/h5repack/dynlib_rpk.c4
-rw-r--r--tools/h5repack/dynlib_vrpk.c8
-rw-r--r--tools/h5repack/h5repack.c28
-rw-r--r--tools/h5repack/h5repack_copy.c108
-rw-r--r--tools/h5repack/h5repack_main.c569
-rw-r--r--tools/h5repack/h5repack_parse.c7
-rw-r--r--tools/h5repack/h5repack_plugin.sh.in25
-rw-r--r--tools/h5repack/h5repack_verify.c7
-rw-r--r--tools/h5repack/h5repacktst.c2
-rw-r--r--tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl14
11 files changed, 394 insertions, 416 deletions
diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake
index fa454ce..0ed2804 100644
--- a/tools/h5repack/CMakeTests.cmake
+++ b/tools/h5repack/CMakeTests.cmake
@@ -19,7 +19,7 @@
set (VFD_LIST ${VFD_LIST} direct)
endif ()
- MACRO (ADD_VFD_TEST vfdname resultcode)
+ macro (ADD_VFD_TEST vfdname resultcode)
add_test (
NAME H5REPACK-VFD-${vfdname}-h5repacktest
COMMAND "${CMAKE_COMMAND}"
@@ -35,7 +35,7 @@
set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest")
- ENDMACRO ()
+ endmacro ()
endif ()
# --------------------------------------------------------------------
@@ -109,7 +109,7 @@
##############################################################################
##############################################################################
- MACRO (ADD_HELP_TEST testname resultcode)
+ macro (ADD_HELP_TEST testname resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5REPACK-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN})
@@ -131,9 +131,9 @@
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_H5_TEST_OLD testname testtype testfile)
+ macro (ADD_H5_TEST_OLD testname testtype testfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -155,9 +155,9 @@
)
set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname})
endif ()
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_H5_TEST testname testtype testfile)
+ macro (ADD_H5_TEST testname testtype testfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -179,9 +179,9 @@
)
set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname})
endif ()
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
+ macro (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -213,9 +213,9 @@
set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test})
endif ()
endif ()
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_H5_DMP_TEST testname testtype resultcode resultfile)
+ macro (ADD_H5_DMP_TEST testname testtype resultcode resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -246,9 +246,9 @@
set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}")
endif ()
endif ()
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter)
+ macro (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -310,9 +310,9 @@
endif ()
endif ()
endif ()
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_H5_TEST_META testname testfile)
+ macro (ADD_H5_TEST_META testname testfile)
add_test (
NAME H5REPACK_META-${testname}_N
COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5
@@ -329,9 +329,9 @@
add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5)
set_tests_properties (H5REPACK_META-${testname} PROPERTIES WILL_FAIL "true")
set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M)
- ENDMACRO ()
+ endmacro ()
- MACRO (ADD_H5_UD_TEST testname resultcode resultfile)
+ macro (ADD_H5_UD_TEST testname resultcode resultfile)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
# Remove any output file left over from previous test run
add_test (
@@ -370,7 +370,7 @@
)
set_tests_properties (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}")
endif ()
- ENDMACRO ()
+ endmacro ()
##############################################################################
##############################################################################
@@ -982,7 +982,7 @@
##############################################################################
### P L U G I N T E S T S
##############################################################################
- ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,1,8,18)
+ ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9)
ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE)
# check for no parameters
diff --git a/tools/h5repack/dynlib_rpk.c b/tools/h5repack/dynlib_rpk.c
index 70333f8..3469e58 100644
--- a/tools/h5repack/dynlib_rpk.c
+++ b/tools/h5repack/dynlib_rpk.c
@@ -38,8 +38,8 @@ const H5Z_class2_t H5Z_DYNLIB1[1] = {{
(H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib1
diff --git a/tools/h5repack/dynlib_vrpk.c b/tools/h5repack/dynlib_vrpk.c
index 97cb211..8da0270 100644
--- a/tools/h5repack/dynlib_vrpk.c
+++ b/tools/h5repack/dynlib_vrpk.c
@@ -67,19 +67,19 @@ H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
/* Check for the library version */
if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
- return 0;
+ return(0);
}
/* Check for the correct number of parameters */
if(cd_nelmts == 0)
- return 0;
+ return(0);
/* Check that permanent parameters are set correctly */
if(cd_values[0] > 9)
- return 0;
+ return(0);
if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
- return 0;
+ return(0);
}
add_on = (int)cd_values[0];
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 3f99374..0c14992 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -79,21 +79,21 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) {
*/
int h5repack_init(pack_opt_t *options, int verbose) {
- int k, n;
-
- HDmemset(options, 0, sizeof(pack_opt_t));
- options->min_comp = 0;
- options->verbose = verbose;
- options->layout_g = H5D_LAYOUT_ERROR;
-
- for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
- options->filter_g[n].filtn = -1;
- options->filter_g[n].cd_nelmts = 0;
- for (k = 0; k < CD_VALUES; k++)
- options->filter_g[n].cd_values[k] = 0;
- }
+ int k, n;
+
+ HDmemset(options, 0, sizeof(pack_opt_t));
+ options->min_comp = 0;
+ options->verbose = verbose;
+ options->layout_g = H5D_LAYOUT_ERROR;
+
+ for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
+ options->filter_g[n].filtn = -1;
+ options->filter_g[n].cd_nelmts = 0;
+ for (k = 0; k < CD_VALUES; k++)
+ options->filter_g[n].cd_values[k] = 0;
+ }
- return (options_table_init(&(options->op_tbl)));
+ return (options_table_init(&(options->op_tbl)));
}
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 9573ee8..c31f400 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -54,12 +54,12 @@
*-------------------------------------------------------------------------
*/
static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
- size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p);
+ size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p);
static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr);
static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
- pack_opt_t *options);
+ pack_opt_t *options);
static int copy_user_block(const char *infile, const char *outfile,
- hsize_t size);
+ hsize_t size);
#if defined (H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
@@ -67,10 +67,10 @@ static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void
/* get the major number from the error stack. */
static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) {
- if (err_desc)
- *((hid_t *) udata) = err_desc->maj_num;
+ if (err_desc)
+ *((hid_t *) udata) = err_desc->maj_num;
- return 0;
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -84,28 +84,18 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t
*
* Date: October, 23, 2003
*
- * Modification:
- * Peter Cao, June 13, 2007
- * Add "-L, --latest" and other options to pack a file with the latest file format
- *
- * Peter Cao, September 25, 2007
- * Copy user block when repacking a file
- *
- * Pedro Vicente, August 20, 2008
- * Add a user block to file if requested
- *
*-------------------------------------------------------------------------
*/
int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t fidin;
- hid_t fidout = -1;
- trav_table_t *travt = NULL;
- hsize_t ub_size = 0; /* size of user block */
- hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
- hid_t fapl = H5P_DEFAULT; /* file access property list ID */
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t fidin;
+ hid_t fidout = -1;
+ trav_table_t *travt = NULL;
+ hsize_t ub_size = 0; /* size of user block */
+ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
+ hid_t fapl = H5P_DEFAULT; /* file access property list ID */
/*-------------------------------------------------------------------------
* open input file
@@ -659,7 +649,7 @@ done:
*/
int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
- pack_opt_t *options) /* repack options */
+ pack_opt_t *options) /* repack options */
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t grp_in = -1; /* group ID */
@@ -1497,65 +1487,65 @@ void print_user_block(const char *filename, hid_t fid)
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
int fh; /* file handle */
- hsize_t ub_size; /* user block size */
- hsize_t size; /* size read */
- hid_t fcpl; /* file creation property list ID for HDF5 file */
- int i;
-
- /* get user block size */
- if(( fcpl = H5Fget_create_plist(fid)) < 0) {
- error_msg("failed to retrieve file creation property list\n");
+ hsize_t ub_size; /* user block size */
+ hsize_t size; /* size read */
+ hid_t fcpl; /* file creation property list ID for HDF5 file */
+ int i;
+
+ /* get user block size */
+ if(( fcpl = H5Fget_create_plist(fid)) < 0) {
+ error_msg("failed to retrieve file creation property list\n");
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed");
}
- if(H5Pget_userblock(fcpl, &ub_size) < 0) {
- error_msg("failed to retrieve userblock size\n");
+ if(H5Pget_userblock(fcpl, &ub_size) < 0) {
+ error_msg("failed to retrieve userblock size\n");
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed");
}
- if(H5Pclose(fcpl) < 0) {
- error_msg("failed to close property list\n");
+ if(H5Pclose(fcpl) < 0) {
+ error_msg("failed to close property list\n");
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
}
- /* open file */
- if((fh = HDopen(filename, O_RDONLY, 0)) < 0) {
+ /* open file */
+ if((fh = HDopen(filename, O_RDONLY, 0)) < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed");
}
- size = ub_size;
+ size = ub_size;
- /* read file */
- while(size > 0) {
- ssize_t nread; /* # of bytes read */
- char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
+ /* read file */
+ while(size > 0) {
+ ssize_t nread; /* # of bytes read */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
- /* read buffer */
- if(size > USERBLOCK_XFER_SIZE)
- nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE);
- else
- nread = HDread(fh, rbuf, (size_t)size);
+ /* read buffer */
+ if(size > USERBLOCK_XFER_SIZE)
+ nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE);
+ else
+ nread = HDread(fh, rbuf, (size_t)size);
- for(i = 0; i < nread; i++) {
+ for(i = 0; i < nread; i++) {
- printf("%c ", rbuf[i]);
+ printf("%c ", rbuf[i]);
- }
- printf("\n");
+ }
+ printf("\n");
- if(nread < 0) {
+ if(nread < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0");
}
- /* update size of userblock left to transfer */
- size -= nread;
- }
+ /* update size of userblock left to transfer */
+ size -= nread;
+ }
done:
- if(fh > 0)
- HDclose(fh);
+ if(fh > 0)
+ HDclose(fh);
- return;
+ return;
}
#endif
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 7998ae8..912126f 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -191,14 +191,12 @@ static void usage(const char *prog) {
* Programmer: Quincey Koziol
* Saturday, 31. January 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static void leave(int ret) {
- h5tools_close();
-
- HDexit(ret);
+static void leave(int ret)
+{
+ h5tools_close();
+ HDexit(ret);
}
/*-------------------------------------------------------------------------
@@ -214,134 +212,133 @@ static void leave(int ret) {
*
*-------------------------------------------------------------------------
*/
-
static
-int read_info(const char *filename, pack_opt_t *options) {
-
- char stype[10];
- char comp_info[1024];
- FILE *fp = NULL;
- char c;
- int i, rc = 1;
- int ret_value = EXIT_SUCCESS;
-
- if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) {
- error_msg("cannot open options file %s\n", filename);
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- }
-
- /* cycle until end of file reached */
- while (1) {
- rc = fscanf(fp, "%s", stype);
- if (rc == -1)
- break;
-
- /*-------------------------------------------------------------------------
- * filter
- *-------------------------------------------------------------------------
- */
- if (HDstrcmp(stype,"-f") == 0) {
- /* find begining of info */
- i = 0;
- c = '0';
- while (c != ' ') {
- if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+int read_info(const char *filename, pack_opt_t *options)
+{
+ char stype[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ char comp_info[1024];
+ FILE *fp = NULL;
+ char c;
+ int i, rc = 1;
+ int ret_value = EXIT_SUCCESS;
+
+ if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) {
+ error_msg("cannot open options file %s\n", filename);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+
+ /* cycle until end of file reached */
+ while (1) {
+ rc = fscanf(fp, "%s", stype);
+ if (rc == -1)
+ break;
+
+ /*-------------------------------------------------------------------------
+ * filter
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(stype,"-f") == 0) {
+ /* find begining of info */
+ i = 0;
+ c = '0';
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
error_msg("fscanf error\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
goto done;
} /* end if */
- if (HDfeof(fp))
- break;
- }
- c = '0';
- /* go until end */
- while (c != ' ') {
- if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ if (HDfeof(fp))
+ break;
+ }
+ c = '0';
+ /* go until end */
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
error_msg("fscanf error\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
goto done;
} /* end if */
- comp_info[i] = c;
- i++;
- if (HDfeof(fp))
- break;
- if (c == 10 /*eol*/)
- break;
- }
- comp_info[i - 1] = '\0'; /*cut the last " */
-
- if (h5repack_addfilter(comp_info, options) == -1) {
- error_msg("could not add compression option\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- }
- }
- /*-------------------------------------------------------------------------
- * layout
- *-------------------------------------------------------------------------
- */
- else if (HDstrcmp(stype,"-l") == 0) {
-
- /* find begining of info */
- i = 0;
- c = '0';
- while (c != ' ') {
- if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ comp_info[i] = c;
+ i++;
+ if (HDfeof(fp))
+ break;
+ if (c == 10 /*eol*/)
+ break;
+ }
+ comp_info[i - 1] = '\0'; /*cut the last " */
+
+ if (h5repack_addfilter(comp_info, options) == -1) {
+ error_msg("could not add compression option\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * layout
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(stype,"-l") == 0) {
+
+ /* find begining of info */
+ i = 0;
+ c = '0';
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
error_msg("fscanf error\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
goto done;
} /* end if */
- if (HDfeof(fp))
- break;
- }
- c = '0';
- /* go until end */
- while (c != ' ') {
- if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ if (HDfeof(fp))
+ break;
+ }
+ c = '0';
+ /* go until end */
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
error_msg("fscanf error\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
goto done;
} /* end if */
- comp_info[i] = c;
- i++;
- if (HDfeof(fp))
- break;
- if (c == 10 /*eol*/)
- break;
- }
- comp_info[i - 1] = '\0'; /*cut the last " */
-
- if (h5repack_addlayout(comp_info, options) == -1) {
- error_msg("could not add chunck option\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- }
- }
- /*-------------------------------------------------------------------------
- * not valid
- *-------------------------------------------------------------------------
- */
- else {
- error_msg("bad file format for %s", filename);
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = EXIT_FAILURE;
- goto done;
- }
- }
+ comp_info[i] = c;
+ i++;
+ if (HDfeof(fp))
+ break;
+ if (c == 10 /*eol*/)
+ break;
+ }
+ comp_info[i - 1] = '\0'; /*cut the last " */
+
+ if (h5repack_addlayout(comp_info, options) == -1) {
+ error_msg("could not add chunck option\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * not valid
+ *-------------------------------------------------------------------------
+ */
+ else {
+ error_msg("bad file format for %s", filename);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+ }
done:
- if (fp)
- HDfclose(fp);
+ if (fp)
+ HDfclose(fp);
- return ret_value;
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -351,184 +348,178 @@ done:
*
*-------------------------------------------------------------------------
*/
-
static
-int parse_command_line(int argc, const char **argv, pack_opt_t* options) {
-
- int opt;
- int ret_value = 0;
-
- /* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch ((char) opt) {
-
- /* -i for backward compability */
- case 'i':
- infile = opt_arg;
- has_i_o = 1;
- break;
-
- /* -o for backward compability */
- case 'o':
- outfile = opt_arg;
- has_i_o = 1;
- break;
-
- case 'h':
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_SUCCESS);
- ret_value = -1;
- goto done;
-
- case 'V':
- print_version(h5tools_getprogname());
- h5tools_setstatus(EXIT_SUCCESS);
- ret_value = -1;
- goto done;
-
- case 'v':
- options->verbose = 1;
- break;
-
- case 'f':
- /* parse the -f filter option */
- if (h5repack_addfilter(opt_arg, options) < 0) {
- error_msg("in parsing filter\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
- break;
-
- case 'l':
- /* parse the -l layout option */
- if (h5repack_addlayout(opt_arg, options) < 0) {
- error_msg("in parsing layout\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
- break;
-
- case 'm':
- options->min_comp = HDstrtoull(opt_arg , NULL, 0);
- if ((int) options->min_comp <= 0) {
- error_msg("invalid minimum compress size <%s>\n", opt_arg);
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
- break;
-
- case 'e':
- ret_value = read_info(opt_arg, options);
- if (ret_value < 0)
- goto done;
- break;
-
- case 'n':
- options->use_native = 1;
- break;
-
- case 'L':
- options->latest = 1;
- break;
-
- case 'c':
- options->grp_compact = HDatoi( opt_arg );
- if (options->grp_compact > 0)
- options->latest = 1; /* must use latest format */
- break;
-
- case 'd':
- options->grp_indexed = HDatoi( opt_arg );
- if (options->grp_indexed > 0)
- options->latest = 1; /* must use latest format */
- break;
-
- case 's':
- {
- int idx = 0;
- int ssize = 0;
- char *msgPtr = HDstrchr( opt_arg, ':');
- options->latest = 1; /* must use latest format */
- if (msgPtr == NULL) {
- ssize = HDatoi( opt_arg );
- for (idx = 0; idx < 5; idx++)
- options->msg_size[idx] = ssize;
- }
- else {
- char msgType[10];
- HDstrcpy(msgType, msgPtr + 1);
- msgPtr[0] = '\0';
- ssize = HDatoi( opt_arg );
- if (HDstrncmp(msgType, "dspace",6) == 0) {
- options->msg_size[0] = ssize;
- }
- else if (HDstrncmp(msgType, "dtype", 5) == 0) {
- options->msg_size[1] = ssize;
- }
- else if (HDstrncmp(msgType, "fill", 4) == 0) {
- options->msg_size[2] = ssize;
- }
- else if (HDstrncmp(msgType, "pline", 5) == 0) {
- options->msg_size[3] = ssize;
- }
- else if (HDstrncmp(msgType, "attr", 4) == 0) {
- options->msg_size[4] = ssize;
- }
- }
- }
- break;
-
- case 'u':
- options->ublock_filename = opt_arg;
- break;
-
- case 'b':
- options->ublock_size = (hsize_t) HDatol( opt_arg );
- break;
-
- case 'M':
- options->meta_block_size = (hsize_t) HDatol( opt_arg );
- break;
-
- case 't':
- options->threshold = (hsize_t) HDatol( opt_arg );
- break;
-
- case 'a':
- options->alignment = HDstrtoull(opt_arg , NULL, 0);
- if (options->alignment < 1) {
- error_msg("invalid alignment size\n", opt_arg);
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
- break;
-
- case 'E':
- enable_error_stack = TRUE;
- break;
+int parse_command_line(int argc, const char **argv, pack_opt_t* options)
+{
+ int opt;
+ int ret_value = 0;
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char) opt) {
+
+ /* -i for backward compability */
+ case 'i':
+ infile = opt_arg;
+ has_i_o = 1;
+ break;
+
+ /* -o for backward compability */
+ case 'o':
+ outfile = opt_arg;
+ has_i_o = 1;
+ break;
+
+ case 'h':
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ ret_value = -1;
+ goto done;
- default:
- break;
- } /* switch */
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ ret_value = -1;
+ goto done;
+
+ case 'v':
+ options->verbose = 1;
+ break;
+
+ case 'f':
+ /* parse the -f filter option */
+ if (h5repack_addfilter(opt_arg, options) < 0) {
+ error_msg("in parsing filter\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'l':
+ /* parse the -l layout option */
+ if (h5repack_addlayout(opt_arg, options) < 0) {
+ error_msg("in parsing layout\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+ case 'm':
+ options->min_comp = HDstrtoull(opt_arg , NULL, 0);
+ if ((int) options->min_comp <= 0) {
+ error_msg("invalid minimum compress size <%s>\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'e':
+ ret_value = read_info(opt_arg, options);
+ if (ret_value < 0)
+ goto done;
+ break;
+
+ case 'n':
+ options->use_native = 1;
+ break;
+
+ case 'L':
+ options->latest = TRUE;
+ break;
+
+ case 'c':
+ options->grp_compact = HDatoi( opt_arg );
+ if (options->grp_compact > 0)
+ options->latest = TRUE; /* must use latest format */
+ break;
+
+ case 'd':
+ options->grp_indexed = HDatoi( opt_arg );
+ if (options->grp_indexed > 0)
+ options->latest = TRUE; /* must use latest format */
+ break;
+
+ case 's':
+ {
+ int idx = 0;
+ int ssize = 0;
+ char *msgPtr = HDstrchr( opt_arg, ':');
+ options->latest = TRUE; /* must use latest format */
+ if (msgPtr == NULL) {
+ ssize = HDatoi( opt_arg );
+ for (idx = 0; idx < 5; idx++)
+ options->msg_size[idx] = ssize;
+ }
+ else {
+ char msgType[10];
+
+ HDstrcpy(msgType, msgPtr + 1);
+ msgPtr[0] = '\0';
+ ssize = HDatoi( opt_arg );
+ if (HDstrncmp(msgType, "dspace",6) == 0)
+ options->msg_size[0] = ssize;
+ else if (HDstrncmp(msgType, "dtype", 5) == 0)
+ options->msg_size[1] = ssize;
+ else if (HDstrncmp(msgType, "fill", 4) == 0)
+ options->msg_size[2] = ssize;
+ else if (HDstrncmp(msgType, "pline", 5) == 0)
+ options->msg_size[3] = ssize;
+ else if (HDstrncmp(msgType, "attr", 4) == 0)
+ options->msg_size[4] = ssize;
+ }
+ }
+ break;
+
+ case 'u':
+ options->ublock_filename = opt_arg;
+ break;
+
+ case 'b':
+ options->ublock_size = (hsize_t) HDatol( opt_arg );
+ break;
+
+ case 'M':
+ options->meta_block_size = (hsize_t) HDatol( opt_arg );
+ break;
+
+ case 't':
+ options->threshold = (hsize_t) HDatol( opt_arg );
+ break;
+
+ case 'a':
+ options->alignment = HDstrtoull(opt_arg , NULL, 0);
+ if (options->alignment < 1) {
+ error_msg("invalid alignment size\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'E':
+ enable_error_stack = TRUE;
+ break;
+
+ default:
+ break;
+ } /* switch */
} /* while */
if (has_i_o == 0) {
- /* check for file names to be processed */
- if (argc <= opt_ind || argv[opt_ind + 1] == NULL) {
- error_msg("missing file names\n");
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- }
- }
+ /* check for file names to be processed */
+ if (argc <= opt_ind || argv[opt_ind + 1] == NULL) {
+ error_msg("missing file names\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
+ }
done:
- return ret_value;
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -548,16 +539,16 @@ done:
*
*-------------------------------------------------------------------------
*/
-int main(int argc, const char **argv) {
+int main(int argc, const char **argv)
+{
+ pack_opt_t options; /*the global options */
H5E_auto2_t func;
H5E_auto2_t tools_func;
void *edata;
void *tools_edata;
- pack_opt_t options; /*the global options */
-
- h5tools_setprogname(PROGRAMNAME);
- h5tools_setstatus(EXIT_SUCCESS);
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
@@ -610,12 +601,12 @@ int main(int argc, const char **argv) {
}
/* pack it */
- h5tools_setstatus(h5repack(infile, outfile, &options));
+ h5tools_setstatus(h5repack(infile, outfile, &options));
done:
- /* free tables */
- h5repack_end(&options);
+ /* free tables */
+ h5repack_end(&options);
- leave(h5tools_getstatus());
+ leave(h5tools_getstatus());
}
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 004b9e4..6759169 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -47,9 +47,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
int k, l, p, q, end_obj = -1, no_param = 0;
unsigned j, n;
char sobj[MAX_NC_NAME];
- char scomp[10];
- char stype[6];
- char smask[3];
+ char scomp[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ char stype[6] = {0, 0, 0, 0, 0, 0};
+ char smask[3] = {0, 0, 0};
obj_list_t* obj_list = NULL;
unsigned pixels_per_block;
@@ -396,6 +396,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
error_msg("invalid filter type in <%s>\n", str);
HDexit(EXIT_FAILURE);
}
+ break;
}
} /*i*/
diff --git a/tools/h5repack/h5repack_plugin.sh.in b/tools/h5repack/h5repack_plugin.sh.in
index 336b3a4..ce77e43 100644
--- a/tools/h5repack/h5repack_plugin.sh.in
+++ b/tools/h5repack/h5repack_plugin.sh.in
@@ -1,16 +1,16 @@
#! /bin/sh
#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
-# the files COPYING and Copyright.html. COPYING can be found at the root
-# of the source code distribution tree; Copyright.html can be found at the
-# root level of an installed copy of the electronic document set and is
-# linked from the top-level documents page. It can also be found at
-# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access
-# to either file, you may request a copy from help@hdfgroup.org.
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic document set and is
+# linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access
+# to either file, you may request a copy from help@hdfgroup.org.
#
srcdir=@srcdir@
TOP_BUILDDIR=@top_builddir@
@@ -246,9 +246,10 @@ TOOLTEST_DUMP()
##############################################################################
# prepare for test
COPY_TESTFILES_TO_TESTDIR
+version_str=`echo @H5_VERSION@ | awk -F"-" '{print $1}' | sed 's/\./,/g'`
# Run the test
-arg="h5repack_layout.h5 -v -f UD=260,4,9,1,8,18"
+arg="h5repack_layout.h5 -v -f UD=260,4,9,$version_str"
TOOLTEST_DUMP plugin_version_test $arg
arg="h5repack_layout.h5 -v -f UD=257,1,9"
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 60962aa..4993cbd 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -39,11 +39,6 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
* Programmer: Pedro Vicente, pvn@hdfgroup.org
*
* Date: December 19, 2003
- * Modified: December, 19, 2007 (exactly 4 years later :-) )
- * Separate into 3 cases
- * 1) no filter input, get all datasets and compare DCPLs. TO DO
- * 2) filter input on selected datasets, get each one trough OBJ and match
- * 3) filter input on all datasets, get all objects and match
*
*-------------------------------------------------------------------------
*/
@@ -524,7 +519,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
{
case H5Z_FILTER_NONE:
- break;
+ break;
case H5Z_FILTER_SHUFFLE:
/* 1 private client value is returned by DCPL */
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 8221160..32d69bb 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -1537,7 +1537,7 @@ int main (void)
hid_t fapl;
fapl = h5_fileaccess();
- h5_cleanup(H5REPACK_FILENAMES, fapl);
+ h5_clean_files(H5REPACK_FILENAMES, fapl);
}
diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
index 9f69270..09b2484 100644
--- a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
+++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
@@ -11,7 +11,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 8 18 }
+ PARAMS { 9 1 8 19 }
}
}
FILLVALUE {
@@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 8 18 }
+ PARAMS { 9 1 8 19 }
}
}
FILLVALUE {
@@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 8 18 }
+ PARAMS { 9 1 8 19 }
}
}
FILLVALUE {
@@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 8 18 }
+ PARAMS { 9 1 8 19 }
}
}
FILLVALUE {
@@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 8 18 }
+ PARAMS { 9 1 8 19 }
}
}
FILLVALUE {
@@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 8 18 }
+ PARAMS { 9 1 8 19 }
}
}
FILLVALUE {
@@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 8 18 }
+ PARAMS { 9 1 8 19 }
}
}
FILLVALUE {