summaryrefslogtreecommitdiffstats
path: root/perform/zip_perf.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
commiteb89d7b53ab95623ab454186a602e1cafc7391f0 (patch)
treeceafe458b3011e38853e765352d3c7e59bbecce1 /perform/zip_perf.c
parent3e468e6ff65d540a439e99ea568a6bff7add7cea (diff)
downloadhdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.zip
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.gz
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.bz2
[svn-r22105] Description:
Bring r20557:22085 from trunk to this branch, also fixing some other issues/failures in the branch simultaneously. The h5repack tests are still failing, but Neil will be checking into those, so the branch can be fully functional again. Tested on: Mac OSX/64 10.7.3 (amazon) w/debug
Diffstat (limited to 'perform/zip_perf.c')
-rw-r--r--perform/zip_perf.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/perform/zip_perf.c b/perform/zip_perf.c
index 5729baf..585dc13 100644
--- a/perform/zip_perf.c
+++ b/perform/zip_perf.c
@@ -23,6 +23,7 @@
/* our header files */
#include "h5test.h"
+#include "h5tools.h"
#include "h5tools_utils.h"
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -66,9 +67,9 @@
#endif
/* internal variables */
-static const char *prog;
-static const char *option_prefix;
-static char *filename;
+static const char *prog=NULL;
+static const char *option_prefix=NULL;
+static char *filename=NULL;
static int compress_percent = 0;
static int compress_level = Z_DEFAULT_COMPRESSION;
static int output, random_test = FALSE;
@@ -175,6 +176,7 @@ cleanup(void)
{
if (!getenv("HDF5_NOCLEANUP"))
unlink(filename);
+ free(filename);
}
static void
@@ -292,10 +294,11 @@ uncompress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
* Programmer: Bill Wendling, 06. June 2002
* Modifications:
*/
+#define ZIP_PERF_FILE "zip_perf.data"
static void
get_unique_name(void)
{
- const char *prefix = NULL, *tmpl = "zip_perf.data";
+ const char *prefix = NULL;
const char *env = getenv("HDF5_PREFIX");
if (env)
@@ -305,19 +308,20 @@ get_unique_name(void)
prefix = option_prefix;
if (prefix)
- /* 2 = 1 for '/' + 1 for null terminator */
- filename = (char *) HDmalloc(strlen(prefix) + strlen(tmpl) + 2);
+ /* 2 = 1 for '/' + 1 for null terminator */
+ filename = (char *) HDmalloc(strlen(prefix) + strlen(ZIP_PERF_FILE) + 2);
else
- filename = (char *) HDmalloc(strlen(tmpl) + 1);
+ filename = (char *) HDmalloc(strlen(ZIP_PERF_FILE) + 1);
if (!filename)
error("out of memory");
+ filename[0] = 0;
if (prefix){
- strcpy(filename, prefix);
- strcat(filename, "/");
+ strcpy(filename, prefix);
+ strcat(filename, "/");
}
- strcat(filename, tmpl);
+ strcat(filename, ZIP_PERF_FILE);
}
/*
@@ -410,7 +414,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
register unsigned u;
h5_stat_t stat_buf;
- if (stat("/dev/urandom", &stat_buf) == 0) {
+ if (HDstat("/dev/urandom", &stat_buf) == 0) {
uLongf len = src_len;
Bytef *buf = src;
int fd = HDopen("/dev/urandom", O_RDONLY, 0);
@@ -570,6 +574,9 @@ main(int argc, char **argv)
int opt;
prog = argv[0];
+
+ /* Initialize h5tools lib */
+ h5tools_init();
while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) > 0) {
switch ((char)opt) {