summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-01-23 20:46:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-01-23 20:46:34 (GMT)
commit56e3f667d6e3e265ac044f3faf1b17137556e0f7 (patch)
tree70f04688f0596ca5be22dd4e9260f601ee77bbd8
parentb09695738a95d8f1fb823894d1880f28dc16669c (diff)
downloadhdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.zip
hdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.tar.gz
hdf5-56e3f667d6e3e265ac044f3faf1b17137556e0f7.tar.bz2
[svn-r11886] Purpose:
Code cleanup Description: Check in some of the code cleanups from working on the external link support. (This doesn't include any of the external link features) Platforms tested: FreeBSD 4.11 (sleipnir) Mac OSX.4 (amazon) Linux 2.4
-rw-r--r--MANIFEST1
-rw-r--r--hl/src/H5LT.c4
-rw-r--r--perform/perf.c2
-rw-r--r--src/H5FDlog.c4
-rw-r--r--src/H5Fpublic.h2
-rw-r--r--src/H5Gname.c10
-rw-r--r--src/H5Gtraverse.c3
-rw-r--r--src/H5Oshared.c6
-rw-r--r--src/H5RS.c6
-rw-r--r--src/H5detect.c4
-rw-r--r--test/b+tree.c3
-rw-r--r--test/cache.c2
-rw-r--r--test/dsets.c36
-rw-r--r--test/dt_arith.c20
-rw-r--r--test/error_test.c6
-rw-r--r--test/tattr.c1
-rw-r--r--test/trefstr.c2
-rw-r--r--test/unlink.c18
-rw-r--r--tools/h5diff/h5diff_common.c2
-rw-r--r--tools/h5diff/h5diff_common.h2
-rw-r--r--tools/h5diff/h5diff_main.c2
-rw-r--r--tools/h5diff/ph5diff_main.c4
-rw-r--r--tools/h5dump/h5dump.c1467
-rw-r--r--tools/h5dump/h5dump.h129
-rw-r--r--tools/h5dump/h5dumpgentest.c2
-rwxr-xr-xtools/h5import/h5import.c35
-rwxr-xr-xtools/h5import/h5import.h6
-rwxr-xr-xtools/h5import/h5importtest.c5
-rw-r--r--tools/h5ls/h5ls.c6
-rw-r--r--tools/h5repack/h5repack.h82
-rw-r--r--tools/h5repack/h5repack_copy.c2
-rw-r--r--tools/h5repack/h5repack_main.c22
-rw-r--r--tools/h5repack/h5repack_parse.c8
-rw-r--r--tools/h5repack/testh5repack.h97
-rw-r--r--tools/h5repack/testh5repack_attr.c1
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c1
-rw-r--r--tools/h5repack/testh5repack_dset.c1
-rw-r--r--tools/h5repack/testh5repack_main.c1
-rw-r--r--tools/h5repack/testh5repack_make.c3
-rw-r--r--tools/h5repack/testh5repack_util.c1
-rw-r--r--tools/lib/h5diff.c87
-rw-r--r--tools/lib/h5diff_array.c44
-rw-r--r--tools/lib/h5tools.c29
-rw-r--r--tools/lib/h5tools.h159
-rw-r--r--tools/lib/h5tools_ref.c27
-rw-r--r--tools/lib/h5tools_str.c12
-rw-r--r--tools/lib/h5tools_str.h8
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/lib/h5trav.c83
-rw-r--r--tools/lib/h5trav.h7
-rw-r--r--tools/misc/h5repart_gentest.c2
-rw-r--r--tools/misc/h5stat.c6
-rw-r--r--tools/testfiles/h5diff_25.txt2
53 files changed, 1198 insertions, 1279 deletions
diff --git a/MANIFEST b/MANIFEST
index 0058601..d44b962 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -853,6 +853,7 @@
./tools/h5repack/h5repack_parse.c
./tools/h5repack/h5repack_refs.c
./tools/h5repack/h5repack_verify.c
+./tools/h5repack/testh5repack.h
./tools/h5repack/testh5repack_attr.c
./tools/h5repack/testh5repack_dset.c
./tools/h5repack/testh5repack_main.c
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 432d696..bee7612 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -2110,8 +2110,8 @@ print_enum(hid_t type, char* str, int indt)
dst_size = H5Tget_size(native);
/* Get the names and raw values of all members */
- name = (char**)calloc(nmembs, sizeof(char *));
- value = (unsigned char*)calloc(nmembs, MAX(dst_size, super_size));
+ name = (char**)calloc((size_t)nmembs, sizeof(char *));
+ value = (unsigned char*)calloc((size_t)nmembs, MAX(dst_size, super_size));
for (i = 0; i < nmembs; i++) {
if((name[i] = H5Tget_member_name(type, i))==NULL)
diff --git a/perform/perf.c b/perform/perf.c
index 8f5d096..0f47bee 100644
--- a/perform/perf.c
+++ b/perform/perf.c
@@ -460,7 +460,7 @@ double Wtime()
#else /* H5_HAVE_PARALLEL */
/* dummy program since H5_HAVE_PARALLE is not configured in */
int
-main()
+main(int UNUSED argc, char UNUSED **argv)
{
printf("No parallel performance because parallel is not configured in\n");
return(0);
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 5725f87..b933182 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -560,11 +560,11 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
/* Check if we are doing any logging at all */
if(file->fa.flags!=0) {
file->iosize=fa->buf_size;
- if(file->fa.flags&H5FD_LOG_NUM_READ) {
+ if(file->fa.flags&H5FD_LOG_FILE_READ) {
file->nread=H5MM_calloc(file->iosize);
assert(file->nread);
} /* end if */
- if(file->fa.flags&H5FD_LOG_NUM_WRITE) {
+ if(file->fa.flags&H5FD_LOG_FILE_WRITE) {
file->nwrite=H5MM_calloc(file->iosize);
assert(file->nwrite);
} /* end if */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index a38fe25..7243c98 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -62,7 +62,7 @@
#define H5F_OBJ_LOCAL (0x0020u) /* Restrict search to objects opened through current file ID */
/* (as opposed to objects opened through any file ID accessing this file) */
-#define H5F_FAMILY_DEFAULT 0
+#define H5F_FAMILY_DEFAULT (hsize_t)0
#ifdef H5_HAVE_PARALLEL
/*
diff --git a/src/H5Gname.c b/src/H5Gname.c
index c4f5c95..cc4e77b 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -169,7 +169,7 @@ H5G_build_fullpath(const char *prefix, const char *name)
path_len += HDstrlen(name) + need_sep;
/* Allocate space for the path */
- if(NULL == (full_path = H5FL_BLK_MALLOC(str_buf, path_len + 1)))
+ if(NULL == (full_path = (char *)H5FL_BLK_MALLOC(str_buf, path_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Build full path */
@@ -575,7 +575,7 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char
/* Allocate space for the new path */
new_path_len = path_prefix2_len + HDstrlen(dst_suffix) + full_suffix_len;
- if(NULL == (new_path = H5FL_BLK_MALLOC(str_buf, new_path_len + 1)))
+ if(NULL == (new_path = (char *)H5FL_BLK_MALLOC(str_buf, new_path_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the new path */
@@ -706,7 +706,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Allocate space for the new full path */
new_full_len = HDstrlen(src_path) + HDstrlen(full_path);
- if(NULL == (new_full_path = H5FL_BLK_MALLOC(str_buf, new_full_len + 1)))
+ if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, new_full_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the new full path */
@@ -752,7 +752,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Build new full path */
/* Create the new full path */
- if(NULL == (new_full_path = H5FL_BLK_MALLOC(str_buf, HDstrlen(full_suffix) + 1)))
+ if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, HDstrlen(full_suffix) + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HDstrcpy(new_full_path, full_suffix);
@@ -838,7 +838,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Allocate space for the new full path */
new_full_len = HDstrlen(dst_path) + HDstrlen(full_suffix);
- if(NULL == (new_full_path = H5FL_BLK_MALLOC(str_buf, new_full_len + 1)))
+ if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, new_full_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Create the new full path */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 8a53064..60ab54b 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -416,9 +416,8 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Set the object location, if it's a hard link set the address also */
obj_loc.oloc->file = grp_loc.oloc->file;
- if(lnk.type == H5G_LINK_HARD) {
+ if(lnk.type == H5G_LINK_HARD)
obj_loc.oloc->addr = lnk.u.hard.addr;
- } /* end if */
obj_loc_valid = TRUE;
/*
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index a8e8246..cdba678 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -107,6 +107,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_shared_t *shared, const H5O_msg_cla
HDassert(shared);
HDassert(type);
+ /* Get the shared message */
ret_value = H5O_read_real(&(shared->oloc), type, 0, mesg, dxpl_id);
if(type->set_share && (type->set_share)(f, ret_value, shared) < 0)
HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to set sharing information")
@@ -321,14 +322,11 @@ done:
* Programmer: Robb Matzke
* Thursday, April 2, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
-H5O_shared_size (const H5F_t *f, const void *_mesg)
+H5O_shared_size (const H5F_t *f, const void UNUSED *_mesg)
{
- const H5O_shared_t *shared = (const H5O_shared_t *) _mesg;
size_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_shared_size);
diff --git a/src/H5RS.c b/src/H5RS.c
index 49128b1..c8f1ecc 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -65,7 +65,7 @@ H5RS_xstrdup(const char *s)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5RS_xstrdup)
if(s) {
- ret_value = H5FL_BLK_MALLOC(str_buf, HDstrlen(s) + 1);
+ ret_value = (char *)H5FL_BLK_MALLOC(str_buf, HDstrlen(s) + 1);
HDassert(ret_value);
HDstrcpy(ret_value, s);
} /* end if */
@@ -147,7 +147,7 @@ H5RS_wrap(const char *s)
HGOTO_ERROR(H5E_RS,H5E_NOSPACE,NULL,"memory allocation failed");
/* Set the internal fields */
- ret_value->s=(char*)s;
+ ret_value->s=(char*)s; /* (Cast away const OK - QAK) */
ret_value->wrapped=1;
ret_value->n=1;
@@ -347,7 +347,7 @@ H5RS_dup_str(const char *s)
path_len = HDstrlen(s);
/* Allocate space for the string */
- if(NULL == (new_str = H5FL_BLK_MALLOC(str_buf, path_len + 1)))
+ if(NULL == (new_str = (char *)H5FL_BLK_MALLOC(str_buf, path_len + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy name for full path */
diff --git a/src/H5detect.c b/src/H5detect.c
index d5af70c..4b15c36 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -520,10 +520,6 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align)
#include \"H5FLprivate.h\"\n\
#include \"H5Tpkg.h\"\n\
\n\
-/* Declare external the free lists for H5T_t's and H5T_shared_t's */\n\
-H5FL_EXTERN(H5T_t);\n\
-H5FL_EXTERN(H5T_shared_t);\n\
-\n\
\n");
/* The interface initialization function */
diff --git a/test/b+tree.c b/test/b+tree.c
index 1c756b8..b29c192 100644
--- a/test/b+tree.c
+++ b/test/b+tree.c
@@ -108,6 +108,7 @@ error:
*
*-------------------------------------------------------------------------
*/
+#ifdef QAK
static int
test_insert_basic(hid_t fapl)
{
@@ -116,7 +117,6 @@ test_insert_basic(hid_t fapl)
H5F_t *f=NULL;
char *record; /* Record to insert into tree */
haddr_t bpt_addr; /* Address of B+ tree created */
- herr_t ret; /* Generic error return value */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
@@ -153,6 +153,7 @@ error:
} H5E_END_TRY;
return 1;
} /* test_insert_basic() */
+#endif /* QAK */
/*-------------------------------------------------------------------------
diff --git a/test/cache.c b/test/cache.c
index 84943ee..fbe93a5 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -1917,7 +1917,7 @@ static void
insert_entry(H5C_t * cache_ptr,
int32_t type,
int32_t idx,
- hbool_t dirty,
+ hbool_t UNUSED dirty,
unsigned int flags)
{
herr_t result;
diff --git a/test/dsets.c b/test/dsets.c
index 3d6fab3..8555168 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2573,7 +2573,7 @@ test_nbit_int(hid_t file)
for (i= 0;i< size[0]; i++)
for (j = 0; j < size[1]; j++) {
orig_data[i][j] = (int)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision - 1)) << offset);
+ (long_long)HDpow(2.0, (double)(precision - 1))) << offset);
/* even-numbered values are negtive */
if((i*size[1]+j+1)%2 == 0)
@@ -2987,7 +2987,7 @@ test_nbit_array(hid_t file)
for (m = 0; m < adims[0]; m++)
for (n = 0; n < adims[1]; n++)
orig_data[i][j][m][n] = (unsigned int)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision)) << offset);
+ (long_long)HDpow(2.0, (double)precision)) << offset);
PASSED();
#else
SKIPPED();
@@ -3167,11 +3167,11 @@ test_nbit_compound(hid_t file)
for (i= 0;i< size[0]; i++)
for (j = 0; j < size[1]; j++) {
orig_data[i][j].i = (int)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[0]-1)) << offset[0]);
+ (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]);
orig_data[i][j].c = (char)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[1]-1)) << offset[1]);
+ (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]);
orig_data[i][j].s = (short)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[2]-1)) << offset[2]);
+ (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]);
orig_data[i][j].f = float_val[i][j];
/* some even-numbered integer values are negtive */
@@ -3414,29 +3414,29 @@ test_nbit_compound_2(hid_t file)
for (i= 0;i< size[0]; i++)
for (j = 0; j < size[1]; j++) {
orig_data[i][j].a.i = (int)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[0]-1)) << offset[0]);
+ (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]);
orig_data[i][j].a.c = (char)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[1]-1)) << offset[1]);
+ (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]);
orig_data[i][j].a.s = (short)(-((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[2]-1)) << offset[2]);
+ (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]);
orig_data[i][j].a.f = float_val[i][j];
orig_data[i][j].v = (unsigned int)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[3])) << offset[3]);
+ (long_long)HDpow(2.0, (double)precision[3])) << offset[3]);
for(m = 0; m < array_dims[0]; m++)
for(n = 0; n < array_dims[1]; n++)
orig_data[i][j].b[m][n] = (char)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[4]-1)) << offset[4]);
+ (long_long)HDpow(2.0, (double)(precision[4]-1))) << offset[4]);
for(m = 0; m < array_dims[0]; m++)
for(n = 0; n < array_dims[1]; n++) {
orig_data[i][j].d[m][n].i = (int)(-((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[0]-1)) << offset[0]);
+ (long_long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]);
orig_data[i][j].d[m][n].c = (char)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[1]-1)) << offset[1]);
+ (long_long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]);
orig_data[i][j].d[m][n].s = (short)(((long_long)HDrandom() %
- (long_long)HDpow(2.0, precision[2]-1)) << offset[2]);
+ (long_long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]);
orig_data[i][j].d[m][n].f = float_val[i][j];
}
}
@@ -3639,7 +3639,7 @@ test_nbit_compound_3(hid_t file)
/* Initialize data */
for(i = 0; i < size[0]; i++) {
- orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17-1);
+ orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0);
strcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = strdup("variable-length C string");
@@ -4131,7 +4131,7 @@ test_scaleoffset_float(hid_t file)
/* Check that the values read are the same as the values written */
for (i=0; i<size[0]; i++) {
for (j=0; j<size[1]; j++) {
- if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -3)) {
+ if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -3.0)) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -4281,7 +4281,7 @@ test_scaleoffset_float_2(hid_t file)
/* Check that the values read are the same as the values written */
for (j=0; j<size[1]; j++) {
- if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -3)) {
+ if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -3.0)) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
@@ -4411,7 +4411,7 @@ test_scaleoffset_double(hid_t file)
/* Check that the values read are the same as the values written */
for (i=0; i<size[0]; i++) {
for (j=0; j<size[1]; j++) {
- if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -7)) {
+ if (HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -7.0)) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -4561,7 +4561,7 @@ test_scaleoffset_double_2(hid_t file)
/* Check that the values read are the same as the values written */
for (j=0; j<size[1]; j++) {
- if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -7)) {
+ if (HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -7.0)) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 36ca72c..86aca82 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -372,7 +372,7 @@ static int without_hardware_g = 0;
void some_dummy_func(float x);
static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits);
static int my_isnan(dtype_t type, void *val);
-static int my_isinf(dtype_t type, int endian, unsigned char *val, size_t size,
+static int my_isinf(int endian, unsigned char *val, size_t size,
size_t mpos, size_t msize, size_t epos, size_t esize);
/*-------------------------------------------------------------------------
@@ -708,14 +708,14 @@ static int test_particular_fp_integer(void)
signed char dst_c;
unsigned char *buf1, *buf2;
unsigned char *saved_buf1, *saved_buf2;
- unsigned int src_size1, src_size2;
- unsigned int dst_size1, dst_size2;
+ size_t src_size1, src_size2;
+ size_t dst_size1, dst_size2;
float src_f = (float)INT_MAX;
int dst_i;
int fill_value = 13;
int endian; /*endianess */
unsigned int fails_this_test = 0;
- int j;
+ size_t j;
TESTING("hard particular floating number -> integer conversions");
@@ -2681,12 +2681,12 @@ my_isnan(dtype_t type, void *val)
*-------------------------------------------------------------------------
*/
static int
-my_isinf(dtype_t type, int endian, unsigned char *val, size_t size,
+my_isinf(int endian, unsigned char *val, size_t size,
size_t mpos, size_t msize, size_t epos, size_t esize)
{
unsigned char *bits;
int retval = 0;
- int i;
+ size_t i;
ssize_t ret1=0, ret2=0;
bits = (unsigned char*)calloc(1, size);
@@ -3088,7 +3088,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
if (underflow &&
HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
continue; /* all underflowed, no error */
- if (overflow && my_isinf(dst_type, endian, buf+j*sizeof(float),
+ if (overflow && my_isinf(endian, buf+j*sizeof(float),
dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
continue; /* all overflowed, no error */
check_mant[0] = HDfrexpf(x, check_expo+0);
@@ -3099,7 +3099,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
if (underflow &&
HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
continue; /* all underflowed, no error */
- if (overflow && my_isinf(dst_type, endian, buf+j*sizeof(double),
+ if (overflow && my_isinf(endian, buf+j*sizeof(double),
dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
continue; /* all overflowed, no error */
check_mant[0] = HDfrexp(x, check_expo+0);
@@ -4389,8 +4389,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
if(run_test==TEST_NORMAL)
return MAX((int)fails_all_tests, 1);
- else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL)
+ else {
+ HDassert(run_test==TEST_DENORM || run_test==TEST_SPECIAL);
return 1;
+ }
}
diff --git a/test/error_test.c b/test/error_test.c
index b7994a0..ad3dd11 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -303,8 +303,8 @@ error_stack(void)
*
*-------------------------------------------------------------------------
*/
-herr_t
-long_desc_cb(unsigned n, const H5E_error_t *err_desc, void* client_data)
+static herr_t
+long_desc_cb(unsigned UNUSED n, const H5E_error_t *err_desc, void* client_data)
{
char *real_desc = (char *)client_data;
@@ -335,7 +335,7 @@ long_desc_cb(unsigned n, const H5E_error_t *err_desc, void* client_data)
static herr_t
test_long_desc(void)
{
- char *format="Testing very long description string, %s";
+ const char *format="Testing very long description string, %s";
char *long_desc;
char *full_desc;
size_t u;
diff --git a/test/tattr.c b/test/tattr.c
index 2363401..6f41225 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -472,7 +472,6 @@ test_attr_plist(void)
hid_t sid1,sid2; /* Dataspace ID */
hid_t attr; /* Attribute ID */
hid_t plist; /* Property list ID */
- char *attr_name=NULL; /* name of attribute */
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {ATTR1_DIM1};
H5T_cset_t cset; /* Character set for attributes */
diff --git a/test/trefstr.c b/test/trefstr.c
index eca4aaf..4ba6df5 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -300,7 +300,7 @@ test_refstr_own(void)
MESSAGE(5, ("Testing Transferring Ref-Counted Strings\n"));
/* Initialize buffer */
- s = H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1);
+ s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1);
HDstrcpy(s, "foo");
/* Transfer ownership of dynamically allocated string to ref-counted string */
diff --git a/test/unlink.c b/test/unlink.c
index 37bd55b..607f89f 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -1504,7 +1504,7 @@ test_unlink_rightleaf(hid_t fid)
ngroups = 150; /* Number of groups to create */
char name[256]; /* Name of object to create */
- TESTING("Deleting right-most child in non-leaf B-tree node");
+ TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
@@ -1568,7 +1568,7 @@ test_unlink_rightnode(hid_t fid)
ngroups = 150; /* Number of groups to create */
char name[256]; /* Name of object to create */
- TESTING("Deleting right-most child in non-leaf B-tree node");
+ TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
@@ -1632,7 +1632,7 @@ test_unlink_middlenode(hid_t fid)
ngroups = 250; /* Number of groups to create */
char name[256]; /* Name of object to create */
- TESTING("Deleting right-most child in non-leaf B-tree node");
+ TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
@@ -1836,7 +1836,7 @@ test_resurrect_dataset(void)
hid_t f=-1, s=-1, d=-1, fapl=-1;
char filename[1024];
- TESTING("Resurrecting dataset after deletion");
+ TESTING("resurrecting dataset after deletion");
/* Create file */
fapl = h5_fileaccess();
@@ -1910,7 +1910,7 @@ test_resurrect_datatype(void)
hid_t file=-1, type=-1, fapl=-1;
char filename[1024];
- TESTING("Resurrecting datatype after deletion");
+ TESTING("resurrecting datatype after deletion");
/* Create file */
fapl = h5_fileaccess();
@@ -1980,7 +1980,7 @@ test_resurrect_group(void)
hid_t file=-1, group=-1, fapl=-1;
char filename[1024];
- TESTING("Resurrecting group after deletion");
+ TESTING("resurrecting group after deletion");
/* Create file */
fapl = h5_fileaccess();
@@ -2055,11 +2055,11 @@ test_unlink_chunked_dataset(void)
hsize_t chunk_dims[FILESPACE_NDIMS]={FILESPACE_CHUNK0,FILESPACE_CHUNK1,FILESPACE_CHUNK2};
char filename[1024];
- TESTING("Unlinking chunked dataset");
+ TESTING("unlinking chunked dataset");
/* Create file */
fapl_id = h5_fileaccess();
- h5_fixname(FILENAME[7], fapl_id, filename, sizeof filename);
+ h5_fixname(FILENAME[9], fapl_id, filename, sizeof filename);
/* Create the file */
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))<0) TEST_ERROR;
@@ -2092,7 +2092,7 @@ test_unlink_chunked_dataset(void)
if(H5Fclose(file_id)<0) TEST_ERROR;
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT))<0) TEST_ERROR;
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id))<0) TEST_ERROR;
/* Delete the dataset */
if(H5Gunlink(file_id, DATASETNAME)<0) TEST_ERROR;
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 9210d40..441f291 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -180,7 +180,7 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char**
*-------------------------------------------------------------------------
*/
- void print_results(hsize_t nfound, diff_opt_t* options)
+ void print_results(diff_opt_t* options)
{
if (options->m_quiet || options->err_stat)
return;
diff --git a/tools/h5diff/h5diff_common.h b/tools/h5diff/h5diff_common.h
index 7cdf7cd..31b1b29 100644
--- a/tools/h5diff/h5diff_common.h
+++ b/tools/h5diff/h5diff_common.h
@@ -20,5 +20,5 @@ int check_n_input( const char* );
int check_f_input( const char* );
void parse_input(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options);
void h5diff_exit(int status);
-void print_results(hsize_t nfound, diff_opt_t* options);
+void print_results(diff_opt_t* options);
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 51c618e..cd23d4b 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -63,7 +63,7 @@ int main(int argc, const char *argv[])
nfound = h5diff(fname1,fname2,objname1,objname2,&options);
- print_results(nfound, &options);
+ print_results(&options);
/*-------------------------------------------------------------------------
* exit code
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index c469a4b..bb4cd1a 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -79,7 +79,7 @@ int main(int argc, const char *argv[])
nfound = h5diff(fname1,fname2,objname1,objname2,&options);
- print_results(nfound, &options);
+ print_results(&options);
MPI_Finalize();
@@ -95,7 +95,7 @@ int main(int argc, const char *argv[])
MPI_Barrier(MPI_COMM_WORLD);
- print_results(nfound, &options);
+ print_results(&options);
print_manager_output();
MPI_Finalize();
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 2a99989..8a5e192 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -59,7 +59,7 @@ static char *prefix;
static const char *driver = NULL; /* The driver to open the file with. */
-static const dump_header *dump_header_format;
+static const h5dump_header_t *dump_header_format;
/* things to display or which are set via command line parameters */
static int display_all = TRUE;
@@ -86,21 +86,20 @@ static int doxml = 0;
static int useschema = 1;
static const char *xml_dtd_uri = NULL;
static const char *xmlnsprefix="hdf5:";
+static int indent; /*how far in to indent the line */
/** end XML **/
/* internal functions */
-static hid_t h5_fileaccess(void);
-static void dump_oid(hid_t oid);
-static void print_enum(hid_t type);
-static herr_t dump_all(hid_t group, const char *name, void *op_data);
-#ifdef LATER
-static void check_compression(hid_t);
-#endif /* LATER */
-static int xml_name_to_XID(const char *, char *, int , int );
-static void init_prefix(char **prfx, size_t prfx_len);
-
-static h5dump_t dataformat = {
+static hid_t h5_fileaccess(void);
+static void dump_oid(hid_t oid);
+static void print_enum(hid_t type);
+static herr_t dump_all(hid_t group, const char *name, void *op_data);
+static int xml_name_to_XID(const char *, char *, int , int );
+static void init_prefix(char **prfx, size_t prfx_len);
+static void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+
+static h5tool_format_t dataformat = {
0, /*raw */
"", /*fmt_raw */
@@ -184,7 +183,7 @@ static h5dump_t dataformat = {
*
* This table only affects XML output.
*/
-static h5dump_t xml_dataformat = {
+static h5tool_format_t xml_dataformat = {
0, /*raw */
"", /*fmt_raw */
@@ -255,13 +254,13 @@ static h5dump_t xml_dataformat = {
/** XML **/
-static const dump_header standardformat = {
+static const h5dump_header_t standardformat = {
"standardformat", /*name */
"HDF5", /*fileebgin */
"", /*fileend */
SUPER_BLOCK, /*bootblockbegin */
"", /*bootblockend */
- GROUPNAME, /*groupbegin */
+ GROUP, /*groupbegin */
"", /*groupend */
DATASET, /*datasetbegin */
"", /*datasetend */
@@ -1335,244 +1334,263 @@ static herr_t
dump_all(hid_t group, const char *name, void * op_data)
{
hid_t obj;
- char *targbuf, *tmp = NULL;
+ char *obj_path = NULL; /* Full path of object */
H5G_stat_t statbuf;
herr_t ret = SUCCEED;
- H5Gget_objinfo(group, name, FALSE, &statbuf);
+ /* Stat the object */
+ if(H5Gget_objinfo(group, name, FALSE, &statbuf) < 0) {
+ error_msg(progname, "unable to get object information\n");
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ goto done;
+ } /* end if */
if (*(int *)op_data != H5G_UNKNOWN && statbuf.type != *(int *) op_data)
goto done;
- tmp = malloc(strlen(prefix) + strlen(name) + 2);
- strcpy(tmp, prefix);
+ /* Build the object's path name */
+ obj_path = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDassert(obj_path);
+ HDstrcpy(obj_path, prefix);
+ HDstrcat(obj_path, "/");
+ HDstrcat(obj_path, name);
switch (statbuf.type) {
- case H5G_LINK:
- indentation(indent);
- targbuf = malloc(statbuf.u.slink.linklen);
+ case H5G_LINK:
+ {
+ char *targbuf;
- if (!doxml) {
- begin_obj(dump_header_format->softlinkbegin, name,
- dump_header_format->softlinkblockbegin);
- indentation(indent + COL);
- }
+ indentation(indent);
+ targbuf = HDmalloc(statbuf.u.slink.linklen);
+ HDassert(targbuf);
- if (H5Gget_linkval(group, name, statbuf.u.slink.linklen, targbuf) < 0) {
- error_msg(progname, "unable to get link value\n");
- d_status = EXIT_FAILURE;
- ret = FAIL;
- } else {
- /* print the value of a soft link */
- if (!doxml) {
- /* Standard DDL: no modification */
- printf("LINKTARGET \"%s\"\n", targbuf);
- } else {
- /* XML */
- char *linkxid = malloc(100);
- char *parentxid = malloc(100);
- char *targetxid = malloc(100);
- char *t_prefix = xml_escape_the_name(strcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_targbuf = xml_escape_the_name(targbuf);
- char *tmp2, *t_tmp;
- int res;
-
- tmp2 = malloc(strlen(prefix) + statbuf.u.slink.linklen + 1);
- strcpy(tmp2, prefix);
-
- if (targbuf && targbuf[0] == '/')
- strcpy(tmp2, targbuf);
- else
- strcat(strcat(tmp2, "/"), targbuf);
-
- t_tmp = xml_escape_the_name(strcat(strcat(tmp, "/"), name));
- xml_name_to_XID(t_tmp,linkxid,100,1);
- xml_name_to_XID(prefix,parentxid,100,1);
-
- res = xml_name_to_XID(tmp2,targetxid,100,0);
-
- if (res == 0) {
- /* target obj found */
- printf("<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
+ if (!doxml) {
+ begin_obj(dump_header_format->softlinkbegin, name,
+ dump_header_format->softlinkblockbegin);
+ indentation(indent + COL);
+ }
+
+ if (H5Gget_linkval(group, name, statbuf.u.slink.linklen, targbuf) < 0) {
+ error_msg(progname, "unable to get link value\n");
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } else {
+ /* print the value of a soft link */
+ if (!doxml) {
+ /* Standard DDL: no modification */
+ printf("LINKTARGET \"%s\"\n", targbuf);
+ } else {
+ /* XML */
+ char linkxid[100];
+ char parentxid[100];
+ char targetxid[100];
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_targbuf = xml_escape_the_name(targbuf);
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_link_path;
+ int res;
+
+ t_link_path = HDmalloc(HDstrlen(prefix) + statbuf.u.slink.linklen + 1);
+ if(targbuf[0] == '/')
+ HDstrcpy(t_link_path, targbuf);
+ else {
+ HDstrcpy(t_link_path, prefix);
+ HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
+ } /* end else */
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
+
+ /* Try to create an OBJ-XID for the object pointed to */
+ res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0);
+ if (res == 0) {
+ /* target obj found */
+ printf("<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
"TargetPath=\"%s\" TargetObj=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
- xmlnsprefix,
- t_name,
- linkxid,
- t_tmp,
- t_targbuf, targetxid,
- parentxid, t_prefix);
- free(targetxid);
- } else {
- /* dangling link -- omit from xml attributes */
- printf("<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ targetxid, /* TargetObj */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ } else {
+ /* dangling link -- omit from xml attributes */
+ printf("<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
"TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
- xmlnsprefix,
- t_name,
- linkxid,
- t_tmp,
- t_targbuf,
- parentxid, t_prefix);
- }
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />\n",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ }
- free(t_name);
- free(t_targbuf);
- free(t_tmp);
- free(tmp2);
- free(linkxid);
- free(parentxid);
- }
- }
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_targbuf);
+ HDfree(t_obj_path);
+ HDfree(t_link_path);
+ }
+ }
- if (!doxml) {
- indentation(indent);
- end_obj(dump_header_format->softlinkend,
- dump_header_format->softlinkblockend);
- }
+ if (!doxml) {
+ indentation(indent);
+ end_obj(dump_header_format->softlinkend,
+ dump_header_format->softlinkblockend);
+ }
- free(targbuf);
- break;
+ HDfree(targbuf);
+ break;
+ }
- case H5G_GROUP:
- if ((obj = H5Gopen(group, name)) < 0) {
- error_msg(progname, "unable to dump group \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- ret = FAIL;
- } else {
- size_t new_len = strlen(prefix) + strlen(name) + 2;
+ case H5G_GROUP:
+ if ((obj = H5Gopen(group, name)) < 0) {
+ error_msg(progname, "unable to dump group \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } else {
+ char *old_prefix; /* Pointer to previous prefix */
- if (prefix_len <= new_len) {
- prefix_len = new_len + 1;
- prefix = realloc(prefix, prefix_len);
- }
+ /* Keep copy of prefix before iterating into group */
+ old_prefix = HDstrdup(prefix);
+ HDassert(old_prefix);
- strcat(strcat(prefix, "/"), name);
- dump_function_table->dump_group_function(obj, name);
- strcpy(prefix, tmp);
- H5Gclose(obj);
- }
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- break;
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- case H5G_DATASET:
- if ((obj = H5Dopen(group, name)) >= 0) {
- /* hard link */
- H5Gget_objinfo(obj, ".", TRUE, &statbuf);
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
- if (statbuf.u.obj.nlink > 1) {
- obj_t *found_obj; /* Found object */
+ /* Close group */
+ H5Gclose(obj);
+ }
- found_obj = search_obj(dset_table, statbuf.u.obj.objno);
+ break;
- if (found_obj == NULL) {
- indentation(indent);
- begin_obj(dump_header_format->datasetbegin, name,
- dump_header_format->datasetblockbegin);
- indentation(indent + COL);
- error_msg(progname,
- "internal error (file %s:line %d)\n",
- __FILE__, __LINE__);
- indentation(indent);
- end_obj(dump_header_format->datasetend,
- dump_header_format->datasetblockend);
- d_status = EXIT_FAILURE;
- ret = FAIL;
- H5Dclose(obj);
- goto done;
- } else if (found_obj->displayed) {
- indentation(indent);
+ case H5G_DATASET:
+ if ((obj = H5Dopen(group, name)) >= 0) {
+ /* hard link */
+ H5Gget_objinfo(obj, ".", TRUE, &statbuf);
+
+ if (statbuf.u.obj.nlink > 1) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, statbuf.u.obj.objno);
+
+ if (found_obj == NULL) {
+ indentation(indent);
+ begin_obj(dump_header_format->datasetbegin, name,
+ dump_header_format->datasetblockbegin);
+ indentation(indent + COL);
+ error_msg(progname,
+ "internal error (file %s:line %d)\n",
+ __FILE__, __LINE__);
+ indentation(indent);
+ end_obj(dump_header_format->datasetend,
+ dump_header_format->datasetblockend);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ H5Dclose(obj);
+ goto done;
+ } else if (found_obj->displayed) {
+ indentation(indent);
+
+ if (!doxml) {
+ begin_obj(dump_header_format->datasetbegin, name,
+ dump_header_format->datasetblockbegin);
+ indentation(indent + COL);
+ printf("%s \"%s\"\n", HARDLINK, found_obj->objname);
+ indentation(indent);
+ end_obj(dump_header_format->datasetend,
+ dump_header_format->datasetblockend);
+ } else {
+ /* the XML version */
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char dsetxid[100];
+ char parentxid[100];
+ char pointerxid[100];
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1);
+ xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1);
+
+ printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
+ "H5Path=\"%s\" Parents=\"%s\" "
+ "H5ParentPaths=\"%s\">\n",
+ xmlnsprefix,
+ t_name, /* Dataset Name */
+ dsetxid, get_next_xid(), /* OBJ-XID */
+ t_obj_path, /* H5Path */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+
+ indentation(indent + COL);
+ xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1);
+ printf("<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n",
+ xmlnsprefix,
+ pointerxid,t_obj_path);
+ indentation(indent);
+ printf("</%sDataset>\n", xmlnsprefix);
+
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ HDfree(t_prefix);
+ }
- if (!doxml) {
- begin_obj(dump_header_format->datasetbegin, name,
- dump_header_format->datasetblockbegin);
- indentation(indent + COL);
- printf("%s \"%s\"\n", HARDLINK, found_obj->objname);
- indentation(indent);
- end_obj(dump_header_format->datasetend,
- dump_header_format->datasetblockend);
- } else {
- /* the XML version */
- char *t_tmp;
- char *t_prefix;
- char *t_name;
- char *dsetxid = malloc(100);
- char *parentxid = malloc(100);
- char *pointerxid = malloc(100);
- char *tx_tmp = malloc(strlen(tmp)+strlen(name)+1);
- strcpy(tx_tmp,tmp);
- t_tmp = xml_escape_the_name(strcat(strcat(tx_tmp, "/"), name));
- t_prefix = xml_escape_the_name(prefix);
- t_name = xml_escape_the_name(name);
- xml_name_to_XID( strcat(strcat(tmp,"/"),name), dsetxid,100,1);
- xml_name_to_XID( prefix ,parentxid,100,1);
-
- printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
- "H5Path=\"%s\" Parents=\"%s\" "
- "H5ParentPaths=\"%s\">\n",
- xmlnsprefix,
- t_name, dsetxid, get_next_xid(),
- t_tmp, parentxid,
- (strcmp(prefix, "") ? t_prefix : "/"));
-
- indentation(indent + COL);
- xml_name_to_XID(found_obj->objname,pointerxid,100,1);
- printf("<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n",
- xmlnsprefix,
- pointerxid,t_tmp);
- indentation(indent);
- printf("</%sDataset>\n", xmlnsprefix);
-
- free(t_name);
- free(dsetxid);
- free(parentxid);
- free(pointerxid);
- free(t_tmp);
- free(tx_tmp);
- free(t_prefix);
- }
-
- H5Dclose(obj);
- goto done;
- } else {
- found_obj->displayed = TRUE;
+ H5Dclose(obj);
+ goto done;
+ } else {
+ found_obj->displayed = TRUE;
+ }
+ } /* end if */
- }
- }
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ H5Dclose(obj);
+ } else {
+ error_msg(progname, "unable to dump dataset \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ }
+ break;
- dump_function_table->dump_dataset_function(obj, name, NULL);
- H5Dclose(obj);
- } else {
- error_msg(progname, "unable to dump dataset \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- ret = FAIL;
- }
- break;
+ case H5G_TYPE:
+ if ((obj = H5Topen(group, name)) < 0) {
+ error_msg(progname, "unable to dump data type \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
+ ret = FAIL;
+ } else {
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
+ }
+ break;
- case H5G_TYPE:
- if ((obj = H5Topen(group, name)) < 0) {
- error_msg(progname, "unable to dump data type \"%s\"\n", name);
- d_status = EXIT_FAILURE;
+ default:
+ error_msg(progname, "unknown object \"%s\"\n", name);
+ d_status = EXIT_FAILURE;
ret = FAIL;
- } else {
- dump_function_table->dump_named_datatype_function(obj, name);
- H5Tclose(obj);
- }
- break;
-
- default:
- error_msg(progname, "unknown object \"%s\"\n", name);
- d_status = EXIT_FAILURE;
- ret = FAIL;
}
done:
- free(tmp);
+ if(obj_path)
+ HDfree(obj_path);
return ret;
}
@@ -1630,19 +1648,19 @@ dump_group(hid_t gid, const char *name)
char type_name[1024], *tmp;
int xtype = H5G_UNKNOWN; /* dump all */
- tmp = malloc(strlen(prefix) + strlen(name) + 2);
- strcpy(tmp, prefix);
+ tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
indentation(indent);
begin_obj(dump_header_format->groupbegin, name,
dump_header_format->groupblockbegin);
indent += COL;
if (display_oid)
- dump_oid(gid);
+ dump_oid(gid);
dump_comment(gid);
- if (!strcmp(name, "/") && unamedtype) {
+ if (!HDstrcmp(name, "/") && unamedtype) {
unsigned u; /* Local index variable */
/* dump unamed type in root group */
@@ -1718,33 +1736,33 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
dump_dataspace(space);
if (display_oid)
- dump_oid(did);
+ dump_oid(did);
if (display_dcpl)
- dump_dcpl(dcpl_id, type, did);
+ dump_dcpl(dcpl_id, type, did);
if (display_data)
switch (H5Tget_class(type)) {
- case H5T_TIME:
- indentation(indent + COL);
- printf("DATA{ not yet implemented.}\n");
- break;
+ case H5T_TIME:
+ indentation(indent + COL);
+ printf("DATA{ not yet implemented.}\n");
+ break;
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- dump_data(did, DATASET_DATA, sset, display_ai);
- break;
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ dump_data(did, DATASET_DATA, sset, display_ai);
+ break;
- default:
- break;
+ default:
+ break;
}
indent += COL;
@@ -1775,7 +1793,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
static void
dump_dims(hsize_t *s, int dims)
{
- register int i;
+ int i;
for (i = 0; i < dims; i++) {
printf("%u", (unsigned int)s[i]);
@@ -1864,7 +1882,7 @@ dump_subsetting_header(struct subset_t *sset, int dims)
static void
dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
{
- h5dump_t *outputformat = &dataformat;
+ h5tool_format_t *outputformat = &dataformat;
int status = -1;
void *buf;
hid_t space, type, p_type;
@@ -1878,12 +1896,11 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
outputformat->do_escape=display_escape;
/* print the matrix indices */
outputformat->pindex=pindex;
- if (outputformat->pindex)
- {
- outputformat->idx_fmt = "(%s): ";
- outputformat->idx_n_fmt = "%lu";
- outputformat->idx_sep = ",";
- outputformat->line_pre = "%s";
+ if (outputformat->pindex) {
+ outputformat->idx_fmt = "(%s): ";
+ outputformat->idx_n_fmt = "%lu";
+ outputformat->idx_sep = ",";
+ outputformat->line_pre = "%s";
}
indent += COL;
@@ -1914,7 +1931,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
if (obj_data == DATASET_DATA) {
hid_t f_type = H5Dget_type(obj_id);
char string_prefix[64];
- h5dump_t string_dataformat;
+ h5tool_format_t string_dataformat;
if (display_char && H5Tget_size(f_type) == 1 && H5Tget_class(f_type) == H5T_INTEGER) {
/*
@@ -1954,7 +1971,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex)
status = SUCCEED;
} else {
char string_prefix[64];
- h5dump_t string_dataformat;
+ h5tool_format_t string_dataformat;
type = H5Aget_type(obj_id);
p_type = h5tools_get_native_type(type);
@@ -2062,15 +2079,15 @@ dump_oid(hid_t oid)
static void dump_comment(hid_t obj_id)
{
- char comment[50];
+ char comment[50];
- comment[0] = '\0';
- H5Gget_comment(obj_id, ".", sizeof(comment), comment);
+ comment[0] = '\0';
+ H5Gget_comment(obj_id, ".", sizeof(comment), comment);
- if (comment[0]) {
- indentation(indent);
- printf("COMMENT \"%s\"\n", comment);
- }
+ if (comment[0]) {
+ indentation(indent);
+ printf("COMMENT \"%s\"\n", comment);
+ }
}
@@ -2094,7 +2111,7 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id)
size_t size;
void *buf=NULL;
hsize_t nelmts=1;
- h5dump_t *outputformat = &dataformat;
+ h5tool_format_t *outputformat = &dataformat;
hid_t n_type;
memset(&ctx, 0, sizeof(ctx));
@@ -2113,7 +2130,6 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id)
if (buf)
free (buf);
-
}
@@ -2131,321 +2147,303 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id)
static void
dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
{
- int nfilters; /* number of filters */
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filtn; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- char f_name[256]; /* filter name */
- unsigned szip_options_mask;
- unsigned szip_pixels_per_block;
- hsize_t chsize[64]; /* chunk size in elements */
- int rank; /* rank */
- char name[256]; /* external file name */
- off_t offset; /* offset of external file */
- hsize_t size; /* size of external file */
- H5D_fill_value_t fvstatus;
- H5D_alloc_time_t at;
- H5D_fill_time_t ft;
- hsize_t storage_size;
- haddr_t ioffset;
- int i, next;
- unsigned j;
-
- storage_size=H5Dget_storage_size(obj_id);
- ioffset=H5Dget_offset(obj_id);
- next=H5Pget_external_count(dcpl_id);
- strcpy(f_name,"\0");
-
-/*-------------------------------------------------------------------------
- * STORAGE_LAYOUT
- *-------------------------------------------------------------------------
- */
- indentation(indent + COL);
- printf("%s %s\n", STORAGE_LAYOUT, BEGIN);
-
- if (H5D_CHUNKED == H5Pget_layout(dcpl_id))
- {
- /*start indent */
- indent += COL;
- indentation(indent + COL);
- printf("%s ", CHUNKED);
- rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize);
- HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]);
- for ( i=1; i<rank; i++)
- HDfprintf(stdout, ", %Hu", chsize[i]);
- printf(" %s\n", dump_header_format->dataspacedimend);
- indentation(indent + COL);
- HDfprintf(stdout, "SIZE %Hu\n ", storage_size);
- /*end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
- }
- else if (H5D_COMPACT == H5Pget_layout(dcpl_id))
- {
- /*start indent */
- indent += COL;
- indentation(indent + COL);
- printf("%s\n", COMPACT);
- indentation(indent + COL);
- HDfprintf(stdout, "SIZE %Hu\n", storage_size);
- /*end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
- }
- else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id))
- {
- /*-------------------------------------------------------------------------
- * EXTERNAL_FILE
- *-------------------------------------------------------------------------
- */
- if (next)
- {
- /*start indent */
- indent += COL;
- indentation(indent + COL);
- printf("%s\n", CONTIGUOUS);
- indentation(indent + COL);
- printf("%s %s\n", EXTERNAL, BEGIN);
- /*start indent */
- indent += COL;
- for ( j=0; j<(unsigned)next; j++) {
- H5Pget_external(dcpl_id,j,sizeof(name),name,&offset,&size);
+ int nfilters; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_name[256]; /* filter name */
+ unsigned szip_options_mask;
+ unsigned szip_pixels_per_block;
+ hsize_t chsize[64]; /* chunk size in elements */
+ int rank; /* rank */
+ char name[256]; /* external file name */
+ off_t offset; /* offset of external file */
+ hsize_t size; /* size of external file */
+ H5D_fill_value_t fvstatus;
+ H5D_alloc_time_t at;
+ H5D_fill_time_t ft;
+ hsize_t storage_size;
+ haddr_t ioffset;
+ int i, next;
+ unsigned j;
+
+ storage_size=H5Dget_storage_size(obj_id);
+ ioffset=H5Dget_offset(obj_id);
+ next=H5Pget_external_count(dcpl_id);
+ strcpy(f_name,"\0");
+
+ /*-------------------------------------------------------------------------
+ * STORAGE_LAYOUT
+ *-------------------------------------------------------------------------
+ */
indentation(indent + COL);
- HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset);
- }
- /*end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
- /*end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
- }
- else
- {
- /*start indent */
- indent += COL;
- indentation(indent + COL);
- printf("%s\n", CONTIGUOUS);
- indentation(indent + COL);
- HDfprintf(stdout,"SIZE %Hu\n", storage_size);
- indentation(indent + COL);
- HDfprintf(stdout,"OFFSET %Hu\n", ioffset);
- /*end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
- }
- }
-/*-------------------------------------------------------------------------
- * FILTERS
- *-------------------------------------------------------------------------
- */
- nfilters = H5Pget_nfilters(dcpl_id);
+ printf("%s %s\n", STORAGE_LAYOUT, BEGIN);
+
+ if (H5D_CHUNKED == H5Pget_layout(dcpl_id)) {
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("%s ", CHUNKED);
+
+ rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize);
+ HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]);
+ for ( i=1; i<rank; i++)
+ HDfprintf(stdout, ", %Hu", chsize[i]);
+ printf(" %s\n", dump_header_format->dataspacedimend);
+ indentation(indent + COL);
+ HDfprintf(stdout, "SIZE %Hu\n ", storage_size);
+
+ /*end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
+ }
+ else if (H5D_COMPACT == H5Pget_layout(dcpl_id)) {
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("%s\n", COMPACT);
+
+ indentation(indent + COL);
+ HDfprintf(stdout, "SIZE %Hu\n", storage_size);
+
+ /*end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
+ }
+ else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) {
+ /*-------------------------------------------------------------------------
+ * EXTERNAL_FILE
+ *-------------------------------------------------------------------------
+ */
+ if (next) {
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("%s\n", CONTIGUOUS);
+
+ indentation(indent + COL);
+ printf("%s %s\n", EXTERNAL, BEGIN);
+
+ /*start indent */
+ indent += COL;
+ for ( j=0; j<(unsigned)next; j++) {
+ H5Pget_external(dcpl_id,j,sizeof(name),name,&offset,&size);
+ indentation(indent + COL);
+ HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset);
+ }
+ /*end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
+
+ /*end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
+ }
+ else {
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("%s\n", CONTIGUOUS);
- indentation(indent + COL);
- printf("%s %s\n", FILTERS, BEGIN);
- indent += COL;
+ indentation(indent + COL);
+ HDfprintf(stdout,"SIZE %Hu\n", storage_size);
+ indentation(indent + COL);
+ HDfprintf(stdout,"OFFSET %Hu\n", ioffset);
+
+ /*end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * FILTERS
+ *-------------------------------------------------------------------------
+ */
+ nfilters = H5Pget_nfilters(dcpl_id);
- if (nfilters)
- {
- for (i=0; i<nfilters; i++)
- {
- cd_nelmts = NELMTS(cd_values);
+ indentation(indent + COL);
+ printf("%s %s\n", FILTERS, BEGIN);
+ indent += COL;
+
+ if (nfilters) {
+ for (i=0; i<nfilters; i++) {
+ cd_nelmts = NELMTS(cd_values);
#ifdef H5_WANT_H5_V1_6_COMPAT
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_name),
- f_name);
+ filtn = H5Pget_filter(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name);
#else
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_name),
- f_name,
- NULL);
+ filtn = H5Pget_filter(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
#endif /* H5_WANT_H5_V1_6_COMPAT */
- switch (filtn)
- {
- case H5Z_FILTER_DEFLATE:
+ switch (filtn) {
+ case H5Z_FILTER_DEFLATE:
+ indentation(indent + COL);
+ printf("%s %s %s %d %s\n", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END);
+ break;
+ case H5Z_FILTER_SHUFFLE:
+ indentation(indent + COL);
+ printf("%s\n", SHUFFLE);
+ break;
+ case H5Z_FILTER_FLETCHER32:
+ indentation(indent + COL);
+ printf("%s\n", FLETCHER32);
+ break;
+ case H5Z_FILTER_SZIP:
+ {
+ szip_options_mask=cd_values[0];;
+ szip_pixels_per_block=cd_values[1];
+
+ indentation(indent + COL);
+ printf("%s %s\n",SZIP, BEGIN);
+
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("PIXELS_PER_BLOCK %d\n", szip_pixels_per_block);
+
+ indentation(indent + COL);
+ if (szip_options_mask & H5_SZIP_CHIP_OPTION_MASK)
+ printf("MODE %s\n", "HARDWARE");
+ else if (szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK)
+ printf("MODE %s\n", "K13");
+
+ indentation(indent + COL);
+ if (szip_options_mask & H5_SZIP_EC_OPTION_MASK)
+ printf("CODING %s\n", "ENTROPY");
+ else if (szip_options_mask & H5_SZIP_NN_OPTION_MASK)
+ printf("CODING %s\n", "NEAREST NEIGHBOUR");
+
+ indentation(indent + COL);
+ if (szip_options_mask & H5_SZIP_LSB_OPTION_MASK)
+ printf("BYTE_ORDER %s\n", "LSB");
+ else if (szip_options_mask & H5_SZIP_MSB_OPTION_MASK)
+ printf("BYTE_ORDER %s\n", "MSB");
+
+ indentation(indent + COL);
+ if (szip_options_mask & H5_SZIP_RAW_OPTION_MASK)
+ printf("HEADER %s\n", "RAW");
+
+ /*end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
+ }
+ break;
+ case H5Z_FILTER_NBIT:
+ indentation(indent + COL);
+ printf("%s\n", NBIT);
+ break;
+ case H5Z_FILTER_SCALEOFFSET:
+ indentation(indent + COL);
+ printf("%s %s %s %d %s\n", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END);
+ break;
+ default:
+ indentation(indent + COL);
+ if (H5Zfilter_avail(filtn))
+ printf("%s %s\n", "USER_REGISTERED_FILTER", BEGIN);
+ else
+ printf("%s %s\n", "UNKNOWN_FILTER", BEGIN);
+ /*start indent */
+ indent += COL;
+ indentation(indent + COL);
+ printf("FILTER_ID %d\n", filtn);
+ if (f_name[0]!='\0') {
+ indentation(indent + COL);
+ printf("COMMENT %s\n", f_name);
+ }
+ if (cd_nelmts) {
+ indentation(indent + COL);
+ printf("%s %s ","PARAMS", BEGIN);
+ for (j=0; j<cd_nelmts; j++)
+ printf("%d ", cd_values[j]);
+ printf("%s\n", END);
+ }
+ break;
+ }/*switch*/
+ } /*i*/
+ }/*nfilters*/
+ else {
+ indentation(indent + COL);
+ printf("NONE\n");
+ }
+ indent -= COL;
indentation(indent + COL);
- printf("%s %s %s %d %s\n", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END);
- break;
- case H5Z_FILTER_SHUFFLE:
+ printf("%s\n",END);
+
+ /*-------------------------------------------------------------------------
+ * FILLVALUE
+ *-------------------------------------------------------------------------
+ */
indentation(indent + COL);
- printf("%s\n", SHUFFLE);
- break;
- case H5Z_FILTER_FLETCHER32:
+ printf("%s %s\n", FILLVALUE, BEGIN);
+ /*start indent */
+ indent += COL;
indentation(indent + COL);
- printf("%s\n", FLETCHER32);
- break;
- case H5Z_FILTER_SZIP:
- {
- szip_options_mask=cd_values[0];;
- szip_pixels_per_block=cd_values[1];
-
- indentation(indent + COL);
- printf("%s %s\n",SZIP, BEGIN);
-
- /*start indent */
- indent += COL;
- indentation(indent + COL);
- printf("PIXELS_PER_BLOCK %d\n", szip_pixels_per_block);
-
- indentation(indent + COL);
- if (szip_options_mask & H5_SZIP_CHIP_OPTION_MASK)
- printf("MODE %s\n", "HARDWARE");
- else if (szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK)
- printf("MODE %s\n", "K13");
-
- indentation(indent + COL);
- if (szip_options_mask & H5_SZIP_EC_OPTION_MASK)
- printf("CODING %s\n", "ENTROPY");
- else if (szip_options_mask & H5_SZIP_NN_OPTION_MASK)
- printf("CODING %s\n", "NEAREST NEIGHBOUR");
-
- indentation(indent + COL);
- if (szip_options_mask & H5_SZIP_LSB_OPTION_MASK)
- printf("BYTE_ORDER %s\n", "LSB");
- else if (szip_options_mask & H5_SZIP_MSB_OPTION_MASK)
- printf("BYTE_ORDER %s\n", "MSB");
-
- indentation(indent + COL);
- if (szip_options_mask & H5_SZIP_RAW_OPTION_MASK)
- printf("HEADER %s\n", "RAW");
-
- /*end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
+ printf("FILL_TIME ");
+ H5Pget_fill_time(dcpl_id, &ft);
+ switch ( ft ) {
+ case H5D_FILL_TIME_ALLOC:
+ printf("%s", "H5D_FILL_TIME_ALLOC\n");
+ break;
+ case H5D_FILL_TIME_NEVER:
+ printf("%s", "H5D_FILL_TIME_NEVER\n");
+ break;
+ case H5D_FILL_TIME_IFSET:
+ printf("%s", "H5D_FILL_TIME_IFSET\n");
+ break;
+ default:
+ assert(0);
+ break;
}
- break;
- case H5Z_FILTER_NBIT:
indentation(indent + COL);
- printf("%s\n", NBIT);
- break;
- case H5Z_FILTER_SCALEOFFSET:
+ printf("%s ", "VALUE ");
+ H5Pfill_value_defined(dcpl_id, &fvstatus);
+ if (fvstatus == H5D_FILL_VALUE_UNDEFINED)
+ printf("%s\n", "H5D_FILL_VALUE_UNDEFINED");
+ else
+ dump_fill_value(dcpl_id,type_id,obj_id);
+ /* end indent */
+ indent -= COL;
indentation(indent + COL);
- printf("%s %s %s %d %s\n", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END);
- break;
- default:
+ printf("\n");
indentation(indent + COL);
- if (H5Zfilter_avail(filtn))
- printf("%s %s\n", "USER_REGISTERED_FILTER", BEGIN);
- else
- printf("%s %s\n", "UNKNOWN_FILTER", BEGIN);
+ printf("%s\n",END);
+
+ /*-------------------------------------------------------------------------
+ * ALLOCATION_TIME
+ *-------------------------------------------------------------------------
+ */
+ indentation(indent + COL);
+ printf("ALLOCATION_TIME %s\n",BEGIN);
/*start indent */
indent += COL;
indentation(indent + COL);
- printf("FILTER_ID %d\n", filtn);
- if (f_name[0]!='\0') {
- indentation(indent + COL);
- printf("COMMENT %s\n", f_name);
- }
- if (cd_nelmts) {
- indentation(indent + COL);
- printf("%s %s ","PARAMS", BEGIN);
- for (j=0; j<cd_nelmts; j++) {
- printf("%d ", cd_values[j]);
- }
- printf("%s\n", END);
+ H5Pget_alloc_time(dcpl_id, &at);
+ switch (at) {
+ case H5D_ALLOC_TIME_EARLY:
+ printf("%s", "H5D_ALLOC_TIME_EARLY\n");
+ break;
+ case H5D_ALLOC_TIME_INCR:
+ printf("%s", "H5D_ALLOC_TIME_INCR\n");
+ break;
+ case H5D_ALLOC_TIME_LATE:
+ printf("%s", "H5D_ALLOC_TIME_LATE\n");
+ break;
+ default:
+ assert(0);
+ break;
}
- break;
- }/*switch*/
- } /*i*/
- }/*nfilters*/
- else
- {
- indentation(indent + COL);
- printf("NONE\n");
- }
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
-
-/*-------------------------------------------------------------------------
- * FILLVALUE
- *-------------------------------------------------------------------------
- */
- indentation(indent + COL);
- printf("%s %s\n", FILLVALUE, BEGIN);
- /*start indent */
- indent += COL;
- indentation(indent + COL);
- printf("FILL_TIME ");
- H5Pget_fill_time(dcpl_id, &ft);
- switch ( ft )
- {
- case H5D_FILL_TIME_ALLOC:
- printf("%s", "H5D_FILL_TIME_ALLOC\n");
- break;
- case H5D_FILL_TIME_NEVER:
- printf("%s", "H5D_FILL_TIME_NEVER\n");
- break;
- case H5D_FILL_TIME_IFSET:
- printf("%s", "H5D_FILL_TIME_IFSET\n");
- break;
- default:
- assert(0);
- break;
- }
- indentation(indent + COL);
- printf("%s ", "VALUE ");
- H5Pfill_value_defined(dcpl_id, &fvstatus);
- if (fvstatus == H5D_FILL_VALUE_UNDEFINED)
- {
- printf("%s\n", "H5D_FILL_VALUE_UNDEFINED");
- }
- else
- {
- dump_fill_value(dcpl_id,type_id,obj_id);
- }
- /* end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("\n");
- indentation(indent + COL);
- printf("%s\n",END);
-
-/*-------------------------------------------------------------------------
- * ALLOCATION_TIME
- *-------------------------------------------------------------------------
- */
- indentation(indent + COL);
- printf("ALLOCATION_TIME %s\n",BEGIN);
- /*start indent */
- indent += COL;
- indentation(indent + COL);
- H5Pget_alloc_time(dcpl_id, &at);
- switch (at)
- {
- case H5D_ALLOC_TIME_EARLY:
- printf("%s", "H5D_ALLOC_TIME_EARLY\n");
- break;
- case H5D_ALLOC_TIME_INCR:
- printf("%s", "H5D_ALLOC_TIME_INCR\n");
- break;
- case H5D_ALLOC_TIME_LATE:
- printf("%s", "H5D_ALLOC_TIME_LATE\n");
- break;
- default:
- assert(0);
- break;
- }
- /* end indent */
- indent -= COL;
- indentation(indent + COL);
- printf("%s\n",END);
+ /* end indent */
+ indent -= COL;
+ indentation(indent + COL);
+ printf("%s\n",END);
}
/*-------------------------------------------------------------------------
@@ -2464,103 +2462,87 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
static void
dump_fcpl(hid_t fid)
{
- hid_t fcpl; /* file creation property list ID */
- hid_t fapl; /* file access property list ID */
- hsize_t userblock; /* userblock size retrieved from FCPL */
- size_t off_size; /* size of offsets in the file */
- size_t len_size; /* size of lengths in the file */
- unsigned super; /* superblock version # */
- unsigned freelist; /* free list version # */
- unsigned stab; /* symbol table entry version # */
- unsigned shhdr; /* shared object header version # */
- hid_t fdriver; /* file driver */
- char dname[15]; /* buffer to store driver name */
- unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
- unsigned sym_ik; /* symbol table B-tree internal 'K' value */
- unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
-
- fcpl=H5Fget_create_plist(fid);
- H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
- H5Pget_userblock(fcpl,&userblock);
- H5Pget_sizes(fcpl,&off_size,&len_size);
- H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
- H5Pget_istore_k(fcpl,&istore_ik);
- H5Pclose(fcpl);
- fapl=h5_fileaccess();
- fdriver=H5Pget_driver(fapl);
- H5Pclose(fapl);
-
-/*-------------------------------------------------------------------------
- * SUPER_BLOCK
- *-------------------------------------------------------------------------
- */
- printf("%s %s\n",SUPER_BLOCK, BEGIN);
- indentation(indent + COL);
- printf("%s %u\n","SUPERBLOCK_VERSION", super);
- indentation(indent + COL);
- printf("%s %u\n","FREELIST_VERSION", freelist);
- indentation(indent + COL);
- printf("%s %u\n","SYMBOLTABLE_VERSION", stab);
- indentation(indent + COL);
- printf("%s %u\n","OBJECTHEADER_VERSION", shhdr);
- indentation(indent + COL);
- HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long_long)off_size);
- indentation(indent + COL);
- HDfprintf(stdout,"%s %Hd\n","LENGTH_SIZE", (long_long)len_size);
- indentation(indent + COL);
- printf("%s %u\n","BTREE_RANK", sym_ik);
- indentation(indent + COL);
- printf("%s %d\n","BTREE_LEAF", sym_lk);
-
- if (H5FD_CORE==fdriver)
- {
- strcpy(dname,"H5FD_CORE");
- }
- else if (H5FD_FAMILY==fdriver)
- {
- strcpy(dname,"H5FD_FAMILY");
- }
- else if (H5FD_LOG==fdriver)
- {
- strcpy(dname,"H5FD_LOG");
- }
- else if (H5FD_MPIO==fdriver)
- {
- strcpy(dname,"H5FD_MPIO");
- }
- else if (H5FD_MULTI==fdriver)
- {
- strcpy(dname,"H5FD_MULTI");
- }
- else if (H5FD_SEC2==fdriver)
- {
- strcpy(dname,"H5FD_SEC2");
- }
- else if (H5FD_STDIO==fdriver)
- {
- strcpy(dname,"H5FD_STDIO");
- }
+ hid_t fcpl; /* file creation property list ID */
+ hid_t fapl; /* file access property list ID */
+ hsize_t userblock; /* userblock size retrieved from FCPL */
+ size_t off_size; /* size of offsets in the file */
+ size_t len_size; /* size of lengths in the file */
+ unsigned super; /* superblock version # */
+ unsigned freelist; /* free list version # */
+ unsigned stab; /* symbol table entry version # */
+ unsigned shhdr; /* shared object header version # */
+ hid_t fdriver; /* file driver */
+ char dname[15]; /* buffer to store driver name */
+ unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
+ unsigned sym_ik; /* symbol table B-tree internal 'K' value */
+ unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
+
+ fcpl=H5Fget_create_plist(fid);
+ H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr);
+ H5Pget_userblock(fcpl,&userblock);
+ H5Pget_sizes(fcpl,&off_size,&len_size);
+ H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
+ H5Pget_istore_k(fcpl,&istore_ik);
+ H5Pclose(fcpl);
+ fapl=h5_fileaccess();
+ fdriver=H5Pget_driver(fapl);
+ H5Pclose(fapl);
+
+ /*-------------------------------------------------------------------------
+ * SUPER_BLOCK
+ *-------------------------------------------------------------------------
+ */
+ printf("%s %s\n",SUPER_BLOCK, BEGIN);
+ indentation(indent + COL);
+ printf("%s %u\n","SUPERBLOCK_VERSION", super);
+ indentation(indent + COL);
+ printf("%s %u\n","FREELIST_VERSION", freelist);
+ indentation(indent + COL);
+ printf("%s %u\n","SYMBOLTABLE_VERSION", stab);
+ indentation(indent + COL);
+ printf("%s %u\n","OBJECTHEADER_VERSION", shhdr);
+ indentation(indent + COL);
+ HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long_long)off_size);
+ indentation(indent + COL);
+ HDfprintf(stdout,"%s %Hd\n","LENGTH_SIZE", (long_long)len_size);
+ indentation(indent + COL);
+ printf("%s %u\n","BTREE_RANK", sym_ik);
+ indentation(indent + COL);
+ printf("%s %d\n","BTREE_LEAF", sym_lk);
+
+ if (H5FD_CORE==fdriver)
+ HDstrcpy(dname,"H5FD_CORE");
+ else if (H5FD_FAMILY==fdriver)
+ HDstrcpy(dname,"H5FD_FAMILY");
+ else if (H5FD_LOG==fdriver)
+ HDstrcpy(dname,"H5FD_LOG");
+ else if (H5FD_MPIO==fdriver)
+ HDstrcpy(dname,"H5FD_MPIO");
+ else if (H5FD_MULTI==fdriver)
+ HDstrcpy(dname,"H5FD_MULTI");
+ else if (H5FD_SEC2==fdriver)
+ HDstrcpy(dname,"H5FD_SEC2");
+ else if (H5FD_STDIO==fdriver)
+ HDstrcpy(dname,"H5FD_STDIO");
#ifdef H5_HAVE_STREAM
- else if (H5FD_STREAM==fdriver)
- {
- strcpy(dname,"H5FD_STREAM");
- }
+ else if (H5FD_STREAM==fdriver)
+ HDstrcpy(dname,"H5FD_STREAM");
#endif
- indentation(indent + COL);
- printf("%s %s\n","FILE_DRIVER", dname);
- indentation(indent + COL);
- printf("%s %u\n","ISTORE_K", istore_ik);
- printf("%s\n",END);
-
-/*-------------------------------------------------------------------------
- * USER_BLOCK
- *-------------------------------------------------------------------------
- */
- printf("USER_BLOCK %s\n",BEGIN);
- indentation(indent + COL);
- HDfprintf(stdout,"%s %Hu\n","USERBLOCK_SIZE", userblock);
- printf("%s\n",END);
+ indentation(indent + COL);
+ printf("%s %s\n","FILE_DRIVER", dname);
+ indentation(indent + COL);
+ printf("%s %u\n","ISTORE_K", istore_ik);
+ printf("%s\n",END);
+
+ /*-------------------------------------------------------------------------
+ * USER_BLOCK
+ *-------------------------------------------------------------------------
+ */
+ printf("USER_BLOCK %s\n",BEGIN);
+ indentation(indent + COL);
+ HDfprintf(stdout,"%s %Hu\n","USERBLOCK_SIZE", userblock);
+ printf("%s\n",END);
}
/*-------------------------------------------------------------------------
@@ -2916,15 +2898,15 @@ handle_groups(hid_t fid, char *group, void UNUSED * data)
dump_header_format->groupblockend);
d_status = EXIT_FAILURE;
} else {
- size_t new_len = strlen(group) + 1;
+ size_t new_len = HDstrlen(group) + 1;
if (prefix_len <= new_len) {
prefix_len = new_len;
- prefix = realloc(prefix, prefix_len);
+ prefix = HDrealloc(prefix, prefix_len);
}
H5Gget_objinfo(gid, ".", TRUE, &statbuf);
- strcpy(prefix, group);
+ HDstrcpy(prefix, group);
dump_group(gid, group);
if (H5Gclose(gid) < 0)
@@ -2952,15 +2934,10 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
H5G_stat_t statbuf;
if (H5Gget_objinfo(fid, links, FALSE, &statbuf) < 0) {
- begin_obj(dump_header_format->softlinkbegin, links,
- dump_header_format->softlinkblockbegin);
- indentation(COL);
error_msg(progname, "unable to get obj info from \"%s\"\n", links);
- end_obj(dump_header_format->softlinkend,
- dump_header_format->softlinkblockend);
d_status = EXIT_FAILURE;
} else if (statbuf.type == H5G_LINK) {
- char *buf = malloc(statbuf.u.slink.linklen);
+ char *buf = HDmalloc(statbuf.u.slink.linklen);
begin_obj(dump_header_format->softlinkbegin, links,
dump_header_format->softlinkblockbegin);
@@ -2976,14 +2953,10 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
end_obj(dump_header_format->softlinkend,
dump_header_format->softlinkblockend);
- free(buf);
+
+ HDfree(buf);
} else {
- begin_obj(dump_header_format->softlinkbegin, links,
- dump_header_format->softlinkblockbegin);
- indentation(COL);
error_msg(progname, "\"%s\" is not a link\n", links);
- end_obj(dump_header_format->softlinkend,
- dump_header_format->softlinkblockend);
d_status = EXIT_FAILURE;
}
}
@@ -3453,13 +3426,13 @@ main(int argc, const char *argv[])
/* find all objects that might be targets of a refernce */
init_ref_path_table(fid); /* Insert the root group into the ref. path table */
- H5Giterate(fid, "/", NULL, fill_ref_path_table, (void *)"");
+ H5Giterate(fid, (const char *)"/", NULL, fill_ref_path_table, (void *)"");
if (doxml) {
/* initialize XML */
/* reset prefix! */
- strcpy(prefix, "");
+ HDstrcpy(prefix, "");
/* make sure the URI is initialized to something */
if (xml_dtd_uri == NULL) {
@@ -3584,7 +3557,7 @@ done:
free_table(dset_table);
free_table(type_table);
- free(prefix);
+ HDfree(prefix);
/* To Do: clean up XML table */
@@ -4485,7 +4458,7 @@ xml_dump_dataspace(hid_t space)
static void
xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNUSED pindex)
{
- h5dump_t *outputformat = &xml_dataformat;
+ h5tool_format_t *outputformat = &xml_dataformat;
int status = -1;
void *buf;
hid_t space, type, p_type;
@@ -4723,14 +4696,14 @@ xml_dump_named_datatype(hid_t type, const char *name)
char *t_prefix;
char *t_name;
- tmp = malloc(strlen(prefix) + strlen(name) + 2);
- strcpy(tmp, prefix);
- strcat(tmp, "/");
- strcat(tmp, name);
+ tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
+ HDstrcat(tmp, "/");
+ HDstrcat(tmp, name);
indentation(indent);
- /*char **/ dtxid = malloc(100);
- /*char **/ parentxid = malloc(100);
+ /*char **/ dtxid = HDmalloc(100);
+ /*char **/ parentxid = HDmalloc(100);
/*char **/t_tmp = xml_escape_the_name(tmp);
/*char **/t_prefix = xml_escape_the_name(prefix);
/*char **/t_name = xml_escape_the_name(name);
@@ -4749,20 +4722,20 @@ xml_dump_named_datatype(hid_t type, const char *name)
"Parents=\"%s\" H5ParentPaths=\"%s\">\n",
xmlnsprefix,
name, dtxid,
- parentxid,(strcmp(prefix, "") ? t_prefix : "/"));
+ parentxid,(HDstrcmp(prefix, "") ? t_prefix : "/"));
} else {
printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
"H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n",
xmlnsprefix,
t_name, dtxid,
- t_tmp, parentxid, (strcmp(prefix, "") ? t_prefix : "/"));
+ t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/"));
}
- free(dtxid);
- free(parentxid);
- free(t_tmp);
- free(t_prefix);
- free(t_name);
- free(tmp);
+ HDfree(dtxid);
+ HDfree(parentxid);
+ HDfree(t_tmp);
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(tmp);
indent += COL;
indentation(indent);
@@ -4807,17 +4780,17 @@ xml_dump_group(hid_t gid, const char *name)
char *t_objname;
char *par_name;
- if (strcmp(name, "/") == 0) {
+ if (HDstrcmp(name, "/") == 0) {
isRoot = 1;
- tmp = malloc(2);
- strcpy(tmp, "/");
+ tmp = HDmalloc(2);
+ HDstrcpy(tmp, "/");
} else {
- tmp = malloc(strlen(prefix) + strlen(name) + 2);
- strcpy(tmp, prefix);
+ tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
- cp = strrchr(par, '/');
+ cp = HDstrrchr(par, '/');
if (cp != NULL) {
- if ((cp == par) && strlen(par) > 1) {
+ if ((cp == par) && HDstrlen(par) > 1) {
*(cp + 1) = '\0';
} else {
*cp = '\0';
@@ -5212,59 +5185,6 @@ xml_print_strs(hid_t did, int source)
}
/*-------------------------------------------------------------------------
- * Function: check_compression
- *
- * Purpose: private function to check for compression and
- * put a comment in the XML. (Not fully implemented.)
- *
- * Return: void
- *
- * Programmer: REMcG
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-#ifdef LATER
-static void
-check_compression(hid_t dcpl)
-{
- int nfilt;
- int i;
- H5Z_filter_t filter;
- char namebuf[20];
- size_t cd_nelmts = 1;
- unsigned int cd_values;
- unsigned int flags;
-/* not used yet: will need to do somehting more elaborate to handle future
- * compression methods.
- char *t1 = "H5Z_FILTER_DEFLATE";
-*/
-
- nfilt = H5Pget_nfilters(dcpl);
- if (nfilt <= 0)
- return;
- for (i = 0; i < nfilt; i++) {
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filter = H5Pget_filter(dcpl, i, &flags,
- (size_t *) &cd_nelmts,
- &cd_values, 20, namebuf);
-#else
- filter = H5Pget_filter(dcpl, i, &flags,
- (size_t *) &cd_nelmts,
- &cd_values, 20, namebuf, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
- if (filter == H5Z_FILTER_DEFLATE) {
- indentation(indent + COL);
- printf("<%sCompression />\n",xmlnsprefix);
- indentation(indent + COL);
- printf("<!-- Compression parameter %d -->\n", cd_values);
- }
- }
-}
-#endif /* LATER */
-
-/*-------------------------------------------------------------------------
* Function: check_filters
*
* Purpose: private function to check for the filters and
@@ -5512,13 +5432,13 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
hsize_t tempi;
char *tmp;
char *t_name, *t_tmp, *t_prefix;
- char *rstr = malloc(100);
- char *pstr = malloc(100);
+ char *rstr = HDmalloc(100);
+ char *pstr = HDmalloc(100);
- tmp = malloc(strlen(prefix) + strlen(name) + 2);
- strcpy(tmp, prefix);
- strcat(tmp, "/");
- strcat(tmp, name);
+ tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
+ HDstrcat(tmp, "/");
+ HDstrcat(tmp, name);
indentation(indent);
t_name = xml_escape_the_name(name);
@@ -5530,12 +5450,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
printf("<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n",xmlnsprefix,
t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/");
- free(t_name);
- free(t_tmp);
- free(t_prefix);
- free(rstr);
- free(pstr);
- free(tmp);
+ HDfree(t_name);
+ HDfree(t_tmp);
+ HDfree(t_prefix);
+ HDfree(rstr);
+ HDfree(pstr);
+ HDfree(tmp);
dcpl = H5Dget_create_plist(did);
type = H5Dget_type(did);
@@ -5994,7 +5914,32 @@ h5_fileaccess(void)
static void
init_prefix(char **prfx, size_t prfx_len)
{
- assert(prfx_len > 0);
+ HDassert(prfx_len > 0);
*prfx = HDcalloc(prfx_len, 1);
}
+
+/*-------------------------------------------------------------------------
+ * Function: add_prefix
+ *
+ * Purpose: Add object to prefix
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+add_prefix(char **prfx, size_t *prfx_len, const char *name)
+{
+ size_t new_len = HDstrlen(*prfx) + HDstrlen(name) + 2;
+
+ /* Check if we need more space */
+ if(*prfx_len <= new_len) {
+ *prfx_len = new_len + 1;
+ *prfx = HDrealloc(*prfx, *prfx_len);
+ }
+
+ /* Append object name to prefix */
+ HDstrcat(HDstrcat(*prfx, "/"), name);
+} /* end add_prefix */
+
diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index 96e7d71..dbc5de9 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -18,4 +18,133 @@
#define H5DUMP_MAX_RANK H5S_MAX_RANK
+#define ATTRIBUTE_DATA 0
+#define DATASET_DATA 1
+#define ENUM_DATA 2
+#define COL 3
+
+/* Strings for output */
+#define ATTRIBUTE "ATTRIBUTE"
+#define BLOCK "BLOCK"
+#define SUPER_BLOCK "SUPER_BLOCK"
+#define COMPRESSION "COMPRESSION"
+#define CONCATENATOR "//"
+#define COMPLEX "COMPLEX"
+#define COUNT "COUNT"
+#define CSET "CSET"
+#define CTYPE "CTYPE"
+#define DATA "DATA"
+#define DATASPACE "DATASPACE"
+#define EXTERNAL "EXTERNAL"
+#define FILENO "FILENO"
+#define HARDLINK "HARDLINK"
+#define NLINK "NLINK"
+#define OBJID "OBJECTID"
+#define OBJNO "OBJNO"
+#define S_SCALAR "SCALAR"
+#define S_SIMPLE "SIMPLE"
+#define S_NULL "NULL"
+#define SOFTLINK "SOFTLINK"
+#define STORAGELAYOUT "STORAGELAYOUT"
+#define START "START"
+#define STRIDE "STRIDE"
+#define STRSIZE "STRSIZE"
+#define STRPAD "STRPAD"
+#define SUBSET "SUBSET"
+#define FILTERS "FILTERS"
+#define DEFLATE "COMPRESSION DEFLATE"
+#define DEFLATE_LEVEL "LEVEL"
+#define SHUFFLE "PREPROCESSING SHUFFLE"
+#define FLETCHER32 "CHECKSUM FLETCHER32"
+#define SZIP "COMPRESSION SZIP"
+#define NBIT "COMPRESSION NBIT"
+#define SCALEOFFSET "COMPRESSION SCALEOFFSET"
+#define SCALEOFFSET_MINBIT "MIN BITS"
+#define STORAGE_LAYOUT "STORAGE_LAYOUT"
+#define CONTIGUOUS "CONTIGUOUS"
+#define COMPACT "COMPACT"
+#define CHUNKED "CHUNKED"
+#define EXTERNAL_FILE "EXTERNAL_FILE"
+#define FILLVALUE "FILLVALUE"
+#define FILE_CONTENTS "FILE_CONTENTS"
+
+#define BEGIN "{"
+#define END "}"
+
+typedef struct h5dump_header_t {
+ const char *name;
+ const char *filebegin;
+ const char *fileend;
+ const char *bootblockbegin;
+ const char *bootblockend;
+ const char *groupbegin;
+ const char *groupend;
+ const char *datasetbegin;
+ const char *datasetend;
+ const char *attributebegin;
+ const char *attributeend;
+ const char *datatypebegin;
+ const char *datatypeend;
+ const char *dataspacebegin;
+ const char *dataspaceend;
+ const char *databegin;
+ const char *dataend;
+ const char *softlinkbegin;
+ const char *softlinkend;
+ const char *subsettingbegin;
+ const char *subsettingend;
+ const char *startbegin;
+ const char *startend;
+ const char *stridebegin;
+ const char *strideend;
+ const char *countbegin;
+ const char *countend;
+ const char *blockbegin;
+ const char *blockend;
+
+ const char *fileblockbegin;
+ const char *fileblockend;
+ const char *bootblockblockbegin;
+ const char *bootblockblockend;
+ const char *groupblockbegin;
+ const char *groupblockend;
+ const char *datasetblockbegin;
+ const char *datasetblockend;
+ const char *attributeblockbegin;
+ const char *attributeblockend;
+ const char *datatypeblockbegin;
+ const char *datatypeblockend;
+ const char *dataspaceblockbegin;
+ const char *dataspaceblockend;
+ const char *datablockbegin;
+ const char *datablockend;
+ const char *softlinkblockbegin;
+ const char *softlinkblockend;
+ const char *strblockbegin;
+ const char *strblockend;
+ const char *enumblockbegin;
+ const char *enumblockend;
+ const char *structblockbegin;
+ const char *structblockend;
+ const char *vlenblockbegin;
+ const char *vlenblockend;
+ const char *subsettingblockbegin;
+ const char *subsettingblockend;
+ const char *startblockbegin;
+ const char *startblockend;
+ const char *strideblockbegin;
+ const char *strideblockend;
+ const char *countblockbegin;
+ const char *countblockend;
+ const char *blockblockbegin;
+ const char *blockblockend;
+
+ const char *dataspacedescriptionbegin;
+ const char *dataspacedescriptionend;
+ const char *dataspacedimbegin;
+ const char *dataspacedimend;
+
+} h5dump_header_t;
+
+
#endif /* !H5DUMP_H__ */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 4f1c0f5..8345e5a 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -4664,7 +4664,7 @@ static void gent_filters(void)
assert(ret>=0);
/* set the scaleoffset filter */
- ret=H5Pset_scaleoffset(dcpl,H5Z_SO_INT,H5Tget_size(H5T_NATIVE_INT));
+ ret=H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT));
assert(ret>=0);
ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1);
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 79c249b..7d81779 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -11,15 +11,14 @@
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <hdf5.h>
-#include <H5private.h>
-#include <stdio.h>
-#ifndef MIPSEL
-#include <math.h>
-#endif /* MIPSEL */
-#include <string.h>
-#include <ctype.h>
-#include "h5import.h"
+
+#include "hdf5.h"
+#include "H5private.h"
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include "h5import.h"
int main(int argc, char *argv[])
{
@@ -30,15 +29,15 @@ int main(int argc, char *argv[])
int state = 0;
struct Input *in=NULL;
- const char *err1 = "Invalid number of arguments: %d.\n";
- const char *err2 = "Error in state table.\n";
- const char *err3 = "No output file given.\n";
- const char *err4 = "Program aborted.\n";
- const char *err5 = "Invalid path %s.\n";
- const char *err6 = "Invalid dimensions - %s.\n";
- const char *err7 = "Invalid type of data - %s.\n";
- const char *err8 = "Invalid size of data - %s.\n";
- const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
+ const char *err1 = "Invalid number of arguments: %d.\n";
+ const char *err2 = "Error in state table.\n";
+ const char *err3 = "No output file given.\n";
+ const char *err4 = "Program aborted.\n";
+ const char *err5 = "Invalid path %s.\n";
+ const char *err6 = "Invalid dimensions - %s.\n";
+ const char *err7 = "Invalid type of data - %s.\n";
+ const char *err8 = "Invalid size of data - %s.\n";
+ const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
(void) setvbuf(stderr, (char *) NULL, _IOLBF, 0);
(void) setvbuf(stdout, (char *) NULL, _IOLBF, 0);
diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h
index cf318fc..85fa71e 100755
--- a/tools/h5import/h5import.h
+++ b/tools/h5import/h5import.h
@@ -18,6 +18,9 @@
*
*/
+#ifndef H5IMPORT_H__
+#define H5IMPORT_H__
+
/*
* state table tokens
*/
@@ -220,3 +223,6 @@ 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);
+
+#endif /* H5IMPORT_H__ */
+
diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c
index e6c29e5..32d3fe5 100755
--- a/tools/h5import/h5importtest.c
+++ b/tools/h5import/h5importtest.c
@@ -11,8 +11,10 @@
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
#include <stdio.h>
-#include <H5private.h>
+#include "H5private.h"
+
/*
* Name:
* h5importtest
@@ -286,4 +288,3 @@ main(void)
return (0);
}
-
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 75e4218..1c1a3fb 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -64,7 +64,7 @@ static struct dispatch_t {
herr_t (*close)(hid_t obj);
herr_t (*list1)(hid_t obj);
herr_t (*list2)(hid_t obj, const char *name);
-} dispatch_g[H5G_NTYPES];
+} dispatch_g[H5G_NLIBTYPES];
#define DISPATCH(TYPE,NAME,OPEN,CLOSE,LIST1,LIST2) { \
dispatch_g[TYPE].name = (NAME); \
@@ -1226,7 +1226,7 @@ dump_dataset_values(hid_t dset)
{
hid_t f_type = H5Dget_type(dset);
size_t size = H5Tget_size(f_type);
- h5dump_t info;
+ h5tool_format_t info;
char string_prefix[64];
static char fmt_double[16], fmt_float[16];
@@ -1332,7 +1332,7 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data)
size_t need;
hsize_t temp_need;
void *buf;
- h5dump_t info;
+ h5tool_format_t info;
H5S_class_t space_type;
printf(" Attribute: ");
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 1554039..3647d43 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -16,7 +16,6 @@
#ifndef H5REPACK_H__
#define H5REPACK_H__
-#include <string.h>
#include "hdf5.h"
#include "h5trav.h"
#include "h5diff.h"
@@ -44,11 +43,11 @@ typedef struct {
the type of filter and additional parameter
type can be one of the filters
H5Z_FILTER_NONE 0, uncompress if compressed
- H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ H5Z_FILTER_DEFLATE 1 , deflation like gzip
H5Z_FILTER_SHUFFLE 2 , shuffle the data
H5Z_FILTER_FLETCHER32 3 , letcher32 checksum of EDC
H5Z_FILTER_SZIP 4 , szip compression
- H5Z_FILTER_NBIT 5 , nbit compression
+ H5Z_FILTER_NBIT 5 , nbit compression
H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression
*/
@@ -244,82 +243,7 @@ obj_list_t* parse_layout(const char *str,
const char* get_sfilter (H5Z_filter_t filtn);
int parse_number(char *str);
-/*-------------------------------------------------------------------------
- * tests
- *-------------------------------------------------------------------------
- */
-
-#define FNAME0 "test0.h5"
-#define FNAME0OUT "test0out.h5"
-#define FNAME1 "test1.h5"
-#define FNAME1OUT "test1out.h5"
-#define FNAME2 "test2.h5"
-#define FNAME2OUT "test2out.h5"
-#define FNAME3 "test3.h5"
-#define FNAME3OUT "test3out.h5"
-#define FNAME4 "test4.h5"
-#define FNAME4OUT "test4out.h5"
-#define FNAME5 "test5.h5"
-#define FNAME5OUT "test5out.h5"
-#define FNAME6 "test6.h5"
-#define FNAME7 "test_szip.h5"
-#define FNAME8 "test_deflate.h5"
-#define FNAME9 "test_shuffle.h5"
-#define FNAME10 "test_fletcher32.h5"
-#define FNAME11 "test_all.h5"
-#define FNAME7OUT "test_szipout.h5"
-#define FNAME8OUT "test_deflateout.h5"
-#define FNAME9OUT "test_shuffleout.h5"
-#define FNAME10OUT "test_fletcher32out.h5"
-#define FNAME11OUT "test_allout.h5"
-#define FNAME12 "test_nbit.h5"
-#define FNAME12OUT "test_nbitout.h5"
-#define FNAME13 "test_scaleoffset.h5"
-#define FNAME13OUT "test_scaleoffsetout.h5"
-
-int make_testfiles(void);
-
-int write_dset( hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *dset_name,
- hid_t type_id,
- void *buf );
-int write_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *attr_name,
- hid_t type_id,
- void *buf);
-void write_attr_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t fid, /* for reference create */
- int make_diffs /* flag to modify data buffers */);
-void write_dset_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t file_id,
- int make_diffs /* flag to modify data buffers */);
-
-
-
-/*-------------------------------------------------------------------------
- * tests utils
- *-------------------------------------------------------------------------
- */
-int make_dset(hid_t loc_id,
- const char *name,
- hid_t sid,
- hid_t dcpl,
- void *buf);
-
-int make_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *attr_name,
- hid_t type_id,
- void *buf);
-
-
#endif /* H5REPACK_H__ */
+
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index fee7440..e5d962a 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -527,7 +527,7 @@ int do_copy_objects(hid_t fidin,
default:
if (options->verbose)
printf(" %-10s %s\n","User defined object",travt->objs[i].name);
- break;
+ goto error;
}
}
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 96eb787..efedd95 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -137,11 +137,11 @@ void usage(void)
printf("-o output Output HDF5 File\n");
printf("[-h] Print usage message\n");
printf("[-v] Verbose mode. Print more output (list of objects,\n");
- printf(" filters, warnings)\n");
+ printf(" filters, warnings)\n");
printf("[-f 'filter'] Filter type: 'filter' is a string with the format\n");
- printf("\n");
+ printf("\n");
printf(" <list of objects> : <name of filter> = <filter parameters>\n");
- printf("\n");
+ printf("\n");
printf(" <list of objects> is a comma separated list of object names\n");
printf(" meaning apply compression only to those objects.\n");
printf(" if no object names are specified, the filter is applied to all objects\n");
@@ -151,7 +151,7 @@ void usage(void)
printf(" SHUF, to apply the HDF5 shuffle filter\n");
printf(" FLET, to apply the HDF5 checksum filter\n");
printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n");
- printf(" SOFF, to apply the HDF5 Scale/Offset filter\n");
+ printf(" SOFF, to apply the HDF5 Scale/Offset filter\n");
printf(" NONE, to remove the filter\n");
printf(" <filter parameters> is optional compression info\n");
printf(" SHUF (no parameter)\n");
@@ -159,12 +159,12 @@ void usage(void)
printf(" NBIT (no parameter)\n");
printf(" GZIP=<deflation level> from 1-9\n");
printf(" SZIP=<pixels per block,coding>\n");
- printf(" (pixels per block is a even number in 2-32 and coding method\n");
- printf(" is 'EC' or 'NN')\n");
- printf(" SOFF=<scale_factor,scale_type>\n");
- printf(" (scale_factor is an integer and scale_type is either 'IN'\n");
- printf(" for integer type, or 'DS', for floating point type\n");
- printf(" using the D-scaling method)\n");
+ printf(" (pixels per block is a even number in 2-32 and coding method\n");
+ printf(" is 'EC' or 'NN')\n");
+ printf(" SOFF=<scale_factor,scale_type>\n");
+ printf(" (scale_factor is an integer and scale_type is either 'IN'\n");
+ printf(" for integer type, or 'DS', for floating point type\n");
+ printf(" using the D-scaling method)\n");
printf("[-l 'layout'] Layout type. 'layout' is a string with the format\n");
printf("\n");
printf(" <list of objects> : <layout type>\n");
@@ -182,7 +182,7 @@ void usage(void)
printf("\n");
printf("-e file File with the -f and -l options (only filter and layout flags)\n");
printf("-m size Do not apply the filter to objects which size in bytes\n");
- printf(" is smaller than number. If no size is specified a minimum of\n");
+ printf(" is smaller than number. If no size is specified a minimum of\n");
printf(" 1024 bytes is assumed.\n");
printf("\n");
printf("Examples of use:\n");
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 1c67216..9760fa2 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -137,9 +137,9 @@ obj_list_t* parse_filter(const char *str,
/*-------------------------------------------------------------------------
* H5Z_FILTER_SZIP
- * szip has the format SZIP=<pixels per block,coding>
+ * szip has the format SZIP=<pixels per block,coding>
* pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
- * example SZIP=8,NN
+ * example SZIP=8,NN
*-------------------------------------------------------------------------
*/
if (strcmp(scomp,"SZIP")==0)
@@ -171,9 +171,9 @@ obj_list_t* parse_filter(const char *str,
i=len-1; /* end */
(*n_objs)--; /* we counted an extra ',' */
if (strcmp(smask,"NN")==0)
- filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK;
+ filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK;
else if (strcmp(smask,"EC")==0)
- filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
+ filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
else
{
printf("Input Error: szip mask must be 'NN' or 'EC' \n");
diff --git a/tools/h5repack/testh5repack.h b/tools/h5repack/testh5repack.h
new file mode 100644
index 0000000..c367009
--- /dev/null
+++ b/tools/h5repack/testh5repack.h
@@ -0,0 +1,97 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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 HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef TESTH5REPACK_H__
+#define TESTH5REPACK_H__
+
+/*-------------------------------------------------------------------------
+ * tests
+ *-------------------------------------------------------------------------
+ */
+
+#define FNAME0 "test0.h5"
+#define FNAME0OUT "test0out.h5"
+#define FNAME1 "test1.h5"
+#define FNAME1DST "test1_dst.h5"
+#define FNAME1OUT "test1out.h5"
+#define FNAME2 "test2.h5"
+#define FNAME2OUT "test2out.h5"
+#define FNAME3 "test3.h5"
+#define FNAME3OUT "test3out.h5"
+#define FNAME4 "test4.h5"
+#define FNAME4OUT "test4out.h5"
+#define FNAME5 "test5.h5"
+#define FNAME5OUT "test5out.h5"
+#define FNAME6 "test6.h5"
+#define FNAME7 "test_szip.h5"
+#define FNAME8 "test_deflate.h5"
+#define FNAME9 "test_shuffle.h5"
+#define FNAME10 "test_fletcher32.h5"
+#define FNAME11 "test_all.h5"
+#define FNAME7OUT "test_szipout.h5"
+#define FNAME8OUT "test_deflateout.h5"
+#define FNAME9OUT "test_shuffleout.h5"
+#define FNAME10OUT "test_fletcher32out.h5"
+#define FNAME11OUT "test_allout.h5"
+#define FNAME12 "test_nbit.h5"
+#define FNAME12OUT "test_nbitout.h5"
+#define FNAME13 "test_scaleoffset.h5"
+#define FNAME13OUT "test_scaleoffsetout.h5"
+
+int make_testfiles(void);
+
+int write_dset( hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *dset_name,
+ hid_t type_id,
+ void *buf );
+int write_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *attr_name,
+ hid_t type_id,
+ void *buf);
+void write_attr_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t fid, /* for reference create */
+ int make_diffs /* flag to modify data buffers */);
+void write_dset_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t file_id,
+ int make_diffs /* flag to modify data buffers */);
+
+
+
+/*-------------------------------------------------------------------------
+ * tests utils
+ *-------------------------------------------------------------------------
+ */
+int make_dset(hid_t loc_id,
+ const char *name,
+ hid_t sid,
+ hid_t dcpl,
+ void *buf);
+
+int make_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *attr_name,
+ hid_t type_id,
+ void *buf);
+
+
+#endif /* TESTH5REPACK_H__ */
+
diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c
index f18bbc2..7635cf2 100644
--- a/tools/h5repack/testh5repack_attr.c
+++ b/tools/h5repack/testh5repack_attr.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
/*-------------------------------------------------------------------------
* Function: write_attr_in
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index 16962af..095910e 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -16,6 +16,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c
index 862257a..c345028 100644
--- a/tools/h5repack/testh5repack_dset.c
+++ b/tools/h5repack/testh5repack_dset.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
static void make_dset_reg_ref(hid_t loc_id);
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index ab6c09e..42beb76 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
#include "h5diff.h"
#if 0
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index 247d606..43b68b1 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -15,6 +15,7 @@
#include "hdf5.h"
#include "h5test.h"
#include "h5repack.h"
+#include "testh5repack.h"
#define DIM1 40
#define DIM2 20
@@ -851,8 +852,10 @@ int make_all(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
hid_t sid; /* dataspace ID */
+#if defined (H5_HAVE_FILTER_NBIT)
hid_t dtid;
hid_t dsid;
+#endif /* H5_HAVE_FILTER_NBIT */
#if defined (H5_HAVE_FILTER_SZIP)
unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block=8;
diff --git a/tools/h5repack/testh5repack_util.c b/tools/h5repack/testh5repack_util.c
index cad52d3..63b8b1d 100644
--- a/tools/h5repack/testh5repack_util.c
+++ b/tools/h5repack/testh5repack_util.c
@@ -14,6 +14,7 @@
#include "hdf5.h"
#include "h5repack.h"
+#include "testh5repack.h"
/*-------------------------------------------------------------------------
* Function: make_dset
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 7a25d4f..b61cc60 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -161,35 +161,31 @@ static void print_incoming_data(void)
*
* Date: October 22, 2003
*
- * Modifications: Jan 2005 Leon Arber, larber@uiuc.edu
- * Added support for parallel diffing
- *
*-------------------------------------------------------------------------
*/
-hsize_t
-h5diff (const char *fname1,
- const char *fname2,
- const char *objname1, const char *objname2, diff_opt_t * options)
+hsize_t h5diff(const char *fname1,
+ const char *fname2,
+ const char *objname1,
+ const char *objname2,
+ diff_opt_t *options)
{
int nobjects1, nobjects2;
trav_info_t *info1 = NULL;
trav_info_t *info2 = NULL;
hid_t file1_id=(-1), file2_id=(-1);
- char filenames[2][1024];
- hsize_t nfound = 0;
- int not_cmp = 0;
+ char filenames[2][1024];
+ hsize_t nfound = 0;
memset(filenames, 0, 1024*2);
-
- if (options->m_quiet && (options->m_verbose || options->m_report))
- {
- printf
- ("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
- options->err_stat = 1;
- return 0;
- }
+ if (options->m_quiet &&
+ (options->m_verbose || options->m_report))
+ {
+ printf("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
+ options->err_stat=1;
+ return 0;
+ }
/*-------------------------------------------------------------------------
* open the files first; if they are not valid, no point in continuing
@@ -256,8 +252,6 @@ h5diff (const char *fname1,
goto out;
}
-
-
/*-------------------------------------------------------------------------
* get the list of objects in the files
*-------------------------------------------------------------------------
@@ -269,10 +263,8 @@ h5diff (const char *fname1,
{
printf ("Error: Not enough memory for object list\n");
options->err_stat = 1;
- if (info1)
- h5trav_freeinfo (info1, nobjects1);
- if (info2)
- h5trav_freeinfo (info2, nobjects1);
+ if (info1) h5trav_freeinfo (info1, nobjects1);
+ if (info2) h5trav_freeinfo (info2, nobjects1);
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
{
@@ -875,10 +867,10 @@ diff_compare (hid_t file1_id,
*
* Purpose: switch between types and choose the diff function
* TYPE is either
- * H5G_LINK Object is a symbolic link
* H5G_GROUP Object is a group
* H5G_DATASET Object is a dataset
* H5G_TYPE Object is a named data type
+ * H5G_LINK Object is a symbolic link
*
* Return: Number of differences found
*
@@ -901,8 +893,6 @@ diff (hid_t file1_id,
int ret;
H5G_stat_t sb1;
H5G_stat_t sb2;
- char *buf1 = NULL;
- char *buf2 = NULL;
hsize_t nfound = 0;
switch (type)
@@ -1042,18 +1032,22 @@ diff (hid_t file1_id,
*-------------------------------------------------------------------------
*/
case H5G_LINK:
- if (H5Gget_objinfo (file1_id, path1, FALSE, &sb1) < 0)
- goto out;
- if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0)
- goto out;
+ {
+ char *buf1 = NULL;
+ char *buf2 = NULL;
- buf1 = malloc (sb1.u.slink.linklen);
- buf2 = malloc (sb2.u.slink.linklen);
+ if (H5Gget_objinfo (file1_id, path1, FALSE, &sb1) < 0)
+ goto out;
+ if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0)
+ goto out;
+
+ buf1 = HDmalloc (sb1.u.slink.linklen);
+ buf2 = HDmalloc (sb2.u.slink.linklen);
if (H5Gget_linkval (file1_id, path1, sb1.u.slink.linklen, buf1) < 0)
- goto out;
+ goto out;
if (H5Gget_linkval (file2_id, path2, sb1.u.slink.linklen, buf2) < 0)
- goto out;
+ goto out;
ret = HDstrcmp (buf1, buf2);
@@ -1061,23 +1055,13 @@ diff (hid_t file1_id,
nfound = (ret != 0) ? 1 : 0;
if (print_objname (options, nfound))
- parallel_print("Link: <%s> and <%s>\n", path1, path2);
-
- if (buf1)
- {
- free (buf1);
- buf1 = NULL;
- }
-
- if (buf2)
- {
- free (buf2);
- buf2 = NULL;
- }
+ parallel_print("Soft Link: <%s> and <%s>\n", path1, path2);
+ HDfree (buf1);
+ HDfree (buf2);
+ }
break;
-
default:
nfound = 0;
if (options->m_verbose)
@@ -1105,11 +1089,6 @@ out:
}
H5E_END_TRY;
- if (buf1)
- free (buf1);
- if (buf2)
- free (buf2);
-
return nfound;
}
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index dd4784d..f9f0da7 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -336,7 +336,7 @@ hsize_t diff_datum(void *_mem1,
}
else
{
- s = mem1;
+ s = (char *)mem1;
size = H5Tget_size(m_type);
}
@@ -382,6 +382,7 @@ hsize_t diff_datum(void *_mem1,
}
break;
+
/*-------------------------------------------------------------------------
* H5T_OPAQUE
*-------------------------------------------------------------------------
@@ -831,7 +832,6 @@ hsize_t diff_datum(void *_mem1,
print_pos(ph,1,i,acc,pos,rank,obj1,obj2);
parallel_print(SPACES);
parallel_print(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short), abs(1-temp2_short/temp1_short));
-
}
nfound++;
}
@@ -841,7 +841,6 @@ hsize_t diff_datum(void *_mem1,
if ( print_data(options) )
{
print_pos(ph,0,i,acc,pos,rank,obj1,obj2);
-
parallel_print(SPACES);
parallel_print(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
}
@@ -1124,7 +1123,7 @@ hsize_t diff_datum(void *_mem1,
parallel_print(SPACES);
parallel_print(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long), labs(1-temp2_long/temp1_long));
}
- nfound++;
+ nfound++;
}
}
/* -d and -p */
@@ -1752,13 +1751,13 @@ void close_obj(H5G_obj_t obj_type, hid_t obj_id)
*/
static int diff_region(hid_t region1_id, hid_t region2_id)
{
- hssize_t nblocks1, npoints1;
- hssize_t nblocks2, npoints2;
+ hssize_t nblocks1, npoints1;
+ hssize_t nblocks2, npoints2;
hsize_t alloc_size;
hsize_t *ptdata1;
hsize_t *ptdata2;
- int ndims1 = H5Sget_simple_extent_ndims(region1_id);
- int ndims2 = H5Sget_simple_extent_ndims(region2_id);
+ int ndims1 = H5Sget_simple_extent_ndims(region1_id);
+ int ndims2 = H5Sget_simple_extent_ndims(region2_id);
int ret=0;
#if defined (H5DIFF_DEBUG)
@@ -2190,7 +2189,7 @@ hsize_t diff_schar(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(char);
- mem2+=sizeof(char);
+ mem2+=sizeof(char);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2217,7 +2216,7 @@ hsize_t diff_schar(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(char);
- mem2+=sizeof(char);
+ mem2+=sizeof(char);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2245,7 +2244,7 @@ hsize_t diff_schar(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(char);
- mem2+=sizeof(char);
+ mem2+=sizeof(char);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2330,7 +2329,7 @@ hsize_t diff_uchar(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
+ mem2+=sizeof(unsigned char);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2358,7 +2357,7 @@ hsize_t diff_uchar(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
+ mem2+=sizeof(unsigned char);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2472,7 +2471,7 @@ hsize_t diff_short(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(short);
- mem2+=sizeof(short);
+ mem2+=sizeof(short);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2500,7 +2499,7 @@ hsize_t diff_short(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(short);
- mem2+=sizeof(short);
+ mem2+=sizeof(short);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2530,7 +2529,7 @@ hsize_t diff_short(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(short);
- mem2+=sizeof(short);
+ mem2+=sizeof(short);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2614,7 +2613,7 @@ hsize_t diff_ushort(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
+ mem2+=sizeof(unsigned short);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2642,7 +2641,7 @@ hsize_t diff_ushort(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
+ mem2+=sizeof(unsigned short);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2672,7 +2671,7 @@ hsize_t diff_ushort(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
+ mem2+=sizeof(unsigned short);
if (options->n && nfound>=options->count)
return nfound;
}
@@ -2889,7 +2888,7 @@ hsize_t diff_uint(unsigned char *mem1,
memcpy(&temp1_uint, mem1, sizeof(unsigned int));
memcpy(&temp2_uint, mem2, sizeof(unsigned int));
- if (abs(temp1_uint-temp2_uint) > options->delta)
+ if (abs((int)(temp1_uint-temp2_uint)) > options->delta)
{
if ( print_data(options) )
{
@@ -3063,9 +3062,6 @@ hsize_t diff_long(unsigned char *mem1,
{
if ( print_data(options) )
{
- memcpy(&temp1_long, mem1, sizeof(long));
- memcpy(&temp2_long, mem2, sizeof(long));
-
if (labs(temp1_long-temp2_long) > (long)options->delta)
{
if ( print_data(options) )
@@ -3218,7 +3214,7 @@ hsize_t diff_ulong(unsigned char *mem1,
nfound++;
}
mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
if (options->n && nfound>=options->count)
return nfound;
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 9556fe7..01f0fca 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -44,7 +44,6 @@
#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
/* global variables */
-int indent;
int compound_data;
FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */
@@ -425,7 +424,7 @@ h5tools_ncols(const char *s)
*-------------------------------------------------------------------------
*/
static void
-h5tools_simple_prefix(FILE *stream, const h5dump_t *info,
+h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, hsize_t elmtno, int secnum)
{
h5tools_str_t prefix;
@@ -538,7 +537,7 @@ h5tools_simple_prefix(FILE *stream, const h5dump_t *info,
*-------------------------------------------------------------------------
*/
void
-h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
+h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
h5tools_context_t *ctx/*in,out*/, unsigned flags,
hsize_t nelmts, hid_t type, void *_mem)
{
@@ -670,11 +669,8 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
multiline++;
/* pass to the prefix in h5tools_simple_prefix the total position
- instead of the current stripmine position i; this is necessary
- to print the array indices */
-
- /* pass to the prefix in h5tools_simple_prefix the total position
- this is necessary to print the array indices */
+ instead of the current stripmine position i; this is necessary
+ to print the array indices */
curr_pos = ctx->sm_pos + i;
h5tools_simple_prefix(stream, info, ctx, curr_pos, secnum);
@@ -709,7 +705,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
*-------------------------------------------------------------------------
*/
static herr_t
-h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset,
+h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset,
hid_t p_type, struct subset_t *sset,
int indentlevel)
{
@@ -876,7 +872,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
+h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
hid_t p_type, int indentlevel)
{
hid_t f_space; /*file data space */
@@ -1071,7 +1067,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
*-------------------------------------------------------------------------
*/
static int
-h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
+h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id,
hid_t type, hid_t space, void *mem, int indentlevel)
{
int i; /*counters */
@@ -1160,7 +1156,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
*-------------------------------------------------------------------------
*/
int
-h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
+h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, hid_t _p_type,
struct subset_t *sset, int indentlevel)
{
hid_t f_space;
@@ -1168,7 +1164,7 @@ h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
hid_t f_type;
H5S_class_t space_type;
int status = FAIL;
- h5dump_t info_dflt;
+ h5tool_format_t info_dflt;
/* Use default values */
if (!stream)
@@ -1238,10 +1234,10 @@ done:
*-------------------------------------------------------------------------
*/
int
-h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type,
+h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, hid_t type,
hid_t space, void *mem, int indentlevel)
{
- h5dump_t info_dflt;
+ h5tool_format_t info_dflt;
/* Use default values */
if (!stream)
@@ -1260,8 +1256,6 @@ h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type,
indentlevel);
}
-
-
/*-------------------------------------------------------------------------
* Function: init_acc_pos
*
@@ -1290,4 +1284,3 @@ void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
ctx->pos[i]=0;
}
-
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index c5ca4fa..4bbc2d6 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -26,13 +26,13 @@
#define ESCAPE_HTML 1
#define OPT(X,S) ((X) ? (X) : (S))
#define OPTIONAL_LINE_BREAK "\001" /* Special strings embedded in the output */
-#define START_OF_DATA 0x0001
-#define END_OF_DATA 0x0002
+#define START_OF_DATA 0x0001
+#define END_OF_DATA 0x0002
/*
* Information about how to format output.
*/
-typedef struct h5dump_t {
+typedef struct h5tool_format_t {
/*
* Fields associated with formatting numeric data. If a datatype matches
* multiple formats based on its size, then the first applicable format
@@ -321,82 +321,7 @@ typedef struct h5dump_t {
/*escape non printable characters */
int do_escape;
-} h5dump_t;
-
-typedef struct dump_header{
- const char *name;
- const char *filebegin;
- const char *fileend;
- const char *bootblockbegin;
- const char *bootblockend;
- const char *groupbegin;
- const char *groupend;
- const char *datasetbegin;
- const char *datasetend;
- const char *attributebegin;
- const char *attributeend;
- const char *datatypebegin;
- const char *datatypeend;
- const char *dataspacebegin;
- const char *dataspaceend;
- const char *databegin;
- const char *dataend;
- const char *softlinkbegin;
- const char *softlinkend;
- const char *subsettingbegin;
- const char *subsettingend;
- const char *startbegin;
- const char *startend;
- const char *stridebegin;
- const char *strideend;
- const char *countbegin;
- const char *countend;
- const char *blockbegin;
- const char *blockend;
-
- const char *fileblockbegin;
- const char *fileblockend;
- const char *bootblockblockbegin;
- const char *bootblockblockend;
- const char *groupblockbegin;
- const char *groupblockend;
- const char *datasetblockbegin;
- const char *datasetblockend;
- const char *attributeblockbegin;
- const char *attributeblockend;
- const char *datatypeblockbegin;
- const char *datatypeblockend;
- const char *dataspaceblockbegin;
- const char *dataspaceblockend;
- const char *datablockbegin;
- const char *datablockend;
- const char *softlinkblockbegin;
- const char *softlinkblockend;
- const char *strblockbegin;
- const char *strblockend;
- const char *enumblockbegin;
- const char *enumblockend;
- const char *structblockbegin;
- const char *structblockend;
- const char *vlenblockbegin;
- const char *vlenblockend;
- const char *subsettingblockbegin;
- const char *subsettingblockend;
- const char *startblockbegin;
- const char *startblockend;
- const char *strideblockbegin;
- const char *strideblockend;
- const char *countblockbegin;
- const char *countblockend;
- const char *blockblockbegin;
- const char *blockblockend;
-
- const char *dataspacedescriptionbegin;
- const char *dataspacedescriptionend;
- const char *dataspacedimbegin;
- const char *dataspacedimend;
-
-} dump_header;
+} h5tool_format_t;
typedef struct h5tools_context_t {
size_t cur_column; /*current column for output */
@@ -419,8 +344,6 @@ typedef struct h5tools_context_t {
hsize_t sm_pos; /* current stripmine element position */
} h5tools_context_t;
-
-
/* a structure to hold the subsetting particulars for a dataset */
struct subset_t {
hsize_t *start;
@@ -429,74 +352,12 @@ struct subset_t {
hsize_t *block;
};
-/*if we get a new program that needs to use the library add its name here*/
-typedef enum {
- UNKNOWN = 0,
- H5LS,
- H5DUMP
-} ProgType;
-
-/* taken from h5dump.h */
-#define ATTRIBUTE_DATA 0
-#define DATASET_DATA 1
-#define ENUM_DATA 2
-
-#define COL 3
-
-extern int indent; /*how far in to indent the line */
extern FILE *rawdatastream; /*output stream for raw data */
-/* taken from h5dump.h*/
-#define ATTRIBUTE "ATTRIBUTE"
-#define BLOCK "BLOCK"
-#define SUPER_BLOCK "SUPER_BLOCK"
-#define COMPRESSION "COMPRESSION"
-#define CONCATENATOR "//"
-#define COMPLEX "COMPLEX"
-#define COUNT "COUNT"
-#define CSET "CSET"
-#define CTYPE "CTYPE"
-#define DATA "DATA"
+/* Strings for output */
+#define GROUP "GROUP"
#define DATASET "DATASET"
-#define DATASPACE "DATASPACE"
#define DATATYPE "DATATYPE"
-#define EXTERNAL "EXTERNAL"
-#define FILENO "FILENO"
-#define GROUPNAME "GROUP"
-#define HARDLINK "HARDLINK"
-#define NLINK "NLINK"
-#define OBJID "OBJECTID"
-#define OBJNO "OBJNO"
-#define S_SCALAR "SCALAR"
-#define S_SIMPLE "SIMPLE"
-#define S_NULL "NULL"
-#define SOFTLINK "SOFTLINK"
-#define STORAGELAYOUT "STORAGELAYOUT"
-#define START "START"
-#define STRIDE "STRIDE"
-#define STRSIZE "STRSIZE"
-#define STRPAD "STRPAD"
-#define SUBSET "SUBSET"
-#define FILTERS "FILTERS"
-#define DEFLATE "COMPRESSION DEFLATE"
-#define DEFLATE_LEVEL "LEVEL"
-#define SHUFFLE "PREPROCESSING SHUFFLE"
-#define FLETCHER32 "CHECKSUM FLETCHER32"
-#define SZIP "COMPRESSION SZIP"
-#define NBIT "COMPRESSION NBIT"
-#define SCALEOFFSET "COMPRESSION SCALEOFFSET"
-#define SCALEOFFSET_MINBIT "MIN BITS"
-#define STORAGE_LAYOUT "STORAGE_LAYOUT"
-#define CONTIGUOUS "CONTIGUOUS"
-#define COMPACT "COMPACT"
-#define CHUNKED "CHUNKED"
-#define EXTERNAL_FILE "EXTERNAL_FILE"
-#define FILLVALUE "FILLVALUE"
-#define FILE_CONTENTS "FILE_CONTENTS"
-
-
-#define BEGIN "{"
-#define END "}"
/* Definitions of useful routines */
extern void h5tools_init(void);
@@ -504,13 +365,13 @@ extern void h5tools_close(void);
extern hid_t h5tools_fopen(const char *fname, const char *driver,
char *drivername, size_t drivername_len,
int argc, const char *argv[]);
-extern int h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset,
+extern int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
hid_t p_typ, struct subset_t *sset, int indentlevel);
-extern int h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
+extern int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id,
hid_t type, hid_t space, void *mem, int indentlevel);
extern hid_t h5tools_get_native_type(hid_t type);
-extern void h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
+extern void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
h5tools_context_t *ctx/*in,out*/, unsigned flags,
hsize_t nelmts, hid_t type, void *_mem);
@@ -520,5 +381,5 @@ extern int h5tools_can_encode(H5Z_filter_t filtn);
void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims);
-
#endif /* H5TOOLS_H__ */
+
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index c93d2e5..89bdaf1 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -156,17 +156,26 @@ haddr_t
ref_path_table_lookup(const char *thepath)
{
H5G_stat_t sb;
- haddr_t ret_value;
- /* Get object ID for object at path */
- if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0)
- /* fatal error ? */
+ /* Check for external link first, so we don't return the OID of an object in another file */
+ if(H5Gget_objinfo(thefile, thepath, FALSE, &sb)<0)
return HADDR_UNDEF;
-
- /* Return OID or HADDR_UNDEF */
- ret_value = ref_path_table_find(sb.u.obj.objno) ? sb.u.obj.objno : HADDR_UNDEF;
-
- return(ret_value);
+ if(sb.type == H5G_LINK) {
+ /* Get object ID for object at path */
+ /* (If the object is not a soft link, we've already retrieved the
+ * correct information and don't have to perform this call. -QAK
+ */
+ if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0)
+ /* fatal error ? */
+ return HADDR_UNDEF;
+ } /* end if */
+
+
+ /* All existing objects in the file had better be in the table */
+ HDassert(ref_path_table_find(sb.u.obj.objno));
+
+ /* Return OID */
+ return(sb.u.obj.objno);
}
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 1c1c1b2..73ca045 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -24,7 +24,7 @@
#include <string.h>
#include "H5private.h"
-#include "h5tools.h" /*for h5dump_t structure */
+#include "h5tools.h" /*for h5tool_format_t structure */
#include "h5tools_ref.h"
#include "h5tools_str.h" /*function prototypes */
@@ -304,7 +304,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5dump_t *info,
+h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
hsize_t elmtno, int ndims, hsize_t min_idx[],
hsize_t max_idx[], h5tools_context_t *ctx)
{
@@ -364,7 +364,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5dump_t *info,
*-------------------------------------------------------------------------
*/
int
-h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info)
+h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5tool_format_t *info)
{
hssize_t nblocks, npoints;
hsize_t alloc_size;
@@ -461,7 +461,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info)
*-------------------------------------------------------------------------
*/
void
-h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
+h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, unsigned char ch)
{
if (info->str_locale == ESCAPE_HTML) {
if (ch <= ' ' || ch > '~')
@@ -564,7 +564,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
+h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
hid_t type, void *vp, h5tools_context_t *ctx)
{
size_t n, offset, size=0, nelmts, start;
@@ -859,7 +859,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
/* Print object type and close object */
switch (otype) {
case H5G_GROUP:
- h5tools_str_append(str, GROUPNAME);
+ h5tools_str_append(str, GROUP);
H5Gclose(obj);
break;
case H5G_DATASET:
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index db7c1b3..19872a1 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -31,12 +31,12 @@ extern char *h5tools_str_append(h5tools_str_t *str, const char *fmt, ...);
extern char *h5tools_str_reset(h5tools_str_t *str);
extern char *h5tools_str_trunc(h5tools_str_t *str, size_t size);
extern char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
-extern char *h5tools_str_prefix(h5tools_str_t *str, const h5dump_t *info,
+extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info,
hsize_t elmtno, int ndims, hsize_t min_idx[],
hsize_t max_idx[], h5tools_context_t *ctx);
-extern int h5tools_str_dump_region(h5tools_str_t *, hid_t, const h5dump_t *);
-extern void h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch);
-extern char *h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info,
+extern int h5tools_str_dump_region(h5tools_str_t *, hid_t, const h5tool_format_t *);
+extern void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, unsigned char ch);
+extern char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
hid_t container, hid_t type, void *vp,
h5tools_context_t *ctx);
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 3e63c56..9eba7c5 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -591,7 +591,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
init_table(type_table);
/* Init the find_objs_t */
- info->prefix = "";
+ info->prefix = (char *)"";
info->group_table = *group_table;
info->type_table = *type_table;
info->dset_table = *dset_table;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 5030e37..b59162a 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -17,14 +17,14 @@
#include "H5private.h"
/* functions for traversal */
-int traverse( hid_t loc_id,
+static int traverse( hid_t loc_id,
const char *group_name,
trav_table_t *table,
trav_info_t *info,
int *idx,
int print);
-herr_t get_nnames( hid_t loc_id,
+static hssize_t get_nnames( hid_t loc_id,
const char *group_name );
herr_t get_name_type( hid_t loc_id,
@@ -159,36 +159,6 @@ void h5trav_freeinfo( trav_info_t *info, int nobjs )
/*-------------------------------------------------------------------------
- * Function: count_names
- *
- * Purpose: operator function
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October 10, 2002
- *
- * Comments:
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static herr_t count_names( hid_t loc_id, const char *name, void *op_data)
-{
-
- H5G_stat_t statbuf;
-
- if (H5Gget_objinfo( loc_id, name, 0, &statbuf) < 0 )
- return 1;
-
- (*(int *)op_data)++;
-
- /* Define a default zero value for return. This will cause the iterator to continue */
- return 0;
-}
-
-/*-------------------------------------------------------------------------
* Function: get_nnames
*
* Purpose: Counts the number of names in the group GROUP_NAME
@@ -209,15 +179,24 @@ static herr_t count_names( hid_t loc_id, const char *name, void *op_data)
*-------------------------------------------------------------------------
*/
-herr_t get_nnames( hid_t loc_id, const char *group_name )
+static hssize_t get_nnames( hid_t loc_id, const char *group_name )
{
+ hid_t gid;
+ hsize_t nobjs = 0;
- int nobjs = 0;
+ /* Open the group */
+ if((gid = H5Gopen(loc_id, group_name)) < 0)
+ return(-1);
- if ( H5Giterate( loc_id, group_name, NULL, count_names, (void *)&nobjs ) < 0 )
- return -1;
+ /* Retrieve the number of objects in it */
+ if(H5Gget_num_objs(gid, &nobjs) < 0)
+ return(-1);
- return nobjs;
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ return(-1);
+
+ return((hssize_t)nobjs);
}
@@ -242,7 +221,7 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data)
H5G_stat_t statbuf;
- if (H5Gget_objinfo( loc_id, name, 0, &statbuf) < 0 )
+ if (H5Gget_objinfo( loc_id, name, FALSE, &statbuf) < 0 )
return -1;
((trav_info_t *)op_data)->type = statbuf.type;
@@ -306,7 +285,7 @@ herr_t get_name_type( hid_t loc_id,
*-------------------------------------------------------------------------
*/
-int traverse( hid_t loc_id,
+static int traverse( hid_t loc_id,
const char *group_name,
trav_table_t *table,
trav_info_t *info,
@@ -323,7 +302,7 @@ int traverse( hid_t loc_id,
int i, j;
/* get the number of names */
- if (( n_names = get_nnames( loc_id, group_name )) < 0 )
+ if (( n_names = (int)get_nnames( loc_id, group_name )) < 0 )
return -1;
for ( i = 0; i < n_names; i++)
@@ -332,13 +311,13 @@ int traverse( hid_t loc_id,
return -1;
/* allocate path buffer */
- path = (char*) HDmalloc(strlen(group_name) + strlen(name) + 2);
+ path = (char*) HDmalloc(HDstrlen(group_name) + HDstrlen(name) + 2);
/* initialize path */
- strcpy( path, group_name );
- if ( strcmp(group_name,"/")!=0 )
- strcat( path, "/" );
- strcat( path, name );
+ HDstrcpy( path, group_name );
+ if ( HDstrcmp(group_name, "/") != 0 )
+ HDstrcat( path, "/" );
+ HDstrcat( path, name );
/* disable error reporting */
H5E_BEGIN_TRY {
@@ -483,22 +462,22 @@ int traverse( hid_t loc_id,
case H5G_LINK:
{
- char *targbuf=NULL;
-
/* increment */
inserted_objs++;
/* add object to table */
- trav_table_add(statbuf.u.obj.objno, path, H5G_LINK, table );
+ trav_table_add(HADDR_UNDEF, path, H5G_LINK, table );
if (statbuf.u.slink.linklen>0)
{
- targbuf=malloc(statbuf.u.slink.linklen);
+ char *targbuf;
+
+ targbuf = HDmalloc(statbuf.u.slink.linklen);
+ assert(targbuf);
H5Gget_linkval(loc_id,path,statbuf.u.slink.linklen,targbuf);
if (print)
printf(" %-10s %s -> %s\n", "link", path, targbuf);
- if (targbuf)
- free(targbuf);
+ free(targbuf);
}
else
{
@@ -511,6 +490,8 @@ int traverse( hid_t loc_id,
default:
+ HDfprintf(stderr, "traverse: Unknown object!\n");
+ return (-1);
break;
}
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index cd38a9b..40fa63d 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -17,19 +17,14 @@
#include "hdf5.h"
-#if 0
-#define H5_TRAV_DEBUG
-#endif
-
-
/*-------------------------------------------------------------------------
* public struct to store name and type of an object
* the TYPE can be:
* H5G_UNKNOWN = -1,
- * H5G_LINK, Object is a symbolic link
* H5G_GROUP, Object is a group
* H5G_DATASET, Object is a dataset
* H5G_TYPE, Object is a named data type
+ * H5G_LINK, Object is a symbolic link
*-------------------------------------------------------------------------
*/
diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c
index df56e72..6457595 100644
--- a/tools/misc/h5repart_gentest.c
+++ b/tools/misc/h5repart_gentest.c
@@ -29,7 +29,7 @@
int main(void)
{
- hid_t file=(-1), fapl, fapl2=(-1), space=(-1), dset=(-1);
+ hid_t file=(-1), fapl, space=(-1), dset=(-1);
char dname[]="dataset";
int i, j;
int buf[FAMILY_NUMBER][FAMILY_SIZE];
diff --git a/tools/misc/h5stat.c b/tools/misc/h5stat.c
index 4965d23..20e76be 100644
--- a/tools/misc/h5stat.c
+++ b/tools/misc/h5stat.c
@@ -94,11 +94,11 @@ static struct {
static unsigned
ceil_log10(unsigned long x)
{
- unsigned long pow = 1;
+ unsigned long pow10 = 1;
unsigned ret = 0;
- while(x >= pow) {
- pow *= 10;
+ while(x >= pow10) {
+ pow10 *= 10;
ret++;
} /* end while */
diff --git a/tools/testfiles/h5diff_25.txt b/tools/testfiles/h5diff_25.txt
index b137f44..237a685 100644
--- a/tools/testfiles/h5diff_25.txt
+++ b/tools/testfiles/h5diff_25.txt
@@ -1,4 +1,4 @@
#############################
Expected output for 'h5diff file3.h5 file3.h5 -v link link'
#############################
-Link: </link> and </link>
+Soft Link: </link> and </link>