diff options
-rw-r--r-- | src/H5.c | 19 | ||||
-rw-r--r-- | src/H5AC.c | 38 | ||||
-rw-r--r-- | src/H5B.c | 201 | ||||
-rw-r--r-- | src/H5C.c | 152 | ||||
-rw-r--r-- | src/H5D.c | 137 | ||||
-rw-r--r-- | src/H5Dconv.c | 3 | ||||
-rw-r--r-- | src/H5Distore.c | 27 | ||||
-rw-r--r-- | src/H5E.c | 18 | ||||
-rw-r--r-- | src/H5Eprivate.h | 20 | ||||
-rw-r--r-- | src/H5Epublic.h | 204 | ||||
-rw-r--r-- | src/H5F.c | 161 | ||||
-rw-r--r-- | src/H5Fcore.c | 4 | ||||
-rw-r--r-- | src/H5Ffamily.c | 34 | ||||
-rw-r--r-- | src/H5Fistore.c | 27 | ||||
-rw-r--r-- | src/H5Flow.c | 20 | ||||
-rw-r--r-- | src/H5Fsec2.c | 12 | ||||
-rw-r--r-- | src/H5Fstdio.c | 24 | ||||
-rw-r--r-- | src/H5G.c | 175 | ||||
-rw-r--r-- | src/H5Gent.c | 6 | ||||
-rw-r--r-- | src/H5Gnode.c | 101 | ||||
-rw-r--r-- | src/H5Gshad.c | 20 | ||||
-rw-r--r-- | src/H5Gstab.c | 34 | ||||
-rw-r--r-- | src/H5H.c | 54 | ||||
-rw-r--r-- | src/H5M.c | 57 | ||||
-rw-r--r-- | src/H5MF.c | 4 | ||||
-rw-r--r-- | src/H5O.c | 112 | ||||
-rw-r--r-- | src/H5Odtype.c (renamed from src/H5Osdtyp.c) | 63 | ||||
-rw-r--r-- | src/H5Oprivate.h | 2 | ||||
-rw-r--r-- | src/H5Osdspace.c (renamed from src/H5Osdim.c) | 0 | ||||
-rw-r--r-- | src/H5P.c | 77 | ||||
-rw-r--r-- | src/H5T.c | 61 | ||||
-rw-r--r-- | src/H5detect.c | 5 | ||||
-rw-r--r-- | src/H5private.h | 9 | ||||
-rw-r--r-- | src/Makefile.in | 5 |
34 files changed, 1044 insertions, 842 deletions
@@ -41,6 +41,7 @@ static char RcsId[] = "@(#)$Revision$"; #include <H5ACprivate.h> /*cache */ #include <H5Bprivate.h> /*B-link trees */ #include <H5Eprivate.h> /*error handling */ +#include <H5MMprivate.h> /*memory management */ #include <H5Tprivate.h> /*data types */ #define PABLO_MASK H5_mask @@ -83,14 +84,16 @@ herr_t H5_init_library(void) /* Install atexit() library cleanup routine */ if(install_atexit_g==TRUE) if (HDatexit(&H5_term_library) != 0) - HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL); + HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, + "unable to register atexit function"); /* * Initialize interfaces that might not be able to initialize themselves * soon enough. */ if (H5T_init_interface ()<0) { - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, FAIL, + "unable to initialize type interface"); } @@ -127,8 +130,7 @@ H5_add_exit (void (*func)(void)) assert(func); - if((new=HDcalloc(1,sizeof(H5_exit_t)))==NULL) - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + new = H5MM_xcalloc (1, sizeof(H5_exit_t)); new->func=func; new->next=lib_exit_head; @@ -188,11 +190,13 @@ herr_t H5_init_thread(void) /* Create/initialize this thread's error stack */ if((thrderrid=H5Enew_err_stack(16))==FAIL) - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, FAIL, + "unable to create thread error stack"); /* Add the "thread termination" routine to the exit chain */ if(H5_add_exit(&H5_term_thread)==FAIL) - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, FAIL, + "unable to set thread atexit function"); FUNC_LEAVE (SUCCEED); } /* H5_init_thread */ @@ -301,7 +305,8 @@ herr_t H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if (majnum==NULL || minnum==NULL || relnum==NULL || patnum==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, + "null pointer argument"); /* Set the version information */ *majnum=HDF5_MAJOR_VERSION; @@ -112,7 +112,8 @@ H5AC_dest (H5F_t *f) cache = f->shared->cache; if (H5AC_flush (f, NULL, NO_ADDR, TRUE)<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, + "unable to flush cache"); } #ifdef H5AC_DEBUG @@ -212,7 +213,8 @@ H5AC_find_f (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, * of the wrong type. */ if (slot->type && slot->type!=type && H5F_addr_eq (&(slot->addr), addr)) { - HRETURN_ERROR (H5E_CACHE, H5E_BADTYPE, NULL); + HRETURN_ERROR (H5E_CACHE, H5E_BADTYPE, NULL, + "internal error (correct address, wrong type)"); } #ifdef H5AC_DEBUG @@ -234,7 +236,7 @@ H5AC_find_f (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, * without preempting anything. */ if (NULL==(thing=(type->load)(f, addr, udata1, udata2))) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load object"); } /* @@ -249,9 +251,11 @@ H5AC_find_f (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, * Release the new thing and fail. */ if ((type->flush)(f, TRUE, addr, thing)<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, NULL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, NULL, + "unable to flush just-loaded object"); } - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, NULL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, NULL, + "unable to flush existing cached object"); } cache->diagnostics[slot->type->id].nflushes++; } @@ -398,7 +402,8 @@ H5AC_flush (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, status = (flush)(f, destroy, &(slot->addr), slot->thing); if (status<0) { map = H5MM_xfree (map); - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, + "can't flush cache"); } cache->diagnostics[slot->type->id].nflushes++; if (destroy) slot->type = NULL; @@ -411,7 +416,8 @@ H5AC_flush (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, * else should have been flushed. */ if (cache->nprots>0) { - HRETURN_ERROR (H5E_CACHE, H5E_PROTECT, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_PROTECT, FAIL, + "cache has protected items"); } } else { @@ -425,7 +431,8 @@ H5AC_flush (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, status = (flush) (f, destroy, &(cache->slot[i].addr), cache->slot[i].thing); if (status<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, + "can't flush object"); } cache->diagnostics[cache->slot[i].type->id].nflushes++; if (destroy) cache->slot[i].type = NULL; @@ -492,7 +499,8 @@ H5AC_set (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing) flush = slot->type->flush; status = (flush)(f, TRUE, &(slot->addr), slot->thing); if (status<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, + "can't flush object"); } cache->diagnostics[slot->type->id].nflushes++; } @@ -582,7 +590,8 @@ H5AC_rename (H5F_t *f, const H5AC_class_t *type, status = (flush)(f, TRUE, &(cache->slot[new_idx].addr), cache->slot[new_idx].thing); if (status<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, + "can't flush object"); } cache->diagnostics[cache->slot[new_idx].type->id].nflushes++; } @@ -668,7 +677,8 @@ H5AC_protect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, /* * Right address but wrong object type. */ - HRETURN_ERROR (H5E_CACHE, H5E_BADTYPE, NULL); + HRETURN_ERROR (H5E_CACHE, H5E_BADTYPE, NULL, + "internal error"); } else { #ifdef H5AC_DEBUG @@ -689,7 +699,8 @@ H5AC_protect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, */ cache->diagnostics[type->id].nmisses++; if (NULL==(thing=(type->load)(f, addr, udata1, udata2))) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTLOAD, NULL, + "can't load object"); } } @@ -770,7 +781,8 @@ H5AC_unprotect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, flush = slot->type->flush; status = (flush)(f, TRUE, &(slot->addr), slot->thing); if (status<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, + "can't flush object"); } cache->diagnostics[slot->type->id].nflushes++; } @@ -179,7 +179,8 @@ H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *retval) sizeof_rkey = (type->get_sizeof_rkey)(f, udata); size = H5B_nodesize (f, type, &total_native_keysize, sizeof_rkey); if (H5MF_alloc (f, H5MF_META, size, retval)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "can't allocate file space for B-tree root node"); } bt = H5MM_xmalloc (sizeof(H5B_t)); bt->type = type; @@ -222,7 +223,8 @@ H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *retval) * Cache the new B-tree node. */ if (H5AC_set (f, H5AC_BT, retval, bt)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL, + "can't add B-tree root node to cache"); } #ifdef H5B_DEBUG @@ -278,19 +280,22 @@ H5B_load (H5F_t *f, const haddr_t *addr, const void *_type, void *udata) bt->key = H5MM_xmalloc ((2*H5B_K(f,type)+1) * sizeof(H5B_key_t)); bt->child = H5MM_xmalloc (2 * H5B_K(f,type) * sizeof(haddr_t)); if (H5F_block_read (f, addr, size, bt->page)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_READERROR, NULL); + HRETURN_ERROR (H5E_BTREE, H5E_READERROR, NULL, + "can't read B-tree node"); } p = bt->page; /* magic number */ if (HDmemcmp (p, H5B_MAGIC, H5B_SIZEOF_MAGIC)) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, NULL, + "wrong B-tree signature"); } p += 4; /* node type and level */ if (*p++ != type->id) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, NULL, + "incorrect B-tree node level"); } bt->level = *p++; @@ -398,7 +403,8 @@ H5B_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt) if (bt->key[i].nkey) { if ((bt->type->encode)(f, bt, bt->key[i].rkey, bt->key[i].nkey)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTENCODE, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTENCODE, FAIL, + "unable to encode B-tree key"); } } bt->key[i].dirty = FALSE; @@ -419,7 +425,8 @@ H5B_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt) * for the final unchanged children. */ if (H5F_block_write (f, addr, size, bt->page)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTFLUSH, FAIL, + "unable to save B-tree node to disk"); } bt->dirty = FALSE; bt->ndirty = 0; @@ -487,14 +494,16 @@ H5B_find (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) * the thing for which we're searching. */ if (NULL==(bt=H5AC_protect (f, H5AC_BT, addr, type, udata))) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to load B-tree node"); } rt = bt->nchildren; while (lt<rt && cmp) { idx = (lt + rt) / 2; if (H5B_decode_keys (f, bt, idx)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL, + "unable to decode B-tree key(s)"); } /* compare */ @@ -506,7 +515,8 @@ H5B_find (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) } } if (cmp) { - HGOTO_ERROR (H5E_BTREE, H5E_NOTFOUND, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_NOTFOUND, FAIL, + "B-tree key not found"); } /* @@ -515,19 +525,22 @@ H5B_find (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) assert (idx>=0 && idx<bt->nchildren); if (bt->level > 0) { if ((ret_value = H5B_find (f, type, bt->child+idx, udata))<0) { - HGOTO_ERROR (H5E_BTREE, H5E_NOTFOUND, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_NOTFOUND, FAIL, + "key not found in subtree"); } } else { ret_value = (type->found)(f, bt->child+idx, bt->key[idx].nkey, udata, bt->key[idx+1].nkey); if (ret_value<0) { - HGOTO_ERROR (H5E_BTREE, H5E_NOTFOUND, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_NOTFOUND, FAIL, + "key not found in leaf node"); } } done: if (bt && H5AC_unprotect (f, H5AC_BT, addr, bt)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL, + "unable to release node"); } FUNC_LEAVE (ret_value); } @@ -588,10 +601,12 @@ H5B_split (H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, * Create the new B-tree node. */ if (H5B_create (f, type, udata, new_addr/*out*/)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL, + "unable to create B-tree"); } if (NULL==(new_bt=H5AC_protect (f, H5AC_BT, new_addr, type, udata))) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to protect B-tree"); } new_bt->level = old_bt->level; @@ -633,7 +648,8 @@ H5B_split (H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, if (H5F_addr_defined (&(old_bt->right))) { if (NULL==(tmp_bt=H5AC_find (f, H5AC_BT, &(old_bt->right), type, udata))) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to load right sibling"); } tmp_bt->dirty = TRUE; tmp_bt->left = *new_addr; @@ -645,7 +661,8 @@ H5B_split (H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, done: { if (new_bt && H5AC_unprotect (f, H5AC_BT, new_addr, new_bt)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL, + "unable to release B-tree node"); } } FUNC_LEAVE (ret_value); @@ -677,7 +694,8 @@ H5B_decode_key (H5F_t *f, H5B_t *bt, intn idx) bt->key[idx].nkey = bt->native + idx * bt->type->sizeof_nkey; if ((bt->type->decode)(f, bt, bt->key[idx].rkey, bt->key[idx].nkey)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL, + "unable to decode key"); } FUNC_LEAVE (SUCCEED); @@ -710,10 +728,12 @@ H5B_decode_keys (H5F_t *f, H5B_t *bt, intn idx) assert (idx>=0 && idx<bt->nchildren); if (!bt->key[idx].nkey && H5B_decode_key (f, bt, idx)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL, + "unable to decode key"); } if (!bt->key[idx+1].nkey && H5B_decode_key (f, bt, idx+1)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL, + "unable to decode key"); } FUNC_LEAVE (SUCCEED); @@ -764,31 +784,36 @@ H5B_insert (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, if ((my_ins=H5B_insert_helper (f, addr, type, lt_key, <_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0 || my_ins<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL, + "unable to insert key"); } if (H5B_INS_NOOP==my_ins) HRETURN (SUCCEED); assert (H5B_INS_RIGHT==my_ins); /* the current root */ if (NULL==(bt = H5AC_find (f, H5AC_BT, addr, type, udata))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to locate root of B-tree"); } level = bt->level; if (!lt_key_changed) { if (!bt->key[0].nkey && H5B_decode_key (f, bt, 0)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL, + "unable to decode key"); } HDmemcpy (lt_key, bt->key[0].nkey, type->sizeof_nkey); } /* the new node */ if (NULL==(bt = H5AC_find (f, H5AC_BT, &child, type, udata))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to load new node"); } if (!rt_key_changed) { if (!bt->key[bt->nchildren].nkey && H5B_decode_key (f, bt, bt->nchildren)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL, + "unable to decode key"); } HDmemcpy (rt_key, bt->key[bt->nchildren].nkey, type->sizeof_nkey); } @@ -801,33 +826,40 @@ H5B_insert (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, size = H5B_nodesize (f, type, NULL, bt->sizeof_rkey); buf = H5MM_xmalloc (size); if (H5MF_alloc (f, H5MF_META, size, &old_root/*out*/)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to allocate file space to move root"); } if (H5AC_flush (f, H5AC_BT, addr, FALSE)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTFLUSH, FAIL, + "unable to flush B-tree root node"); } if (H5F_block_read (f, addr, size, buf)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_READERROR, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_READERROR, FAIL, + "unable to read B-tree root node"); } if (H5F_block_write (f, &old_root, size, buf)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_WRITEERROR, FAIL, + "unable to move B-tree root node"); } if (H5AC_rename (f, H5AC_BT, addr, &old_root)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTSPLIT, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTSPLIT, FAIL, + "unable to move B-tree root node"); } buf = H5MM_xfree (buf); /* update the new child's left pointer */ if (NULL==(bt=H5AC_find (f, H5AC_BT, &child, type, udata))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to load new child"); } bt->dirty = TRUE; bt->left = old_root; /* clear the old root at the old address (we already copied it)*/ if (NULL==(bt=H5AC_find (f, H5AC_BT, addr, type, udata))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to clear old root location"); } bt->dirty = TRUE; bt->ndirty = 0; @@ -837,7 +869,8 @@ H5B_insert (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, /* the new root */ if (NULL==(bt = H5AC_find (f, H5AC_BT, addr, type, udata))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to load new root"); } bt->dirty = TRUE; bt->ndirty = 2; @@ -1032,14 +1065,16 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, * should get the new data. */ if (NULL==(bt=H5AC_protect (f, H5AC_BT, addr, type, udata))) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, + "unable to load node"); } rt = bt->nchildren; while (lt<rt && cmp) { idx = (lt + rt) / 2; if (H5B_decode_keys (f, bt, idx)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } if ((cmp=(type->cmp3)(f, bt->key[idx].nkey, udata, bt->key[idx+1].nkey))<0) { @@ -1060,7 +1095,8 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, if ((type->new)(f, H5B_INS_FIRST, bt->key[0].nkey, udata, bt->key[1].nkey, bt->child+0/*out*/)<0) { bt->key[0].nkey = bt->key[1].nkey = NULL; - HGOTO_ERROR (H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, + "unable to create leaf node"); } bt->nchildren = 1; bt->dirty = TRUE; @@ -1075,8 +1111,8 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) { - /* Can't insert first leaf node */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert first leaf node"); } } else { my_ins = H5B_INS_NOOP; @@ -1089,15 +1125,16 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, */ idx = 0; if (H5B_decode_keys (f, bt, idx)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } if ((my_ins=H5B_insert_helper (f, bt->child+idx, type, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) { - /* Can't insert minimum subtree */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert minimum subtree"); } } else if (cmp<0 && idx<=0 && type->follow_min) { @@ -1108,15 +1145,16 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, */ idx = 0; if (H5B_decode_keys (f, bt, idx)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } if ((my_ins=(type->insert)(f, bt->child+idx, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) { - /* Can't insert minimum leaf node */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert minimum leaf node"); } } else if (cmp<0 && idx<=0) { @@ -1127,14 +1165,15 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, */ idx = 0; if (H5B_decode_keys (f, bt, idx)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } my_ins = H5B_INS_LEFT; HDmemcpy (md_key, bt->key[idx].nkey, type->sizeof_nkey); if ((type->new)(f, H5B_INS_LEFT, bt->key[idx].nkey, udata, md_key, &child_addr/*out*/)<0) { - /* Can't insert minimum leaf node */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert minimum leaf node"); } *lt_key_changed = TRUE; @@ -1145,15 +1184,16 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, */ idx = bt->nchildren - 1; if (H5B_decode_keys (f, bt, idx)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } if ((my_ins=H5B_insert_helper (f, bt->child+idx, type, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) { - /* Can't insert maximum subtree */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert maximum subtree"); } } else if (cmp>0 && idx+1>=bt->nchildren && type->follow_max) { @@ -1164,15 +1204,16 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, */ idx = bt->nchildren - 1; if (H5B_decode_keys (f, bt, idx)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } if ((my_ins=(type->insert)(f, bt->child+idx, bt->key[idx].nkey, lt_key_changed, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) { - /* Can't insert maximum leaf node */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert maximum leaf node"); } } else if (cmp>0 && idx+1>=bt->nchildren) { @@ -1183,14 +1224,15 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, */ idx = bt->nchildren - 1; if (H5B_decode_keys (f, bt, idx)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } my_ins = H5B_INS_RIGHT; HDmemcpy (md_key, bt->key[idx+1].nkey, type->sizeof_nkey); if ((type->new)(f, H5B_INS_RIGHT, md_key, udata, bt->key[idx+1].nkey, &child_addr/*out*/)<0) { - /* Can't insert maximum leaf node */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert maximum leaf node"); } *rt_key_changed = TRUE; @@ -1211,8 +1253,8 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) { - /* Can't insert subtree */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert subtree"); } } else { @@ -1225,8 +1267,8 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, md_key, udata, bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/))<0) { - /* Can't insert leaf node */ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert leaf node"); } } @@ -1270,12 +1312,12 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, /* If this node is full then split it before inserting the new child. */ if (bt->nchildren==2*H5B_K (f, type)) { if (H5B_split (f, type, bt, addr, udata, new_node/*out*/)<0) { - /*can't split node*/ - HGOTO_ERROR (H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, + "can't split node"); } if (NULL==(twin=H5AC_protect (f, H5AC_BT, new_node, type, udata))) { - /*can't load B-tree*/ - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, + "can't load B-tree"); } if (idx<=H5B_K (f, type)) { tmp_bt = bt; @@ -1290,8 +1332,8 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, /* Insert the child */ if (H5B_insert_child (f, type, tmp_bt, idx, &child_addr, my_ins, md_key)<0) { - /*can't insert child*/ - HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "can't insert child"); } } @@ -1302,7 +1344,8 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type, */ if (twin) { if (!twin->key[0].nkey && H5B_decode_key (f, twin, 0)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR); + HGOTO_ERROR (H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, + "unable to decode key"); } HDmemcpy (md_key, twin->key[0].nkey, type->sizeof_nkey); ret_value = H5B_INS_RIGHT; @@ -1328,7 +1371,8 @@ done: herr_t e1 = (bt && H5AC_unprotect (f, H5AC_BT, addr, bt)<0); herr_t e2 = (twin && H5AC_unprotect (f, H5AC_BT, new_node, twin)<0); if (e1 || e2) { /*use vars to prevent short-circuit of side effects*/ - HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR); + HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, + "unable to release node(s)"); } } @@ -1375,12 +1419,14 @@ H5B_list (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) assert (udata); if (NULL==(bt = H5AC_find (f, H5AC_BT, addr, type, udata))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to load B-tree node"); } if (bt->level>0) { if (H5B_list (f, type, bt->child+0, udata)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLIST, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLIST, FAIL, + "unable to list B-tree node"); } else { HRETURN (SUCCEED); } @@ -1388,18 +1434,21 @@ H5B_list (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) for (cur_addr=addr; !H5F_addr_defined (cur_addr); cur_addr=&next_addr) { if (NULL==(bt=H5AC_protect (f, H5AC_BT, cur_addr, type, udata))) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to protect B-tree node"); } for (i=0; i<bt->nchildren; i++) { if ((type->list)(f, bt->child+i, udata)<0) { - HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to list leaf node"); } } next_addr = bt->right; if (H5AC_unprotect (f, H5AC_BT, addr, bt)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL, + "unable to release B-tree node"); } bt = NULL; } @@ -1408,7 +1457,8 @@ H5B_list (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) done: if (bt && H5AC_unprotect (f, H5AC_BT, cur_addr, bt)<0) { - HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_PROTECT, FAIL, + "unable to release B-tree node"); } FUNC_LEAVE (ret_value); } @@ -1511,7 +1561,8 @@ H5B_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, * Load the tree node. */ if (NULL==(bt=H5AC_find (f, H5AC_BT, addr, type, udata))) { - HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, + "unable to load B-tree node"); } /* @@ -69,13 +69,17 @@ H5C_init_interface (void) status = H5Ainit_group (H5_TEMPLATE_0+i, H5A_TEMPID_HASHSIZE, 0, NULL); if (status<0) ret_value = FAIL; } - if (ret_value<0) HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL); + if (ret_value<0) { + HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL, + "unable to initialize atom group"); + } /* * Register cleanup function. */ if (H5_add_exit (H5C_term_interface)<0) { - HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL, + "unable to install atexit function"); } FUNC_LEAVE(ret_value); @@ -143,8 +147,8 @@ H5Ccreate (H5C_class_t type) break; case H5C_FILE_ACCESS: - /* Not implemented yet */ - HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "not implemented yet"); case H5C_DATASET_CREATE: tmpl = H5MM_xmalloc (sizeof(H5D_create_t)); @@ -157,13 +161,14 @@ H5Ccreate (H5C_class_t type) break; default: - /* Unknown template class */ - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, + "unknown template class"); } /* Atomize the new template */ if ((ret_value = H5C_create (type, tmpl))<0) { - HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL); /*can't register template*/ + HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL, + "can't register template"); } FUNC_LEAVE (ret_value); @@ -201,7 +206,8 @@ H5C_create (H5C_class_t type, void *tmpl) /* Atomize the new template */ if ((ret_value = H5Aregister_atom (H5_TEMPLATE_0+type, tmpl))<0) { - HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL); /*can't register template*/ + HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL, + "can't register template"); } FUNC_LEAVE (ret_value); @@ -229,7 +235,7 @@ H5Cclose (hid_t template) /* Chuck the object! :-) */ if (NULL==(tmpl=H5Aremove_atom (template))) { - HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); + HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to remove atom"); } H5MM_xfree (tmpl); @@ -264,8 +270,7 @@ H5Cget_class (hid_t template) if ((group = H5Aatom_group (template))<0 || group<H5_TEMPLATE_0 || group>=H5_TEMPLATE_MAX) { - /* not a template */ - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, H5C_NO_CLASS); + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, H5C_NO_CLASS, "not a template"); } ret_value = group - H5_TEMPLATE_0; @@ -425,7 +430,7 @@ H5Cget_prop (hid_t template, H5C_prop_t prop, void *buf/*out*/) /* check args */ if ((type=H5Cget_class (template))<0 || NULL==(tmpl=H5Aatom_object (template))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a template*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a template"); } /* Handle each class of template */ @@ -479,14 +484,14 @@ H5Cget_prop (hid_t template, H5C_prop_t prop, void *buf/*out*/) break; default: - /* Unknown property for file create template */ - HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown property for file create template"); } break; case H5C_FILE_ACCESS: - /* Unknown property for file access template */ - HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown property for file access template"); case H5C_DATASET_CREATE: dset_create = (const H5D_create_t *)tmpl; @@ -499,8 +504,8 @@ H5Cget_prop (hid_t template, H5C_prop_t prop, void *buf/*out*/) if (H5D_CHUNKED==dset_create->layout) { *(int*)buf = dset_create->chunk_ndims; } else { - /* Chunk dimensionality is not initialized */ - HRETURN_ERROR (H5E_TEMPLATE, H5E_UNINITIALIZED, FAIL); + HRETURN_ERROR (H5E_TEMPLATE, H5E_UNINITIALIZED, FAIL, + "chunk dimensionality is not initialized"); } break; @@ -510,30 +515,30 @@ H5Cget_prop (hid_t template, H5C_prop_t prop, void *buf/*out*/) ((size_t*)buf)[i] = dset_create->chunk_size[i]; } } else { - /* Chunk size is not initialized */ - HRETURN_ERROR (H5E_TEMPLATE, H5E_UNINITIALIZED, FAIL); + HRETURN_ERROR (H5E_TEMPLATE, H5E_UNINITIALIZED, FAIL, + "chunk size is not initialized"); } break; case H5D_COMPRESS: case H5D_PRE_OFFSET: case H5D_PRE_SCALE: - /* Not implemented yet */ - HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "not implemented yet"); default: - /* Unknown property for dataset create template */ - HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown property for dataset create template"); } break; case H5C_DATASET_XFER: - /* Unknown property for dataset transfer template */ - HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown property for dataset transfer template"); default: - /* Unknown template class */ - HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown template class"); } FUNC_LEAVE (SUCCEED); } @@ -583,7 +588,7 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) if ((type=H5Cget_class (template))<0 || NULL==(tmpl=H5Aatom_object (template))) { - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a template*/ + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a template"); } /* Handle each class of template */ @@ -599,8 +604,8 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) if (size==p2) break; } if (i>=8*sizeof(int)) { - /* Userblock size is not valid */ - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, + "userblock size is not valid"); } file_create->userblock_size = size; break; @@ -608,8 +613,8 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5F_SIZEOF_ADDR: size = va_arg (ap, size_t); if (size!=2 && size!=4 && size!=8 && size!=16) { - /* file haddr_t size is not valid */ - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, + "file haddr_t size is not valid"); } file_create->sizeof_addr = size; break; @@ -617,8 +622,8 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5F_SIZEOF_SIZE: size = va_arg (ap, size_t); if (size!=2 && size!=4 && size!=8 && size!=16) { - /* file size_t size is not valid */ - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, + "file size_t size is not valid"); } file_create->sizeof_size = size; break; @@ -626,8 +631,8 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5F_SYM_LEAF_K: n = va_arg (ap, int); if (n<2) { - /* Symbol leaf node 1/2 rank is not valid */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "symbol leaf node 1/2 rank is not valid"); } file_create->sym_leaf_k = n; break; @@ -635,8 +640,8 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5F_SYM_INTERN_K: n = va_arg (ap, int); if (n<2) { - /* Symbol internal node 1/2 rank is not valid */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "symbol internal node 1/2 rank is not valid"); } file_create->btree_k[H5B_SNODE_ID] = n; break; @@ -644,8 +649,8 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5F_ISTORE_K: n = va_arg (ap, int); if (n<2) { - /* Indexed storage internal node 1/2 rank is not valid */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "indexed storage internal node 1/2 rank not valid"); } file_create->btree_k[H5B_ISTORE_ID] = n; break; @@ -655,18 +660,18 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5F_FREESPACE_VER: case H5F_OBJECTDIR_VER: case H5F_SHAREDHEADER_VER: - /* This is a read-only property */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "this is a read-only property"); default: - /* Unknown file creation property */ - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown file creation property"); } break; case H5C_FILE_ACCESS: - /* Unknown property for file access template */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown property for file access template"); case H5C_DATASET_CREATE: dset_create = (H5D_create_t *)tmpl; @@ -675,8 +680,8 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5D_LAYOUT: layout = va_arg (ap, H5D_layout_t); if (layout<0 || layout>=H5D_NLAYOUTS) { - /* Raw data layout method is not valid */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "raw data layout method is not valid"); } dset_create->layout = layout; break; @@ -684,12 +689,12 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5D_CHUNK_NDIMS: n = va_arg (ap, int); if (H5D_CHUNKED!=dset_create->layout) { - /* Not a chunked layout template */ - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, + "not a chunked layout template"); } if (n<=0 || n>NELMTS (dset_create->chunk_size)) { - /* Invalid number of dimensions */ - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, + "invalid number of dimensions"); } dset_create->chunk_ndims = n; for (i=0; i<n; i++) dset_create->chunk_size[i] = 1; @@ -698,16 +703,16 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5D_CHUNK_SIZE: dims = va_arg (ap, size_t*); if (H5D_CHUNKED!=dset_create->layout) { - /* Not a chunked layout template */ - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, + "not a chunked layout template"); } if (!dims) { - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no dims*/ + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no dims"); } for (i=0; i<dset_create->chunk_ndims; i++) { if (dims[i]<=0) { - /* Invalid dimension size */ - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, + "invalid dimension size"); } } for (i=0; i<dset_create->chunk_ndims; i++) { @@ -718,22 +723,22 @@ H5Cset_prop (hid_t template, H5C_prop_t prop, ...) case H5D_COMPRESS: case H5D_PRE_OFFSET: case H5D_PRE_SCALE: - /* Not implemented yet */ - HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "not implemented yet"); default: - /* Unknown property for dataset create template */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown property for dataset create template"); } break; case H5C_DATASET_XFER: - /* Unknown property for dataset transfer template */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown property for dataset transfer template"); default: - /* Unknown template class */ - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown template class"); } ret_value = SUCCEED; @@ -783,8 +788,8 @@ H5Ccopy (hid_t template) if (NULL==(tmpl=H5Aatom_object (template)) || (type=H5Cget_class (template))<0 || (group=H5Aatom_group (template))<0) { - /* Can't unatomize template */ - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, + "can't unatomize template"); } /* How big is the template */ @@ -794,8 +799,8 @@ H5Ccopy (hid_t template) break; case H5C_FILE_ACCESS: - /* File access properties are not implemented yet */ - HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "file access properties are not implemented yet"); case H5C_DATASET_CREATE: size = sizeof(H5D_create_t); @@ -806,8 +811,8 @@ H5Ccopy (hid_t template) break; default: - /* Unknown template class */ - HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, + "unknown template class"); } /* Create the new template */ @@ -816,7 +821,8 @@ H5Ccopy (hid_t template) /* Register the atom for the new template */ if ((ret_value=H5Aregister_atom (group, new_tmpl))<0) { - HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL); + HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, + "unable to atomize template pointer"); } FUNC_LEAVE (ret_value); @@ -179,24 +179,24 @@ H5Dcreate (hid_t file_id, const char *name, hid_t type_id, hid_t space_id, /* check arguments */ if (H5_FILE!=H5Aatom_group (file_id) || NULL==(f=H5Aatom_object (file_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a file*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no name*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); } if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(type=H5Aatom_object (type_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a type"); } if (H5_DATASPACE!=H5Aatom_group (space_id) || NULL==(space=H5Aatom_object (space_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space */ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } if (create_parms_id>=0) { if (H5C_DATASET_CREATE!=H5Cget_class (create_parms_id) || NULL==(create_parms=H5Aatom_object (create_parms_id))) { - /* Not a dataset creation template */ - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, + "not a dataset creation template"); } } else { create_parms = &H5D_create_dflt; @@ -204,14 +204,14 @@ H5Dcreate (hid_t file_id, const char *name, hid_t type_id, hid_t space_id, /* build and open the new dataset */ if (NULL==(new_dset=H5D_create (f, name, type, space, create_parms))) { - HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL); /*can't create dataset*/ + HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "can't create dataset"); } /* Register the new datatype and get an ID for it */ if ((ret_value=H5Aregister_atom (H5_DATASET, new_dset))<0) { H5D_close (new_dset); - /* Can't register dataset */ - HRETURN_ERROR (H5E_DATASET, H5E_CANTREGISTER, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_CANTREGISTER, FAIL, + "can't register dataset"); } FUNC_LEAVE (ret_value); @@ -255,22 +255,22 @@ H5Dopen (hid_t file_id, const char *name) /* Check args */ if (H5_FILE!=H5Aatom_group (file_id) || NULL==(file=H5Aatom_object (file_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a file*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no name*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); } /* Find the dataset */ if (NULL==(dataset=H5D_open (file, name))) { - HRETURN_ERROR (H5E_DATASET, H5E_NOTFOUND, FAIL); /*dataset not found*/ + HRETURN_ERROR (H5E_DATASET, H5E_NOTFOUND, FAIL, "dataset not found"); } /* Create an atom for the dataset */ if ((ret_value=H5Aregister_atom (H5_DATASET, dataset))<0) { H5D_close (dataset); - /* Can't register dataset */ - HRETURN_ERROR (H5E_DATASET, H5E_CANTREGISTER, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_CANTREGISTER, FAIL, + "can't register dataset"); } FUNC_LEAVE (ret_value); @@ -311,7 +311,7 @@ H5Dclose (hid_t dataset_id) if (H5_DATASET!=H5Aatom_group (dataset_id) || NULL==(dataset=H5Aatom_object (dataset_id)) || NULL==dataset->file) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a dataset*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } /* @@ -319,7 +319,7 @@ H5Dclose (hid_t dataset_id) * reaches zero. */ if (H5A_dec_ref (dataset_id)<0) { - HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL); /*can't free*/ + HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "can't free"); } FUNC_LEAVE (SUCCEED); @@ -379,31 +379,31 @@ H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id, if (H5_DATASET!=H5Aatom_group (dataset_id) || NULL==(dataset=H5Aatom_object (dataset_id)) || NULL==dataset->file) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a dataset*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(type=H5Aatom_object (type_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (H5P_ALL!=space_id) { if (H5_DATASPACE!=H5Aatom_group (space_id) || NULL==(space=H5Aatom_object (space_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } if (H5C_DEFAULT==xfer_parms_id) { xfer_parms = &H5D_xfer_dflt; } else if (H5C_DATASET_XFER!=H5Cget_class (xfer_parms_id) || NULL==(xfer_parms=H5Aatom_object (xfer_parms_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not xfer parms*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); } if (!buf) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no output buffer*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer"); } /* read raw data */ if (H5D_read (dataset, type, space, xfer_parms, buf/*out*/)<0) { - HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL); /*can't read data*/ + HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); } FUNC_LEAVE (SUCCEED); @@ -459,31 +459,31 @@ H5Dwrite (hid_t dataset_id, hid_t type_id, hid_t space_id, if (H5_DATASET!=H5Aatom_group (dataset_id) || NULL==(dataset=H5Aatom_object (dataset_id)) || NULL==dataset->file) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a dataset*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(type=H5Aatom_object (type_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (H5P_ALL!=space_id) { if (H5_DATASPACE!=H5Aatom_group (space_id) || NULL==(space=H5Aatom_object (space_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } if (H5C_DEFAULT==xfer_parms_id) { xfer_parms = &H5D_xfer_dflt; } else if (H5C_DATASET_XFER!=H5Cget_class (xfer_parms_id) || NULL==(xfer_parms=H5Aatom_object (xfer_parms_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not xfer parms*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); } if (!buf) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no output buffer*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer"); } /* write raw data */ if (H5D_write (dataset, type, space, xfer_parms, buf)<0) { - HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL); /*can't write data*/ + HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL, "can't write data"); } FUNC_LEAVE (SUCCEED); @@ -588,16 +588,16 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space, * is cached it shouldn't cause any disk activity. */ if (NULL==(new_dset->ent = H5G_create (f, name, H5D_MINHDR_SIZE))) { - /* Problem with the dataset name */ - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "problem with the dataset name"); } /* Update the type and space header messages */ if (H5O_modify (f, NO_ADDR, new_dset->ent, H5O_DTYPE, 0, new_dset->type)<0 || H5P_modify (f, new_dset->ent, new_dset->space)<0) { - /* Can't update type or space header messages */ - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "can't update type or space header messages"); } /* Total raw data size */ @@ -609,13 +609,13 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space, new_dset->storage.cstore.size = nbytes; if (H5MF_alloc (f, H5MF_RAW, nbytes, &(new_dset->storage.cstore.addr))<0) { - /* Can't allocate raw file storage */ - HGOTO_ERROR (H5E_DATASET, H5E_NOSPACE, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_NOSPACE, NULL, + "can't allocate raw file storage"); } if (H5O_modify (f, NO_ADDR, new_dset->ent, H5O_CSTORE, 0, &(new_dset->storage.cstore))<0) { - /* Can't update dataset object header */ - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "can't update dataset object header"); } break; @@ -628,27 +628,27 @@ H5D_create (H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space, */ ndims = new_dset->create_parms.chunk_ndims; if (ndims != H5P_get_ndims (space)) { - /* Dimensionality of chunks doesn't match the data space */ - HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL, + "dimensionality of chunks doesn't match the data space"); } assert (ndims<NELMTS (new_dset->create_parms.chunk_size)); new_dset->create_parms.chunk_size[ndims] = H5T_get_size (type); if (H5F_istore_create (f, &(new_dset->storage.istore), ndims+1, new_dset->create_parms.chunk_size)<0) { - /* Can't initialize chunked storage */ - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "can't initialize chunked storage"); } if (H5O_modify (f, NO_ADDR, new_dset->ent, H5O_ISTORE, 0, &(new_dset->storage.istore))<0) { - /* Can't update dataset object header */ - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "can't update dataset object header"); } break; default: assert ("not implemented yet" && 0); - HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet"); } /* Success */ @@ -707,15 +707,15 @@ H5D_open (H5F_t *f, const char *name) /* Open the dataset object */ if (NULL==(dataset->ent=H5G_open (f, name))) { - HGOTO_ERROR (H5E_DATASET, H5E_NOTFOUND, NULL); /*not found*/ + HGOTO_ERROR (H5E_DATASET, H5E_NOTFOUND, NULL, "not found"); } /* Get the type and space */ if (NULL==(dataset->type = H5O_read (f, NO_ADDR, dataset->ent, H5O_DTYPE, 0, NULL)) || NULL==(dataset->space = H5P_read (f, dataset->ent))) { - /* Can't load type of space info from dataset header */ - HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "can't load type of space info from dataset header"); } /* @@ -746,7 +746,7 @@ H5D_open (H5F_t *f, const char *name) } else { assert ("not implemented yet" && 0); - HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL); + HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet"); } /* Success */ @@ -819,8 +819,9 @@ H5D_close (H5D_t *dataset) H5MM_xfree (dataset); if (free_failed) { - /* Couldn't free the type or space, but the dataset was freed anyway. */ - HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, + "couldn't free the type or space, but the dataset was " + "freed anyway."); } FUNC_LEAVE (SUCCEED); @@ -866,16 +867,16 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, assert (buf); if (H5D_CONTIGUOUS!=dataset->create_parms.layout) { - /* Layout is not supported yet */ - HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "layout is not supported yet"); } if (H5T_cmp (type, dataset->type)) { - /* Type conversion not supported yet */ - HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "type conversion not supported yet"); } if (space && H5P_cmp (space, dataset->space)) { - /* Space conversion not supported yet */ - HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "space conversion not supported yet"); } /* Compute the size of the request */ @@ -888,7 +889,7 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, */ if (H5F_block_read (dataset->file, &(dataset->storage.cstore.addr), nbytes, buf)<0) { - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); /*read failed*/ + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed"); } break; @@ -901,13 +902,14 @@ H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space, size[dataset->storage.istore.ndims-1] = H5T_get_size (dataset->type); if (H5F_istore_read (dataset->file, &(dataset->storage.istore), offset, size, buf)<0) { - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); /*read failed*/ + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed"); } break; default: assert ("not implemented yet" && 0); - HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "not implemented yet"); } FUNC_LEAVE (SUCCEED); @@ -954,16 +956,16 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, assert (buf); if (H5D_CONTIGUOUS!=dataset->create_parms.layout) { - /* Layout is not supported yet */ - HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "layout is not supported yet"); } if (H5T_cmp (type, dataset->type)) { - /* Type conversion not supported yet */ - HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "type conversion not supported yet"); } if (space && H5P_cmp (space, dataset->space)) { - /* Space conversion not supported yet */ - HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "space conversion not supported yet"); } /* Compute the size of the request */ @@ -977,7 +979,7 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, */ if (H5F_block_write (dataset->file, &(dataset->storage.cstore.addr), nbytes, buf)<0) { - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); /*write failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed"); } break; @@ -990,13 +992,14 @@ H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *space, size[dataset->storage.istore.ndims-1] = H5T_get_size (dataset->type); if (H5F_istore_write (dataset->file, &(dataset->storage.istore), offset, size, buf)<0) { - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); /*write failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed"); } break; default: assert ("not implemented yet" && 0); - HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "not implemented yet"); } FUNC_LEAVE (SUCCEED); diff --git a/src/H5Dconv.c b/src/H5Dconv.c index 25ff762..5f9ee36 100644 --- a/src/H5Dconv.c +++ b/src/H5Dconv.c @@ -117,7 +117,8 @@ herr_t H5D_convert_buf(void *dst, const void *src, uintn len, uintn size) break; default: - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "not implemented yet"); } /* end switch */ done: diff --git a/src/H5Distore.c b/src/H5Distore.c index 8684465..15c7d4d 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -370,8 +370,8 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op, nbytes = H5V_vector_reduce_product (udata->mesg.ndims, udata->key.size); assert (nbytes>0); if (H5MF_alloc (f, H5MF_RAW, nbytes, addr/*out*/)<0) { - /* Couldn't allocate new file storage */ - HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, + "couldn't allocate new file storage"); } udata->addr = *addr; udata->key.file_number = 0; @@ -518,7 +518,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, if (cmp<0) { /* Negative indices not supported yet */ assert ("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR (H5E_STORAGE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_STORAGE, H5E_UNSUPPORTED, FAIL, "internal error"); } else if (H5V_hyper_eq (udata->mesg.ndims, udata->key.offset, udata->key.size, @@ -554,7 +554,8 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, * Allocate storage for the new chunk */ if (H5MF_alloc (f, H5MF_RAW, nbytes, new_node/*out*/)<0) { - HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, + "file allocation failed"); } udata->addr = *new_node; udata->key.file_number = 0; @@ -562,7 +563,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, } else { assert ("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "internal error"); } FUNC_LEAVE (ret_value); @@ -704,7 +705,8 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, if (status>=0 && H5F_addr_defined (&(udata.addr))) { assert (0==udata.key.file_number); if (H5F_block_read (f, &(udata.addr), chunk_size, chunk)<0) { - HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL); + HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, + "unable to read raw storage chunk"); } } else { HDmemset (chunk, 0, chunk_size); @@ -718,7 +720,8 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, size_m, sub_offset_m, buf); assert (0==udata.key.file_number); if (H5F_block_write (f, &(udata.addr), chunk_size, chunk)<0) { - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "unable to write raw storage chunk"); } } else { H5V_hyper_copy (istore->ndims, sub_size, @@ -774,8 +777,8 @@ H5F_istore_read (H5F_t *f, const H5O_istore_t *istore, if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_READ, offset, size, H5V_ZERO, size, buf)<0) { - /* hyperslab output failure */ - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, + "hyperslab output failure"); } FUNC_LEAVE (SUCCEED); @@ -815,8 +818,8 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_WRITE, offset, size, H5V_ZERO, size, buf)<0) { - /* hyperslab output failure */ - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "hyperslab output failure"); } FUNC_LEAVE (SUCCEED); @@ -868,7 +871,7 @@ H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore/*out*/, udata.mesg.ndims = istore->ndims = ndims; if (H5B_create (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) { - HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); /* Can't create B-tree */ + HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree"); } for (i=0; i<ndims; i++) { @@ -239,11 +239,11 @@ intn H5Edelete_err_stack(int32 err_stack) /* Clear errors and check args and all the boring stuff. */ if (H5Aatom_group(err_stack)!=H5_ERR) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack"); /* Get the error stack to put the error on */ if((old_stack=H5Aremove_atom(err_stack))==NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't remove atom"); /* Clear the error descriptions and reset the stack top */ for(; old_stack->stack_top>0; old_stack->stack_top--) @@ -292,11 +292,11 @@ H5Eclear (int32 err_hand) /* Get the error stack for this error handler, initialized earlier in H5Enew_err_stack */ if (H5Aatom_group(err_hand)!=H5_ERR) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack"); /* Get the error stack to put the error on */ if((err_stack=H5Aatom_object(err_hand))==NULL) - HGOTO_ERROR(H5E_BADATOM, H5E_BADATOM, FAIL); + HGOTO_ERROR(H5E_BADATOM, H5E_BADATOM, FAIL, "not an error stack"); /* Clear the error descriptions and reset the stack top */ for(; err_stack->stack_top>0; err_stack->stack_top--) @@ -337,7 +337,7 @@ DESCRIPTION --------------------------------------------------------------------------*/ herr_t -H5E_store(int32 errid, hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line) +H5E_store(int32 errid, H5E_major_t maj, H5E_minor_t min, const char *function_name, const char *file_name, intn line) { H5E_errstack_t *err_stack=NULL; /* Pointer to the error stack to put value on */ herr_t ret_value = SUCCEED; @@ -349,7 +349,7 @@ H5E_store(int32 errid, hdf_maj_err_code_t maj, hdf_min_err_code_t min, const cha /* Get the error stack to put the error on */ if((err_stack=H5Aatom_object(errid))==NULL) - HGOTO_ERROR(H5E_BADATOM, H5E_BADATOM, FAIL); + HGOTO_ERROR(H5E_BADATOM, H5E_BADATOM, FAIL, "not an error stack"); /* Check if we need to expand the stack */ if(err_stack->stack_top>=err_stack->stack_size) @@ -403,7 +403,7 @@ DESCRIPTION --------------------------------------------------------------------------*/ herr_t -H5Epush(hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line) +H5Epush(H5E_major_t maj, H5E_minor_t min, const char *function_name, const char *file_name, intn line) { H5E_errstack_t *err_stack=NULL; /* Pointer to the error stack to put value on */ herr_t ret_value = SUCCEED; @@ -412,11 +412,11 @@ H5Epush(hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_nam /* Clear errors and check args and all the boring stuff. */ if (function_name==NULL || file_name==NULL || H5Aatom_group(thrderrid)!=H5_ERR) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "wrong arguments"); /* Get the error stack to put the error on */ if((err_stack=H5Aatom_object(thrderrid))==NULL) - HGOTO_ERROR(H5E_BADATOM, H5E_BADATOM, FAIL); + HGOTO_ERROR(H5E_BADATOM, H5E_BADATOM, FAIL, "not an error stack"); (err_stack->push)(thrderrid, maj, min, function_name, file_name, line); diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 50b8241..47d3631 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -36,14 +36,14 @@ Assume that func and file are both stored in static space, or at least be not corrupted in the meanwhile. */ -#define HERROR(maj, min) H5Epush(maj, min, FUNC, __FILE__, __LINE__) +#define HERROR(maj, min, str) H5Epush(maj, min, FUNC, __FILE__, __LINE__) /* HRETURN_ERROR macro, used to facilitate error reporting. Makes same assumptions as HERROR. IN ADDITION, this macro causes a return from the calling routine */ -#define HRETURN_ERROR(maj, min, ret_val) { \ - HERROR (maj, min); \ +#define HRETURN_ERROR(maj, min, ret_val, str) { \ + HERROR (maj, min, str); \ PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \ return (ret_val); \ } @@ -60,8 +60,8 @@ a jump to the label 'done' which should be in every fucntion Also there is an assumption of a variable 'ret_value' */ -#define HGOTO_ERROR(maj, min, ret_val) { \ - HERROR (maj, min); \ +#define HGOTO_ERROR(maj, min, ret_val, str) { \ + HERROR (maj, min, str); \ ret_value = ret_val; \ goto done; \ } @@ -87,7 +87,7 @@ */ typedef struct { - hdf_maj_err_code_t error_code; + H5E_major_t error_code; const char *str; } hdf_maj_error_messages_t; @@ -95,7 +95,7 @@ hdf_maj_error_messages_t; typedef struct { - hdf_min_err_code_t error_code; + H5E_minor_t error_code; const char *str; } hdf_min_error_messages_t; @@ -107,8 +107,8 @@ hdf_min_error_messages_t; /* the structure of the error stack element */ typedef struct error_t { - hdf_maj_err_code_t maj; /* Major error number */ - hdf_min_err_code_t min; /* Minor error number */ + H5E_major_t maj; /* Major error number */ + H5E_minor_t min; /* Minor error number */ char function_name[MAX_FUNC_NAME_LEN]; /* function where error occur */ const char *file_name; /* file where error occur */ intn line; /* line in file where error occurs */ @@ -132,6 +132,6 @@ extern int32 thrderrid; /* Thread-specific "global" error-handler ID */ extern hbool_t install_atexit; /* Whether to install the atexit routine */ /* Private functions in H5E.c */ -herr_t H5E_store(int32 errid, hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line); +herr_t H5E_store(int32 errid, H5E_major_t maj, H5E_minor_t min, const char *function_name, const char *file_name, intn line); #endif diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 8f85551..57f40e5 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -1,13 +1,13 @@ /**************************************************************************** - * NCSA HDF * - * Software Development Group * - * National Center for Supercomputing Applications * - * University of Illinois at Urbana-Champaign * - * 605 E. Springfield, Champaign IL 61820 * - * * - * For conditions of distribution and use, see the accompanying * - * hdf/COPYING file. * - * * + * NCSA HDF * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * * + * For conditions of distribution and use, see the accompanying * + * hdf/COPYING file. * + * * ****************************************************************************/ /* $Id$ */ @@ -22,113 +22,115 @@ /* Public headers needed by this file */ #include <H5public.h> -/* Declare an enumerated type which holds all the valid major HDF error codes */ -typedef enum - { - H5E_NONE_MAJOR = 0, /* special zero, no error */ - H5E_ARGS, /* Invalid arguments to routine */ - H5E_RESOURCE, /* Resource unavailable */ - H5E_INTERNAL, /* Internal error (too specific to document +/* + * Declare an enumerated type which holds all the valid major HDF error codes. + */ +typedef enum H5E_major_t { + H5E_NONE_MAJOR = 0, /* special zero, no error */ + H5E_ARGS, /* Invalid arguments to routine */ + H5E_RESOURCE, /* Resource unavailable */ + H5E_INTERNAL, /* Internal error (too specific to document * in detail) */ - H5E_FILE, /* File Accessability */ - H5E_IO, /* Low-level I/O */ - H5E_FUNC, /* Function Entry/Exit */ - H5E_ATOM, /* Object Atom */ - H5E_CACHE, /* Object Cache */ - H5E_BTREE, /* B-Tree Node */ - H5E_SYM, /* Symbol Table */ - H5E_HEAP, /* Heap */ - H5E_OHDR, /* Object Header */ - H5E_DATATYPE, /* Datatype */ - H5E_DATASPACE, /* Dataspace */ - H5E_DATASET, /* Dataset */ - H5E_STORAGE, /* Data storage */ - H5E_TEMPLATE /* Templates */ - } -hdf_maj_err_code_t; + H5E_FILE, /* File Accessability */ + H5E_IO, /* Low-level I/O */ + H5E_FUNC, /* Function Entry/Exit */ + H5E_ATOM, /* Object Atom */ + H5E_CACHE, /* Object Cache */ + H5E_BTREE, /* B-Tree Node */ + H5E_SYM, /* Symbol Table */ + H5E_HEAP, /* Heap */ + H5E_OHDR, /* Object Header */ + H5E_DATATYPE, /* Datatype */ + H5E_DATASPACE, /* Dataspace */ + H5E_DATASET, /* Dataset */ + H5E_STORAGE, /* Data storage */ + H5E_TEMPLATE /* Templates */ +} H5E_major_t; + /* Declare an enumerated type which holds all the valid minor HDF error codes */ -typedef enum - { - H5E_NONE_MINOR = 0, /* special zero, no error */ - - /* Argument errors */ - H5E_UNINITIALIZED, /* Information is unitialized */ - H5E_UNSUPPORTED, /* Feature is unsupported */ - H5E_BADTYPE, /* Incorrect type found */ - H5E_BADRANGE, /* Argument out of range */ - H5E_BADVALUE, /* Bad value for argument */ - - /* Resource errors */ - H5E_NOSPACE, /* No space available for allocation */ - - /* File accessability errors */ - H5E_FILEEXISTS, /* File already exists */ - H5E_FILEOPEN, /* File already open */ - H5E_CANTCREATE, /* Can't create file */ - H5E_CANTOPENFILE, /* Can't open file */ - H5E_NOTHDF5, /* Not an HDF5 format file */ - H5E_BADFILE, /* Bad file ID accessed */ - H5E_TRUNCATED, /* File has been truncated */ - - /* Generic low-level file I/O errors */ - H5E_SEEKERROR, /* Seek failed */ - H5E_READERROR, /* Read failed */ - H5E_WRITEERROR, /* Write failed */ - H5E_CLOSEERROR, /* Close failed */ - - /* Function entry/exit interface errors */ - H5E_CANTINIT, /* Can't initialize interface */ - H5E_ALREADYINIT, /* Object already initialized */ - - /* Object atom related errors */ - H5E_BADATOM, /* Can't find atom information */ - H5E_CANTREGISTER, /* Can't register new atom */ - - /* Cache related errors */ - H5E_CANTFLUSH, /* Can't flush object from cache */ - H5E_CANTLOAD, /* Can't load object into cache */ - H5E_PROTECT, /* Protected object error */ - H5E_NOTCACHED, /* Object not currently cached */ +typedef enum H5E_minor_t { + H5E_NONE_MINOR = 0, /* special zero, no error */ + + /* Argument errors */ + H5E_UNINITIALIZED, /* Information is unitialized */ + H5E_UNSUPPORTED, /* Feature is unsupported */ + H5E_BADTYPE, /* Incorrect type found */ + H5E_BADRANGE, /* Argument out of range */ + H5E_BADVALUE, /* Bad value for argument */ + + /* Resource errors */ + H5E_NOSPACE, /* No space available for allocation */ + + /* File accessability errors */ + H5E_FILEEXISTS, /* File already exists */ + H5E_FILEOPEN, /* File already open */ + H5E_CANTCREATE, /* Can't create file */ + H5E_CANTOPENFILE, /* Can't open file */ + H5E_NOTHDF5, /* Not an HDF5 format file */ + H5E_BADFILE, /* Bad file ID accessed */ + H5E_TRUNCATED, /* File has been truncated */ + + /* Generic low-level file I/O errors */ + H5E_SEEKERROR, /* Seek failed */ + H5E_READERROR, /* Read failed */ + H5E_WRITEERROR, /* Write failed */ + H5E_CLOSEERROR, /* Close failed */ + + /* Function entry/exit interface errors */ + H5E_CANTINIT, /* Can't initialize interface */ + H5E_ALREADYINIT, /* Object already initialized */ + + /* Object atom related errors */ + H5E_BADATOM, /* Can't find atom information */ + H5E_CANTREGISTER, /* Can't register new atom */ + + /* Cache related errors */ + H5E_CANTFLUSH, /* Can't flush object from cache */ + H5E_CANTLOAD, /* Can't load object into cache */ + H5E_PROTECT, /* Protected object error */ + H5E_NOTCACHED, /* Object not currently cached */ - /* B-tree related errors */ - H5E_NOTFOUND, /* Object not found */ - H5E_EXISTS, /* Object already exists */ - H5E_CANTENCODE, /* Can't encode value */ - H5E_CANTDECODE, /* Can't decode value */ - H5E_CANTSPLIT, /* Can't split node */ - H5E_CANTINSERT, /* Can't insert object */ - H5E_CANTLIST, /* Can't list node */ - - /* Object header related errors */ - H5E_LINKCOUNT, /* Bad object header link count */ - H5E_VERSION, /* Wrong version number */ - H5E_ALIGNMENT, /* Alignment error */ - H5E_BADMESG, /* Unrecognized message */ - - /* Group related errors */ - H5E_CANTOPENOBJ, /* Can't open object */ - H5E_COMPLEN, /* Name component is too long */ - H5E_CWG, /* Problem with current working group */ - H5E_LINK /* Link count failure */ - } -hdf_min_err_code_t; + /* B-tree related errors */ + H5E_NOTFOUND, /* Object not found */ + H5E_EXISTS, /* Object already exists */ + H5E_CANTENCODE, /* Can't encode value */ + H5E_CANTDECODE, /* Can't decode value */ + H5E_CANTSPLIT, /* Can't split node */ + H5E_CANTINSERT, /* Can't insert object */ + H5E_CANTLIST, /* Can't list node */ + + /* Object header related errors */ + H5E_LINKCOUNT, /* Bad object header link count */ + H5E_VERSION, /* Wrong version number */ + H5E_ALIGNMENT, /* Alignment error */ + H5E_BADMESG, /* Unrecognized message */ + + /* Group related errors */ + H5E_CANTOPENOBJ, /* Can't open object */ + H5E_COMPLEN, /* Name component is too long */ + H5E_CWG, /* Problem with current working group */ + H5E_LINK /* Link count failure */ +} H5E_minor_t; /* Function pointer to report errors through */ -typedef herr_t (*H5E_push_func_t)(int32 errid, hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line); +typedef herr_t (*H5E_push_func_t)(int32 errid, H5E_major_t maj, + H5E_minor_t min, const char *function_name, + const char *file_name, intn line); #ifdef __cplusplus extern "C" { #endif /* Functions in H5E.c */ -int32 H5Enew_err_stack(uintn initial_stack_size); -intn H5Edelete_err_stack(int32 err_hand); +int32 H5Enew_err_stack (uintn initial_stack_size); +intn H5Edelete_err_stack (int32 err_hand); #ifdef H5_ERROR_DEBUG -H5E_push_func_t H5Eset_push(H5E_push_func_t func); +H5E_push_func_t H5Eset_push (H5E_push_func_t func); #endif -herr_t H5Epush(hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_name, const char *file_name, intn line); +herr_t H5Epush (H5E_major_t maj, H5E_minor_t min, const char *function_name, + const char *file_name, intn line); herr_t H5Eclear(int32 err_hand); void H5E_term_interface(void); @@ -232,18 +232,18 @@ H5Fget_create_template (hid_t fid) /* check args */ if (H5_FILE!=H5Aatom_group (fid)) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*not a file*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "not a file"); } if (NULL==(file=H5Aatom_object (fid))) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*can't get file struct*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "can't get file struct"); } /* Create the template object to return */ tmpl = H5MM_xmalloc (sizeof(H5F_create_t)); *tmpl = file->shared->create_parms; if ((ret_value=H5C_create (H5C_FILE_CREATE, tmpl))<0) { - /* Can't register template */ - HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL); + HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, + "can't register template"); } FUNC_LEAVE (ret_value); @@ -313,7 +313,7 @@ H5F_locate_signature (H5F_low_t *f_handle, haddr_t *addr/*out*/) H5F_addr_reset (addr); while (H5F_addr_lt (addr, &max_addr)) { if (H5F_low_read (f_handle, addr, H5F_SIGNATURE_LEN, buf)<0) { - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "can't read file"); } if (!HDmemcmp (buf, H5F_SIGNATURE, H5F_SIGNATURE_LEN)) break; H5F_addr_pow2 (n++, addr); @@ -357,12 +357,12 @@ hbool_t H5Fis_hdf5(const char *filename) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(filename==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, BFAIL); /*no filename specified*/ + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, BFAIL, "no filename specified"); /* Open the file */ if (NULL==(f_handle=H5F_low_open (H5F_LOW_DFLT, filename, 0, NULL))) { - /* Low-level file open failure */ - HGOTO_ERROR(H5E_FILE, H5E_BADFILE, BFAIL); + HGOTO_ERROR(H5E_FILE, H5E_BADFILE, BFAIL, + "low-level file open failure"); } if (H5F_locate_signature (f_handle, &addr)>=0) { @@ -616,8 +616,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, #endif type = H5F_LOW_FAM; } else if (type==H5F_LOW_FAM) { - /* Invalid file family name */ - HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "invalid file family name"); } /* @@ -659,29 +659,29 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, */ if (file_exists) { if (flags & H5F_ACC_EXCL) { - /* File already exists - CREAT EXCL failed */ - HRETURN_ERROR (H5E_FILE, H5E_FILEEXISTS, NULL); + HRETURN_ERROR (H5E_FILE, H5E_FILEEXISTS, NULL, + "file already exists - CREAT EXCL failed"); } if (!H5F_low_access (type, name, R_OK, NULL)) { - /* File is not readable */ - HRETURN_ERROR (H5E_FILE, H5E_READERROR, NULL); + HRETURN_ERROR (H5E_FILE, H5E_READERROR, NULL, + "file is not readable"); } if ((flags & H5F_ACC_WRITE) && !H5F_low_access (type, name, W_OK, NULL)) { - /* File is not writable */ - HRETURN_ERROR (H5E_FILE, H5E_WRITEERROR, NULL); + HRETURN_ERROR (H5E_FILE, H5E_WRITEERROR, NULL, + "file is not writable"); } if ((old=H5Asearch_atom (H5_FILE, H5F_compare_files, &search))) { if (flags & H5F_ACC_TRUNC) { - /* File already open - TRUNC failed */ - HRETURN_ERROR (H5E_FILE, H5E_FILEOPEN, NULL); + HRETURN_ERROR (H5E_FILE, H5E_FILEOPEN, NULL, + "file already open - TRUNC failed"); } if ((flags & H5F_ACC_WRITE) && 0==(old->shared->flags & H5F_ACC_WRITE)) { if (NULL==(fd=H5F_low_open (type, name, H5F_ACC_WRITE, NULL))) { - /* File cannot be reopened with write access */ - HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "file cannot be reopened with write access"); } H5F_low_close (old->shared->lf); old->shared->lf = fd; @@ -693,13 +693,13 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, } else if (flags & H5F_ACC_TRUNC) { /* Truncate existing file */ if (0==(flags & H5F_ACC_WRITE)) { - /* Can't truncate without write intent */ - HRETURN_ERROR (H5E_FILE, H5E_BADVALUE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_BADVALUE, NULL, + "can't truncate without write intent"); } fd = H5F_low_open (type, name, H5F_ACC_WRITE|H5F_ACC_TRUNC, NULL); if (!fd) { - /* Can't truncate file */ - HRETURN_ERROR (H5E_FILE, H5E_CANTCREATE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_CANTCREATE, NULL, + "can't truncate file"); } f = H5F_new (NULL); f->shared->key = search; @@ -710,8 +710,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, } else { fd = H5F_low_open (type, name, (flags & H5F_ACC_WRITE), NULL); if (!fd) { - /* Cannot open existing file */ - HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "cannot open existing file"); } f = H5F_new (NULL); f->shared->key = search; @@ -721,15 +721,15 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, } else if (flags & H5F_ACC_CREAT) { if (0==(flags & H5F_ACC_WRITE)) { - /* Can't create file without write intent */ - HRETURN_ERROR (H5E_FILE, H5E_BADVALUE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_BADVALUE, NULL, + "can't create file without write intent"); } fd = H5F_low_open (type, name, H5F_ACC_WRITE|H5F_ACC_CREAT|H5F_ACC_EXCL, &search); if (!fd) { - /* Can't create file */ - HRETURN_ERROR (H5E_FILE, H5E_CANTCREATE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_CANTCREATE, NULL, + "can't create file"); } f = H5F_new (NULL); f->shared->key = search; @@ -738,8 +738,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, empty_file = TRUE; } else { - /* File does not exist */ - HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HRETURN_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "file does not exist"); } assert (f); @@ -778,17 +778,17 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, f->shared->consist_flags = 0x03; if (H5F_flush (f, FALSE)<0) { - /* Can't write file boot block */ - HGOTO_ERROR (H5E_FILE, H5E_CANTINIT, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTINIT, NULL, + "can't write file boot block"); } } else if (1==f->shared->nrefs) { /* For existing files we must read the boot block. */ if (H5F_locate_signature (f->shared->lf, &(f->shared->boot_addr))<0) { - HGOTO_ERROR (H5E_FILE, H5E_NOTHDF5, NULL);/*Can't find signature*/ + HGOTO_ERROR (H5E_FILE, H5E_NOTHDF5, NULL, "can't find signature"); } if (H5F_low_read (f->shared->lf, &(f->shared->boot_addr), fixed_size, buf)<0) { - HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL);/*Can't read boot block*/ + HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "can't read boot block"); } /* @@ -810,32 +810,32 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, cp->bootblock_ver = *p++; if (cp->bootblock_ver != HDF5_BOOTBLOCK_VERSION) { - /* Bad boot block version number */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad boot block version number"); } cp->smallobject_ver = *p++; if (cp->smallobject_ver != HDF5_SMALLOBJECT_VERSION) { - /* Bad small object heap version number */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad small object heap version number"); } cp->freespace_ver = *p++; if (cp->freespace_ver != HDF5_FREESPACE_VERSION) { - /* Bad free space version number */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad free space version number"); } cp->objectdir_ver = *p++; if (cp->objectdir_ver != HDF5_OBJECTDIR_VERSION) { - /* Bad object dir version number */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad object dir version number"); } cp->sharedheader_ver = *p++; if (cp->sharedheader_ver != HDF5_SHAREDHEADER_VERSION) { - /* Bad shared header version number */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad shared header version number"); } cp->sizeof_addr = *p++; @@ -844,8 +844,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, cp->sizeof_addr!=8 && cp->sizeof_addr!=16 && cp->sizeof_addr!=32) { - /* Bad address size */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad address size"); } cp->sizeof_size = *p++; @@ -854,8 +854,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, cp->sizeof_size!=8 && cp->sizeof_size!=16 && cp->sizeof_size!=32) { - /* Bad length size */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad length size"); } /* Reserved byte */ @@ -863,14 +863,14 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, UINT16DECODE (p, cp->sym_leaf_k); if (cp->sym_leaf_k<1) { - /* Bad symbol table leaf node 1/2 rank */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad symbol table leaf node 1/2 rank"); } UINT16DECODE (p, cp->btree_k[H5B_SNODE_ID]); if (cp->btree_k[H5B_SNODE_ID]<1) { - /* Bad symbol table internal node 1/2 rank */ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "bad symbol table internal node 1/2 rank"); } UINT32DECODE (p, f->shared->consist_flags); @@ -887,8 +887,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, addr1 = f->shared->boot_addr; H5F_addr_inc (&addr1, fixed_size); if (H5F_low_read (f->shared->lf, &addr1, variable_size, buf)<0) { - /*can't read boot block*/ - HGOTO_ERROR (H5E_FILE, H5E_NOTHDF5, NULL); + HGOTO_ERROR (H5E_FILE, H5E_NOTHDF5, NULL, + "can't read boot block"); } p = buf; @@ -896,8 +896,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, H5F_addr_decode (f, &p, &(f->shared->freespace_addr)); H5F_addr_decode (f, &p, &(f->shared->hdf5_eof)); if (H5G_ent_decode (f, &p, f->shared->root_sym)<0) { - /*can't read root symbol entry*/ - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL, + "can't read root symbol entry"); } } @@ -913,7 +913,7 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags, * Truncated file? This might happen if one tries to open the first * member of a file family. */ - HGOTO_ERROR (H5E_FILE, H5E_TRUNCATED, NULL); + HGOTO_ERROR (H5E_FILE, H5E_TRUNCATED, NULL, "truncated file"); } else if (H5F_addr_gt (&addr1, &addr2)) { /* * The file is larger than the hdf5 data. It either has extra junk at @@ -1013,16 +1013,16 @@ hid_t H5Fcreate(const char *filename, uintn flags, hid_t create_temp, /* Check/fix arguments */ if (!filename || !*filename) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*invalid file name*/ + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name"); if (flags & ~H5ACC_OVERWRITE) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*invalid flags*/ + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags"); flags = (H5F_ACC_WRITE | H5F_ACC_CREAT) | (H5ACC_OVERWRITE==flags ? H5F_ACC_TRUNC : H5F_ACC_EXCL); if (create_temp<=0) { create_parms = &H5F_create_dflt; } else if (NULL==(create_parms=H5Aatom_object (create_temp))) { - HGOTO_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*can't unatomize template*/ + HGOTO_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize template"); } #ifdef LATER @@ -1038,12 +1038,12 @@ hid_t H5Fcreate(const char *filename, uintn flags, hid_t create_temp, */ if (NULL==(new_file = H5F_open (H5F_LOW_DFLT, filename, flags, create_parms))) { - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, FAIL); /*can't create file */ + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't create file"); } /* Get an atom for the file */ if ((ret_value=H5Aregister_atom (H5_FILE, new_file))<0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL); /*can't atomize file*/ + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't atomize file"); done: if (ret_value<0 && new_file) { @@ -1108,7 +1108,7 @@ hid_t H5Fopen(const char *filename, uintn flags, hid_t access_temp) /* Check/fix arguments. */ if (!filename || !*filename) - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);/*invalid file name*/ + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "invalid file name"); flags = flags & H5ACC_WRITE ? H5F_ACC_WRITE : 0; #ifdef LATER @@ -1120,12 +1120,12 @@ hid_t H5Fopen(const char *filename, uintn flags, hid_t access_temp) /* Open the file */ if (NULL==(new_file=H5F_open (H5F_LOW_DFLT, filename, flags, NULL))) { - HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, FAIL); /*cant open file*/ + HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, FAIL, "cant open file"); } /* Get an atom for the file */ if ((ret_value = H5Aregister_atom (H5_FILE, new_file))<0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL);/*can't atomize file*/ + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't atomize file"); done: if (ret_value<0 && new_file) { @@ -1187,7 +1187,7 @@ H5F_flush (H5F_t *f, hbool_t invalidate) /* flush (and invalidate) the entire cache */ if (H5AC_flush (f, NULL, 0, invalidate)<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); /*can't flush cache*/ + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush cache"); } /* encode the file boot block */ @@ -1219,17 +1219,17 @@ H5F_flush (H5F_t *f, hbool_t invalidate) /* write the boot block to disk */ if (H5F_low_write (f->shared->lf, &(f->shared->boot_addr), p-buf, buf)<0) { - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); /*can't write header*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "can't write header"); } /* Flush file buffers to disk */ if (H5F_low_flush (f->shared->lf)<0) { - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); /*low level flush failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed"); } /* Did shadow flush fail above? */ if (shadow_flush<0) { - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, -2);/*object are still open*/ + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, -2, "object are still open"); } FUNC_LEAVE (SUCCEED); @@ -1263,8 +1263,8 @@ H5F_close (H5F_t *f) if (-2==(ret_value=H5F_flush (f, TRUE))) { /*objects are still open, but don't fail yet*/ } else if (ret_value<0) { - /*can't flush cache*/ - HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL, + "can't flush cache"); } if (f->intent & H5F_ACC_DEBUG) H5AC_debug (f); @@ -1273,7 +1273,7 @@ H5F_close (H5F_t *f) /* Did the H5F_flush() fail because of open objects? */ if (ret_value<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTFLUSH, ret_value); + HRETURN_ERROR (H5E_SYM, H5E_CANTFLUSH, ret_value, "objects are open"); } FUNC_LEAVE (ret_value); @@ -1322,16 +1322,16 @@ herr_t H5Fclose(hid_t fid) /* Check/fix arguments. */ if (H5_FILE!=H5Aatom_group (fid)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL);/*not a file atom*/ + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file atom"); if (NULL==(file=H5Aatom_object (fid))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);/*can't unatomize file*/ + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize file"); /* Close the file */ ret_value = H5F_close (file); /* Remove the file atom */ if (NULL==H5Aremove_atom(fid)) { - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);/*can't remove atom*/ + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't remove atom"); } done: @@ -1376,7 +1376,7 @@ H5F_block_read (H5F_t *f, const haddr_t *addr, size_t size, void *buf) /* Read the data */ if (H5F_low_read (f->shared->lf, &abs_addr, size, buf)<0) { - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); /*low-level read failed*/ + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "low-level read failed"); } FUNC_LEAVE (SUCCEED); @@ -1416,8 +1416,7 @@ H5F_block_write (H5F_t *f, const haddr_t *addr, size_t size, const void *buf) if (0==size) return 0; if (0==(f->intent & H5F_ACC_WRITE)) { - /* no write intent */ - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "no write intent"); } /* Convert the relative address to an absolute address */ @@ -1426,7 +1425,7 @@ H5F_block_write (H5F_t *f, const haddr_t *addr, size_t size, const void *buf) /* Write the data */ if (H5F_low_write (f->shared->lf, &abs_addr, size, buf)) { - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL);/*low-level write failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "low-level write failed"); } FUNC_LEAVE (SUCCEED); diff --git a/src/H5Fcore.c b/src/H5Fcore.c index a024e20..0a8797f 100644 --- a/src/H5Fcore.c +++ b/src/H5Fcore.c @@ -102,8 +102,8 @@ H5F_core_open (const char *name, uintn flags, H5F_search_t *key) FUNC_ENTER (H5F_core_open, NULL); if (0==(flags & H5F_ACC_WRITE) || 0==(flags & H5F_ACC_CREAT)) { - /* must creat file with write access */ - HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL); + HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL, + "must creat file with write access"); } lf = H5MM_xcalloc (1, sizeof(H5F_low_t)); diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c index bf0431f..3c4c35b 100644 --- a/src/H5Ffamily.c +++ b/src/H5Ffamily.c @@ -110,7 +110,7 @@ H5F_fam_open (const char *name, uintn flags, H5F_search_t *key/*out*/) if (!H5F_low_access (H5F_LOW_DFLT, member_name, F_OK, NULL)) { break; } else if (unlink (member_name)<0) { - HGOTO_ERROR (H5E_IO, H5E_CANTINIT, NULL);/*can't delete member*/ + HGOTO_ERROR (H5E_IO, H5E_CANTINIT, NULL, "can't delete member"); } } } @@ -133,8 +133,8 @@ H5F_fam_open (const char *name, uintn flags, H5F_search_t *key/*out*/) 0==membno?key:NULL); if (!member) { if (0==membno) { - /* Can't open first family member */ - HGOTO_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL); + HGOTO_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL, + "can't open first family member"); } break; } @@ -294,8 +294,8 @@ H5F_fam_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf) cur_addr.offset = offset; if (H5F_low_read (lf->u.fam.memb[membno], &cur_addr, nbytes, buf)<0) { - /* Can't read from family member */ - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, + "can't read from family member"); } buf += nbytes; size -= nbytes; @@ -366,8 +366,8 @@ H5F_fam_write (H5F_low_t *lf, const haddr_t *addr, size_t size, lf->u.fam.flags|H5F_ACC_CREAT, NULL); if (!member) { - /* Can't create a new member */ - HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, FAIL); + HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, FAIL, + "can't create a new member"); } /* @@ -401,8 +401,8 @@ H5F_fam_write (H5F_low_t *lf, const haddr_t *addr, size_t size, /* Write the data to the member */ if (H5F_low_write (lf->u.fam.memb[membno], &cur_addr, nbytes, buf)<0) { - /* Can't write to family member */ - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "can't write to family member"); } buf += nbytes; size -= nbytes; @@ -458,12 +458,12 @@ H5F_fam_flush (H5F_low_t *lf) H5F_addr_inc (&addr3, (size_t)1); H5F_low_seteof (lf->u.fam.memb[0], &addr3); /*prevent a warning*/ if (H5F_low_read (lf->u.fam.memb[0], &addr1, 1, buf)<0) { - /* Can't read from first family member */ - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, + "can't read from first family member"); } if (H5F_low_write (lf->u.fam.memb[0], &addr1, 1, buf)<0) { - /* Can't write to first family member */ - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "can't write to first family member"); } H5F_low_seteof (lf->u.fam.memb[0], &addr2); /*reset old eof*/ @@ -477,8 +477,8 @@ H5F_fam_flush (H5F_low_t *lf) } } if (nerrors) { - /* Can't flush family member */ - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "can't flush family member"); } FUNC_LEAVE (SUCCEED); @@ -539,8 +539,8 @@ H5F_fam_access (const char *name, int mode, H5F_search_t *key/*out*/) } if (status<0) { - /* Access method failed for a member file */ - HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, FAIL); + HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, FAIL, + "access method failed for a member file"); } } diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 8684465..15c7d4d 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -370,8 +370,8 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op, nbytes = H5V_vector_reduce_product (udata->mesg.ndims, udata->key.size); assert (nbytes>0); if (H5MF_alloc (f, H5MF_RAW, nbytes, addr/*out*/)<0) { - /* Couldn't allocate new file storage */ - HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, + "couldn't allocate new file storage"); } udata->addr = *addr; udata->key.file_number = 0; @@ -518,7 +518,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, if (cmp<0) { /* Negative indices not supported yet */ assert ("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR (H5E_STORAGE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_STORAGE, H5E_UNSUPPORTED, FAIL, "internal error"); } else if (H5V_hyper_eq (udata->mesg.ndims, udata->key.offset, udata->key.size, @@ -554,7 +554,8 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, * Allocate storage for the new chunk */ if (H5MF_alloc (f, H5MF_RAW, nbytes, new_node/*out*/)<0) { - HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, + "file allocation failed"); } udata->addr = *new_node; udata->key.file_number = 0; @@ -562,7 +563,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr, } else { assert ("HDF5 INTERNAL ERROR -- see rpm" && 0); - HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "internal error"); } FUNC_LEAVE (ret_value); @@ -704,7 +705,8 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, if (status>=0 && H5F_addr_defined (&(udata.addr))) { assert (0==udata.key.file_number); if (H5F_block_read (f, &(udata.addr), chunk_size, chunk)<0) { - HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL); + HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, + "unable to read raw storage chunk"); } } else { HDmemset (chunk, 0, chunk_size); @@ -718,7 +720,8 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op, size_m, sub_offset_m, buf); assert (0==udata.key.file_number); if (H5F_block_write (f, &(udata.addr), chunk_size, chunk)<0) { - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "unable to write raw storage chunk"); } } else { H5V_hyper_copy (istore->ndims, sub_size, @@ -774,8 +777,8 @@ H5F_istore_read (H5F_t *f, const H5O_istore_t *istore, if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_READ, offset, size, H5V_ZERO, size, buf)<0) { - /* hyperslab output failure */ - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, + "hyperslab output failure"); } FUNC_LEAVE (SUCCEED); @@ -815,8 +818,8 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore, if (H5F_istore_copy_hyperslab (f, istore, H5F_ISTORE_WRITE, offset, size, H5V_ZERO, size, buf)<0) { - /* hyperslab output failure */ - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "hyperslab output failure"); } FUNC_LEAVE (SUCCEED); @@ -868,7 +871,7 @@ H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore/*out*/, udata.mesg.ndims = istore->ndims = ndims; if (H5B_create (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) { - HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); /* Can't create B-tree */ + HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree"); } for (i=0; i<ndims; i++) { diff --git a/src/H5Flow.c b/src/H5Flow.c index 0dfd11c..9cfb51f 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -79,7 +79,7 @@ H5F_low_open (const H5F_low_class_t *type, const char *name, uintn flags, assert (name && *name); if (NULL==(lf=(type->open)(name, flags, key))) { - HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL);/*open failed*/ + HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL, "open failed"); } lf->type = type; @@ -123,7 +123,7 @@ H5F_low_close (H5F_low_t *lf) if (lf) { if ((lf->type->close)(lf)<0) { H5MM_xfree (lf); - HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, NULL); /*close failed*/ + HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, NULL, "close failed"); } H5MM_xfree (lf); } @@ -172,10 +172,10 @@ H5F_low_read (H5F_low_t *lf, const haddr_t *addr, size_t size, if (lf->type->read) { if ((ret_value = (lf->type->read)(lf, addr, size, buf))<0) { - HRETURN_ERROR (H5E_IO, H5E_READERROR, ret_value);/*read failed*/ + HRETURN_ERROR (H5E_IO, H5E_READERROR, ret_value, "read failed"); } } else { - HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL);/*no read method*/ + HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "no read method"); } FUNC_LEAVE (ret_value); @@ -231,10 +231,10 @@ H5F_low_write (H5F_low_t *lf, const haddr_t *addr, size_t size, /* Write the data */ if (lf->type->write) { if ((ret_value = (lf->type->write)(lf, addr, size, buf))<0) { - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, ret_value);/*write failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, ret_value, "write failed"); } } else { - HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL);/*no write method*/ + HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "no write method"); } FUNC_LEAVE (ret_value); @@ -288,8 +288,8 @@ H5F_low_flush (H5F_low_t *lf) /* Invoke the subclass the flush method */ if (lf->type->flush) { if ((lf->type->flush)(lf)<0) { - /* Low level flush failed */ - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, + "low level flush failed"); } } @@ -438,8 +438,8 @@ H5F_low_extend (H5F_low_t *lf, intn op, size_t size, haddr_t *addr/*out*/) if (lf->type->extend) { if ((lf->type->extend)(lf, op, size, addr/*out*/)<0) { - /* Unable to extend file */ - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to extend file"); } } else { *addr = lf->eof; diff --git a/src/H5Fsec2.c b/src/H5Fsec2.c index 4d82d11..03cd240 100644 --- a/src/H5Fsec2.c +++ b/src/H5Fsec2.c @@ -82,7 +82,7 @@ H5F_sec2_open (const char *name, uintn flags, H5F_search_t *key/*out*/) oflags |= (flags & H5F_ACC_TRUNC) ? O_TRUNC : 0; if ((fd=open (name, oflags, 0666))<0) { - HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL);/*open failed*/ + HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL, "open failed"); } lf = H5MM_xcalloc (1, sizeof(H5F_low_t)); @@ -126,7 +126,7 @@ H5F_sec2_close (H5F_low_t *lf) FUNC_ENTER (H5F_sec2_close, FAIL); if (close (lf->u.sec2.fd)<0) { - HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, FAIL); /*close failed*/ + HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, FAIL, "close failed"); } lf->u.sec2.fd = -1; @@ -185,7 +185,7 @@ H5F_sec2_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf) lf->u.sec2.op==H5F_OP_UNKNOWN || lf->u.sec2.cur!=offset) { if (lseek (lf->u.sec2.fd, offset, SEEK_SET)<0) { - HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL); /*lseek failed*/ + HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL, "lseek failed"); } lf->u.sec2.cur = offset; } @@ -205,7 +205,7 @@ H5F_sec2_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf) */ if ((n=read (lf->u.sec2.fd, buf, size))<0) { lf->u.sec2.op = H5F_OP_UNKNOWN; - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); /*read failed*/ + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "read failed"); } else if (n<size) { HDmemset (buf+n, 0, size-n); } @@ -264,7 +264,7 @@ H5F_sec2_write (H5F_low_t *lf, const haddr_t *addr, size_t size, lf->u.sec2.op==H5F_OP_UNKNOWN || lf->u.sec2.cur!=offset) { if (lseek (lf->u.sec2.fd, offset, SEEK_SET)<0) { - HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL); /*lseek failed*/ + HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL, "lseek failed"); } lf->u.sec2.cur = offset; } @@ -275,7 +275,7 @@ H5F_sec2_write (H5F_low_t *lf, const haddr_t *addr, size_t size, */ if (size != write (lf->u.sec2.fd, buf, size)) { lf->u.sec2.op = H5F_OP_UNKNOWN; - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); /*write failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "write failed"); } /* diff --git a/src/H5Fstdio.c b/src/H5Fstdio.c index 46c63b5..b610a7a 100644 --- a/src/H5Fstdio.c +++ b/src/H5Fstdio.c @@ -80,13 +80,13 @@ H5F_stdio_open (const char *name, uintn flags, H5F_search_t *key/*out*/) if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_WRITE)) { f = fopen (name, "wb+"); } else { - /* File doesn't exist and CREAT wasn't specified */ - HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL); + HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL, + "file doesn't exist and CREAT wasn't specified"); } } else if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_EXCL)) { - /* File exists but CREAT and EXCL were specified */ - HRETURN_ERROR (H5E_IO, H5E_FILEEXISTS, NULL); + HRETURN_ERROR (H5E_IO, H5E_FILEEXISTS, NULL, + "file exists but CREAT and EXCL were specified"); } else if (flags & H5F_ACC_WRITE) { if (flags & H5F_ACC_TRUNC) f = fopen (name, "wb+"); @@ -95,7 +95,7 @@ H5F_stdio_open (const char *name, uintn flags, H5F_search_t *key/*out*/) } else { f = fopen (name, "rb"); } - if (!f) HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL); /*fopen failed*/ + if (!f) HRETURN_ERROR (H5E_IO, H5E_CANTOPENFILE, NULL, "fopen failed"); /* Build the return value */ lf = H5MM_xcalloc (1, sizeof(H5F_low_t)); @@ -126,7 +126,7 @@ H5F_stdio_open (const char *name, uintn flags, H5F_search_t *key/*out*/) * Purpose: Closes a file. * * Errors: - * IO CLOSEERROR Close failed. + * IO CLOSEERROR Fclose failed. * * Return: Success: SUCCEED * @@ -145,7 +145,7 @@ H5F_stdio_close (H5F_low_t *lf) FUNC_ENTER (H5F_stdio_close, FAIL); if (fclose (lf->u.stdio.f)<0) { - HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, FAIL); /*close failed*/ + HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, FAIL, "fclose failed"); } lf->u.stdio.f = NULL; @@ -202,7 +202,7 @@ H5F_stdio_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf) lf->u.stdio.op!=H5F_OP_READ || lf->u.stdio.cur!=offset) { if (fseek (lf->u.stdio.f, offset, SEEK_SET)<0) { - HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL); /*fseek failed*/ + HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL, "fseek failed"); } lf->u.stdio.cur = offset; } @@ -224,7 +224,7 @@ H5F_stdio_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf) n = fread (buf, 1, size, lf->u.stdio.f); if (n<=0 && ferror (lf->u.stdio.f)) { lf->u.stdio.op = H5F_OP_UNKNOWN; - HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL); /*fread failed*/ + HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, "fread failed"); } else if (n<size) { HDmemset (buf+n, 0, size-n); } @@ -279,7 +279,7 @@ H5F_stdio_write (H5F_low_t *lf, const haddr_t *addr, size_t size, lf->u.stdio.op!=H5F_OP_WRITE || lf->u.stdio.cur!=offset) { if (fseek (lf->u.stdio.f, offset, SEEK_SET)<0) { - HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL); /*fseek failed*/ + HRETURN_ERROR (H5E_IO, H5E_SEEKERROR, FAIL, "fseek failed"); } lf->u.stdio.cur = offset; } @@ -291,7 +291,7 @@ H5F_stdio_write (H5F_low_t *lf, const haddr_t *addr, size_t size, */ if (size != fwrite (buf, 1, size, lf->u.stdio.f)) { lf->u.stdio.op = H5F_OP_UNKNOWN; - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); /*fwrite failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "fwrite failed"); } /* @@ -337,7 +337,7 @@ H5F_stdio_flush (H5F_low_t *lf) * Flush */ if (fflush (lf->u.stdio.f)<0) { - HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL); /*fflush failed*/ + HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "fflush failed"); } FUNC_LEAVE (SUCCEED); @@ -96,24 +96,24 @@ H5Gnew (hid_t file, const char *name, size_t size_hint) /* Check/fix arguments */ if (!name || !*name) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);/*no name given*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); } if (H5_FILE!=H5Aatom_group (file)) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL);/*not a file atom*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file atom"); } if (NULL==(f=H5Aatom_object (file))) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL);/*can't unatomize file*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize file"); } /* Create the group */ if (NULL==(grp_handle=H5G_new (f, name, size_hint))) { - /*can't create group*/ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "can't create group"); } /* Close the group handle */ if (H5G_close (f, grp_handle)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL);/*can't close handle*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "can't close handle"); } FUNC_LEAVE (SUCCEED); @@ -162,18 +162,18 @@ H5Gset (hid_t file, const char *name) /* Check/fix arguments */ if (!name || !*name) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);/*no name given*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); } if (H5_FILE!=H5Aatom_group (file)) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL);/*not a file atom*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file atom"); } if (NULL==(f=H5Aatom_object (file))) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL);/*can't unatomize file*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize file"); } if (H5G_set (f, name)<0) { - /* Can't change current working group */ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "can't change current working group"); } FUNC_LEAVE (SUCCEED); @@ -221,18 +221,18 @@ H5Gpush (hid_t file, const char *name) /* Check/fix arguments */ if (!name || !*name) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);/*no name given*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); } if (H5_FILE!=H5Aatom_group (file)) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL);/*not a file atom*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file atom"); } if (NULL==(f=H5Aatom_object (file))) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL);/*can't unatomize file*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize file"); } if (H5G_push (f, name)<0) { - /* Can't change current working group */ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "can't change current working group"); } FUNC_LEAVE (SUCCEED); @@ -281,15 +281,15 @@ H5Gpop (hid_t file) /* Check/fix arguments */ if (H5_FILE!=H5Aatom_group (file)) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL);/*not a file atom*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file atom"); } if (NULL==(f=H5Aatom_object (file))) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL);/*can't unatomize file*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize file"); } if (H5G_pop (f)<0) { - /* Stack is empty */ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "stack is empty"); } FUNC_LEAVE (SUCCEED); @@ -436,8 +436,8 @@ H5G_namei (H5F_t *f, H5G_entry_t *cwg, const char *name, /* starting point */ if ('/'==*name) { if (!H5F_addr_defined (&(f->shared->root_sym->header))) { - /* No root group */ - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, + "no root group"); } ret_value = f->shared->root_sym; grp = *(f->shared->root_sym); @@ -466,9 +466,8 @@ H5G_namei (H5F_t *f, H5G_entry_t *cwg, const char *name, * we can pass it down to the other symbol table functions. */ if (nchars+1 > sizeof(comp)) { - /* component is too long */ if (grp_ent) *grp_ent = grp; - HRETURN_ERROR (H5E_SYM, H5E_COMPLEN, NULL); + HRETURN_ERROR (H5E_SYM, H5E_COMPLEN, NULL, "component is too long"); } HDmemcpy (comp, name, nchars); comp[nchars] = '\0'; @@ -492,10 +491,9 @@ H5G_namei (H5F_t *f, H5G_entry_t *cwg, const char *name, ret_value = f->shared->root_sym; aside = TRUE; } else { - /* component not found */ H5O_reset (H5O_NAME, &mesg); if (grp_ent) *grp_ent = grp; - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, "component not found"); } } @@ -516,7 +514,7 @@ H5G_namei (H5F_t *f, H5G_entry_t *cwg, const char *name, /* Perhaps the root object doesn't even exist! */ if (!H5F_addr_defined (&(ret_value->header))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); /*root not found*/ + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, "root not found"); } FUNC_LEAVE (ret_value); @@ -587,12 +585,12 @@ H5G_mkroot (H5F_t *f, size_t size_hint) */ if (H5F_addr_defined (&(f->shared->root_sym->header))) { if (H5O_read (f, NO_ADDR, f->shared->root_sym, H5O_STAB, 0, &stab)) { - /* root group already exists */ - HGOTO_ERROR (H5E_SYM, H5E_EXISTS, -2); + HGOTO_ERROR (H5E_SYM, H5E_EXISTS, -2, + "root group already exists"); } else if (NULL==(handle=H5G_shadow_open (f, NULL, f->shared->root_sym))) { - /* can't open root object */ - HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "can't open root object"); } else if (NULL==H5O_read (f, NO_ADDR, handle, H5O_NAME, 0, &name)) { obj_name = "Root Object"; } else { @@ -607,10 +605,11 @@ H5G_mkroot (H5F_t *f, size_t size_hint) * info back into f->root_sym because we set the dirty bit. */ if (H5G_stab_create (f, f->shared->root_sym, size_hint)<0) { - HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*cant create root*/ + HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "cant create root"); } if (1!=H5O_link (f, f->shared->root_sym, 1)) { - HGOTO_ERROR (H5E_SYM, H5E_LINK, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_LINK, FAIL, + "internal error (wrong link count)"); } /* @@ -620,13 +619,13 @@ H5G_mkroot (H5F_t *f, size_t size_hint) */ if (obj_name) { if (1!=H5O_link (f, handle, 0)) { - /* Bad link count on old root object */ - HGOTO_ERROR (H5E_SYM, H5E_LINK, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_LINK, FAIL, + "bad link count on old root object"); } if (NULL==(ent_ptr=H5G_stab_insert (f, f->shared->root_sym, obj_name, handle))) { - /* Can't reinsert old root object */ - HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "can't reinsert old root object"); } /* @@ -719,14 +718,14 @@ H5G_new (H5F_t *f, const char *name, size_t size_hint) * fails because the root group already exists. */ if ((status=H5G_mkroot (f, H5G_SIZE_HINT))<0 && -2!=status) { - /* Can't create root group */ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, + "can't create root group"); } H5ECLEAR; /* lookup name */ if (H5G_namei (f, cwg, name, &rest, &grp_ent)) { - HRETURN_ERROR (H5E_SYM, H5E_EXISTS, NULL); /*already exists*/ + HRETURN_ERROR (H5E_SYM, H5E_EXISTS, NULL, "already exists"); } H5ECLEAR; /*it's OK that we didn't find it*/ @@ -735,11 +734,11 @@ H5G_new (H5F_t *f, const char *name, size_t size_hint) assert (rest && *rest); if (rest[nchars]) { if (H5G_component (rest+nchars, NULL)) { - /* missing component */ - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, + "missing component"); } else if (nchars+1 > sizeof _comp) { - /* component is too long */ - HRETURN_ERROR (H5E_SYM, H5E_COMPLEN, NULL); + HRETURN_ERROR (H5E_SYM, H5E_COMPLEN, NULL, + "component is too long"); } else { /* null terminate */ HDmemcpy (_comp, rest, nchars); @@ -750,17 +749,17 @@ H5G_new (H5F_t *f, const char *name, size_t size_hint) /* create group */ if (H5G_stab_create (f, &ent, size_hint)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); /*can't create grp*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, "can't create grp"); } /* insert child name into parent */ if (NULL==(ent_ptr=H5G_stab_insert (f, &grp_ent, rest, &ent))) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); /*can't insert*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, "can't insert"); } /* open the group */ if (NULL==(ret_value=H5G_shadow_open (f, &grp_ent, ent_ptr))) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); /*can't open*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, "can't open"); } FUNC_LEAVE (ret_value); @@ -803,12 +802,10 @@ H5G_set (H5F_t *f, const char *name) FUNC_ENTER (H5G_set, FAIL); if (NULL==(handle=H5G_open (f, name))) { - /* Can't open group */ - HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL, "can't open group"); } if (NULL==H5O_read (f, NO_ADDR, handle, H5O_NAME, 0, &stab_mesg)) { - /* Not a group */ - HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL, "not a group"); } /* @@ -820,8 +817,8 @@ H5G_set (H5F_t *f, const char *name) f->cwg_stack->handle = handle; } else { if (H5G_close (f, f->cwg_stack->handle)<0) { - /* Couldn't close previous c.w.g. */ - HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL, + "couldn't close previous c.w.g."); } f->cwg_stack->handle = handle; } @@ -907,12 +904,10 @@ H5G_push (H5F_t *f, const char *name) FUNC_ENTER (H5G_push, FAIL); if (NULL==(handle=H5G_open (f, name))) { - /* Can't open group */ - HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL, "can't open group"); } if (NULL==H5O_read (f, NO_ADDR, handle, H5O_NAME, 0, &stab_mesg)) { - /* Not a group */ - HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CWG, FAIL, "not a group"); } /* @@ -962,15 +957,14 @@ H5G_pop (H5F_t *f) if ((stack=f->cwg_stack)) { if (H5G_close (f, stack->handle)<0) { - /* Can't close current working group */ - HRETURN_ERROR (H5E_SYM, H5E_CWG, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CWG, FAIL, + "can't close current working group"); } f->cwg_stack = stack->next; stack->handle = NULL; H5MM_xfree (stack); } else { - /* Stack is empty */ - HRETURN_ERROR (H5E_SYM, H5E_CWG, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CWG, FAIL, "stack is empty"); } FUNC_LEAVE (SUCCEED); @@ -1040,7 +1034,7 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint) * Look up the name -- it shouldn't exist yet. */ if (H5G_namei (f, cwg, name, &rest, &grp)) { - HRETURN_ERROR (H5E_SYM, H5E_EXISTS, NULL); /*already exists*/ + HRETURN_ERROR (H5E_SYM, H5E_EXISTS, NULL, "already exists"); } H5ECLEAR; /*it's OK that we didn't find it*/ rest = H5G_component (rest, &nchars); @@ -1052,18 +1046,19 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint) * it already has as a message. */ if (H5F_addr_defined (&(f->shared->root_sym->header))) { - HRETURN_ERROR (H5E_SYM, H5E_EXISTS, NULL); /*root exists*/ + HRETURN_ERROR (H5E_SYM, H5E_EXISTS, NULL, "root exists"); } if (H5O_create (f, 0, ohdr_hint, &(ent.header)/*out*/)<0) { - /* can't create header */ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, + "can't create header"); } if (1!=H5O_link (f, &ent, 1)) { - HRETURN_ERROR (H5E_SYM, H5E_LINK, NULL); /*bad link count*/ + HRETURN_ERROR (H5E_SYM, H5E_LINK, NULL, "bad link count"); } *(f->shared->root_sym) = ent; if (NULL==(ret_value=H5G_shadow_open (f, NULL, f->shared->root_sym))) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, + "can't open root object"); } HRETURN (ret_value); } @@ -1074,11 +1069,11 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint) */ if (rest[nchars]) { if (H5G_component (rest+nchars, NULL)) { - /* component not found */ - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, + "component not found"); } else if (nchars+1 > sizeof _comp) { - /* component is too long */ - HRETURN_ERROR (H5E_SYM, H5E_COMPLEN, NULL); + HRETURN_ERROR (H5E_SYM, H5E_COMPLEN, NULL, + "component is too long"); } else { /* null terminate */ HDmemcpy (_comp, rest, nchars); @@ -1091,7 +1086,8 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint) * Create the object header. */ if (H5O_create (f, 0, ohdr_hint, &(ent.header)/*out*/)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, + "can't create object header"); } @@ -1105,15 +1101,16 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint) H5O_name_t name_mesg; name_mesg.s = rest; if (H5O_modify (f, NO_ADDR, &ent, H5O_NAME, 0, &name_mesg)<0) { - /* cannot add/change name message */ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, + "cannot add/change name message"); } if (1!=H5O_link (f, &ent, 1)) { - HRETURN_ERROR (H5E_SYM, H5E_LINK, NULL); /*bad link count*/ + HRETURN_ERROR (H5E_SYM, H5E_LINK, NULL, "bad link count"); } *(f->shared->root_sym) = ent; if (NULL==(ret_value=H5G_shadow_open (f, &grp, f->shared->root_sym))) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, + "can't open root object"); } HRETURN (ret_value); } else { @@ -1125,8 +1122,8 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint) &(f->shared->root_sym->header)); herr_t status = H5G_mkroot (f, H5G_SIZE_HINT); if (status<0 && -2!=status) { - /* Can't create root group */ - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, + "can't create root group"); } H5ECLEAR; if (update_grp) grp = *(f->shared->root_sym); @@ -1137,13 +1134,13 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint) * entry into a symbol table. */ if (H5O_link (f, &ent, 1)<0) { - HRETURN_ERROR (H5E_SYM, H5E_LINK, NULL); /*link inc failure*/ + HRETURN_ERROR (H5E_SYM, H5E_LINK, NULL, "link inc failure"); } if (NULL==(ent_ptr=H5G_stab_insert (f, &grp, rest, &ent))) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); /*can't insert*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, "can't insert"); } if (NULL==(ret_value=H5G_shadow_open (f, &grp, ent_ptr))) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); /*can't open object*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL, "can't open object"); } FUNC_LEAVE (ret_value); } @@ -1192,7 +1189,7 @@ H5G_open (H5F_t *f, const char *name) /* check args */ assert (f); if (!name || !*name) { - HRETURN_ERROR (H5E_SYM, H5E_BADVALUE, NULL); + HRETURN_ERROR (H5E_SYM, H5E_BADVALUE, NULL, "no name"); } /* Get CWG */ @@ -1200,13 +1197,13 @@ H5G_open (H5F_t *f, const char *name) assert (cwg || '/'==*name); if (!H5F_addr_defined (&(f->shared->root_sym->header))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); /*object not found*/ + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, "object not found"); } if (NULL==(ent=H5G_namei (f, cwg, name, NULL, &grp))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); /*object not found*/ + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, "object not found"); } if (NULL==(ret_value=H5G_shadow_open (f, &grp, ent))) { - HRETURN_ERROR (H5E_SYM, H5E_CANTOPENOBJ, NULL); /*can't open obj*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTOPENOBJ, NULL, "can't open obj"); } FUNC_LEAVE (ret_value); @@ -1241,8 +1238,8 @@ H5G_close (H5F_t *f, H5G_entry_t *ent) assert (f); if (ent && H5G_shadow_close (f, ent)<0) { - /* Can't close object */ - HRETURN_ERROR (H5E_SYM, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTFLUSH, FAIL, + "can't close object"); } FUNC_LEAVE (SUCCEED); @@ -1303,11 +1300,11 @@ H5G_find (H5F_t *f, const char *name, assert (cwg || '/'==*name); if (!H5F_addr_defined (&(f->shared->root_sym->header))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); /*object not found*/ + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); } if (NULL==(ent_p=H5G_namei (f, cwg, name, NULL, grp_ent))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); /*object not found*/ + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); } if (ent) *ent = *ent_p; diff --git a/src/H5Gent.c b/src/H5Gent.c index 29860e0..b8510f7 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -130,7 +130,7 @@ H5G_ent_cache (H5G_entry_t *ent, H5G_type_t *cache_type) { FUNC_ENTER (H5G_ent_cache, NULL); if (!ent) { - HRETURN_ERROR (H5E_SYM, H5E_BADVALUE, NULL); + HRETURN_ERROR (H5E_SYM, H5E_BADVALUE, NULL, "no entry"); } if (cache_type) *cache_type = ent->type; @@ -208,7 +208,7 @@ H5G_ent_decode_vec (H5F_t *f, const uint8 **pp, H5G_entry_t *ent, intn n) /* decode entries */ for (i=0; i<n; i++) { if (H5G_ent_decode (f, pp, ent+i)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTDECODE, FAIL); /*can't decode*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode"); } } @@ -320,7 +320,7 @@ H5G_ent_encode_vec (H5F_t *f, uint8 **pp, H5G_entry_t *ent, intn n) /* encode entries */ for (i=0; i<n; i++) { if (H5G_ent_encode (f, pp, ent+i)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTENCODE, FAIL); /*can't encode*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode"); } } diff --git a/src/H5Gnode.c b/src/H5Gnode.c index f912c55..c4349a5 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -256,7 +256,8 @@ H5G_node_create (H5F_t *f, H5B_ins_t op, size = H5G_node_size (f); if (H5MF_alloc (f, H5MF_META, size, addr/*out*/)<0) { H5MM_xfree (sym); - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "unable to allocate file space"); } sym->dirty = TRUE; @@ -264,7 +265,8 @@ H5G_node_create (H5F_t *f, H5B_ins_t op, if (H5AC_set (f, H5AC_SNODE, addr, sym)<0) { H5MM_xfree (sym->entry); H5MM_xfree (sym); - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, + "unable to cache symbol table leaf node"); } /* @@ -324,7 +326,9 @@ H5G_node_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, */ for (i=0; i<sym->nsyms; i++) { if (H5G_shadow_sync (sym->entry+i)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTFLUSH, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_CANTFLUSH, FAIL, + "unable to synchronize symbol table node with open " + "objects"); } if (sym->entry[i].dirty) sym->dirty = TRUE; } @@ -355,7 +359,9 @@ H5G_node_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, status = H5F_block_write (f, addr, size, buf); buf = H5MM_xfree (buf); - if (status<0) HRETURN_ERROR (H5E_SYM, H5E_WRITEERROR, FAIL); + if (status<0) HRETURN_ERROR (H5E_SYM, H5E_WRITEERROR, FAIL, + "unable to write symbol table node to " + "the file"); } /* @@ -423,18 +429,21 @@ H5G_node_load (H5F_t *f, const haddr_t *addr, const void *_udata1, sym->entry = H5MM_xcalloc (2*H5G_NODE_K(f), sizeof(H5G_entry_t)); if (H5F_block_read (f, addr, size, buf)<0) { - HGOTO_ERROR (H5E_SYM, H5E_READERROR, NULL); + HGOTO_ERROR (H5E_SYM, H5E_READERROR, NULL, + "unabel to read symbol table node"); } /* magic */ if (HDmemcmp (p, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC)) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL, + "bad symbol table node signature"); } p += 4; /* version */ if (H5G_NODE_VERS!=*p++) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL, + "bad symbol table node version"); } /* reserved */ @@ -445,7 +454,8 @@ H5G_node_load (H5F_t *f, const haddr_t *addr, const void *_udata1, /* entries */ if (H5G_ent_decode_vec (f, &p, sym->entry, sym->nsyms)<0) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL, + "unable to decode symbol table entries"); } buf = H5MM_xfree (buf); @@ -456,7 +466,9 @@ H5G_node_load (H5F_t *f, const haddr_t *addr, const void *_udata1, */ if (H5F_addr_defined (&(ac_udata->grp_addr)) && H5G_shadow_assoc_node (f, sym, ac_udata)<0) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL, + "unable to associate symbol table node with open " + "objects"); } ret_value = sym; @@ -513,10 +525,12 @@ H5G_node_cmp2 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) assert (rt_key); if (NULL==(s1=H5H_peek (f, &(udata->heap_addr), lt_key->offset))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to read symbol name"); } if (NULL==(s2=H5H_peek (f, &(udata->heap_addr), rt_key->offset))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to read symbol name"); } cmp = HDstrcmp (s1, s2); @@ -564,13 +578,15 @@ H5G_node_cmp3 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key) /* left side */ if (NULL==(s=H5H_peek (f, &(udata->heap_addr), lt_key->offset))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to read symbol name"); } if (HDstrcmp (udata->name, s)<=0) HRETURN (-1); /* right side */ if (NULL==(s=H5H_peek (f, &(udata->heap_addr), rt_key->offset))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to read symbol name"); } if (HDstrcmp (udata->name, s)>0) HRETURN(1); @@ -633,7 +649,8 @@ H5G_node_found (H5F_t *f, const haddr_t *addr, const void *_lt_key, * Load the symbol table node for exclusive access. */ if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata, NULL))) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL, + "unable to protect symbol table node"); } /* @@ -644,7 +661,8 @@ H5G_node_found (H5F_t *f, const haddr_t *addr, const void *_lt_key, idx = (lt + rt) / 2; if (NULL==(s=H5H_peek (f, &(bt_udata->heap_addr), sn->entry[idx].name_off))) { - HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to read symbol name"); } cmp = HDstrcmp (bt_udata->name, s); @@ -654,7 +672,7 @@ H5G_node_found (H5F_t *f, const haddr_t *addr, const void *_lt_key, lt = idx+1; } } - if (cmp) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + if (cmp) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "not found"); switch (bt_udata->operation) { case H5G_OPER_FIND: @@ -669,7 +687,8 @@ H5G_node_found (H5F_t *f, const haddr_t *addr, const void *_lt_key, break; default: - HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL, + "internal erorr (unknown symbol find operation)"); break; } ret_value = SUCCEED; @@ -682,7 +701,8 @@ done: */ if (ret_value<0) { if (sn && H5AC_unprotect (f, H5AC_SNODE, addr, sn)<0) { - HRETURN_ERROR (H5E_SYM, H5E_PROTECT, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_PROTECT, FAIL, + "unable to release symbol table node"); } } @@ -776,7 +796,8 @@ H5G_node_insert (H5F_t *f, const haddr_t *addr, ac_udata.grp_addr = bt_udata->grp_addr; ac_udata.heap_addr = bt_udata->heap_addr; if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata, NULL))) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, + "unable to protect symbol table node"); } /* @@ -787,11 +808,13 @@ H5G_node_insert (H5F_t *f, const haddr_t *addr, idx = (lt + rt) / 2; if (NULL==(s=H5H_peek (f, &(bt_udata->heap_addr), sn->entry[idx].name_off))) { - HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR); + HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, + "unable to read symbol name"); } if (0==(cmp=HDstrcmp (bt_udata->name, s))) { /*already present*/ - HGOTO_ERROR (H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, + "symbol is already present in symbol table"); } if (cmp<0) { rt = idx; @@ -809,8 +832,11 @@ H5G_node_insert (H5F_t *f, const haddr_t *addr, offset = H5H_insert (f, &(bt_udata->heap_addr), HDstrlen(bt_udata->name)+1, bt_udata->name); bt_udata->entry.name_off = offset; - if (offset<=0) HGOTO_ERROR (H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR); - + if (offset<=0) { + HGOTO_ERROR (H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, + "unable to insert symbol name into heap"); + } + if (sn->nsyms>=2*H5G_NODE_K(f)) { /* * The node is full. Split it into a left and right @@ -822,10 +848,12 @@ H5G_node_insert (H5F_t *f, const haddr_t *addr, /* The right node */ if (H5G_node_create (f, H5B_INS_FIRST, NULL, NULL, NULL, new_node/*out*/)<0) { - HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR); + HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, + "unable to split symbol table node"); } if (NULL==(snrt=H5AC_find (f, H5AC_SNODE, new_node, &ac_udata, NULL))) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, + "unable to split symbol table node"); } HDmemcpy (snrt->entry, sn->entry + H5G_NODE_K(f), H5G_NODE_K(f) * sizeof(H5G_entry_t)); @@ -902,16 +930,19 @@ done: if (ret_value<0) { /* failing... */ if (sn && H5AC_unprotect (f, H5AC_SNODE, addr, sn)<0) { - HRETURN_ERROR (H5E_SYM, H5E_PROTECT, H5B_INS_ERROR); + HRETURN_ERROR (H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, + "unable to release symbol table node"); } } else if (insert_into!=sn) { /* unprotect the first node and protect the return value */ if (H5AC_unprotect (f, H5AC_SNODE, addr, sn)<0) { - HRETURN_ERROR (H5E_SYM, H5E_PROTECT, H5B_INS_ERROR); + HRETURN_ERROR (H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, + "unable to release symbol table node"); } if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, &insert_addr, &ac_udata, NULL))) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, + "unable to protect symbol table node"); } bt_udata->node_ptr = sn; bt_udata->entry_ptr = sn->entry + idx; @@ -963,7 +994,8 @@ H5G_node_list (H5F_t *f, const haddr_t *addr, void *_udata) ac_udata.grp_addr = bt_udata->grp_addr; ac_udata.heap_addr = bt_udata->heap_addr; if (NULL==(sn=H5AC_protect (f, H5AC_SNODE, addr, &ac_udata, NULL))) { - HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL, + "unable to protect symbol table node"); } /* @@ -989,7 +1021,8 @@ H5G_node_list (H5F_t *f, const haddr_t *addr, void *_udata) for (i=0; i<sn->nsyms && bt_udata->nsyms+i<bt_udata->maxentries; i++) { if (NULL==(s=H5H_peek (f, &(bt_udata->heap_addr), sn->entry[i].name_off))) { - HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to read symbol name"); } bt_udata->name[bt_udata->nsyms+i] = H5MM_xstrdup (s); } @@ -1003,7 +1036,8 @@ H5G_node_list (H5F_t *f, const haddr_t *addr, void *_udata) done: if (sn && H5AC_unprotect (f, H5AC_SNODE, addr, sn)<0) { - HRETURN_ERROR (H5E_CACHE, H5E_PROTECT, FAIL); + HRETURN_ERROR (H5E_CACHE, H5E_PROTECT, FAIL, + "unable to release symbol table node"); } FUNC_LEAVE (ret_value); } @@ -1067,7 +1101,10 @@ H5G_node_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, if (NULL==(sn=H5AC_protect(f, H5AC_SNODE, addr, &ac_udata, NULL))) { H5ECLEAR; /*discard that error*/ status = H5B_debug (f, addr, stream, indent, fwidth, H5B_SNODE, NULL); - if (status<0) HRETURN_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL); + if (status<0) { + HRETURN_ERROR (H5E_SYM, H5E_CANTLOAD, FAIL, + "unable to debug B-tree node"); + } HRETURN (SUCCEED); } diff --git a/src/H5Gshad.c b/src/H5Gshad.c index f7941ef..861f7e5 100644 --- a/src/H5Gshad.c +++ b/src/H5Gshad.c @@ -255,8 +255,8 @@ H5G_shadow_sync (H5G_entry_t *ent) if (shadow && shadow->entry.dirty) { if (!ent) { - /* Main entry is not cached */ - HRETURN_ERROR (H5E_SYM, H5E_NOTCACHED, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_NOTCACHED, FAIL, + "main entry is not cached"); } *ent = shadow->entry; shadow->entry.dirty = FALSE; @@ -466,10 +466,12 @@ H5G_shadow_open (H5F_t *f, H5G_entry_t *grp, H5G_entry_t *ent) * Some entry other than the root. */ if (NULL==H5O_read (f, NO_ADDR, grp, H5O_STAB, 0, &stab)) { - HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, + "unable to read symbol table object header message"); } if (NULL==(s=H5H_peek (f, &(stab.heap_addr), ent->name_off))) { - HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, + "unable to read symbol name"); } shadow->name = H5MM_xstrdup (s); } @@ -576,7 +578,8 @@ H5G_shadow_close (H5F_t *f, H5G_entry_t *ent) if (1==shadow->nrefs && ent->dirty) { if (!shadow->main && NULL==H5G_stab_find (f, &(shadow->grp_addr), NULL, shadow->name)) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to find shadow name in symbol table"); } assert (shadow->main); *(shadow->main) = *ent; @@ -760,7 +763,9 @@ H5G_shadow_flush (H5F_t *f, hbool_t invalidate) if (!shadow->main && NULL==H5G_stab_find (f, &(shadow->grp_addr), NULL, shadow->name)) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, + "unable to find shadow name in symbol " + "table"); } assert (shadow->main); *(shadow->main) = shadow->entry; @@ -797,7 +802,8 @@ H5G_shadow_flush (H5F_t *f, hbool_t invalidate) * shadow and then something else tries to access it (perhaps to close * it) then they trample on freed memory. */ - HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL, + "leaking memory due to shadow errors"); } FUNC_LEAVE (SUCCEED); diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 30bca74..a607e5e 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -72,22 +72,23 @@ H5G_stab_create (H5F_t *f, H5G_entry_t *self, size_t init) /* Create symbol table private heap */ if (H5H_create (f, H5H_LOCAL, init, &(stab.heap_addr)/*out*/)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't create heap*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap"); } if ((name = H5H_insert (f, &(stab.heap_addr), 1, "")<0)) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't initialize heap*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "can't initialize heap"); } if (0!=name) { /* * B-tree's won't work if the first name isn't at the beginning * of the heap. */ - HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL, + "internal error (heap doesn't begin at zero)"); } /* Create the B-tree */ if (H5B_create (f, H5B_SNODE, NULL, &(stab.btree_addr)/*out*/)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't create B-tree*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree"); } /* @@ -96,14 +97,14 @@ H5G_stab_create (H5F_t *f, H5G_entry_t *self, size_t init) * incremented if the object is added to the group directed graph. */ if (H5O_create (f, 0, 4+2*H5F_SIZEOF_ADDR(f), &addr/*out*/)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't create header*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "can't create header"); } /* insert the symbol table message */ memset (self, 0, sizeof(H5G_entry_t)); self->header = addr; if (H5O_modify(f, NO_ADDR, self, H5O_STAB, H5O_NEW_MESG, &stab)<0) { - HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't create message*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); } FUNC_LEAVE (SUCCEED); @@ -153,16 +154,16 @@ H5G_stab_find (H5F_t *f, const haddr_t *addr, H5G_entry_t *self, assert (f); assert (!addr || H5F_addr_defined (addr)); if (!addr && (!self || !H5F_addr_defined (&(self->header)))) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, "bad address"); } if (!name || !*name) { - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, "no name"); } if (!addr) addr = &(self->header); /* set up the udata */ if (NULL==H5O_read (f, addr, self, H5O_STAB, 0, &stab)) { - HRETURN_ERROR (H5E_SYM, H5E_BADMESG, NULL); /*can't read message*/ + HRETURN_ERROR (H5E_SYM, H5E_BADMESG, NULL, "can't read message"); } udata.operation = H5G_OPER_FIND; udata.name = name; @@ -175,14 +176,15 @@ H5G_stab_find (H5F_t *f, const haddr_t *addr, H5G_entry_t *self, if (udata.node_ptr) { H5AC_unprotect (f, H5AC_SNODE, &(udata.node_addr), udata.node_ptr); } - HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL); /*not found*/ + HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, NULL, "not found"); } /* Unprotect the symbol table node */ if (udata.node_ptr) { if (H5AC_unprotect (f, H5AC_SNODE, &(udata.node_addr), udata.node_ptr)<0) { - HRETURN_ERROR (H5E_SYM, H5E_PROTECT, NULL); + HRETURN_ERROR (H5E_SYM, H5E_PROTECT, NULL, + "unable to release symbol table node"); } } @@ -238,7 +240,7 @@ H5G_stab_insert (H5F_t *f, H5G_entry_t *self, const char *name, /* initialize data to pass through B-tree */ if (NULL==H5O_read (f, &(self->header), self, H5O_STAB, 0, &stab)) { - HRETURN_ERROR (H5E_SYM, H5E_BADMESG, NULL); /*can't read message*/ + HRETURN_ERROR (H5E_SYM, H5E_BADMESG, NULL, "can't read message"); } udata.operation = H5G_OPER_INSERT; @@ -254,7 +256,7 @@ H5G_stab_insert (H5F_t *f, H5G_entry_t *self, const char *name, if (udata.node_ptr) { H5AC_unprotect (f, H5AC_SNODE, &(udata.node_addr), udata.node_ptr); } - HRETURN_ERROR (H5E_SYM, H5E_CANTINSERT, NULL); /*can't insert entry*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTINSERT, NULL, "can't insert entry"); } /* @@ -264,7 +266,7 @@ H5G_stab_insert (H5F_t *f, H5G_entry_t *self, const char *name, * until the next call to H5AC. */ if (H5AC_unprotect (f, H5AC_SNODE, &(udata.node_addr), udata.node_ptr)<0) { - HRETURN_ERROR (H5E_SYM, H5E_PROTECT, NULL); /*can't unprotect*/ + HRETURN_ERROR (H5E_SYM, H5E_PROTECT, NULL, "can't unprotect"); } /* update the name offset in the entry */ @@ -321,7 +323,7 @@ H5G_stab_list (H5F_t *f, H5G_entry_t *self, intn maxentries, /* initialize data to pass through B-tree */ if (NULL==H5O_read (f, &(self->header), self, H5O_STAB, 0, &stab)) { - HRETURN_ERROR (H5E_SYM, H5E_BADMESG, FAIL); /*not a symbol table*/ + HRETURN_ERROR (H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); } udata.entry = entries; udata.name = names; @@ -336,7 +338,7 @@ H5G_stab_list (H5F_t *f, H5G_entry_t *self, intn maxentries, if (names) { for (i=0; i<maxentries; i++) H5MM_xfree (names[i]); } - HRETURN_ERROR (H5E_SYM, H5E_CANTLIST, FAIL); /*B-tree list failure*/ + HRETURN_ERROR (H5E_SYM, H5E_CANTLIST, FAIL, "b-tree list failure"); } FUNC_LEAVE (udata.nsyms); @@ -117,7 +117,8 @@ H5H_create (H5F_t *f, H5H_type_t heap_type, size_t size_hint, /* allocate file version */ total_size = H5H_SIZEOF_HDR(f) + size_hint; if (H5MF_alloc (f, H5MF_META, total_size, addr/*out*/)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to allocate file memory"); } /* allocate memory version */ @@ -143,7 +144,8 @@ H5H_create (H5F_t *f, H5H_type_t heap_type, size_t size_hint, if (H5AC_set (f, H5AC_HEAP, addr, heap)<0) { heap->chunk = H5MM_xfree (heap->chunk); heap->freelist = H5MM_xfree (heap->freelist); - HRETURN_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL, + "unable to cache heap"); } FUNC_LEAVE (SUCCEED); @@ -187,14 +189,16 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) assert (!udata2); if (H5F_block_read (f, addr, H5H_SIZEOF_HDR(f), hdr)<0) { - HRETURN_ERROR (H5E_HEAP, H5E_READERROR, NULL); + HRETURN_ERROR (H5E_HEAP, H5E_READERROR, NULL, + "unable to read heap header"); } p = hdr; heap = H5MM_xcalloc (1, sizeof(H5H_t)); /* magic number */ if (HDmemcmp (hdr, H5H_MAGIC, H5H_SIZEOF_MAGIC)) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap signature"); } p += H5H_SIZEOF_MAGIC; @@ -205,7 +209,8 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) /* free list head */ H5F_decode_length (f, p, free_block); if (free_block!=H5H_FREE_NULL && free_block>=heap->disk_alloc) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap free list"); } /* data */ @@ -214,13 +219,15 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) if (heap->disk_alloc && H5F_block_read (f, &(heap->addr), heap->disk_alloc, heap->chunk + H5H_SIZEOF_HDR(f))<0) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "unable to read heap data"); } /* free list */ while (H5H_FREE_NULL!=free_block) { if (free_block>=heap->disk_alloc) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap free list"); } fl = H5MM_xmalloc (sizeof (H5H_free_t)); fl->offset = free_block; @@ -235,7 +242,8 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2) H5F_decode_length (f, p, fl->size); if (fl->offset + fl->size > heap->disk_alloc) { - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "bad heap free list"); } } @@ -297,7 +305,8 @@ H5H_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5H_t *heap) if (heap->mem_alloc > heap->disk_alloc) { haddr_t old_addr = heap->addr, new_addr; if (H5MF_alloc (f, H5MF_META, heap->mem_alloc, &new_addr/*out*/)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to allocate file space for heap"); } heap->addr = new_addr; H5MF_free (f, &old_addr, heap->disk_alloc); @@ -336,15 +345,18 @@ H5H_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5H_t *heap) /* The header and data are contiguous */ if (H5F_block_write (f, addr, H5H_SIZEOF_HDR(f)+heap->disk_alloc, heap->chunk)<0) { - HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, + "unable to write heap header and data to disk"); } } else { if (H5F_block_write (f, addr, H5H_SIZEOF_HDR(f), heap->chunk)<0) { - HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, + "unable to write heap header to disk"); } if (H5F_block_write (f, &(heap->addr), heap->disk_alloc, heap->chunk + H5H_SIZEOF_HDR(f))<0) { - HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, + "unable to write heap data to disk"); } } @@ -411,7 +423,8 @@ H5H_read (H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf) assert (offset>=0); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "unable to load heap"); } assert (offset<heap->mem_alloc); assert (offset+size<=heap->mem_alloc); @@ -471,7 +484,8 @@ H5H_peek (H5F_t *f, const haddr_t *addr, size_t offset) assert (offset>=0); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, + "unable to load heap"); } assert (offset<heap->mem_alloc); @@ -549,7 +563,8 @@ H5H_insert (H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf) assert (buf); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } heap->dirty += 1; @@ -704,7 +719,8 @@ H5H_write (H5F_t *f, const haddr_t *addr, size_t offset, size_t size, assert (buf); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } assert (offset<heap->mem_alloc); assert (offset+size<=heap->mem_alloc); @@ -766,7 +782,8 @@ H5H_remove (H5F_t *f, const haddr_t *addr, size_t offset, size_t size) assert (size>0); if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } assert (offset<heap->mem_alloc); assert (offset+size<=heap->mem_alloc); @@ -882,7 +899,8 @@ H5H_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, intn fwidth assert (fwidth>=0); if (NULL==(h=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, + "unable to load heap"); } fprintf (stream, "%*sHeap...\n", indent, ""); @@ -229,11 +229,12 @@ hid_t H5Maccess(hid_t oid) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].access==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "no access method"); ret_value=(meta_func_arr[i].access)(oid); done: @@ -272,11 +273,11 @@ hid_t H5Mcopy(hid_t oid) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].copy==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no copy method"); ret_value=(meta_func_arr[i].copy)(oid); done: @@ -326,12 +327,12 @@ H5Mfind_name (hid_t owner_id, group_t type, const char *name) i=H5M_find_type(group); #else /* OLD_WAY */ if(type<=BADGROUP || type>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(type); #endif /* OLD_WAY */ if(meta_func_arr[i].find_name==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no open method"); ret_value=(meta_func_arr[i].find_name)(owner_id,type,name); done: @@ -370,11 +371,11 @@ uint32 H5Mname_len(hid_t oid) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].name_len==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no name_len method"); ret_value=(meta_func_arr[i].name_len)(oid); done: @@ -414,11 +415,12 @@ herr_t H5Mget_name(hid_t oid, char *name) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].get_name==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "no get_name method"); ret_value=(meta_func_arr[i].get_name)(oid,name); done: @@ -458,11 +460,12 @@ herr_t H5Mset_name(hid_t oid, const char *name) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].set_name==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "no set_name method"); ret_value=(meta_func_arr[i].set_name)(oid,name); done: @@ -504,11 +507,11 @@ H5Msearch (hid_t oid, group_t type, const char *name) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].search==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no search method"); ret_value=(meta_func_arr[i].search)(oid,type,name); done: @@ -550,11 +553,11 @@ H5Mindex (hid_t oid, group_t type, uint32 idx) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].index==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no index method"); ret_value=(meta_func_arr[i].index)(oid,type,idx); done: @@ -594,12 +597,12 @@ hid_t H5Mflush(hid_t oid) H5ECLEAR; group=H5Aatom_group(oid); /* look up group for incoming object */ if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); /* Find correct function pointer set from static array */ i=H5M_find_type(group); if(meta_func_arr[i].flush==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no flush method"); ret_value=(meta_func_arr[i].flush)(oid); done: @@ -639,11 +642,11 @@ herr_t H5Mdelete(hid_t oid) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].delete==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no delete method"); ret_value=(meta_func_arr[i].delete)(oid); done: @@ -682,11 +685,12 @@ hid_t H5Mget_parent(hid_t oid) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].get_parent==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "no get_parent method"); ret_value=(meta_func_arr[i].get_parent)(oid); done: @@ -725,11 +729,12 @@ hid_t H5Mget_file(hid_t oid) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].get_file==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, + "no get_file method"); ret_value=(meta_func_arr[i].get_file)(oid); done: @@ -768,11 +773,11 @@ herr_t H5Mclose(hid_t oid) /* Clear errors and check args and all the boring stuff. */ H5ECLEAR; if(group<=BADGROUP || group>=MAXGROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); i=H5M_find_type(group); if(meta_func_arr[i].close==NULL) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "no close method"); ret_value=(meta_func_arr[i].close)(oid); done: @@ -70,8 +70,8 @@ H5MF_alloc (H5F_t *f, intn op, size_t size, haddr_t *addr/*out*/) * the file. */ if (H5F_low_extend (f->shared->lf, op, size, addr/*out*/)<0) { - /* Low level mem management failed */ - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "low level mem management failed"); } /* Convert from absolute to relative */ addr->offset -= f->shared->base_addr.offset; @@ -108,7 +108,8 @@ H5O_create (H5F_t *f, intn nlink, size_t size_hint, haddr_t *addr/*out*/) /* allocate disk space for header and first chunk */ size = H5O_SIZEOF_HDR(f) + size_hint; if (H5MF_alloc (f, H5MF_META, size, addr/*out*/)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to allocate file space for object header hdr"); } /* allocate the object header and fill in header fields */ @@ -145,7 +146,8 @@ H5O_create (H5F_t *f, intn nlink, size_t size_hint, haddr_t *addr/*out*/) /* cache it */ if (H5AC_set (f, H5AC_OHDR, addr, oh)<0) { H5MM_xfree (oh); - HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, + "unable to cache object header"); } FUNC_LEAVE (SUCCEED); @@ -199,20 +201,23 @@ H5O_load (H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2) /* read fixed-lenth part of object header */ hdr_size = H5O_SIZEOF_HDR (f); if (H5F_block_read (f, addr, hdr_size, buf)<0) { - HGOTO_ERROR (H5E_OHDR, H5E_READERROR, NULL); + HGOTO_ERROR (H5E_OHDR, H5E_READERROR, NULL, + "unable to read object header"); } p = buf; /* decode version */ oh->version = *p++; if (H5O_VERSION!=oh->version) { - HGOTO_ERROR (H5E_OHDR, H5E_VERSION, NULL); + HGOTO_ERROR (H5E_OHDR, H5E_VERSION, NULL, + "bad object header version number"); } /* decode alignment */ oh->alignment = *p++; if (4!=oh->alignment) { - HGOTO_ERROR (H5E_OHDR, H5E_ALIGNMENT, NULL); + HGOTO_ERROR (H5E_OHDR, H5E_ALIGNMENT, NULL, + "unsupported object header alignment"); } /* decode number of messages */ @@ -248,7 +253,8 @@ H5O_load (H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2) oh->chunk[chunkno].image = H5MM_xmalloc (chunk_size); if (H5F_block_read (f, &chunk_addr, chunk_size, oh->chunk[chunkno].image)<0) { - HGOTO_ERROR (H5E_OHDR, H5E_READERROR, NULL); + HGOTO_ERROR (H5E_OHDR, H5E_READERROR, NULL, + "unable to read object header data"); } @@ -260,10 +266,12 @@ H5O_load (H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2) UINT16DECODE (p, mesg_size); if (id>=NELMTS(message_type_g) || NULL==message_type_g[id]) { - HGOTO_ERROR (H5E_OHDR, H5E_BADMESG, NULL); + 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); + HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, + "corrupt object header"); } if (H5O_NULL_ID==id && oh->nmesgs>0 && @@ -275,7 +283,8 @@ H5O_load (H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2) } else { /* new message */ if (oh->nmesgs>=nmesgs) { - HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL); + HGOTO_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL, + "corrupt object header"); } mesgno = oh->nmesgs++; oh->mesg[mesgno].type = message_type_g[id]; @@ -373,7 +382,8 @@ H5O_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh) /* write the object header header */ if (H5F_block_write (f, addr, H5O_SIZEOF_HDR(f), buf)<0) { - HRETURN_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, + "unable to write object header hdr to disk"); } /* encode messages */ @@ -396,7 +406,9 @@ H5O_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh) cont->size = oh->chunk[cont->chunkno].size; if (H5MF_alloc (f, H5MF_META, cont->size, &(cont->addr)/*out*/)<0) { - HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "unable to allocate space for object " + "header data"); } oh->chunk[cont->chunkno].addr = cont->addr; } @@ -410,7 +422,8 @@ H5O_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh) if ((oh->mesg[i].type->encode)(f, oh->mesg[i].raw_size, oh->mesg[i].raw, oh->mesg[i].native)<0) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTENCODE, FAIL, + "unable to encode object header message"); } } oh->mesg[i].dirty = FALSE; @@ -424,7 +437,8 @@ H5O_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh) assert (H5F_addr_defined (&(oh->chunk[i].addr))); if (H5F_block_write (f, &(oh->chunk[i].addr), oh->chunk[i].size, oh->chunk[i].image)<0) { - HRETURN_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_WRITEERROR, FAIL, + "unable to write object header data to disk"); } oh->chunk[i].dirty = FALSE; } @@ -483,7 +497,8 @@ H5O_reset (const H5O_class_t *type, void *native) if (type->reset) { if ((type->reset)(native)<0) { /* reset class method failed */ - HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, + "reset method failed"); } } else { HDmemset (native, 0, type->native_size); @@ -528,13 +543,15 @@ H5O_link (H5F_t *f, H5G_entry_t *ent, intn adjust) /* get header */ if (NULL==(oh=H5AC_find (f, H5AC_OHDR, &addr, NULL, NULL))) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, + "unable to load object header"); } /* adjust link count */ if (adjust<0) { if (oh->nlink + adjust < 0) { - HRETURN_ERROR (H5E_OHDR, H5E_LINKCOUNT, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_LINKCOUNT, FAIL, + "link could would be negative"); } oh->nlink += adjust; if (1==oh->nlink && ent) { @@ -589,7 +606,8 @@ H5O_read (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, assert (f); if (!addr) { if (!ent || H5G_ent_addr (ent, &_addr/*out*/)) { - HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, NULL, + "invalid symbol table entry"); } addr = &_addr; } @@ -608,7 +626,8 @@ H5O_read (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, /* can we get it from the object header? */ if ((idx = H5O_find_in_ohdr (f, addr, &type, sequence))<0) { - HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, NULL, + "unable to find message in object header"); } #ifdef LATER @@ -617,11 +636,15 @@ H5O_read (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, /* copy the message to the user-supplied buffer */ if (NULL==(oh=H5AC_find (f, H5AC_OHDR, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL, + "unable to load object header"); } retval = (type->copy)(oh->mesg[idx].native, mesg); - if (!retval) HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, NULL); - + if (!retval) { + HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, + "unable to copy object header message to user space"); + } + FUNC_LEAVE (retval); } @@ -660,7 +683,8 @@ H5O_find_in_ohdr (H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p, /* load the object header */ if (NULL==(oh=H5AC_find (f, H5AC_OHDR, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, + "unable to load object header"); } /* scan through the messages looking for the right one */ @@ -668,7 +692,10 @@ H5O_find_in_ohdr (H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p, if (*type_p && (*type_p)->id!=oh->mesg[i].type->id) continue; if (--sequence<0) break; } - if (sequence>=0) HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, FAIL); + if (sequence>=0) { + HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, FAIL, + "unable to find object header message"); + } /* decode the message if necessary */ if (NULL==oh->mesg[i].native) { @@ -677,7 +704,8 @@ H5O_find_in_ohdr (H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p, oh->mesg[i].raw_size, oh->mesg[i].raw); if (NULL==oh->mesg[i].native) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTDECODE, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTDECODE, FAIL, + "unable to decode message"); } } @@ -725,10 +753,12 @@ H5O_peek (H5F_t *f, const haddr_t *addr, const H5O_class_t *type, assert (addr && H5F_addr_defined (addr)); if ((idx = H5O_find_in_ohdr (f, addr, &type, sequence))<0) { - HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, NULL); + HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, NULL, + "unable to find object header message"); } if (NULL==(oh=H5AC_find (f, H5AC_OHDR, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, NULL, + "unable to load object header"); } FUNC_LEAVE (oh->mesg[idx].native); @@ -784,14 +814,16 @@ H5O_modify (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, assert (mesg); if (!addr) { if (!ent || H5G_ent_addr (ent, &_addr)<0) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, + "invalid object header address"); } addr = &_addr; } assert (H5F_addr_defined (addr)); if (NULL==(oh=H5AC_find (f, H5AC_OHDR, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, + "unable to load object header"); } /* Count similar messages */ @@ -808,7 +840,7 @@ H5O_modify (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, if (overwrite==sequence+1) { overwrite = -1; } else { - HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, FAIL); /*message not found*/ + HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, FAIL, "message not found"); } } @@ -817,14 +849,18 @@ H5O_modify (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, size = (type->raw_size)(f, mesg); H5O_ALIGN (size, oh->alignment); idx = H5O_alloc (f, oh, type, size); - if (idx<0) HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL); + if (idx<0) { + HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, + "unable to allocate object header space for message"); + } sequence++; } /* Copy the native value into the object header */ oh->mesg[idx].native = (type->copy)(mesg, oh->mesg[idx].native); if (NULL==oh->mesg[idx].native) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, + "unable to copy message to object header"); } oh->mesg[idx].dirty = TRUE; oh->dirty = TRUE; @@ -887,7 +923,8 @@ H5O_remove (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, assert (type); if (!addr) { if (!ent || H5G_ent_addr (ent, &_addr)<0) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL, + "invalid object header address"); } addr = &_addr; } @@ -895,7 +932,8 @@ H5O_remove (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent, /* load the object header */ if (NULL==(oh=H5AC_find (f, H5AC_OHDR, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, + "unable to load object header"); } for (i=seq=0; i<oh->nmesgs; i++) { @@ -963,7 +1001,7 @@ H5O_alloc_extend_chunk (H5O_t *oh, intn chunkno, size_t size) assert (size>0); if (H5F_addr_defined (&(oh->chunk[chunkno].addr))) { - HRETURN_ERROR (H5E_OHDR, H5E_NOSPACE, FAIL); /*chunk is on disk*/ + HRETURN_ERROR (H5E_OHDR, H5E_NOSPACE, FAIL, "chunk is on disk"); } /* try to extend a null message */ @@ -1269,7 +1307,8 @@ H5O_alloc (H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) */ if (idx<0) { if ((idx=H5O_alloc_new_chunk (f, oh, size))<0) { - HRETURN_ERROR (H5E_OHDR, H5E_NOSPACE, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_NOSPACE, FAIL, + "unable to create a new object header data chunk"); } } } @@ -1341,7 +1380,8 @@ H5O_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, assert (fwidth>=0); if (NULL==(oh=H5AC_find (f, H5AC_OHDR, addr, NULL, NULL))) { - HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL); + HRETURN_ERROR (H5E_OHDR, H5E_CANTLOAD, FAIL, + "unable to load object header"); } /* debug */ diff --git a/src/H5Osdtyp.c b/src/H5Odtype.c index edc4c82..e6f4c03 100644 --- a/src/H5Osdtyp.c +++ b/src/H5Odtype.c @@ -124,8 +124,8 @@ H5O_dtype_decode_helper (const uint8 **pp, H5T_t *dt) dt->u.atomic.u.f.norm = H5T_NORM_IMPLIED; break; default: - /* unknown floating-point normalization */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "unknown floating-point normalization"); } dt->u.atomic.u.f.sign = (flags>>8) & 0xff; UINT16DECODE (*pp, dt->u.atomic.offset); @@ -167,16 +167,16 @@ H5O_dtype_decode_helper (const uint8 **pp, H5T_t *dt) H5T_COMPOUND==dt->u.compnd.memb[i].type.type) { for (j=0; j<=i; j++) H5MM_xfree (dt->u.compnd.memb[i].name); H5MM_xfree (dt->u.compnd.memb); - /* Can't decode member type */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTDECODE, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTDECODE, FAIL, + "can't decode member type"); } } break; default: if (flags) { - /* class flags are non-zero */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "class flags are non-zero"); } break; } @@ -231,8 +231,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x01; break; default: - /* Byte order is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "byte order is not supported in file format yet"); } switch (dt->u.atomic.lo_pad) { @@ -242,8 +242,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x02; break; default: - /* Bit padding is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "bit padding is not supported in file format yet"); } switch (dt->u.atomic.hi_pad) { @@ -253,8 +253,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x04; break; default: - /* Bit padding is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "bit padding is not supported in file format yet"); } switch (dt->u.atomic.u.i.sign) { @@ -264,8 +264,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x08; break; default: - /* Sign scheme is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "sign scheme is not supported in file format yet"); } UINT16ENCODE (*pp, dt->u.atomic.offset); @@ -283,8 +283,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x01; break; default: - /* Byte order is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "byte order is not supported in file format yet"); } switch (dt->u.atomic.lo_pad) { @@ -294,8 +294,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x02; break; default: - /* Bit padding is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "bit padding is not supported in file format yet"); } switch (dt->u.atomic.hi_pad) { @@ -305,8 +305,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x04; break; default: - /* Bit padding is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "bit padding is not supported in file format yet"); } switch (dt->u.atomic.u.f.pad) { @@ -316,8 +316,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x08; break; default: - /* Bit padding is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "bit padding is not supported in file format yet"); } switch (dt->u.atomic.u.f.norm) { @@ -330,8 +330,9 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) flags |= 0x20; break; default: - /* Normalization scheme is not supported in file format yet */ - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, + "normalization scheme is not supported in file " + "format yet"); } flags |= (dt->u.atomic.u.f.sign << 8) & 0xff00; @@ -369,8 +370,8 @@ H5O_dtype_encode_helper (uint8 **pp, const H5T_t *dt) } UINT32ENCODE (*pp, perm_word); if (H5O_dtype_encode_helper (pp, &(dt->u.compnd.memb[i].type))<0) { - /* Can't encode member type */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTENCODE, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTENCODE, FAIL, + "can't encode member type"); } } break; @@ -422,8 +423,8 @@ H5O_dtype_decode (H5F_t *f, size_t raw_size, const uint8 *p) if (H5O_dtype_decode_helper (&p, dt)<0) { H5MM_xfree (dt); - /* can't decode type */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTDECODE, NULL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTDECODE, NULL, + "can't decode type"); } assert (raw_size==H5O_dtype_size (f, (void*)dt)); @@ -462,8 +463,8 @@ H5O_dtype_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *mesg) /* encode */ if (H5O_dtype_encode_helper (&p, dt)<0) { - /* can't encode type */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTENCODE, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTENCODE, FAIL, + "can't encode type"); } FUNC_LEAVE (SUCCEED); @@ -499,7 +500,7 @@ H5O_dtype_copy (const void *_src, void *_dst) /* copy */ if (NULL==(dst=H5T_copy (src))) { - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL); /*can't copy type*/ + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, "can't copy type"); } /* was result already allocated? */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 23086e8..8d00117 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -93,7 +93,7 @@ typedef struct H5O_t { extern const H5O_class_t H5O_NULL[1]; /* - * Simple Dimensionality Message. + * Simple Data Space Message. */ #define H5O_SDSPACE_ID 0x0001 extern const H5O_class_t H5O_SDSPACE[1]; diff --git a/src/H5Osdim.c b/src/H5Osdspace.c index 3bc1e04..3bc1e04 100644 --- a/src/H5Osdim.c +++ b/src/H5Osdspace.c @@ -124,17 +124,18 @@ H5Pcreate (H5P_class_t type) break; case H5P_COMPLEX: - /* Complex types are not supported yet */ - HGOTO_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + HGOTO_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "complex types are not supported yet"); default: - /* Unknown data space type */ - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, + "unknown data space type"); } /* Register the new data space and get an ID for it */ if ((ret_value = H5Aregister_atom (H5_DATASPACE, ds))<0) { - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL); + HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, + "unable to register data space for ID"); } done: @@ -173,12 +174,12 @@ H5Pclose (hid_t space_id) /* check args */ if (H5_DATASPACE!=H5Aatom_group (space_id) || NULL==H5Aatom_object (space_id)) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } /* When the reference count reaches zero the resources are freed */ if (H5A_dec_ref (space_id)<0) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*problem freeing id*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id"); } FUNC_LEAVE (SUCCEED); @@ -327,7 +328,7 @@ H5Pget_npoints (hid_t space_id) /* check args */ if (H5_DATASPACE!=H5Aatom_group (space_id) || NULL==(ds=H5Aatom_object (space_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, 0); /*not a data space*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, 0, "not a data space"); } ret_value = H5P_get_npoints (ds); @@ -375,12 +376,13 @@ H5P_get_npoints (const H5P_t *ds) break; case H5P_COMPLEX: - /* complex data spaces are not supported yet */ - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0, + "complex data spaces are not supported yet"); default: assert ("unknown data space class" && 0); - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0, + "internal error (unknown data space class)"); } FUNC_LEAVE (ret_value); @@ -415,7 +417,7 @@ H5Pget_ndims (hid_t space_id) /* check args */ if (H5_DATASPACE!=H5Aatom_group (space_id) || NULL==(ds=H5Aatom_object (space_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } ret_value = H5P_get_ndims (ds); @@ -461,12 +463,13 @@ H5P_get_ndims (const H5P_t *ds) break; case H5P_COMPLEX: - /* complex data spaces are not supported yet */ - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "complex data spaces are not supported yet"); default: assert ("unknown data space class" && 0); - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "internal error (unknown data space class)"); } FUNC_LEAVE (ret_value); @@ -504,10 +507,10 @@ H5Pget_dims (hid_t space_id, size_t dims[]/*out*/) /* check args */ if (H5_DATASPACE!=H5Aatom_group (space_id) || NULL==(ds=H5Aatom_object (space_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } if (!dims) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no output buffer*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer"); } @@ -559,12 +562,13 @@ H5P_get_dims (const H5P_t *ds, size_t dims[]) break; case H5P_COMPLEX: - /* complex data spaces are not supported yet */ - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "complex data spaces are not supported yet"); default: assert ("unknown data space class" && 0); - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "internal error (unknown data space class)"); } FUNC_LEAVE (ret_value); @@ -599,19 +603,19 @@ H5P_modify (H5F_t *f, H5G_entry_t *ent, const H5P_t *ds) switch (ds->type) { case H5P_SCALAR: - /* Scalar data spaces are not implemented yet */ - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "scalar data spaces are not implemented yet"); case H5P_SIMPLE: if (H5O_modify (f, NO_ADDR, ent, H5O_SDSPACE, 0, &(ds->u.simple))<0) { - /* Can't update simple data space message */ - HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL); + HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, + "can't update simple data space message"); } break; case H5P_COMPLEX: - /* Complex data spaces are not implemented yet */ - HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "complex data spaces are not implemented yet"); default: assert ("unknown data space class" && 0); @@ -783,7 +787,7 @@ hbool_t H5Pis_simple(hid_t sid) H5ECLEAR; if((space=H5Aatom_object(sid))==NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); ret_value=H5P_is_simple(space); @@ -832,9 +836,9 @@ herr_t H5Pset_space(hid_t sid, intn rank, const intn *dims) /* Get the object */ if((space=H5Aatom_object(sid))==NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); if(rank>0 && dims==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank"); /* shift out of the previous state to a "simple" dataspace */ switch(space->type) @@ -851,7 +855,8 @@ herr_t H5Pset_space(hid_t sid, intn rank, const intn *dims) /* Fall through to report error */ default: - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL); + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, + "unknown data space class"); } /* end switch */ space->type=H5P_SIMPLE; @@ -881,18 +886,18 @@ herr_t H5Pset_space(hid_t sid, intn rank, const intn *dims) /* Set the rank and copy the dims */ space->u.simple.rank=rank; - if((space->u.simple.size=HDcalloc(sizeof(intn),rank))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL); + space->u.simple.size = H5MM_xcalloc (sizeof(intn), rank); HDmemcpy(space->u.simple.size,dims,sizeof(intn)*rank); /* check if there are unlimited dimensions and create the maximum dims array */ for(u=0; u<rank; u++) if(dims[u]==0) { - if(u>0) /* sanity check for unlimited dimensions not in the lowest dimensionality */ - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); - if((space->u.simple.max=HDcalloc(sizeof(intn),rank))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL); + if(u>0) + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "unlimited dimensions not in the lowest " + "dimensionality"); + space->u.simple.max = H5MM_xcalloc (sizeof(intn),rank); HDmemcpy(space->u.simple.max,dims,sizeof(intn)*rank); space->u.simple.dim_flags|=H5P_VALID_MAX; break; @@ -120,18 +120,18 @@ H5Tcreate (H5T_class_t type, size_t size) /* check args */ if (size<=0) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*invalid size*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid size"); } /* create the type */ if (NULL==(dt=H5T_create (type, size))) { - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL);/*can't create type*/ + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't create type"); } /* Make it an atom */ if ((ret_value=H5Aregister_atom (H5_DATATYPE, dt))<0) { - /* Can't register data type atom */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, + "can't register data type atom"); } FUNC_LEAVE (ret_value); @@ -169,16 +169,16 @@ H5T_create (H5T_class_t type, size_t size) case H5T_FIXED: /* Default type is a native `int' */ if (NULL==(dt=H5T_copy (H5Aatom_object (H5T_NATIVE_INT)))) { - /* Can't derive type from native int */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, + "can't derive type from native int"); } break; case H5T_FLOAT: /* Default type is a native `double' */ if (NULL==(dt=H5T_copy (H5Aatom_object (H5T_NATIVE_DOUBLE)))) { - /* Can't derive type from native double */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, + "can't derive type from native double"); } break; @@ -187,7 +187,8 @@ H5T_create (H5T_class_t type, size_t size) case H5T_BITFIELD: case H5T_OPAQUE: assert ("not implemented yet" && 0); - HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, NULL); + HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, NULL, + "not implemented yet"); case H5T_COMPOUND: dt = H5MM_xcalloc (1, sizeof(H5T_t)); @@ -195,8 +196,8 @@ H5T_create (H5T_class_t type, size_t size) break; default: - /* Unknown data type class */ - HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, NULL); + HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, NULL, + "unknown data type class"); } dt->size = size; @@ -236,7 +237,7 @@ H5Tget_num_members (hid_t type_id) if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(dt=H5Aatom_object (type_id)) || H5T_COMPOUND!=dt->type) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a compound data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); } FUNC_LEAVE (dt->u.compnd.nmembs); @@ -271,7 +272,7 @@ H5Tget_class (hid_t type_id) /* Check args */ if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(dt=H5Aatom_object (type_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } FUNC_LEAVE (dt->type); @@ -309,7 +310,7 @@ H5Tget_size (hid_t type_id) /* Check args */ if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(dt=H5Aatom_object (type_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } /* size */ @@ -391,23 +392,23 @@ H5Tinsert_member (hid_t parent_id, const char *name, off_t offset, if (H5_DATATYPE!=H5Aatom_group (parent_id) || NULL==(parent=H5Aatom_object (parent_id)) || H5T_COMPOUND!=parent->type) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a compound data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); } if (parent->locked) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*parent is locked*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "parent is locked"); } if (!name || !*name) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no member name*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no member name"); } if (H5_DATATYPE!=H5Aatom_group (member_id) || NULL==(member=H5Aatom_object (member_id)) || H5T_COMPOUND==member->type) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not an atomic data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } if (H5T_insert_member (parent, name, offset, member)<0) { - /* Can't insert member. */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL, + "can't insert member"); } FUNC_LEAVE (SUCCEED); @@ -451,8 +452,8 @@ H5T_insert_member (H5T_t *parent, const char *name, off_t offset, /* Does NAME already exist in PARENT? */ for (i=0; i<parent->u.compnd.nmembs; i++) { if (!HDstrcmp (parent->u.compnd.memb[i].name, name)) { - /* Member name is not unique */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINSERT, FAIL, + "member name is not unique"); } } @@ -507,19 +508,19 @@ H5Tcopy (hid_t type_id) /* check args */ if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(dt=H5Aatom_object (type_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } /* copy */ if (NULL==(new_dt = H5T_copy (dt))) { - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL); /*can't copy*/ + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't copy"); } /* atomize result */ if ((ret_value=H5Aregister_atom (H5_DATATYPE, new_dt))<0) { H5T_close (new_dt); - /* Can't register data type atom */ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL); + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, + "can't register data type atom"); } FUNC_LEAVE (ret_value); @@ -602,15 +603,15 @@ H5Tclose (hid_t type_id) /* check args */ if (H5_DATATYPE!=H5Aatom_group (type_id) || NULL==(dt=H5Aatom_object (type_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (dt->locked) { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*predefined data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "predefined data type"); } /* When the reference count reaches zero the resources are freed */ if (H5A_dec_ref (type_id)<0) { - HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*problem freeing id*/ + HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id"); } FUNC_LEAVE (SUCCEED); @@ -691,7 +692,7 @@ H5Tequal (hid_t type1_id, hid_t type2_id) NULL==(dt1=H5Aatom_object (type1_id)) || H5_DATATYPE!=H5Aatom_group (type2_id) || NULL==(dt2=H5Aatom_object (type2_id))) { - HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data type*/ + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } ret_value = (0==H5T_cmp (dt1, dt2)); diff --git a/src/H5detect.c b/src/H5detect.c index 18a8d60..be77339 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -351,8 +351,9 @@ H5T_init (void)\n\ /* Atomize the type */ printf ("\ if ((H5T_NATIVE_%s = H5Aregister_atom (H5_DATATYPE, dt))<0) {\n\ - /* Can't initialize type system - atom registration failure */\n\ - HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL);\n\ + HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,\n\ + \"can't initialize type system (atom registration \"\n\ + \"failure\");\n\ }\n", d[i].varname); diff --git a/src/H5private.h b/src/H5private.h index aaf2bf9..6972ebf 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -424,14 +424,16 @@ extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */ if (!library_initialize_g) { \ library_initialize_g = TRUE; \ if (H5_init_library()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "library initialization failed"); \ } \ } \ \ if (!thread_initialize_g) { \ thread_initialize_g = TRUE; \ if (H5_init_thread()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "thread initialization failed"); \ } \ } \ \ @@ -439,7 +441,8 @@ extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */ interface_initialize_g = TRUE; \ if (interface_init_func && \ ((herr_t(*)(void))interface_init_func)()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err); \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "interface initialization failed"); \ } \ } \ { diff --git a/src/Makefile.in b/src/Makefile.in index 33485cd..16086f2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -17,8 +17,9 @@ PROGS=debug LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5Dconv.c H5E.c H5F.c H5Fcore.c \ H5Ffamily.c H5Fistore.c H5Flow.c H5Fsec2.c H5Fsplit.c H5Fstdio.c \ H5G.c H5Gent.c H5Gnode.c H5Gshad.c H5Gstab.c H5H.c H5M.c H5MF.c \ - H5MM.c H5O.c H5Ocont.c H5Ocstore.c H5Oefl.c H5Oistore.c H5Oname.c \ - H5Onull.c H5Osdtyp.c H5Osdim.c H5Ostab.c H5P.c H5T.c H5Tinit.c H5V.c + H5MM.c H5O.c H5Ocont.c H5Ocstore.c H5Odtype.c H5Oefl.c H5Oistore.c \ + H5Oname.c H5Onull.c H5Osdspace.c H5Ostab.c H5P.c H5T.c H5Tinit.c \ + H5V.c LIB_OBJ=$(LIB_SRC:.c=.o) |