summaryrefslogtreecommitdiffstats
path: root/src/H5SMcache.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2007-01-03 22:08:25 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2007-01-03 22:08:25 (GMT)
commit1bef5c88ad69194b8f0333ac507679f6c1825160 (patch)
tree71f0265e855a6a1f569d2e70656bb94b54e8491c /src/H5SMcache.c
parenta15089ee73ddf92468de1af48babd7f55d9e5b16 (diff)
downloadhdf5-1bef5c88ad69194b8f0333ac507679f6c1825160.zip
hdf5-1bef5c88ad69194b8f0333ac507679f6c1825160.tar.gz
hdf5-1bef5c88ad69194b8f0333ac507679f6c1825160.tar.bz2
[svn-r13105] Fixed a bug where buffer size didn't change when #defined constants changed.
Committing from Windows using Tortoise SVN. Cool!
Diffstat (limited to 'src/H5SMcache.c')
-rw-r--r--src/H5SMcache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 1f2d0d0..bd1eb2b 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -43,7 +43,6 @@
/****************/
/* Local Macros */
/****************/
-#define H5F_TABLEBUF_SIZE H5SM_TABLE_SIZEOF_MAGIC + 20 + (H5SM_MAX_NINDEXES * 29)
/* JAMES: should this change according to address size? */
#define H5F_LISTBUF_SIZE H5SM_LIST_SIZEOF_MAGIC + H5SM_MAX_LIST_ELEMS * 16
@@ -124,7 +123,7 @@ H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
HDassert(table);
if (table->cache_info.is_dirty) {
- uint8_t buf[H5F_TABLEBUF_SIZE]; /* Temporary buffer */ /* JAMES This is big. Do I need to use H5FL_BLK_MALLOC instead? */
+ uint8_t *buf; /* Temporary buffer */
uint8_t *p; /* Pointer into raw data buffer */
size_t size; /* Header size on disk */
uint32_t computed_chksum; /* Computed metadata checksum value */
@@ -133,6 +132,10 @@ H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
/* Encode the master table and all of the index headers as one big blob */
size = H5SM_TABLE_SIZE(f) + (H5SM_INDEX_HEADER_SIZE(f) * table->num_indexes);
+ /* Allocate the buffer */ /* JAMES: use H5FL_BLK_MALLOC instead? */
+ if(NULL == (buf = HDmalloc(size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
/* Encode the master table */
p = buf;