summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/h5repack.h2
-rw-r--r--tools/h5repack/testh5repack_attr.c29
-rw-r--r--tools/h5repack/testh5repack_dset.c26
-rw-r--r--tools/h5repack/testh5repack_make.c3
4 files changed, 56 insertions, 4 deletions
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index b91d516..ef6dca6 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -293,10 +293,12 @@ 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_null_attr(hid_t loc_id);
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 */);
+void write_null_dset(hid_t loc_id);
int make_filters(hid_t loc_id);
int make_layout(hid_t loc_id);
diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c
index a1dad92..135d15b 100644
--- a/tools/h5repack/testh5repack_attr.c
+++ b/tools/h5repack/testh5repack_attr.c
@@ -1028,5 +1028,30 @@ etc
make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
}
-
-
+/*-------------------------------------------------------------------------
+ * Function: write_null_attr
+ *
+ * Purpose: write null attribute in LOC_ID (dataset, group, named datatype)
+ *
+ * Programmer: Raymond Lu, slu@ncsa.uiuc.edu
+ *
+ * Date: May 24, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+void write_null_attr(hid_t loc_id)
+{
+ hid_t sid, attr_id;
+ int val = 2;
+
+ /* Create the null attribute */
+ sid = H5Screate(H5S_NULL);
+ attr_id = H5Acreate(loc_id, "null_attr", H5T_NATIVE_INT, sid, H5P_DEFAULT);
+
+ /* Not supposed to write anything */
+ H5Awrite(attr_id, H5T_NATIVE_INT, &val);
+
+ /* Close */
+ H5Aclose(attr_id);
+ H5Sclose(sid);
+}
diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c
index 57a5b27..7f6345b 100644
--- a/tools/h5repack/testh5repack_dset.c
+++ b/tools/h5repack/testh5repack_dset.c
@@ -617,7 +617,31 @@ void write_dset_in(hid_t loc_id,
write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
}
-
+/*-------------------------------------------------------------------------
+ * Function: write_null_dset
+ *
+ * Purpose: write null dataset in LOC_ID
+ *
+ * Programmer: Raymond Lu, slu@ncsa.uiuc.edu
+ *
+ * Date: May 24, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+void write_null_dset(hid_t loc_id)
+{
+ hid_t sid, dset_id;
+ int val = 2;
+
+ /* Create the null dataset */
+ sid = H5Screate(H5S_NULL);
+ dset_id = H5Dcreate(loc_id,"null_dset",H5T_NATIVE_INT,sid,H5P_DEFAULT);
+ H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val);
+
+ /* Close */
+ H5Dclose(dset_id);
+ H5Sclose(sid);
+}
/*-------------------------------------------------------------------------
* Function: make_dset_reg_ref
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index c69abd9..2ab1e00 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -164,7 +164,7 @@ int make_all_objects(hid_t loc_id)
write_dset_in(root_id,"dset_referenced",loc_id,0);
write_dset_in(group_id,"dset_referenced",loc_id,0);
-
+ write_null_dset(root_id);
/* Close */
H5Dclose(dset_id);
@@ -216,6 +216,7 @@ int make_attributes(hid_t loc_id)
write_attr_in(dset_id,"dset",loc_id,0);
write_attr_in(group_id,"dset",loc_id,0);
write_attr_in(root_id,"dset",loc_id,0);
+ write_null_attr(root_id);
/* Close */
H5Dclose(dset_id);