summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-09-10 15:31:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-09-10 15:31:11 (GMT)
commit14f7f3e53d97c3f31a129145e7ea7e9cd55008dc (patch)
tree8c722b0b1ae3bee185e4b4a512ecef31700ee40c
parent91709a2b438aa622f0fef679e7c05378b07adecb (diff)
downloadhdf5-14f7f3e53d97c3f31a129145e7ea7e9cd55008dc.zip
hdf5-14f7f3e53d97c3f31a129145e7ea7e9cd55008dc.tar.gz
hdf5-14f7f3e53d97c3f31a129145e7ea7e9cd55008dc.tar.bz2
[svn-r7453] Purpose:
Checkpoint file format spec. Description: Clarifications and cleanups related to file format review.
-rw-r--r--src/H5D.c6
-rw-r--r--src/H5Ofill.c76
-rw-r--r--src/H5Oprivate.h7
-rw-r--r--src/H5Pdcpl.c12
4 files changed, 60 insertions, 41 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 901ab2f..b1f6d4b 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1385,8 +1385,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
if(dset->dcpl_id!=H5P_DATASET_CREATE_DEFAULT) {
/*
* Retrieve properties of fill value and others. Copy them into new fill
- * value struct. Convert the fill value to the dataset type and write
- * the message
+ * value struct.
*/
if (H5P_get(plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time")
@@ -1429,9 +1428,8 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
fill.size = -1;
fill.type = fill.buf = NULL;
fill.fill_defined = FALSE;
- } else {
+ } else
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined")
- }
fill.alloc_time = alloc_time;
fill.fill_time = fill_time;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 95d098e..13da259 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,30 @@ 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;
@@ -249,7 +268,7 @@ H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
assert(mesg && NULL==mesg->type);
/* Version */
- *p++ = H5O_FILL_VERSION;
+ *p++ = H5O_FILL_VERSION_2;
/* Space allocation time */
*p++ = mesg->alloc_time;
/* Fill value writing time */
@@ -257,13 +276,15 @@ H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
/* Whether fill value is defined */
*p++ = mesg->fill_defined;
- /* Does it handle undefined fill value? */
- UINT32ENCODE(p, mesg->size);
- if(mesg->size>0)
- if(mesg->buf) {
- H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
- HDmemcpy(p, mesg->buf, (size_t)mesg->size);
- } /* end if */
+ /* Only write out the size and fill value if it is defined */
+ if(mesg->fill_defined) {
+ UINT32ENCODE(p, mesg->size);
+ if(mesg->size>0)
+ if(mesg->buf) {
+ H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
+ HDmemcpy(p, mesg->buf, (size_t)mesg->size);
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -351,13 +372,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 +441,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;
@@ -479,8 +498,9 @@ H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg)
ret_value = 1 + /* Version number */
1 + /* Space allocation time */
1 + /* Fill value write time */
- 1 + /* Fill value defined */
- 4 + /* Fill value size */
+ 1; /* Fill value defined */
+ if(mesg->fill_defined)
+ ret_value += 4 + /* Fill value size */
(mesg->size>0 ? mesg->size : 0); /* Size of fill value */
done:
@@ -560,7 +580,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 +703,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 +755,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;
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index d9d4e4f..ed07b24 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -48,17 +48,20 @@
/* Flags which are part of a message */
#define H5O_FLAG_CONSTANT 0x01u
#define H5O_FLAG_SHARED 0x02u
-#define H5O_FLAG_BITS 0x03u
+#define H5O_FLAG_BITS (H5O_FLAG_CONSTANT|H5O_FLAG_SHARED)
/* Header message IDs */
#define H5O_NULL_ID 0x0000 /* Null Message. */
#define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */
+/* Complex dataspace is/was planned for message 0x0002 */
#define H5O_DTYPE_ID 0x0003 /* Datatype Message. */
#define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */
#define H5O_FILL_NEW_ID 0x0005 /* Fill Value Message. (New) */
+/* Compact data storage is/was planned for message 0x0006 */
#define H5O_EFL_ID 0x0007 /* External File List Message */
#define H5O_LAYOUT_ID 0x0008 /* Data Storage Layout Message. */
#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */
+/* message 0x000a appears unused... */
#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */
#define H5O_ATTR_ID 0x000c /* Attribute Message. */
#define H5O_NAME_ID 0x000d /* Object name message. */
@@ -91,7 +94,7 @@ typedef struct H5O_fill_new_t {
void *buf; /*the fill value */
H5D_alloc_time_t alloc_time; /* time to allocate space */
H5D_fill_time_t fill_time; /* time to write fill value */
- htri_t fill_defined; /* whether fill value is defined */
+ hbool_t fill_defined; /* whether fill value is defined */
} H5O_fill_new_t;
/*
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index e43e916..8052600 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1141,8 +1141,7 @@ done:
* be the same type as the dataset but the library must be able
* to convert VALUE to the dataset type when the dataset is
* created. If VALUE is NULL, it will be interpreted as
- * undefining fill value. The fill value property will be
- * removed from property list.
+ * undefining fill value.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1337,17 +1336,14 @@ H5P_is_fill_value_defined(const struct H5O_fill_t *fill, H5D_fill_value_t *statu
assert(status);
/* Check if the fill value was never set */
- if(fill->size == (size_t)-1 && !fill->buf) {
+ if(fill->size == (size_t)-1 && !fill->buf)
*status = H5D_FILL_VALUE_UNDEFINED;
- }
/* Check if the fill value was set to the default fill value by the library */
- else if(fill->size == 0 && !fill->buf) {
+ else if(fill->size == 0 && !fill->buf)
*status = H5D_FILL_VALUE_DEFAULT;
- }
/* Check if the fill value was set by the application */
- else if(fill->size > 0 && fill->buf) {
+ else if(fill->size > 0 && fill->buf)
*status = H5D_FILL_VALUE_USER_DEFINED;
- }
else {
*status = H5D_FILL_VALUE_ERROR;
HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info");