summaryrefslogtreecommitdiffstats
path: root/src/H5Ocomp.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-06 19:39:22 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-06 19:39:22 (GMT)
commitde875442351b3ddd204b65d371536e63de6be8ff (patch)
tree70a5b576c5335e57b8ae210741c14f255a301c13 /src/H5Ocomp.c
parent430b1a9c84257bac574fddd09d90cb8676d02cb7 (diff)
downloadhdf5-de875442351b3ddd204b65d371536e63de6be8ff.zip
hdf5-de875442351b3ddd204b65d371536e63de6be8ff.tar.gz
hdf5-de875442351b3ddd204b65d371536e63de6be8ff.tar.bz2
[svn-r578] Changes since 19980805
---------------------- ./MANIFEST Replaced Compression.html with Filters.html ./doc/html/Filters.html ./src/H5Ocomp.c ./src/H5P.c ./src/H5Ppublic.h ./src/H5Z.c ./src/H5Zprivate.h Added two extra arguments to H5Pget_filter() in order to retrieve the filter name. The name is the name registered for the filter with H5Zregister(), but if the dataset creation property originally came from an existing file then the name is that which is stored in the file. ./tools/h5ls.c The `-v' option now prints the names of the filters. ./src/H5B.c ./src/H5Fistore.c ./src/H5O.c ./src/H5Oefl.c ./src/H5Oprivate.h ./src/H5P.c Plugged a memory leak. ./src/H5MMprivate.h H5MM_malloc(0) and H5MM_calloc(0) actually allocate a single byte in order to be sure that we get a valid pointer. ./src/H5S.c ./src/H5Sselect.c Fixed pointer->integer conversions in error return values in three places.
Diffstat (limited to 'src/H5Ocomp.c')
-rw-r--r--src/H5Ocomp.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/H5Ocomp.c b/src/H5Ocomp.c
index a30eb6f..1b959a1 100644
--- a/src/H5Ocomp.c
+++ b/src/H5Ocomp.c
@@ -171,6 +171,8 @@ H5O_pline_encode (H5F_t __unused__ *f, uint8 *p/*out*/, const void *mesg)
{
const H5O_pline_t *pline = (const H5O_pline_t*)mesg;
size_t i, j, name_length;
+ const char *name=NULL;
+ H5Z_class_t *cls=NULL;
FUNC_ENTER (H5O_pline_encode, FAIL);
@@ -188,17 +190,24 @@ H5O_pline_encode (H5F_t __unused__ *f, uint8 *p/*out*/, const void *mesg)
*p++ = 0; /*reserved 6*/
for (i=0; i<pline->nfilters; i++) {
- if (pline->filter[i].name) {
- name_length = strlen(pline->filter[i].name)+1;
- } else {
- name_length = 0;
+ /*
+ * Get the filter name. If the pipeline message has a name in it then
+ * use that one. Otherwise try to look up the filter and get the name
+ * as it was registered.
+ */
+ if (NULL==(name=pline->filter[i].name) &&
+ (cls=H5Z_find(pline->filter[i].id))) {
+ name = cls->name;
}
+ name_length = name ? strlen(name)+1 : 0;
+
+ /* Encode the filter */
UINT16ENCODE(p, pline->filter[i].id);
UINT16ENCODE(p, H5O_ALIGN(name_length));
UINT16ENCODE(p, pline->filter[i].flags);
UINT16ENCODE(p, pline->filter[i].cd_nelmts);
if (name_length>0) {
- memcpy(p, pline->filter[i].name, name_length);
+ memcpy(p, name, name_length);
p += name_length;
while (name_length++ % 8) *p++ = 0;
}
@@ -313,23 +322,32 @@ static size_t
H5O_pline_size (H5F_t __unused__ *f, const void *mesg)
{
const H5O_pline_t *pline = (const H5O_pline_t*)mesg;
- size_t i, size;
+ size_t i, size, name_len;
+ const char *name = NULL;
+ H5Z_class_t *cls = NULL;
FUNC_ENTER (H5O_pline_size, 0);
+ /* Message header */
size = 1 + /*version */
1 + /*number of filters */
6; /*reserved */
for (i=0; i<pline->nfilters; i++) {
+ /* Get the name of the filter, same as done with H5O_pline_encode() */
+ if (NULL==(name=pline->filter[i].name) &&
+ (cls=H5Z_find(pline->filter[i].id))) {
+ name = cls->name;
+ }
+ name_len = name ? strlen(name)+1 : 0;
+
+
size += 2 + /*filter identification number */
2 + /*name length */
2 + /*flags */
- 2; /*number of client data values */
- if (pline->filter[i].name) {
- size_t n = strlen(pline->filter[i].name) + 1;
- size += H5O_ALIGN(n);
- }
+ 2 + /*number of client data values */
+ H5O_ALIGN(name_len); /*length of the filter name */
+
size += pline->filter[i].cd_nelmts * 4;
if (pline->filter[i].cd_nelmts % 2) size += 4;
}