From 326981f421b993815657daecc8b37bd732513d82 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Mon, 11 Aug 1997 17:49:59 -0500 Subject: [PATCH] [svn-r24] ./src/H5B.c ./src/H5Bprivate.h ./src/H5G.c H5B_new() only takes two arguments. ./src/H5C.c Fixed initializer for default_file_create to be the same order as it's definition. ./src/H5D.c Changed commented-out code to #if 0/#endif. #if'd out a variable that was unused because of #if'd out code. ./src/H5Dproto.c Added a prototype for H5Dwrite(). ./src/H5F.c Changed parentheses to fix precedence problems from: flags & (~H5AC_OVERWRITE) != 0 to (flags & ~H5AC_OVERWRITE) != 0 ./src/H5H.c Heap reallocation doubles the heap size instead of tripling it. ./src/H5O.c Got rid of a statement with no effect. ./src/hdf5port.h Indented a few #defines. Added a defn for MAX3(). --- src/H5B.c | 5 +++-- src/H5Bprivate.h | 2 +- src/H5C.c | 2 +- src/H5D.c | 6 +++++- src/H5Dproto.h | 1 + src/H5F.c | 2 +- src/H5G.c | 2 +- src/H5H.c | 3 +-- src/H5O.c | 1 - src/hdf5port.h | 7 +++++-- 10 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/H5B.c b/src/H5B.c index 7182f10210..d700a7ca11 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -158,11 +158,11 @@ static interface_initialize_g = FALSE; *------------------------------------------------------------------------- */ haddr_t -H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey) +H5B_new (hdf5_file_t *f, const H5B_class_t *type) { H5B_t *bt=NULL; haddr_t addr; - size_t size; + size_t size, sizeof_rkey; size_t total_native_keysize; intn offset, i; @@ -178,6 +178,7 @@ H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey) /* * Allocate file and memory data structures. */ + sizeof_rkey = (type->get_sizeof_rkey)(f); size = H5B_nodesize (f, type, &total_native_keysize, sizeof_rkey); if ((addr = H5MF_alloc (f, size))<0) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 43642034fa..92c29855f2 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -86,7 +86,7 @@ typedef struct H5B_t { */ herr_t H5B_debug (hdf5_file_t *f, haddr_t addr, FILE *stream, intn indent, intn fwidth, const H5B_class_t *type); -haddr_t H5B_new (hdf5_file_t *f, const H5B_class_t *type, size_t sizeof_rkey); +haddr_t H5B_new (hdf5_file_t *f, const H5B_class_t *type); herr_t H5B_find (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata); haddr_t H5B_insert (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, diff --git a/src/H5C.c b/src/H5C.c index 501b873996..1ed0c31641 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -48,9 +48,9 @@ static intn interface_initialize_g = FALSE; /* Define the library's default file creation template (constants in hdf5lims.h) */ const file_create_temp_t default_file_create={ HDF5_USERBLOCK_DEFAULT, /* Default user-block size */ + HDF5_BTREEPAGE_DEFAULT, /* Default B-tree page size */ HDF5_OFFSETSIZE_DEFAULT, /* Default offset size */ HDF5_LENGTHSIZE_DEFAULT, /* Default length size */ - HDF5_BTREEPAGE_DEFAULT, /* Default B-tree page size */ HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */ HDF5_SMALLOBJECT_VERSION, /* Current Small-Object heap version # */ HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */ diff --git a/src/H5D.c b/src/H5D.c index 2ff5582f29..f9ace29bc4 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -193,7 +193,9 @@ done: herr_t H5Dwrite(hatom_t oid, hatom_t did, VOIDP buf) { H5D_dataset_t *dataset; /* dataset object to release */ +#if 0 uintn towrite; /* number of bytes to write out */ +#endif herr_t ret_value = SUCCEED; FUNC_ENTER(H5Dwrite, H5D_init_interface, FAIL); @@ -214,7 +216,9 @@ herr_t H5Dwrite(hatom_t oid, hatom_t did, VOIDP buf) if(dataset->type==0 || dataset->dim==0) HGOTO_ERROR(H5E_FUNC, H5E_UNINITIALIZED, FAIL); -/* towrite=H5Tsize(dataset->type)*H5Pnelem(did); */ +#if 0 + towrite=H5Tsize(dataset->type)*H5Pnelem(did); +#endif /* Check memory to disk datatype conversions, etc. */ /* data out */ diff --git a/src/H5Dproto.h b/src/H5Dproto.h index 362d323276..d7114c866c 100644 --- a/src/H5Dproto.h +++ b/src/H5Dproto.h @@ -28,6 +28,7 @@ extern "C" hatom_t H5D_create(hatom_t owner_id, hobjtype_t type, const char *name); herr_t H5Dset_info(hatom_t oid, hatom_t tid, hatom_t did); herr_t H5D_release(hatom_t oid); +herr_t H5Dwrite(hatom_t oid, hatom_t did, VOIDP buf); #if defined c_plusplus || defined __cplusplus } diff --git a/src/H5F.c b/src/H5F.c index fe950c5d15..38eb17c9b3 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -433,7 +433,7 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_ H5ECLEAR; if(filename==NULL) /* check for valid filename */ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL); - if(flags&(~H5ACC_OVERWRITE)!=0) /* check for valid flags */ + if((flags&~H5ACC_OVERWRITE)!=0) /* check for valid flags */ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL); /* See if this file is already open */ diff --git a/src/H5G.c b/src/H5G.c index 172b9460f3..458792b86f 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -286,7 +286,7 @@ H5G_stab_insert (hdf5_file_t *f, H5G_entry_t *self, const char *name, } if (stab.btree<=0 || stab.heap<=0) { if (stab.btree<=0 && - (stab.btree = H5B_new (f, H5B_SNODE, sizeof(H5G_node_key_t)))<0) { + (stab.btree = H5B_new (f, H5B_SNODE))<0) { HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); } if (stab.heap<=0) { diff --git a/src/H5H.c b/src/H5H.c index 2a92dee7f2..8c90095f64 100644 --- a/src/H5H.c +++ b/src/H5H.c @@ -573,8 +573,7 @@ H5H_insert (hdf5_file_t *f, haddr_t addr, size_t buf_size, const void *buf) */ if (offset<0) { - need_more = MAX (2*heap->mem_alloc, H5H_SIZEOF_FREE(f)); - need_more = MAX (need_more, need); + need_more = MAX3 (need, heap->mem_alloc, H5H_SIZEOF_FREE(f)); if (max_fl && max_fl->offset+max_fl->size==heap->mem_alloc) { /* diff --git a/src/H5O.c b/src/H5O.c index 6e899fc943..1b259ba3ed 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1038,7 +1038,6 @@ H5O_alloc (hdf5_file_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) /* check args */ assert (oh); assert (type); - assert (size>=0); H5O_ALIGN (size, oh->alignment); /* look for a null message which is large enough */ diff --git a/src/hdf5port.h b/src/hdf5port.h index 5b7c84876c..3f3a5c27bb 100644 --- a/src/hdf5port.h +++ b/src/hdf5port.h @@ -24,10 +24,13 @@ * Generally useful macro definitions **************************************************************************/ #ifndef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) +# define MIN(a,b) (((a)<(b)) ? (a) : (b)) #endif #ifndef MAX -#define MAX(a,b) (((a)>(b)) ? (a) : (b)) +# define MAX(a,b) (((a)>(b)) ? (a) : (b)) +#endif +#ifndef MAX3 +# define MAX3(a,b,c) MAX(MAX(a,b),c) #endif /**************************************************************************