summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-17 12:48:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-17 12:48:04 (GMT)
commit13c484162cc9098e6538deec931563848011bdb5 (patch)
treec33201bfab0f74c7e3bff9b17a55d92deb852118 /tools
parentbe729e5f78ae9308dd4a305039e8ddd58068d477 (diff)
downloadhdf5-13c484162cc9098e6538deec931563848011bdb5.zip
hdf5-13c484162cc9098e6538deec931563848011bdb5.tar.gz
hdf5-13c484162cc9098e6538deec931563848011bdb5.tar.bz2
[svn-r14206] Description:
Make H5Pget_filter API versioned and switch internal usage to H5Pget_filter2. Add regression test for H5Pget_filter1. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c15
-rw-r--r--tools/h5ls/h5ls.c49
-rw-r--r--tools/h5repack/h5repack_copy.c37
-rw-r--r--tools/h5repack/h5repack_filters.c36
-rw-r--r--tools/h5repack/h5repack_verify.c37
-rw-r--r--tools/h5stat/h5stat.c6
-rw-r--r--tools/lib/h5tools_filters.c14
7 files changed, 59 insertions, 135 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 2d1ac7c..a46054d 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2571,13 +2571,8 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
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);
-#else
- filtn = H5Pget_filter(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ filtn = H5Pget_filter2(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:
@@ -5776,15 +5771,9 @@ check_filters(hid_t dcpl)
if (nfilt <= 0)
return;
for (i = 0; i < nfilt; i++) {
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
- (size_t *) &cd_nelmts,
- cd_values, 120, namebuf);
-#else
- filter = H5Pget_filter(dcpl, (unsigned)i, &flags,
+ filter = H5Pget_filter2(dcpl, (unsigned)i, &flags,
(size_t *) &cd_nelmts,
cd_values, 120, namebuf, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
if (filter == H5Z_FILTER_DEFLATE) {
indentation(indent + COL);
printf("<%sDeflate Level=\"",xmlnsprefix);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 06de2bc..f98a84b 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1530,7 +1530,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
double utilization; /* percent utilization of storage */
int i;
- if (verbose_g>0) {
+ if(verbose_g > 0) {
dcpl = H5Dget_create_plist(dset);
space = H5Dget_space(dset);
type = H5Dget_type(dset);
@@ -1565,12 +1565,12 @@ dataset_list2(hid_t dset, const char UNUSED *name)
putchar('\n');
/* Print information about external strorage */
- if ((nf = H5Pget_external_count(dcpl))>0) {
- for (i=0, max_len=0; i<nf; i++) {
+ if((nf = H5Pget_external_count(dcpl)) > 0) {
+ for(i = 0, max_len = 0; i < nf; i++) {
H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL);
n = display_string(NULL, f_name, TRUE);
max_len = MAX(max_len, n);
- }
+ } /* end for */
printf(" %-10s %d external file%s\n",
"Extern:", nf, 1==nf?"":"s");
printf(" %4s %10s %10s %10s %s\n",
@@ -1599,32 +1599,28 @@ dataset_list2(hid_t dset, const char UNUSED *name)
}
printf(" %4s %10s %10s %10s ",
"----", "----------", "----------", "----------");
- for (i=0; i<max_len; i++) putchar('-');
+ for (i=0; i<max_len; i++)
+ putchar('-');
putchar('\n');
- }
+ } /* end if */
/* Print information about raw data filters */
- if ((nf = H5Pget_nfilters(dcpl))>0) {
- for (i=0; i<nf; i++) {
+ if((nf = H5Pget_nfilters(dcpl)) > 0) {
+ for(i = 0; i < nf; i++) {
cd_nelmts = NELMTS(cd_values);
-#ifdef H5_WANT_H5_V1_6_COMPAT
- filt_id = H5Pget_filter(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_name), f_name);
-#else
- filt_id = H5Pget_filter(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
+ filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
- f_name[sizeof(f_name)-1] = '\0';
+ f_name[sizeof(f_name) - 1] = '\0';
sprintf(s, "Filter-%d:", i);
printf(" %-10s %s-%u %s {", s,
- f_name[0]?f_name:"method",
+ (f_name[0] ? f_name : "method"),
(unsigned)filt_id,
- filt_flags & H5Z_FLAG_OPTIONAL?"OPT":"");
- for (cd_num=0; cd_num<cd_nelmts; cd_num++)
- printf("%s%u", cd_num?", ":"", cd_values[cd_num]);
+ ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
+ for(cd_num = 0; cd_num < cd_nelmts; cd_num++)
+ printf("%s%u", (cd_num ? ", " : ""), cd_values[cd_num]);
printf("}\n");
- }
- }
+ } /* end for */
+ } /* end if */
/* Print data type */
printf(" %-10s ", "Type:");
@@ -1632,17 +1628,20 @@ dataset_list2(hid_t dset, const char UNUSED *name)
printf("\n");
/* Print address information */
- if (address_g) H5Ddebug(dset);
+ if(address_g)
+ H5Ddebug(dset);
/* Close stuff */
H5Tclose(type);
H5Sclose(space);
H5Pclose(dcpl);
- }
+ } /* end if */
+
+ if(data_g)
+ dump_dataset_values(dset);
- if (data_g) dump_dataset_values(dset);
return 0;
-}
+} /* end dataset_list2() */
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index b1417e1..e6c32c6 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -1053,36 +1053,19 @@ static void print_dataset_info(hid_t dcpl_id,
strcpy(strfilter,"\0");
/* get information about input filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return;
- for ( i=0; i<nfilters; i++)
- {
+ 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_objname),
- f_objname);
-#else
- filtn = H5Pget_filter(dcpl_id,
- (unsigned)i,
- &filt_flags,
- &cd_nelmts,
- cd_values,
- sizeof(f_objname),
- f_objname,
- NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
-
- switch (filtn)
- {
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_objname), f_objname, NULL);
+
+ switch(filtn) {
default:
break;
+
case H5Z_FILTER_DEFLATE:
strcat(strfilter,"GZIP ");
@@ -1093,8 +1076,8 @@ static void print_dataset_info(hid_t dcpl_id,
strcat(strfilter,temp);
}
#endif
-
break;
+
case H5Z_FILTER_SZIP:
strcat(strfilter,"SZIP ");
@@ -1114,15 +1097,19 @@ static void print_dataset_info(hid_t dcpl_id,
#endif
break;
+
case H5Z_FILTER_SHUFFLE:
strcat(strfilter,"SHUF ");
break;
+
case H5Z_FILTER_FLETCHER32:
strcat(strfilter,"FLET ");
break;
+
case H5Z_FILTER_NBIT:
strcat(strfilter,"NBIT ");
break;
+
case H5Z_FILTER_SCALEOFFSET:
strcat(strfilter,"SCALEOFFSET ");
break;
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index a2d86fa..0e7a557 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -412,8 +412,6 @@ int apply_filters(const char* name, /* object name from traverse list */
return 0;
}
-
-
/*-------------------------------------------------------------------------
* Function: print_filters
*
@@ -437,47 +435,25 @@ int print_filters(hid_t dcpl_id)
int i;
/* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
- for (i=0; i<nfilters; i++)
- {
+ 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);
-#else
- 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 */
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
f_name[sizeof(f_name)-1] = '\0';
sprintf(s, "Filter-%d:", i);
printf(" %-10s %s-%u %s {", s,
- f_name[0]?f_name:"method",
+ f_name[0] ? f_name : "method",
(unsigned)filtn,
filt_flags & H5Z_FLAG_OPTIONAL?"OPT":"");
- for (cd_num=0; cd_num<cd_nelmts; cd_num++) {
+ for(cd_num = 0; cd_num < cd_nelmts; cd_num++)
printf("%s%u", cd_num?", ":"", cd_values[cd_num]);
- }
printf("}\n");
}
return 0;
-
-
}
-
-
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index e87d318..995aca1 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -37,53 +37,34 @@ extern char *progname;
static int
has_filter(hid_t dcpl_id, H5Z_filter_t filtnin)
{
-
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 */
- int have=0; /* flag, filter is present */
+ int have = 0; /* flag, filter is present */
int i; /* index */
/* if no information about the input filter is requested return exit */
- if (filtnin==-1)
+ if(filtnin == -1)
return 1;
/* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return -1;
/* if we do not have filters and the requested filter is NONE, return 1 */
- if (!nfilters && filtnin==H5Z_FILTER_NONE)
+ if(!nfilters && filtnin == H5Z_FILTER_NONE)
return 1;
- for (i=0; i<nfilters; i++)
- {
+ 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);
-#else
- 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 */
-
- if (filtnin==filtn)
- have=1;
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
+ if(filtnin == filtn)
+ have = 1;
}
return have;
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index ed6c6c4..fbf38bd 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -691,11 +691,7 @@ dataset_stats(hid_t group, const char *name, const H5O_info_t *oi, iter_t *iter)
if(nfltr == 0)
iter->dset_comptype[0]++;
for(u = 0; u < (unsigned)nfltr; u++) {
-#ifdef H5_WANT_H5_V1_6_COMPAT
- fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0);
-#else /* H5_WANT_H5_V1_6_COMPAT */
- fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0, NULL);
-#endif /* H5_WANT_H5_V1_6_COMPAT */
+ fltr = H5Pget_filter2(dcpl, u, 0, 0, 0, 0, 0, NULL);
if(fltr < (H5_NFILTERS_IMPL - 1))
iter->dset_comptype[fltr]++;
else
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 9ba9492..325023d 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -85,24 +85,20 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
return 1;
/* check availability of filters */
- for (i=0; i<nfilters; i++)
+ for(i = 0; i < nfilters; i++)
{
-#ifdef H5_WANT_H5_V1_6_COMPAT
- if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0))<0)
-#else
- if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0,NULL))<0)
-#endif
+ if((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, 0, 0, NULL)) < 0)
return -1;
- switch (filtn)
+ switch(filtn)
{
/*-------------------------------------------------------------------------
* user defined filter
*-------------------------------------------------------------------------
*/
default:
- if (name)
- print_warning(name,"user defined");
+ if(name)
+ print_warning(name, "user defined");
return 0;
/*-------------------------------------------------------------------------