summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/Makefile.in2
-rw-r--r--tools/lib/h5diff.c2
-rw-r--r--tools/lib/h5diff.h5
-rw-r--r--tools/lib/h5diff_array.c8
-rw-r--r--tools/lib/h5diff_attr.c24
-rw-r--r--tools/lib/h5diff_dset.c45
-rw-r--r--tools/lib/h5tools.c14
-rw-r--r--tools/lib/h5tools.h6
-rw-r--r--tools/lib/h5tools_filters.c2
-rw-r--r--tools/lib/h5tools_str.c3
-rw-r--r--tools/lib/h5tools_type.c47
-rw-r--r--tools/lib/h5trav.c6
-rw-r--r--tools/lib/h5trav.h6
-rw-r--r--tools/lib/talign.c7
14 files changed, 78 insertions, 99 deletions
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index 2fff656..0e382b9 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -41,7 +41,7 @@ PROGS=$(PUB_PROGS) $(TEST_PROGS)
## Source and object files for the library; do not install
##
-LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c h5tools_filters.c h5tools_ref.c
+LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c h5tools_filters.c h5tools_ref.c h5tools_type.c
LIB_OBJ=$(LIB_SRC:.c=.lo)
PUB_LIB=
AUX_LIB=$(LIB)
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index f5ba995..c271f21 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -412,7 +412,7 @@ hsize_t diff( hid_t file1_id,
hid_t file2_id,
const char *path2,
diff_opt_t *options,
- H5G_obj_t1 type )
+ H5G_obj_t type )
{
hid_t type1_id;
hid_t type2_id;
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 4c56f81..1ef3c87 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -18,9 +18,6 @@
#include "hdf5.h"
#include "h5trav.h"
-typedef H5G_obj_t H5G_obj_t1;
-
-
#if 0
#define H5DIFF_DEBUG
@@ -115,7 +112,7 @@ hsize_t diff( hid_t file1_id,
hid_t file2_id,
const char *path2,
diff_opt_t *options,
- H5G_obj_t1 type );
+ H5G_obj_t type );
hsize_t diff_compare( hid_t file1_id,
const char *file1_name,
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 73a1fbf..0339e47 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -17,7 +17,7 @@
#include "H5private.h"
/* local functions */
-static void close_obj(H5G_obj_t1 obj_type, hid_t obj_id);
+static void close_obj(H5G_obj_t obj_type, hid_t obj_id);
static int diff_region(hid_t region1_id, hid_t region2_id);
static hbool_t is_zero(const void *_mem, size_t size);
@@ -202,8 +202,8 @@ hsize_t diff_datum(void *_mem1,
size_t size;
int iszero1;
int iszero2;
- H5G_obj_t1 obj1_type;
- H5G_obj_t1 obj2_type;
+ H5G_obj_t obj1_type;
+ H5G_obj_t obj2_type;
hid_t obj1_id;
hid_t obj2_id;
H5G_stat_t sb1;
@@ -1659,7 +1659,7 @@ is_zero(const void *_mem, size_t size)
*/
static
-void close_obj(H5G_obj_t1 obj_type, hid_t obj_id)
+void close_obj(H5G_obj_t obj_type, hid_t obj_id)
{
switch (obj_type) {
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 3278bdb..fb4343f 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -12,6 +12,7 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include "h5tools.h"
#include "h5diff.h"
#include "H5private.h"
@@ -66,7 +67,6 @@ int diff_attr(hid_t loc1_id,
int ret=0;
hsize_t nfound;
int cmp=1;
- H5T_class_t type_class; /* Datatype class */
if ((n1 = H5Aget_num_attrs(loc1_id))<0)
goto error;
@@ -162,25 +162,11 @@ int diff_attr(hid_t loc1_id,
for (j=0; j<rank1; j++)
nelmts1*=dims1[j];
- if((type_class = H5Tget_class(ftype1_id))<0)
- goto error;
- if(type_class==H5T_BITFIELD) {
- if((mtype1_id=H5Tcopy(ftype1_id))<0)
- goto error;
- } else {
- if ((mtype1_id=H5Tget_native_type(ftype1_id,H5T_DIR_DEFAULT))<0)
- goto error;
- }
+ if ((mtype1_id=h5tools_get_native_type(ftype1_id))<0)
+ goto error;
- if((type_class = H5Tget_class(ftype2_id))<0)
- goto error;
- if(type_class==H5T_BITFIELD) {
- if((mtype2_id=H5Tcopy(ftype2_id))<0)
- goto error;
- } else {
- if ((mtype2_id=H5Tget_native_type(ftype2_id,H5T_DIR_DEFAULT))<0)
- goto error;
- }
+ if ((mtype2_id=h5tools_get_native_type(ftype2_id))<0)
+ goto error;
if ((msize1=H5Tget_size(mtype1_id))==0)
goto error;
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 767587d..0cc8324 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -155,7 +155,6 @@ hsize_t diff_datasetid( hid_t dset1_id,
hsize_t storage_size1;
hsize_t storage_size2;
hsize_t nfound=0; /* number of differences found */
- H5T_class_t type_class; /* data type class */
int cmp=1; /* do diff or not */
int i;
@@ -267,25 +266,11 @@ hsize_t diff_datasetid( hid_t dset1_id,
* memory type and sizes
*-------------------------------------------------------------------------
*/
- if((type_class = H5Tget_class(f_type1))<0)
- goto error;
- if(type_class==H5T_BITFIELD) {
- if((m_type1=H5Tcopy(f_type1))<0)
- goto error;
- } else {
- if ((m_type1=H5Tget_native_type(f_type1,H5T_DIR_DEFAULT))<0)
- goto error;
- }
+ if ((m_type1=h5tools_get_native_type(f_type1))<0)
+ goto error;
- if((type_class = H5Tget_class(f_type2))<0)
- goto error;
- if(type_class==H5T_BITFIELD) {
- if((m_type2=H5Tcopy(f_type2))<0)
- goto error;
- } else {
- if ((m_type2=H5Tget_native_type(f_type2,H5T_DIR_DEFAULT))<0)
- goto error;
- }
+ if ((m_type2=h5tools_get_native_type(f_type2))<0)
+ goto error;
m_size1 = H5Tget_size( m_type1 );
m_size2 = H5Tget_size( m_type2 );
@@ -322,15 +307,8 @@ hsize_t diff_datasetid( hid_t dset1_id,
{
H5Tclose(m_type1);
- if((type_class = H5Tget_class(f_type2))<0)
- goto error;
- if(type_class==H5T_BITFIELD) {
- if((m_type1=H5Tcopy(f_type2))<0)
- goto error;
- } else {
- if ((m_type1=H5Tget_native_type(f_type2,H5T_DIR_DEFAULT))<0)
- goto error;
- }
+ if ((m_type1=h5tools_get_native_type(f_type2))<0)
+ goto error;
m_size1 = H5Tget_size( m_type1 );
}
@@ -338,15 +316,8 @@ hsize_t diff_datasetid( hid_t dset1_id,
{
H5Tclose(m_type2);
- if((type_class = H5Tget_class(f_type1))<0)
- goto error;
- if(type_class==H5T_BITFIELD) {
- if((m_type2=H5Tcopy(f_type1))<0)
- goto error;
- } else {
- if ((m_type2=H5Tget_native_type(f_type1,H5T_DIR_DEFAULT))<0)
- goto error;
- }
+ if ((m_type2=h5tools_get_native_type(f_type1))<0)
+ goto error;
m_size2 = H5Tget_size( m_type2 );
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index d3a2d7a..dd96aa7 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -43,8 +43,6 @@
#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
-
-
/* global variables */
int indent;
int compound_data;
@@ -1137,15 +1135,8 @@ h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
if (info->raw)
p_type = H5Tcopy(f_type);
- else {
- H5T_class_t type_class;
-
- type_class = H5Tget_class(f_type);
- if(type_class==H5T_BITFIELD)
- p_type=H5Tcopy(f_type);
- else
- p_type = H5Tget_native_type(f_type,H5T_DIR_DEFAULT);
- }
+ else
+ p_type = h5tools_get_native_type(f_type);
H5Tclose(f_type);
@@ -1219,3 +1210,4 @@ h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type,
return h5tools_dump_simple_mem(stream, info, obj_id, type, space, mem,
indentlevel);
}
+
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 7837a5e..f5731a0 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -315,10 +315,10 @@ typedef struct h5dump_t {
const char *dset_ptformat_pre;
const char *dset_ptformat;
- /*print array indices in output matrix */
+ /*print array indices in output matrix */
int pindex;
- /*escape non printable characters */
+ /*escape non printable characters */
int do_escape;
} h5dump_t;
@@ -473,7 +473,6 @@ extern FILE *rawdatastream; /*output stream for raw data */
#define STRSIZE "STRSIZE"
#define STRPAD "STRPAD"
#define SUBSET "SUBSET"
-
#define FILTERS "FILTERS"
#define DEFLATE "COMPRESSION DEFLATE"
#define DEFLATE_LEVEL "LEVEL"
@@ -502,6 +501,7 @@ extern int h5tools_dump_dset(FILE *stream, const h5dump_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,
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,
h5tools_context_t *ctx/*in,out*/, unsigned flags,
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 5315fd4..368283f 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -1,5 +1,3 @@
-
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 3350f51..f5a1690 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -28,8 +28,6 @@
#include "h5tools_str.h" /*function prototypes */
#include "h5tools_ref.h"
-
-
/*
* If REPEAT_VERBOSE is defined then character strings will be printed so
* that repeated character sequences like "AAAAAAAAAA" are displayed as
@@ -931,7 +929,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
h5tools_str_append(str, "%s", OPT(info->line_pre, ""));
}
-
for (x = 0; x < ctx->indent_level + 1; x++)
h5tools_str_append(str,"%s",OPT(info->line_indent,""));
} /* end if */
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
new file mode 100644
index 0000000..53a3505
--- /dev/null
+++ b/tools/lib/h5tools_type.c
@@ -0,0 +1,47 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5tools.h"
+
+/*-------------------------------------------------------------------------
+ * Function: h5tools_get_native_type
+ *
+ * Purpose: Wrapper around H5Tget_native_type() to work around
+ * Problems with bitfields.
+ *
+ * Return: Success: datatype ID
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, October 5, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+h5tools_get_native_type(hid_t type)
+{
+ hid_t p_type;
+ H5T_class_t type_class;
+
+ type_class = H5Tget_class(type);
+ if(type_class==H5T_BITFIELD)
+ p_type=H5Tcopy(type);
+ else
+ p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT);
+
+ return(p_type);
+}
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 93211c5..8094c33 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -25,7 +25,7 @@ int traverse( hid_t loc_id,
int print);
herr_t get_nnames( hid_t loc_id,
- const char *group_name );
+ const char *group_name );
herr_t get_name_type( hid_t loc_id,
const char *group_name,
@@ -322,14 +322,12 @@ int traverse( hid_t loc_id,
int inserted_objs=0;
int i, j;
-
/* get the number of names */
if (( n_names = get_nnames( loc_id, group_name )) < 0 )
return -1;
for ( i = 0; i < n_names; i++)
{
-
if (get_name_type( loc_id, group_name, i, &name, &type ) < 0 )
return -1;
@@ -407,7 +405,6 @@ int traverse( hid_t loc_id,
}
-
break;
/*-------------------------------------------------------------------------
@@ -512,7 +509,6 @@ int traverse( hid_t loc_id,
break;
-
default:
break;
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index 671e17c..e8e8a3f 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -27,9 +27,9 @@
* 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_GROUP, Object is a group
+ * H5G_DATASET, Object is a dataset
+ * H5G_TYPE, Object is a named data type
*-------------------------------------------------------------------------
*/
diff --git a/tools/lib/talign.c b/tools/lib/talign.c
index 082e37e..bb9f96e 100644
--- a/tools/lib/talign.c
+++ b/tools/lib/talign.c
@@ -29,7 +29,6 @@ int main(void)
hsize_t dim[2];
hsize_t cdim[4];
- H5T_class_t type_class;
char string5[5];
float fok[2] = {1234., 2341.};
@@ -73,11 +72,7 @@ int main(void)
H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt);
H5Tclose(array_dt);
- type_class = H5Tget_class(cmp);
- if(type_class==H5T_BITFIELD)
- fix=H5Tcopy(cmp);
- else
- fix=H5Tget_native_type(cmp, H5T_DIR_DEFAULT);
+ fix=h5tools_get_native_type(cmp);
cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok));