summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2002-04-11 23:56:52 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2002-04-11 23:56:52 (GMT)
commita040b40b5cc42a0547bf2c4a9a75f3365f15fd69 (patch)
tree922aa705fdb946bc325a89c684fb66975de4f440 /src
parent27e7bde1725d4e5ed25b199b5e0ec8f4f8bc2548 (diff)
downloadhdf5-a040b40b5cc42a0547bf2c4a9a75f3365f15fd69.zip
hdf5-a040b40b5cc42a0547bf2c4a9a75f3365f15fd69.tar.gz
hdf5-a040b40b5cc42a0547bf2c4a9a75f3365f15fd69.tar.bz2
[svn-r5172]
Purpose: Compatibility with v1.5 Description: Modified a little to match V1.5's fill value changes. Platforms tested: Linux 2.2
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c18
-rw-r--r--src/H5O.c67
-rw-r--r--src/H5Olayout.c11
-rw-r--r--src/H5T.c1
4 files changed, 65 insertions, 32 deletions
diff --git a/src/H5D.c b/src/H5D.c
index a389b59..764e135 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1431,12 +1431,16 @@ H5D_open_oid(H5G_entry_t *ent)
}
/* Get the external file list message, which might not exist */
- if (NULL==H5O_read (&(dataset->ent), H5O_EFL, 0,
+ /*if (NULL==H5O_read (&(dataset->ent), H5O_EFL, 0,
&(dataset->create_parms->efl)) &&
!H5F_addr_defined (dataset->layout.addr)) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"storage address is undefined an no external file list");
- }
+ }*/
+ /* A temporary solution for compatibility with v1.5. For new fill value
+ * design, data space may not allocated except in case of external storage.
+ */
+ H5O_read (&(dataset->ent), H5O_EFL, 0, &(dataset->create_parms->efl));
/*
* Make sure all storage is properly initialized for chunked datasets.
@@ -1614,6 +1618,11 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t));
HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t));
+ /* Check if the dataset has space */
+ if(!H5F_addr_defined (dataset->layout.addr)
+ && (dataset->create_parms->efl.nused==0))
+ HGOTO_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "no data to read");
+
/* Get the dataset transfer property list */
if (H5P_DEFAULT == dxpl_id) {
xfer_parms = &H5D_xfer_dflt;
@@ -2088,6 +2097,11 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
printf("%s: check 0.3, buf=%p\n", FUNC,buf);
#endif /* QAK */
+ /* Check if the dataset has space */
+ if(!H5F_addr_defined (dataset->layout.addr)
+ && (dataset->create_parms->efl.nused==0))
+ HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "no space to write");
+
/* Get the dataset transfer property list */
if (H5P_DEFAULT == dxpl_id) {
xfer_parms = &H5D_xfer_dflt;
diff --git a/src/H5O.c b/src/H5O.c
index f4fa32f..5636c6c 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -343,6 +343,12 @@ H5O_close(H5G_entry_t *obj_ent)
*
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * Raymond Lu, 2002-2-27
+ * Add a temporary solution for compatibility with version 1.5.
+ * A new fill value message is added to 1.5, whose ID is 5. Don't
+ * read this message since v1.4 doesn't know it.
+ *
*-------------------------------------------------------------------------
*/
static H5O_t *
@@ -450,34 +456,39 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
flags = *p++;
p += 3; /*reserved*/
- if (id >= NELMTS(message_type_g) || NULL == message_type_g[id]) {
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL,
- "corrupt object header");
- }
- if (p + mesg_size > oh->chunk[chunkno].image + chunk_size) {
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
- "corrupt object header");
- }
- if (H5O_NULL_ID == id && oh->nmesgs > 0 &&
- H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
- oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
- /* combine adjacent null messages */
- mesgno = oh->nmesgs - 1;
- oh->mesg[mesgno].raw_size += H5O_SIZEOF_MSGHDR(f) + mesg_size;
- } else {
- /* new message */
- if (oh->nmesgs >= nmesgs) {
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
- "corrupt object header");
- }
- mesgno = oh->nmesgs++;
- oh->mesg[mesgno].type = message_type_g[id];
- oh->mesg[mesgno].dirty = FALSE;
- oh->mesg[mesgno].flags = flags;
- oh->mesg[mesgno].native = NULL;
- oh->mesg[mesgno].raw = p;
- oh->mesg[mesgno].raw_size = mesg_size;
- oh->mesg[mesgno].chunkno = chunkno;
+ if (id != 5) { /* This is a temporary solution for compatibility
+ * with version 1.5. A new fill value message is
+ * added to 1.5, whose ID is 5. Don't read this
+ * message since v1.4 doesn't know it. */
+ if (id>=NELMTS(message_type_g) || NULL==message_type_g[id]) {
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL,
+ "corrupt object header");
+ }
+ if (p + mesg_size > oh->chunk[chunkno].image + chunk_size) {
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
+ "corrupt object header");
+ }
+ if (H5O_NULL_ID == id && oh->nmesgs > 0 &&
+ H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id &&
+ oh->mesg[oh->nmesgs - 1].chunkno == chunkno) {
+ /* combine adjacent null messages */
+ mesgno = oh->nmesgs - 1;
+ oh->mesg[mesgno].raw_size+=H5O_SIZEOF_MSGHDR(f)+mesg_size;
+ } else {
+ /* new message */
+ if (oh->nmesgs >= nmesgs) {
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
+ "corrupt object header");
+ }
+ mesgno = oh->nmesgs++;
+ oh->mesg[mesgno].type = message_type_g[id];
+ oh->mesg[mesgno].dirty = FALSE;
+ oh->mesg[mesgno].flags = flags;
+ oh->mesg[mesgno].native = NULL;
+ oh->mesg[mesgno].raw = p;
+ oh->mesg[mesgno].raw_size = mesg_size;
+ oh->mesg[mesgno].chunkno = chunkno;
+ }
}
}
assert(p == oh->chunk[chunkno].image + chunk_size);
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 6cce757..dd43aff 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -39,7 +39,11 @@ const H5O_class_t H5O_LAYOUT[1] = {{
H5O_layout_debug, /*debug the message */
}};
+/* A temporary solution for compatibility with v1.5. Added version 2 for
+ * layout. If data space has been allocated by v1.5, version is 2;
+ * otherwise it's 1. */
#define H5O_LAYOUT_VERSION 1
+#define H5O_LAYOUT_VERSION_2 2
/* Interface initialization */
#define PABLO_MASK H5O_layout_mask
@@ -89,9 +93,12 @@ H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
"memory allocation failed");
}
- /* Version */
+ /* Version. Here is a temporary solution for compatibility with v1.5.
+ * Added version 2 for layout. If data space hasn't been allocated by
+ * v1.5, version is 2; otherwise it's 1.
+ */
version = *p++;
- if (version!=H5O_LAYOUT_VERSION) {
+ if (version!=H5O_LAYOUT_VERSION && version!=H5O_LAYOUT_VERSION_2) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
"bad version number for layout message");
}
diff --git a/src/H5T.c b/src/H5T.c
index e75dfd4..0f01331 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3433,6 +3433,7 @@ H5Tget_member_index(hid_t type_id, const char *name)
int nmembs, i;
FUNC_ENTER(H5Tget_member_index, NULL);
+ H5TRACE2("Is","is",type_id,name);
/* Check arguments */
assert(name);