summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-07-10 13:11:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-07-10 13:11:27 (GMT)
commitdbe6d5acbcdcac21337180e9b6a21d19ee1555f8 (patch)
treeb045e4874e7f5e2e141b34a4286d0e51f56f1759
parent9d17fc7424cce0c54d57fa7b5cfc23a96fbbc016 (diff)
downloadhdf5-dbe6d5acbcdcac21337180e9b6a21d19ee1555f8.zip
hdf5-dbe6d5acbcdcac21337180e9b6a21d19ee1555f8.tar.gz
hdf5-dbe6d5acbcdcac21337180e9b6a21d19ee1555f8.tar.bz2
[svn-r7196] Purpose:
Code cleanup Description: Add version number checking to local heap code. Platforms tested: FreeBSD 4.8 (sleipnir) too small to need h5committest
-rw-r--r--src/H5HL.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index 4400e10..d9153f1 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -47,6 +47,11 @@
#define H5HL_FREE_NULL 1 /*end of free list on disk */
#define H5HL_MIN_HEAP 256 /* Minimum size to reduce heap buffer to */
+/*
+ * Local heap collection version.
+ */
+#define H5HL_VERSION 0
+
/* Private typedefs */
/* PRIVATE PROTOTYPES */
@@ -237,8 +242,12 @@ H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap signature");
p += H5HL_SIZEOF_MAGIC;
+ /* Version */
+ if (H5HL_VERSION!=*p++)
+ HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "wrong version number in global heap");
+
/* Reserved */
- p += 4;
+ p += 3;
/* Allocate space in memory for the heap */
if (NULL==(heap = H5FL_CALLOC(H5HL_t)))
@@ -444,7 +453,7 @@ H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap)
fl=heap->freelist;
HDmemcpy(p, H5HL_MAGIC, H5HL_SIZEOF_MAGIC);
p += H5HL_SIZEOF_MAGIC;
- *p++ = 0; /*reserved*/
+ *p++ = H5HL_VERSION;
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/