[svn-r8062] Purpose:

bug fix

Description:
cases of rank 0 were not handled, now a warning is made that the dataset cannot be compressed

Solution:

Platforms tested:
linux
solaris
AIX

Misc. update:
This commit is contained in:
Pedro Vicente Nunes 2004-01-14 15:09:44 -05:00
parent 62a9b30a64
commit 7f7fbb4718
5 changed files with 26 additions and 15 deletions

View File

@ -19,7 +19,7 @@
#include "hdf5.h"
#include "h5trav.h"
#if 0
#if 1
#define H5_REPACK_DEBUG
#endif

View File

@ -73,10 +73,6 @@ int copy_objects(const char* fnamein,
if (h5trav_gettable(fidin,travt)<0)
goto out;
#if defined (H5_REPACK_DEBUG)
h5trav_printtable(travt);
#endif
/*-------------------------------------------------------------------------
* do the copy
*-------------------------------------------------------------------------
@ -221,6 +217,7 @@ int do_copy_objects(hid_t fidin,
goto error;
if ( (rank=H5Sget_simple_extent_ndims(space_id))<0)
goto error;
HDmemset(dims, 0, sizeof dims);
if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0)
goto error;
nelmts=1;
@ -282,15 +279,24 @@ int do_copy_objects(hid_t fidin,
*/
if (filter_this(travt->objs[i].name,options,&obj))
{
/* filters require CHUNK layout; if we do not have one define a default */
if (obj.chunk.rank==0)
if (rank)
{
obj.chunk.rank=rank;
for (j=0; j<rank; j++)
obj.chunk.chunk_lengths[j] = dims[j];
/* filters require CHUNK layout; if we do not have one define a default */
if (obj.chunk.rank==0)
{
obj.chunk.rank=rank;
for (j=0; j<rank; j++)
obj.chunk.chunk_lengths[j] = dims[j];
}
if (apply_filters(dcpl_id,H5Tget_size(mtype_id),options,&obj)<0)
continue;
}
else
{
if (options->verbose)
printf("Warning: Filter could not be applied to <%s>\n",
travt->objs[i].name);
}
if (apply_filters(dcpl_id,H5Tget_size(mtype_id),options,&obj)<0)
continue;
}
/*-------------------------------------------------------------------------

View File

@ -128,7 +128,7 @@ int print_filters(hid_t dcpl_id)
{
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter(dcpl_id,
i,
(unsigned)i,
&filt_flags,
&cd_nelmts,
cd_values,
@ -190,7 +190,7 @@ int apply_filters(hid_t dcpl_id,
{
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter(dcpl_id,
i,
(unsigned)i,
&filt_flags,
&cd_nelmts,
cd_values,

View File

@ -90,6 +90,11 @@ int main(int argc, char **argv)
/* pack it */
h5repack(infile,outfile,&options);
#if defined(H5_REPACK_DEBUG)
if (h5repack_verify(outfile,&options)<=0)
printf("Warning: Output file does not have some of the requested filters\n");
#endif
/* free tables */
h5repack_end(&options);

View File

@ -57,7 +57,7 @@ int has_filter(hid_t dcpl_id,
{
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter(dcpl_id,
i,
(unsigned)i,
&filt_flags,
&cd_nelmts,
cd_values,