diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-29 05:36:16 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-29 05:36:16 (GMT) |
commit | e1747e456cf5605faeaab199cfbb3e72dca6cd40 (patch) | |
tree | 250395108e569cbcea9e749ab73ee90dd58b0234 | |
parent | fefbe61aca1a42e716e900be7af5b382be5e19c1 (diff) | |
download | hdf5-e1747e456cf5605faeaab199cfbb3e72dca6cd40.zip hdf5-e1747e456cf5605faeaab199cfbb3e72dca6cd40.tar.gz hdf5-e1747e456cf5605faeaab199cfbb3e72dca6cd40.tar.bz2 |
[svn-r11307] Purpose:
Code cleanup
Description:
Clean up internals of group creation & iteration code.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Mac OS X (nile)
Too minor to require h5committest
-rw-r--r-- | src/H5Fprivate.h | 8 | ||||
-rw-r--r-- | src/H5G.c | 32 | ||||
-rw-r--r-- | src/H5Gent.c | 7 | ||||
-rw-r--r-- | src/H5Gnode.c | 34 | ||||
-rw-r--r-- | src/H5Gpkg.h | 18 | ||||
-rw-r--r-- | src/H5Gstab.c | 40 | ||||
-rw-r--r-- | src/H5Opkg.h | 45 | ||||
-rw-r--r-- | src/H5Ostab.c | 7 | ||||
-rw-r--r-- | test/tmisc.c | 19 |
9 files changed, 105 insertions, 105 deletions
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index d3f6cd8..b9d9d74 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -52,13 +52,13 @@ typedef struct H5F_t H5F_t; */ # define INT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } # define UINT16ENCODE(p, i) { \ - *(p) = (uint8_t)( (i) & 0xff); (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ + *(p) = (uint8_t)( (unsigned)(i) & 0xff); (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++; \ } # define INT32ENCODE(p, i) { \ @@ -1578,25 +1578,21 @@ H5G_namei(const H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/ /* Reset group entry */ H5G_ent_reset(&new_ent); - /* Create the group entry */ + /* Create the intermediate group */ if (H5G_stab_create(grp_ent->file, dxpl_id, 0, &new_ent/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create grp"); /* Insert new group into current group's symbol table */ - if (H5G_stab_insert(grp_ent, H5G_comp_g, &new_ent, dxpl_id)) + if (H5G_stab_insert(grp_ent, H5G_comp_g, &new_ent, TRUE, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group"); - /* Close new group entry */ - if (H5O_close(&new_ent) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close"); - - /* Copy newly created group's entry, so we can traverse into it */ - if (H5G_ent_copy(obj_ent, &new_ent, H5G_COPY_NULL)<0) + /* Keep newly created group's entry, so we can traverse into it */ + if (H5G_ent_copy(obj_ent, &new_ent, H5G_COPY_DEEP)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry"); - /* Insert the name into the new symbol entry */ - if (H5G_stab_insert_name(grp_ent, obj_ent, H5G_comp_g ) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name"); + /* Close new group */ + if (H5O_close(&new_ent) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close"); } else HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found"); @@ -1604,7 +1600,7 @@ H5G_namei(const H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/ } /* end if */ else { did_insert = 1; - if (H5G_stab_insert(grp_ent, H5G_comp_g, ent, dxpl_id) < 0) + if (H5G_stab_insert(grp_ent, H5G_comp_g, ent, TRUE, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert name"); HGOTO_DONE(SUCCEED); } /* end else */ @@ -2341,12 +2337,6 @@ H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent, hid_t dxpl_id, if (H5G_namei(loc, name, NULL, NULL, NULL, target, NULL, H5G_NAMEI_INSERT, ent, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "already exists"); - /* - * Insert the object into a symbol table. - */ - if (H5O_link(ent, 1, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "unable to increment hard link count"); - done: FUNC_LEAVE_NOAPI(ret_value); } @@ -2642,8 +2632,10 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, * exist and the file is writable (because the local heap is * writable). But if it does, the only side effect is that the local * heap has some extra garbage in it. + * + * Note: We don't increment the link count of the destination object */ - if (H5G_stab_insert (&grp_ent, rest, &cur_obj, dxpl_id)<0) + if (H5G_stab_insert (&grp_ent, rest, &cur_obj, FALSE, dxpl_id)<0) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to create new name/link for object"); break; @@ -2651,7 +2643,7 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc, if (H5G_namei(cur_loc, norm_cur_name, NULL, NULL, &cur_obj, namei_flags, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found"); cur_obj_init=1; /* Indicate that the cur_obj struct is initialized */ - if (H5G_insert (new_loc, norm_new_name, &cur_obj, dxpl_id, 0)<0) + if (H5G_insert (new_loc, norm_new_name, &cur_obj, dxpl_id, NULL)<0) HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to create new name/link for object"); break; diff --git a/src/H5Gent.c b/src/H5Gent.c index ffc7a52..bcc7895 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -377,7 +377,8 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) * previous value in the destination. * H5G_COPY_SHALLOW - Copy all the fields from the source * to the destination, including the user path and - * canonical path. + * canonical path. (Destination "takes ownership" of + * user and canonical paths) * H5G_COPY_DEEP - Copy all the fields from the source to * the destination, deep copying the user and canonical * paths. @@ -416,8 +417,10 @@ H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5G_ent_copy_depth_t dept dst->user_path_r=NULL; dst->canon_path_r=NULL; } else if(depth==H5G_COPY_SHALLOW) { +#ifndef NDEBUG /* Discarding 'const' qualifier OK - QAK */ - H5G_ent_reset(src); + H5G_ent_reset((H5G_entry_t *)src); +#endif /* NDEBUG */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 214e3fe..7aac30a 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -996,18 +996,17 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key if (cmp) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found"); - if (bt_udata->operation==H5G_OPER_FIND) - /* - * The caller is querying the symbol entry, copy it into the UDATA - * entry field. (Hmm... should this use H5G_ent_copy()? - QAK) - */ - bt_udata->ent = sn->entry[idx]; - else - HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "internal erorr (unknown symbol find operation)"); + /* + * The caller is querying the symbol entry, copy it into the UDATA + * entry field. + * + * (do a NULL copy, since the entry's name will be constructed later) + */ + if (H5G_ent_copy(bt_udata->ent, &sn->entry[idx], H5G_COPY_NULL)<0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to copy entry"); done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, - H5AC__NO_FLAGS_SET) < 0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -1137,7 +1136,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, */ offset = H5HL_insert(f, dxpl_id, bt_udata->heap_addr, HDstrlen(bt_udata->name)+1, bt_udata->name); - bt_udata->ent.name_off = offset; + bt_udata->ent->name_off = offset; if (0==offset || (size_t)(-1)==offset) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert symbol name into heap"); if ((size_t)(sn->nsyms) >= 2*H5F_SYM_LEAF_K(f)) { @@ -1194,12 +1193,19 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, } } - /* Move entries */ + /* Move entries down to make room for new entry */ HDmemmove(insert_into->entry + idx + 1, insert_into->entry + idx, (insert_into->nsyms - idx) * sizeof(H5G_entry_t)); - H5G_ent_copy(&(insert_into->entry[idx]), &(bt_udata->ent),H5G_COPY_NULL); + + /* Copy new entry into table */ + /* (use H5G_COPY_NULL because we don't track the object names in the table) */ + H5G_ent_copy(&(insert_into->entry[idx]), bt_udata->ent, H5G_COPY_NULL); + + /* Flag entry as dirty */ insert_into->entry[idx].dirty = TRUE; + + /* Increment # of symbols in table */ insert_into->nsyms += 1; done: @@ -1844,7 +1850,7 @@ H5G_node_close(const H5F_t *f) /* Free the raw B-tree node buffer */ if (H5F_GRP_BTREE_SHARED(f)) - H5RC_DEC(H5F_GRP_BTREE_SHARED(f)); + H5RC_DEC(H5F_GRP_BTREE_SHARED(f)); FUNC_LEAVE_NOAPI(SUCCEED); } /* end H5G_node_close */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 78d1bbd..0bc7883 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -65,30 +65,17 @@ struct H5G_t { }; /* - * These operations can be passed down from the H5G_stab layer to the - * H5G_node layer through the B-tree layer. - */ -typedef enum H5G_oper_t { - H5G_OPER_FIND = 0, /*find a symbol */ - H5G_OPER_INSERT = 1, /*insert a new symbol */ - H5G_OPER_REMOVE = 2 /*remove existing symbol */ -} H5G_oper_t; - -/* * Data exchange structure for symbol table nodes. This structure is * passed through the B-link tree layer to the methods for the objects * to which the B-link tree points. */ typedef struct H5G_bt_ud1_t { - /* downward */ - H5G_oper_t operation; /*what operation to perform */ const char *name; /*points to temporary memory */ haddr_t heap_addr; /*symbol table heap address */ /* downward for INSERT, upward for FIND */ - H5G_entry_t ent; /*entry to insert into table */ - + H5G_entry_t *ent; /*entry to insert into table */ } H5G_bt_ud1_t; /* @@ -105,7 +92,6 @@ typedef struct H5G_bt_ud2_t { /* upward */ int final_ent; /*final entry looked at */ - } H5G_bt_ud2_t; /* @@ -141,7 +127,7 @@ H5_DLL herr_t H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5_DLL herr_t H5G_stab_find(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id); H5_DLL herr_t H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, - H5G_entry_t *obj_ent, hid_t dxpl_id); + H5G_entry_t *obj_ent, hbool_t inc_link, hid_t dxpl_id); H5_DLL herr_t H5G_stab_insert_name(H5G_entry_t *loc, H5G_entry_t *obj, const char *name); H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, haddr_t btree_addr, haddr_t heap_addr); diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 94378a8..1d813eb 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -153,31 +153,23 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name, /* Check arguments */ assert(grp_ent); assert(grp_ent->file); + assert(obj_ent); assert(name && *name); /* set up the udata */ if (NULL == H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message"); - udata.operation = H5G_OPER_FIND; udata.name = name; udata.heap_addr = stab.heap_addr; + udata.ent = obj_ent; /* search the B-tree */ - if (H5B_find(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0) { + if (H5B_find(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found"); - } /* end if */ - /* change OBJ_ENT only if found */ - else { - if (obj_ent) { - /* do a NULL copy, since the obj_ent name will be constructed in H5G_stab_insert_name() */ - if (H5G_ent_copy(obj_ent, &(udata.ent),H5G_COPY_NULL)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry"); - - /* insert the name into the symbol entry OBJ_ENT */ - if (H5G_stab_insert_name( grp_ent, obj_ent, name ) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name"); - } /* end if */ - } /* end else */ + + /* insert the name into the symbol entry OBJ_ENT */ + if (H5G_stab_insert_name( grp_ent, obj_ent, name ) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name"); done: FUNC_LEAVE_NOAPI(ret_value); @@ -207,7 +199,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hid_t dxpl_id) +H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, + hbool_t inc_link, hid_t dxpl_id) { H5O_stab_t stab; /*symbol table message */ H5G_bt_ud1_t udata; /*data to pass through B-tree */ @@ -230,17 +223,18 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hi if (NULL == H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); - udata.operation = H5G_OPER_INSERT; udata.name = name; udata.heap_addr = stab.heap_addr; - H5G_ent_copy(&(udata.ent),obj_ent,H5G_COPY_NULL); /* NULL copy here, no copies happens in H5G_node_insert() callback() */ + udata.ent = obj_ent; /* insert */ if (H5B_insert(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry"); - /* update the name offset in the entry */ - obj_ent->name_off = udata.ent.name_off; + /* Increment link count on object, if appropriate */ + if(inc_link) + if (H5O_link(obj_ent, 1, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "unable to increment hard link count") done: FUNC_LEAVE_NOAPI(ret_value); @@ -276,10 +270,9 @@ H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id) /* initialize data to pass through B-tree */ if (NULL==H5O_read(grp_ent, H5O_STAB_ID, 0, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); - udata.operation = H5G_OPER_REMOVE; udata.name = name; udata.heap_addr = stab.heap_addr; - HDmemset(&(udata.ent), 0, sizeof(udata.ent)); + udata.ent = NULL; /* remove */ if (H5B_remove(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata)<0) @@ -439,10 +432,9 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, haddr_t btree_addr, haddr_t heap_addr) assert(H5F_addr_defined(heap_addr)); /* Set up user data for B-tree deletion */ - HDmemset(&udata, 0, sizeof udata); - udata.operation = H5G_OPER_REMOVE; udata.name = NULL; udata.heap_addr = heap_addr; + udata.ent = NULL; /* Delete entire B-tree */ if(H5B_delete(f, dxpl_id, H5B_SNODE, btree_addr, &udata)<0) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 7217e53..df36d08 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -104,97 +104,100 @@ typedef struct H5O_t { } H5O_t; /* - * Null Message. + * Null Message. (0x0000) */ H5_DLLVAR const H5O_class_t H5O_NULL[1]; /* - * Simple Data Space Message. + * Simple Dataspace Message. (0x0001) */ H5_DLLVAR const H5O_class_t H5O_SDSPACE[1]; /* - * Data Type Message. + * Datatype Message. (0x0003) */ H5_DLLVAR const H5O_class_t H5O_DTYPE[1]; /* - * Old Fill Value Message. + * Old Fill Value Message. (0x0004) */ H5_DLLVAR const H5O_class_t H5O_FILL[1]; /* - * New Fill Value Message. The new fill value message is fill value plus + * New Fill Value Message. (0x0005) + * + * The new fill value message is fill value plus * space allocation time and fill value writing time and whether fill * value is defined. */ H5_DLLVAR const H5O_class_t H5O_FILL_NEW[1]; /* - * External File List Message + * External File List Message. (0x0007) */ H5_DLLVAR const H5O_class_t H5O_EFL[1]; /* - * Data Layout Message. + * Data Layout Message. (0x0008) */ H5_DLLVAR const H5O_class_t H5O_LAYOUT[1]; #ifdef H5O_ENABLE_BOGUS /* - * "Bogus" Message. + * "Bogus" Message. (0x0009) */ H5_DLLVAR const H5O_class_t H5O_BOGUS[1]; #endif /* H5O_ENABLE_BOGUS */ /* - * Filter pipeline message. + * Filter pipeline message. (0x000b) */ H5_DLLVAR const H5O_class_t H5O_PLINE[1]; /* - * Attribute Message. + * Attribute Message. (0x000c) */ H5_DLLVAR const H5O_class_t H5O_ATTR[1]; /* - * Object name message. + * Object name message. (0x000d) */ H5_DLLVAR const H5O_class_t H5O_NAME[1]; /* - * Modification time message. The message is just a `time_t'. + * Modification Time Message. (0x000e) + * + * The message is just a `time_t'. * (See also the "new" modification time message) */ H5_DLLVAR const H5O_class_t H5O_MTIME[1]; /* - * Shared object message. This message ID never really appears in an object + * Shared Object Message. (0x000f) + * + * This message ID never really appears in an object * header. Instead, bit 2 of the `Flags' field will be set and the ID field * will be the ID of the pointed-to message. */ H5_DLLVAR const H5O_class_t H5O_SHARED[1]; /* - * Object header continuation message. + * Object Header Continuation Message. (0x0010) */ H5_DLLVAR const H5O_class_t H5O_CONT[1]; /* - * Symbol table message. + * Symbol Table Message. (0x0011) */ H5_DLLVAR const H5O_class_t H5O_STAB[1]; /* - * New Modification time message. The message is just a `time_t'. + * New Modification Time Message. (0x0012) + * + * The message is just a `time_t'. */ H5_DLLVAR const H5O_class_t H5O_MTIME_NEW[1]; -/* - * Generic property list message. - */ -H5_DLLVAR const H5O_class_t H5O_PLIST[1]; - /* Package-local function prototypes */ H5_DLL void * H5O_read_real(const H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg, hid_t dxpl_id); diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 7bb06d5..e5996c6 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -32,7 +32,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Gpkg.h" /* Groups */ -#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ @@ -41,7 +40,7 @@ static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shar static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_stab_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_stab_size(const H5F_t *f, const void *_mesg); -static herr_t H5O_stab_free (void *_mesg); +static herr_t H5O_stab_free(void *_mesg); static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -72,7 +71,7 @@ H5FL_DEFINE_STATIC(H5O_stab_t); * Function: H5O_stab_decode * * Purpose: Decode a symbol table message and return a pointer to - * a new one created with malloc(). + * a newly allocated one. * * Return: Success: Ptr to new message in native order. * @@ -97,7 +96,7 @@ H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_t U /* check args */ assert(f); assert(p); - assert (!sh); + assert(!sh); /* decode */ if (NULL==(stab = H5FL_CALLOC(H5O_stab_t))) diff --git a/test/tmisc.c b/test/tmisc.c index d228452..e11bec2 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -256,6 +256,7 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset /* Definitions for misc. test #23 */ #define MISC23_FILE "tmisc23.h5" +#define MISC23_NAME_BUF_SIZE 40 /**************************************************************** ** @@ -3718,6 +3719,8 @@ test_misc23(void) hsize_t dims[] = {10}; hid_t file_id=0, group_id=0, type_id=0, space_id=0, tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT; + char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */ + H5G_stat_t sb; /* Output message about test being performed */ MESSAGE(5, ("Testing intermediate group creation\n")); @@ -3783,6 +3786,22 @@ test_misc23(void) tmp_id = H5Gcreate_expand(file_id, "/A/B01/grp", 0, create_id, access_id); CHECK(tmp_id, FAIL, "H5Gcreate_expand"); + /* Query that the name of the new group is correct */ + status = H5Iget_name( tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE ); + CHECK(status, FAIL, "H5Iget_name"); + VERIFY_STR(objname, "/A/B01/grp", "H5Iget_name"); + + status = H5Gclose(tmp_id); + CHECK(status, FAIL, "H5Gclose"); + + /* Check that intermediate group is set up correctly */ + tmp_id = H5Gopen(file_id, "/A/B01"); + CHECK(tmp_id, FAIL, "H5Gopen"); + + status = H5Gget_objinfo(tmp_id, ".", FALSE, &sb); + CHECK(status, FAIL, "H5Gget_objinfo"); + VERIFY(sb.u.obj.nlink,1,"H5Gget_objinfo"); + status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); |