diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-10 15:33:58 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-10 15:33:58 (GMT) |
commit | 0282f2219bdeaf8b7bcd9141b20e4bf02d3a5301 (patch) | |
tree | d4a1aa14bc0153ea6ace561978e04a156ba4b095 /src/H5Ofill.c | |
parent | 59e8237a025bb89b37cce363267d00536bbcf228 (diff) | |
download | hdf5-0282f2219bdeaf8b7bcd9141b20e4bf02d3a5301.zip hdf5-0282f2219bdeaf8b7bcd9141b20e4bf02d3a5301.tar.gz hdf5-0282f2219bdeaf8b7bcd9141b20e4bf02d3a5301.tar.bz2 |
[svn-r7455] Purpose:
Checkpoint file format revisions.
Description:
Clarifications and cleanups related to file format review.
Platforms tested:
FreeBSD 4.9 (sleipnir)
Too minor to need h5committest
Diffstat (limited to 'src/H5Ofill.c')
-rw-r--r-- | src/H5Ofill.c | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 95d098e..2d190a2 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -83,7 +83,10 @@ const H5O_class_t H5O_FILL_NEW[1] = {{ H5O_fill_new_debug, /*debug the message */ }}; -#define H5O_FILL_VERSION 1 +/* Initial version of the "new" fill value information */ +#define H5O_FILL_VERSION 1 +/* Revised version of the "new" fill value information */ +#define H5O_FILL_VERSION_2 2 /* Interface initialization */ static int interface_initialize_g = 0; @@ -133,7 +136,7 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, /* Version */ version = *p++; - if( version != H5O_FILL_VERSION) + if( version != H5O_FILL_VERSION && version !=H5O_FILL_VERSION_2) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for fill value message"); /* Space allocation time */ @@ -145,14 +148,31 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, /* Whether fill value is defined */ mesg->fill_defined = *p++; - /* Does it handle undefined fill value? */ - UINT32DECODE(p, mesg->size); - if (mesg->size>0) { - H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t); - if (NULL==(mesg->buf=H5MM_malloc((size_t)mesg->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); - HDmemcpy(mesg->buf, p, (size_t)mesg->size); - } + /* Check for version of fill value message */ + if(version==H5O_FILL_VERSION) { + UINT32DECODE(p, mesg->size); + if (mesg->size>0) { + H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t); + if (NULL==(mesg->buf=H5MM_malloc((size_t)mesg->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); + HDmemcpy(mesg->buf, p, (size_t)mesg->size); + } + } /* end if */ + else { + /* Only decode fill value information if one is defined */ + if(mesg->fill_defined) { + UINT32DECODE(p, mesg->size); + if (mesg->size>0) { + H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t); + if (NULL==(mesg->buf=H5MM_malloc((size_t)mesg->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); + HDmemcpy(mesg->buf, p, (size_t)mesg->size); + } + } /* end if */ + else + mesg->size=(-1); + } /* end else */ + /* Set return value */ ret_value = (void*)mesg; @@ -351,13 +371,11 @@ H5O_fill_new_copy(const void *_mesg, void *_dest) H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t); if (NULL==(dest->buf=H5MM_malloc((size_t)mesg->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); - dest->size = mesg->size; HDmemcpy(dest->buf, mesg->buf, (size_t)mesg->size); } /* end if */ - else { + else dest->buf=NULL; - dest->size=0; - } /* end else */ + dest->size = mesg->size; /* Copy three fill value attributes */ dest->alloc_time = mesg->alloc_time; @@ -422,11 +440,11 @@ H5O_fill_copy(const void *_mesg, void *_dest) if (mesg->buf) { if (NULL==(dest->buf=H5MM_malloc(mesg->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); - dest->size = mesg->size; HDmemcpy(dest->buf, mesg->buf, mesg->size); } /* end if */ else dest->buf=NULL; + dest->size = mesg->size; /* Set return value */ ret_value = dest; @@ -560,7 +578,7 @@ H5O_fill_new_reset(void *_mesg) } mesg->alloc_time = (H5D_alloc_time_t)0; mesg->fill_time = (H5D_fill_time_t)0; - mesg->fill_defined = (H5D_fill_value_t)0; + mesg->fill_defined = FALSE; done: FUNC_LEAVE_NOAPI(ret_value); @@ -683,6 +701,7 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL int indent, int fwidth) { const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; + H5D_fill_value_t fill_status; /* Whether the fill value is defined */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_fill_new_debug, FAIL); @@ -734,7 +753,8 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL } /* end switch */ fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Value Defined:"); - switch(mesg->fill_time) { + H5P_is_fill_value_defined((const H5O_fill_t *)mesg, &fill_status); + switch(fill_status) { case H5D_FILL_VALUE_UNDEFINED: fprintf(stream,"Undefined\n"); break; |