diff options
Diffstat (limited to 'tools/h5repack')
-rw-r--r-- | tools/h5repack/H5srcdir.h.in | 52 | ||||
-rw-r--r-- | tools/h5repack/Makefile.in | 9 | ||||
-rw-r--r-- | tools/h5repack/h5repack.h | 2 | ||||
-rwxr-xr-x | tools/h5repack/h5repack.sh.in | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 9 | ||||
-rw-r--r-- | tools/h5repack/h5repack_main.c | 12 | ||||
-rw-r--r-- | tools/h5repack/h5repack_verify.c | 6 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_detect_szip.c | 2 |
8 files changed, 75 insertions, 19 deletions
diff --git a/tools/h5repack/H5srcdir.h.in b/tools/h5repack/H5srcdir.h.in new file mode 100644 index 0000000..b7a75af --- /dev/null +++ b/tools/h5repack/H5srcdir.h.in @@ -0,0 +1,52 @@ +/* If you are reading this file and it has a '.h' suffix, it was automatically + * generated from the '.in' version. Make changes there. + */ + +/* Set the 'srcdir' path from configure time */ +static const char *config_srcdir = "@srcdir@"; + +/* Buffer to construct path in and return pointer to */ +static char srcdir_path[1024] = ""; + +/* Buffer to construct file in and return pointer to */ +static char srcdir_testpath[1024] = ""; + +/* Append the test file name to the srcdir path and return the whole string */ +static const char *H5_get_srcdir_filename(const char *filename) +{ + const char *srcdir = HDgetenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if(NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to test file */ + if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) { + HDstrcpy(srcdir_testpath, srcdir); + HDstrcat(srcdir_testpath, "/"); + HDstrcat(srcdir_testpath, filename); + return(srcdir_testpath); + } /* end if */ + else + return(NULL); +} + +/* Just return the srcdir path */ +static const char *H5_get_srcdir(void) +{ + const char *srcdir = HDgetenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if(NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to all test files */ + if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) { + HDstrcpy(srcdir_path, srcdir); + HDstrcat(srcdir_path, "/"); + return(srcdir_path); + } /* end if */ + else + return(NULL); +} + diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index aa7781e..58f5f6d 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -51,8 +51,9 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/h5repack.sh.in $(top_srcdir)/config/commence.am \ +DIST_COMMON = $(srcdir)/H5srcdir.h.in $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/h5repack.sh.in \ + $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am noinst_PROGRAMS = testh5repack_detect_szip$(EXEEXT) check_PROGRAMS = $(am__EXEEXT_1) @@ -65,7 +66,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = h5repack.sh +CONFIG_CLEAN_FILES = H5srcdir.h h5repack.sh CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" am__EXEEXT_1 = h5repacktst$(EXEEXT) @@ -449,6 +450,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +H5srcdir.h: $(top_builddir)/config.status $(srcdir)/H5srcdir.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ h5repack.sh: $(top_builddir)/config.status $(srcdir)/h5repack.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 4a35dd1..3c3b9b8 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -17,6 +17,8 @@ #ifndef H5REPACK_H__ #define H5REPACK_H__ +#include <assert.h> +#include <string.h> #include "hdf5.h" #include "h5trav.h" diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 69f5059..32622a0 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -435,7 +435,7 @@ else fi #file -arg="$FILE4 -e $INFO_FILE" +arg="$FILE4 -e $srcdir/$INFO_FILE" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 8075a77..c7d8b1e 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -14,9 +14,16 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" -#include "h5test.h" #include "h5tools.h" +/* number of members in an array */ +#ifndef NELMTS +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +#endif + +/* minimum of two values */ +#undef MIN +#define MIN(a,b) (((a)<(b)) ? (a) : (b)) /*------------------------------------------------------------------------- * Function: aux_find_obj diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 03aaa46..78bae25 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -513,18 +513,8 @@ void read_info(const char *filename, FILE *fp; char c; int i, rc=1; - char *srcdir = getenv("srcdir"); /* the source directory */ - char data_file[512]=""; /* buffer to hold name of existing file */ - /* compose the name of the file to open, using the srcdir, if appropriate */ - if (srcdir){ - strcpy(data_file,srcdir); - strcat(data_file,"/"); - } - strcat(data_file,filename); - - - if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { + if ((fp = fopen(filename, "r")) == (FILE *)NULL) { error_msg(progname, "cannot open options file %s\n", filename); exit(EXIT_FAILURE); } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 385deee..ac4570b 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -14,13 +14,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" -#include "h5test.h" #include "h5tools_utils.h" extern char *progname; static int verify_layout(hid_t pid, pack_info_t *obj); static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); +/* number of members in an array */ +#ifndef NELMTS +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +#endif + /*------------------------------------------------------------------------- * Function: h5repack_verify diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c index 906996a..b16e0d4 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -16,8 +16,6 @@ #include <stdio.h> #include "h5repack.h" #include "h5tools.h" -#include "h5test.h" - /*------------------------------------------------------------------------- |