summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-03-26 18:31:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-03-26 18:31:00 (GMT)
commit505b31ee08bfd3efc62df84e00602a9fd6c46a4f (patch)
tree77c1e8cd2a59bfb655f789fd6ddac4e74b4fe5c9 /tools/h5repack
parent5f2e591745df8a05950c07e4c86de00d6678828e (diff)
downloadhdf5-505b31ee08bfd3efc62df84e00602a9fd6c46a4f.zip
hdf5-505b31ee08bfd3efc62df84e00602a9fd6c46a4f.tar.gz
hdf5-505b31ee08bfd3efc62df84e00602a9fd6c46a4f.tar.bz2
[svn-r16619] Description:
Bring r16606:16618 from trunk to the revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) h5committest not necessary on this branch
Diffstat (limited to 'tools/h5repack')
-rwxr-xr-xtools/h5repack/h5repack.sh.in3
-rw-r--r--tools/h5repack/h5repack_copy.c10
-rw-r--r--tools/h5repack/h5repack_filters.c9
-rw-r--r--tools/h5repack/h5repacktst.c40
-rw-r--r--tools/h5repack/testfiles/h5repack_objs.h5bin19589 -> 19770 bytes
5 files changed, 57 insertions, 5 deletions
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index ba3bdfe..4a48c8a 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -504,6 +504,9 @@ TOOLTEST $arg
# to new version and be readable, etc.)
TOOLTEST $FILE14
+# test for datum size > H5TOOLS_MALLOCSIZE
+TOOLTEST $FILE1 -f GZIP=1
+
if test $nerrors -eq 0 ; then
echo "All $H5REPACK tests passed."
fi
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index b165dc7..4e2e036 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -650,7 +650,7 @@ int do_copy_objects(hid_t fidin,
{
int j;
-
+
if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
goto error;
if((f_space_id = H5Dget_space(dset_in)) < 0)
@@ -790,8 +790,12 @@ int do_copy_objects(hid_t fidin,
*/
sm_nbytes = p_type_nbytes;
- for (k = rank; k > 0; --k) {
- sm_size[k - 1] = MIN(dims[k - 1], H5TOOLS_BUFSIZE / sm_nbytes);
+ for (k = rank; k > 0; --k)
+ {
+ hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
+ if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
+ size = 1;
+ sm_size[k - 1] = MIN(dims[k - 1], size);
sm_nbytes *= sm_size[k - 1];
assert(sm_nbytes > 0);
}
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 5038cbb..cfd867a 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -296,14 +296,19 @@ int apply_filters(const char* name, /* object name from traverse list */
* determine the strip mine size. The strip mine is
* a hyperslab whose size is manageable.
*/
+
+
sm_nbytes = msize;
for ( i = rank; i > 0; --i)
{
- sm_size[i - 1] = MIN(dims[i - 1], H5TOOLS_BUFSIZE / sm_nbytes);
+ hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
+ if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
+ size = 1;
+ sm_size[i - 1] = MIN(dims[i - 1], size);
sm_nbytes *= sm_size[i - 1];
assert(sm_nbytes > 0);
-
+
}
for ( i = 0; i < rank; i++)
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 1a9422e..c6afce1 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -3337,6 +3337,46 @@ void write_dset_in(hid_t loc_id,
type_id = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
write_dset(loc_id, 1, dims, "array", type_id, buf6);
status = H5Tclose(type_id);
+
+ {
+
+ double *dbuf; /* information to write */
+ hid_t did; /* dataset ID */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+ size_t size;
+ hsize_t sdims[] = {1};
+ hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1};
+ int j;
+
+ /* allocate and initialize array data to write */
+ size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double);
+ dbuf = malloc( size );
+
+ for( j = 0; j < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; j++)
+ dbuf[j] = j;
+
+ if (make_diffs)
+ {
+ dbuf[5] = 0;
+ dbuf[6] = 0;
+ }
+
+ /* create a type larger than H5TOOLS_MALLOCSIZE */
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims);
+ size = H5Tget_size(tid);
+ sid = H5Screate_simple(1, sdims, NULL);
+ did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#if defined(WRITE_ARRAY)
+ H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+#endif
+
+ /* close */
+ H5Dclose(did);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ free( dbuf );
+ }
/*-------------------------------------------------------------------------
* H5T_INTEGER and H5T_FLOAT
diff --git a/tools/h5repack/testfiles/h5repack_objs.h5 b/tools/h5repack/testfiles/h5repack_objs.h5
index 0a0c041..16d55da 100644
--- a/tools/h5repack/testfiles/h5repack_objs.h5
+++ b/tools/h5repack/testfiles/h5repack_objs.h5
Binary files differ