mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[svn-r5947] Purpose:
Code cleanup Description: Clean up ID->name code: - Reformat to better match library coding standard - Changed several algorithms to be more efficient - Integrated into library more smoothly Platforms tested: eirene w/FORTRAN & C++ arabica w/FORTRAN modi4 w/FORTRAN & parallel sleipnir
This commit is contained in:
parent
f9c3920d28
commit
12e30dc9b2
18
src/H5A.c
18
src/H5A.c
@ -204,7 +204,7 @@ done:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added a deep copy of the symbol table entry
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static hid_t
|
||||
@ -244,9 +244,9 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type,
|
||||
/* Mark it initially set to initialized */
|
||||
attr->initialized = TRUE; /*for now, set to false later*/
|
||||
|
||||
/* Deep copy of the symbol table entry */
|
||||
if (H5G_ent_copy(ent,&(attr->ent))<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
|
||||
/* Deep copy of the symbol table entry */
|
||||
if (H5G_ent_copy(ent,&(attr->ent))<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
|
||||
|
||||
/* Compute the internal sizes */
|
||||
attr->dt_size=(H5O_DTYPE[0].raw_size)(attr->ent.file,type);
|
||||
@ -477,9 +477,9 @@ done:
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added a deep copy of the symbol table entry
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static hid_t
|
||||
@ -499,9 +499,9 @@ H5A_open(H5G_entry_t *ent, unsigned idx)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from dataset header");
|
||||
attr->initialized=1;
|
||||
|
||||
/* Deep copy of the symbol table entry */
|
||||
if (H5G_ent_copy(ent,&(attr->ent))<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
|
||||
/* Deep copy of the symbol table entry */
|
||||
if (H5G_ent_copy(ent,&(attr->ent))<0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
|
||||
|
||||
/* Hold the symbol table entry (and file) open */
|
||||
if (H5O_open(&(attr->ent)) < 0) {
|
||||
|
18
src/H5D.c
18
src/H5D.c
@ -1905,8 +1905,8 @@ done:
|
||||
* Quincey Koziol, 12 Oct 1998
|
||||
* Moved guts of function into H5D_open_oid
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1935,10 +1935,6 @@ H5D_open(H5G_entry_t *loc, const char *name)
|
||||
ret_value = dataset;
|
||||
|
||||
done:
|
||||
|
||||
/*Free the ID to name buffer */
|
||||
H5G_free_ent_name(&ent);
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
@ -1965,8 +1961,8 @@ done:
|
||||
* Feb 26, 2002
|
||||
* A new fill value message and two new properties are added.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added a deep copy of the symbol table entry
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added a deep copy of the symbol table entry
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1992,10 +1988,8 @@ H5D_open_oid(H5G_entry_t *ent)
|
||||
if(NULL==(dataset = H5D_new(H5P_DEFAULT)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
||||
|
||||
/* Deep copy of the symbol table entry */
|
||||
if (H5G_ent_copy(ent,&(dataset->ent))<0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to copy entry");
|
||||
|
||||
/* Shallow copy (take ownership) of the group entry object */
|
||||
HDmemcpy(&(dataset->ent),ent,sizeof(H5G_entry_t));
|
||||
|
||||
/* Find the dataset object */
|
||||
if (H5O_open(&(dataset->ent)) < 0)
|
||||
|
61
src/H5F.c
61
src/H5F.c
@ -1457,8 +1457,8 @@ done:
|
||||
* H5FL_FREE() aborts if called with a null pointer (unlike the
|
||||
* original H5MM_free()).
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1476,10 +1476,10 @@ H5F_dest(H5F_t *f)
|
||||
* the memory associated with it.
|
||||
*/
|
||||
if (f->shared->root_grp) {
|
||||
|
||||
/*Free the ID to name buffer */
|
||||
/* Free the ID to name buffer */
|
||||
H5G_free_grp_name(f->shared->root_grp);
|
||||
|
||||
/* Free the memory for the root group */
|
||||
H5FL_FREE(H5G_t,f->shared->root_grp);
|
||||
f->shared->root_grp=NULL;
|
||||
}
|
||||
@ -2813,6 +2813,9 @@ done:
|
||||
* Robb Matzke, 1998-10-14
|
||||
* The reference count for the mounted H5F_t is incremented.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
@ -2894,6 +2897,11 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child,
|
||||
child->mtab.parent = parent;
|
||||
child->nrefs++;
|
||||
|
||||
/* Search the open IDs and replace names for mount operation */
|
||||
/* We pass H5G_UNKNOWN as object type; search all IDs */
|
||||
if (H5G_replace_name( H5G_UNKNOWN, loc, name, NULL, OP_MOUNT )<0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to replace name");
|
||||
|
||||
done:
|
||||
if (ret_value<0 && mount_point)
|
||||
H5G_close(mount_point);
|
||||
@ -2920,12 +2928,12 @@ done:
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Robb Matzke, 1998-10-14
|
||||
* The ref count for the child is decremented by calling H5F_close().
|
||||
* Robb Matzke, 1998-10-14
|
||||
* The ref count for the child is decremented by calling H5F_close().
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
@ -2965,10 +2973,9 @@ H5F_unmount(H5G_entry_t *loc, const char *name)
|
||||
parent = child->mtab.parent;
|
||||
for (i=0; i<parent->mtab.nmounts; i++) {
|
||||
if (parent->mtab.child[i].file==child) {
|
||||
|
||||
/* Search the symbol table entry list and replace names through group IDs */
|
||||
if (H5G_replace_name( H5G_UNKNOWN, loc, name, NULL, OP_UNMOUNT )<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to replace name ");
|
||||
/* Search the open IDs replace names to reflect unmount operation */
|
||||
if (H5G_replace_name( H5G_UNKNOWN, loc, name, NULL, OP_UNMOUNT )<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to replace name ");
|
||||
|
||||
/* Unmount the child */
|
||||
parent->mtab.nmounts -= 1;
|
||||
@ -3038,9 +3045,9 @@ done:
|
||||
* Tuesday, October 6, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -3051,7 +3058,6 @@ H5F_mountpoint(H5G_entry_t *find/*in,out*/)
|
||||
int lt, rt, md=(-1), cmp;
|
||||
H5G_entry_t *ent = NULL;
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
char *tmp;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5F_mountpoint, FAIL);
|
||||
|
||||
@ -3082,10 +3088,19 @@ H5F_mountpoint(H5G_entry_t *find/*in,out*/)
|
||||
|
||||
/* Copy root info over to ENT */
|
||||
if (0==cmp) {
|
||||
char *tmp_name, *tmp_old_name; /* Temporary string pointers for entry's name and "old name"*/
|
||||
|
||||
/* Get the entry for the root group in the child's file */
|
||||
ent = H5G_entof(parent->mtab.child[md].file->shared->root_grp);
|
||||
tmp = find->name;
|
||||
|
||||
/* Don't lose the name of the group when we copy the root group's entry */
|
||||
tmp_name = find->name;
|
||||
tmp_old_name = find->old_name;
|
||||
*find = *ent;
|
||||
find->name = tmp;
|
||||
find->name = tmp_name;
|
||||
find->old_name = tmp_old_name;
|
||||
|
||||
/* Switch to child's file */
|
||||
parent = ent->file;
|
||||
}
|
||||
} while (!cmp);
|
||||
@ -3107,9 +3122,6 @@ done:
|
||||
* Tuesday, October 6, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -3139,11 +3151,6 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
|
||||
if (H5F_mount(loc, name, child, plist_id)<0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file");
|
||||
|
||||
/* Search the symbol table entry list and replace names through group IDs */
|
||||
/* We pass H5G_UNKNOWN as object type; search all IDs */
|
||||
if (H5G_replace_name( H5G_UNKNOWN, loc, name, NULL, OP_MOUNT )<0)
|
||||
HRETURN_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to replace name ");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
30
src/H5Gent.c
30
src/H5Gent.c
@ -337,8 +337,7 @@ done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_ent_copy
|
||||
*
|
||||
@ -356,33 +355,28 @@ done:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
herr_t
|
||||
H5G_ent_copy( const H5G_entry_t *src, H5G_entry_t *dst )
|
||||
{
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
FUNC_ENTER_NOAPI(H5G_ent_copy, FAIL);
|
||||
|
||||
FUNC_ENTER_NOAPI(H5G_ent_copy, FAIL);
|
||||
/* check arguments */
|
||||
assert( src );
|
||||
assert( dst );
|
||||
|
||||
assert( src );
|
||||
assert( dst );
|
||||
/* Copy the top level information */
|
||||
HDmemcpy(dst,src,sizeof(H5G_entry_t));
|
||||
|
||||
HDmemcpy(dst,src,sizeof(H5G_entry_t));
|
||||
/* Deep copy the names */
|
||||
dst->name=H5MM_xstrdup(src->name);
|
||||
dst->old_name=H5MM_xstrdup(src->old_name);
|
||||
|
||||
if (src->name){
|
||||
dst->name=H5MM_strdup(src->name);
|
||||
}
|
||||
if (src->old_name){
|
||||
dst->old_name=H5MM_strdup(src->old_name);
|
||||
}
|
||||
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_ent_debug
|
||||
|
@ -324,9 +324,9 @@ done:
|
||||
* Added dxpl parameter to allow more control over I/O from metadata
|
||||
* cache.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
@ -401,11 +401,9 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_
|
||||
* preempted from the cache.
|
||||
*/
|
||||
if (destroy) {
|
||||
|
||||
/*Free the ID to name buffer */
|
||||
for (i=0; i<sym->nsyms; i++) {
|
||||
H5G_free_ent_name(&(sym->entry[i]));
|
||||
}
|
||||
/* Free the ID to name buffer */
|
||||
for (i=0; i<sym->nsyms; i++)
|
||||
H5G_free_ent_name(&(sym->entry[i]));
|
||||
|
||||
sym->entry = H5FL_ARR_FREE(H5G_entry_t,sym->entry);
|
||||
H5FL_FREE(H5G_node_t,sym);
|
||||
@ -858,7 +856,7 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key,
|
||||
HDmemmove(insert_into->entry + idx + 1,
|
||||
insert_into->entry + idx,
|
||||
(insert_into->nsyms - idx) * sizeof(H5G_entry_t));
|
||||
insert_into->entry[idx] = bt_udata->ent;
|
||||
H5G_ent_copy(&(bt_udata->ent), &(insert_into->entry[idx])); /* Deep copy the entry */
|
||||
insert_into->entry[idx].dirty = TRUE;
|
||||
insert_into->nsyms += 1;
|
||||
|
||||
@ -889,12 +887,12 @@ done:
|
||||
* Thursday, September 24, 1998
|
||||
*
|
||||
* Modifications:
|
||||
* Robb Matzke, 1999-07-28
|
||||
* The ADDR argument is passed by value.
|
||||
* Robb Matzke, 1999-07-28
|
||||
* The ADDR argument is passed by value.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static H5B_ins_t
|
||||
@ -959,8 +957,8 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/,
|
||||
H5HL_remove(f, bt_udata->heap_addr, sn->entry[idx].name_off, HDstrlen(s)+1);
|
||||
H5E_clear(); /*no big deal*/
|
||||
|
||||
/*Free the ID to name buffer */
|
||||
H5G_free_ent_name(sn->entry+idx);
|
||||
/* Free the ID to name buffer for the entry being squeezed out */
|
||||
H5G_free_ent_name(sn->entry+idx);
|
||||
|
||||
/* Remove the entry from the symbol table node */
|
||||
if (1==sn->nsyms) {
|
||||
|
@ -11,9 +11,9 @@
|
||||
* Purpose: Library-visible declarations.
|
||||
*
|
||||
* Modifications: Aug 22, 2002
|
||||
* Pedro Vicente <pvn@ncsa.uiuc.edu>
|
||||
* Added 'names' field to H5G_entry_t
|
||||
* Added H5G_replace_name
|
||||
* Pedro Vicente <pvn@ncsa.uiuc.edu>
|
||||
* Added 'names' field to H5G_entry_t
|
||||
* Added H5G_replace_name
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -112,24 +112,13 @@ typedef struct H5G_typeinfo_t {
|
||||
char *desc; /*description of object type */
|
||||
} H5G_typeinfo_t;
|
||||
|
||||
|
||||
typedef enum H5G_names_op_t {
|
||||
OP_MOVE = 0, /* H5*move call */
|
||||
OP_LINK = 1, /* H5Glink call */
|
||||
OP_UNLINK = 2, /* H5Gunlink call */
|
||||
OP_MOUNT = 3, /* H5Fmount call */
|
||||
OP_UNMOUNT= 4 /* H5Funmount call */
|
||||
}H5G_names_op_t;
|
||||
|
||||
/* Struct only used by change name callback function */
|
||||
typedef struct H5G_names_t {
|
||||
H5I_type_t obj_type;
|
||||
const char *src_name;
|
||||
const char *dst_name;
|
||||
H5G_entry_t *loc;
|
||||
H5G_names_op_t op;
|
||||
} H5G_names_t;
|
||||
|
||||
/* Type of operation being performed for call to H5G_replace_name() */
|
||||
typedef enum H5G_names_op_t {
|
||||
OP_MOVE = 0, /* H5*move call */
|
||||
OP_UNLINK, /* H5Gunlink call */
|
||||
OP_MOUNT, /* H5Fmount call */
|
||||
OP_UNMOUNT /* H5Funmount call */
|
||||
} H5G_names_op_t;
|
||||
|
||||
/*
|
||||
* Library prototypes... These are the ones that other packages routinely
|
||||
@ -176,6 +165,12 @@ H5_DLL herr_t H5G_traverse_slink(H5G_entry_t *grp_ent/*in,out*/,
|
||||
H5_DLL herr_t H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent);
|
||||
H5_DLL herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp,
|
||||
H5G_entry_t *ent/*out*/);
|
||||
H5_DLL herr_t H5G_replace_name(int type, H5G_entry_t *loc, const char *src_name,
|
||||
const char *dst_name, H5G_names_op_t op);
|
||||
H5_DLL herr_t H5G_insert_name(H5G_entry_t *loc, H5G_entry_t *obj, const char *name);
|
||||
H5_DLL herr_t H5G_ent_copy(const H5G_entry_t *src, H5G_entry_t *dst );
|
||||
H5_DLL herr_t H5G_free_grp_name(H5G_t *grp);
|
||||
H5_DLL herr_t H5G_free_ent_name(H5G_entry_t *ent);
|
||||
|
||||
/*
|
||||
* These functions operate on symbol table nodes.
|
||||
@ -192,11 +187,4 @@ H5_DLL H5G_cache_t *H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type);
|
||||
H5_DLL herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type);
|
||||
H5_DLL herr_t H5G_ent_debug(H5F_t *f, const H5G_entry_t *ent, FILE * stream,
|
||||
int indent, int fwidth, haddr_t heap);
|
||||
H5_DLL herr_t H5G_replace_name( int type, H5G_entry_t *loc, const char *src_name,
|
||||
const char *dst_name, int op );
|
||||
H5_DLL herr_t H5G_insert_name( H5G_entry_t *loc, H5G_entry_t *obj, const char *name);
|
||||
H5_DLL herr_t H5G_ent_copy( const H5G_entry_t *src, H5G_entry_t *dst );
|
||||
/*Free the ID to name buffer */
|
||||
H5_DLL herr_t H5G_free_grp_name(H5G_t *grp);
|
||||
H5_DLL herr_t H5G_free_ent_name(H5G_entry_t *ent);
|
||||
#endif
|
||||
|
@ -121,9 +121,9 @@ done:
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
* Added a deep copy of the symbol table entry
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
* Added a deep copy of the symbol table entry
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -135,8 +135,6 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
|
||||
H5O_stab_t stab; /*symbol table message */
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
|
||||
obj_ent->name=NULL;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5G_stab_find, FAIL);
|
||||
|
||||
/* Check arguments */
|
||||
@ -153,27 +151,20 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
|
||||
|
||||
/* search the B-tree */
|
||||
if (H5B_find(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata) < 0) {
|
||||
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
|
||||
}
|
||||
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
|
||||
} /* end if */
|
||||
/* change OBJ_ENT only if found */
|
||||
else
|
||||
{
|
||||
if (obj_ent) {
|
||||
|
||||
/* do a deep copy */
|
||||
if (H5G_ent_copy( &(udata.ent), obj_ent )<0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
|
||||
|
||||
/* insert the name into the symbol entry OBJ_ENT */
|
||||
if (H5G_insert_name( grp_ent, obj_ent, name ) < 0) {
|
||||
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
|
||||
"cannot insert name");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (obj_ent) {
|
||||
/* do a deep copy */
|
||||
if (H5G_ent_copy( &(udata.ent), obj_ent )<0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
|
||||
|
||||
/* insert the name into the symbol entry OBJ_ENT */
|
||||
if (H5G_insert_name( grp_ent, obj_ent, name ) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
|
||||
} /* end if */
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
@ -197,8 +188,8 @@ done:
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -225,10 +216,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent)
|
||||
udata.operation = H5G_OPER_INSERT;
|
||||
udata.name = name;
|
||||
udata.heap_addr = stab.heap_addr;
|
||||
|
||||
/* Deep copy */
|
||||
H5G_ent_copy(obj_ent, &udata.ent);
|
||||
|
||||
udata.ent = *obj_ent; /* Shallow copy here, deep copy happens in H5G_node_insert() callback() */
|
||||
|
||||
/* insert */
|
||||
if (H5B_insert(grp_ent->file, H5B_SNODE, stab.btree_addr, split_ratios, &udata) < 0)
|
||||
@ -237,11 +225,9 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent)
|
||||
/* update the name offset in the entry */
|
||||
obj_ent->name_off = udata.ent.name_off;
|
||||
|
||||
/* insert the name into the symbol entry OBJ_ENT */
|
||||
if (H5G_insert_name( grp_ent, obj_ent, name ) < 0) {
|
||||
HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
|
||||
"cannot insert name");
|
||||
}
|
||||
/* insert the name into the symbol entry OBJ_ENT */
|
||||
if(H5G_insert_name(grp_ent, obj_ent, name) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
|
400
src/H5I.c
400
src/H5I.c
@ -37,15 +37,16 @@
|
||||
#include "H5FLprivate.h" /*Free Lists */
|
||||
#include "H5MMprivate.h"
|
||||
|
||||
/* Define this to compile in support for dumping ID information */
|
||||
/* #define H5I_DEBUG_OUTPUT */
|
||||
#ifndef H5I_DEBUG_OUTPUT
|
||||
#include "H5Gprivate.h" /*symbol tables */
|
||||
#else /* H5I_DEBUG_OUTPUT */
|
||||
#define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */
|
||||
#define H5I_DEBUG_OUTPUT
|
||||
|
||||
|
||||
#include "H5Gprivate.h" /*symbol tables */
|
||||
#include "H5Gpkg.h"
|
||||
#include "H5Dprivate.h" /*datasets */
|
||||
#include "H5Tprivate.h" /*data types */
|
||||
#include "H5Aprivate.h" /*attributes */
|
||||
#endif /* H5I_DEBUG_OUTPUT */
|
||||
|
||||
/* Interface initialialization? */
|
||||
#define PABLO_MASK H5I_mask
|
||||
@ -1117,9 +1118,7 @@ done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Iget_name
|
||||
*
|
||||
@ -1145,44 +1144,36 @@ done:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size)
|
||||
ssize_t
|
||||
H5Iget_name(hid_t id, char *name/*out*/, size_t size)
|
||||
{
|
||||
H5G_entry_t *ent; /*symbol table entry */
|
||||
size_t len=0;
|
||||
size_t count;
|
||||
ssize_t ret_value;
|
||||
|
||||
FUNC_ENTER_API (H5Iget_name, FAIL);
|
||||
|
||||
/* get symbol table entry */
|
||||
if ( NULL== ( ent = H5G_loc( id )))
|
||||
goto done;
|
||||
|
||||
if ( ent->name != NULL ) {
|
||||
|
||||
len = HDstrlen(ent->name);
|
||||
count = MIN(len+1,size);
|
||||
|
||||
if ( name ) {
|
||||
HDstrncpy( name, ent->name, count );
|
||||
if ( len >= size ) {
|
||||
name[size-1]='\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0;
|
||||
}
|
||||
|
||||
H5G_entry_t *ent; /*symbol table entry */
|
||||
size_t len=0;
|
||||
ssize_t ret_value;
|
||||
|
||||
FUNC_ENTER_API (H5Iget_name, FAIL);
|
||||
|
||||
/* get symbol table entry */
|
||||
if(NULL!=(ent = H5G_loc(id))) {
|
||||
if (ent->name != NULL) {
|
||||
len = HDstrlen(ent->name);
|
||||
|
||||
if(name) {
|
||||
HDstrncpy(name, ent->name, MIN(len+1,size));
|
||||
if(len >= size)
|
||||
name[size-1]='\0';
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
/* Set return value */
|
||||
ret_value=len;
|
||||
|
||||
done:
|
||||
ret_value = len;
|
||||
FUNC_LEAVE( ret_value );
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5I_debug
|
||||
*
|
||||
@ -1197,8 +1188,8 @@ done:
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1206,265 +1197,70 @@ done:
|
||||
static herr_t
|
||||
H5I_debug(H5I_type_t grp)
|
||||
{
|
||||
H5I_id_group_t *grp_ptr;
|
||||
H5I_id_info_t *cur;
|
||||
int is, js;
|
||||
unsigned int iu;
|
||||
herr_t ret_value; /* Return value */
|
||||
|
||||
|
||||
H5G_entry_t *ent = NULL;
|
||||
|
||||
FUNC_ENTER_API(H5I_debug, FAIL);
|
||||
|
||||
fprintf(stderr, "Dumping group %d\n", (int)grp);
|
||||
grp_ptr = H5I_id_group_list_g[grp];
|
||||
|
||||
/* Header */
|
||||
fprintf(stderr, " count = %u\n", grp_ptr->count);
|
||||
fprintf(stderr, " reserved = %u\n", grp_ptr->reserved);
|
||||
fprintf(stderr, " wrapped = %u\n", grp_ptr->wrapped);
|
||||
fprintf(stderr, " hash_size = %lu\n",
|
||||
(unsigned long)grp_ptr->hash_size);
|
||||
fprintf(stderr, " ids = %u\n", grp_ptr->ids);
|
||||
fprintf(stderr, " nextid = %u\n", grp_ptr->nextid);
|
||||
|
||||
/* Cache */
|
||||
fprintf(stderr, " Cache:\n");
|
||||
for (is=0; is<ID_CACHE_SIZE; is++) {
|
||||
if (H5I_cache_g[is] && H5I_GROUP(H5I_cache_g[is]->id)==grp) {
|
||||
fprintf(stderr, " Entry-%d, ID=%lu\n",
|
||||
is, (unsigned long)(H5I_cache_g[is]->id));
|
||||
}
|
||||
}
|
||||
|
||||
/* List */
|
||||
fprintf(stderr, " List:\n");
|
||||
for (iu=0; iu<grp_ptr->hash_size; iu++) {
|
||||
for (js=0, cur=grp_ptr->id_list[iu]; cur; cur=cur->next, js++) {
|
||||
fprintf(stderr, " #%u.%d\n", iu, js);
|
||||
fprintf(stderr, " id = %lu\n",
|
||||
(unsigned long)(cur->id));
|
||||
fprintf(stderr, " count = %u\n", cur->count);
|
||||
fprintf(stderr, " obj = 0x%08lx\n",
|
||||
(unsigned long)(cur->obj_ptr));
|
||||
|
||||
|
||||
switch(grp) {
|
||||
|
||||
case H5I_GROUP:
|
||||
ent = H5G_entof((H5G_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATASET:
|
||||
ent = H5D_entof((H5D_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATATYPE:
|
||||
ent = H5T_entof((H5T_t*)cur->obj_ptr);
|
||||
break;
|
||||
default:
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
|
||||
"unknown data object");
|
||||
}/* switch*/
|
||||
|
||||
fprintf(stderr, "name = %s\n",ent->name);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
H5I_id_group_t *grp_ptr;
|
||||
H5I_id_info_t *cur;
|
||||
H5G_entry_t *ent = NULL;
|
||||
int is, js;
|
||||
unsigned int iu;
|
||||
herr_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(H5I_debug, FAIL);
|
||||
|
||||
fprintf(stderr, "Dumping group %d\n", (int)grp);
|
||||
grp_ptr = H5I_id_group_list_g[grp];
|
||||
|
||||
/* Header */
|
||||
fprintf(stderr, " count = %u\n", grp_ptr->count);
|
||||
fprintf(stderr, " reserved = %u\n", grp_ptr->reserved);
|
||||
fprintf(stderr, " wrapped = %u\n", grp_ptr->wrapped);
|
||||
fprintf(stderr, " hash_size = %lu\n", (unsigned long)grp_ptr->hash_size);
|
||||
fprintf(stderr, " ids = %u\n", grp_ptr->ids);
|
||||
fprintf(stderr, " nextid = %u\n", grp_ptr->nextid);
|
||||
|
||||
/* Cache */
|
||||
fprintf(stderr, " Cache:\n");
|
||||
for (is=0; is<ID_CACHE_SIZE; is++) {
|
||||
if (H5I_cache_g[is] && H5I_GROUP(H5I_cache_g[is]->id)==grp) {
|
||||
fprintf(stderr, " Entry-%d, ID=%lu\n",
|
||||
is, (unsigned long)(H5I_cache_g[is]->id));
|
||||
}
|
||||
}
|
||||
|
||||
/* List */
|
||||
fprintf(stderr, " List:\n");
|
||||
for (iu=0; iu<grp_ptr->hash_size; iu++) {
|
||||
for (js=0, cur=grp_ptr->id_list[iu]; cur; cur=cur->next, js++) {
|
||||
fprintf(stderr, " #%u.%d\n", iu, js);
|
||||
fprintf(stderr, " id = %lu\n", (unsigned long)(cur->id));
|
||||
fprintf(stderr, " count = %u\n", cur->count);
|
||||
fprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(cur->obj_ptr));
|
||||
|
||||
/* Get the symbol table entry, so we get get the name */
|
||||
switch(grp) {
|
||||
case H5I_GROUP:
|
||||
ent = H5G_entof((H5G_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATASET:
|
||||
ent = H5D_entof((H5D_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATATYPE:
|
||||
ent = H5T_entof((H5T_t*)cur->obj_ptr);
|
||||
break;
|
||||
default:
|
||||
continue; /* Other types of IDs are not stored in files */
|
||||
} /* end switch*/
|
||||
|
||||
if(ent) {
|
||||
if(ent->name)
|
||||
fprintf(stderr, " name = %s\n",ent->name);
|
||||
if(ent->old_name)
|
||||
fprintf(stderr, " old_name = %s\n",ent->old_name);
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
} /* end for */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
#endif /* H5I_DEBUG_OUTPUT */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5I_debug_grp
|
||||
*
|
||||
* Purpose: Dump the contents of a group to stderr for debugging
|
||||
*
|
||||
* Return: Success: 0, Failure: -1
|
||||
*
|
||||
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
||||
*
|
||||
* Date: July 26, 2002
|
||||
*
|
||||
* Comments: Public function
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef H5I_DEBUG_OUTPUT
|
||||
herr_t H5Idebug_grp(H5I_type_t grp)
|
||||
{
|
||||
H5I_id_group_t *grp_ptr;
|
||||
H5I_id_info_t *cur;
|
||||
int is, js;
|
||||
unsigned int iu;
|
||||
herr_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(H5Idebug_grp, FAIL);
|
||||
|
||||
fprintf(stderr, "Dumping group %d\n", (int)grp);
|
||||
grp_ptr = H5I_id_group_list_g[grp];
|
||||
|
||||
/* Header */
|
||||
fprintf(stderr, " count = %u\n", grp_ptr->count);
|
||||
fprintf(stderr, " reserved = %u\n", grp_ptr->reserved);
|
||||
fprintf(stderr, " wrapped = %u\n", grp_ptr->wrapped);
|
||||
fprintf(stderr, " hash_size = %lu\n",
|
||||
(unsigned long)grp_ptr->hash_size);
|
||||
fprintf(stderr, " ids = %u\n", grp_ptr->ids);
|
||||
fprintf(stderr, " nextid = %u\n", grp_ptr->nextid);
|
||||
|
||||
/* Cache */
|
||||
fprintf(stderr, " Cache:\n");
|
||||
for (is=0; is<ID_CACHE_SIZE; is++) {
|
||||
if (H5I_cache_g[is] && H5I_GROUP(H5I_cache_g[is]->id)==grp) {
|
||||
fprintf(stderr, " Entry-%d, ID=%lu\n",
|
||||
is, (unsigned long)(H5I_cache_g[is]->id));
|
||||
}
|
||||
}
|
||||
|
||||
/* List */
|
||||
fprintf(stderr, " List:\n");
|
||||
for (iu=0; iu<grp_ptr->hash_size; iu++) {
|
||||
for (js=0, cur=grp_ptr->id_list[iu]; cur; cur=cur->next, js++) {
|
||||
|
||||
/* avoid no named datatypes */
|
||||
if( grp==H5I_DATATYPE && H5T_is_immutable((H5T_t*)cur->obj_ptr))
|
||||
break;
|
||||
|
||||
|
||||
fprintf(stderr, " #%u.%d\n", iu, js);
|
||||
fprintf(stderr, " id = %lu\n",
|
||||
(unsigned long)(cur->id));
|
||||
fprintf(stderr, " count = %u\n", cur->count);
|
||||
fprintf(stderr, " obj = 0x%08lx\n",
|
||||
(unsigned long)(cur->obj_ptr));
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
#endif /* H5I_DEBUG_OUTPUT */
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Idebug_name
|
||||
*
|
||||
* Purpose: Dump the contents of a group to stderr for debugging
|
||||
*
|
||||
* Return: Success: 0, Failure: -1
|
||||
*
|
||||
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
||||
*
|
||||
* Date: July 26, 2002
|
||||
*
|
||||
* Comments: Public function
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef H5I_DEBUG_OUTPUT
|
||||
herr_t H5Idebug_name(hid_t id)
|
||||
{
|
||||
|
||||
H5I_type_t grp_type; /* group type */
|
||||
H5I_id_group_t *grp_ptr; /* ptr to the atomic group */
|
||||
H5I_id_info_t *cur=NULL; /* Current node being worked with */
|
||||
H5I_id_info_t *next=NULL; /* Next node in list */
|
||||
unsigned i;
|
||||
|
||||
H5G_entry_t *ent = NULL;
|
||||
H5G_t *group=NULL;
|
||||
H5T_t *dt=NULL;
|
||||
H5D_t *dset=NULL;
|
||||
herr_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API (H5Idebug_name, FAIL);
|
||||
|
||||
grp_type = H5I_get_type(id);
|
||||
|
||||
/* Check it */
|
||||
if (grp_type <= H5I_BADID || grp_type >= H5I_NGROUPS) {
|
||||
HRETURN(FAIL);
|
||||
}
|
||||
|
||||
grp_ptr = H5I_id_group_list_g[grp_type];
|
||||
if (grp_ptr == NULL || grp_ptr->count <= 0) {
|
||||
HRETURN(FAIL);
|
||||
}
|
||||
|
||||
/* Cache */
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "Cache:\n");
|
||||
for (i=0; i<ID_CACHE_SIZE; i++) {
|
||||
if (H5I_cache_g[i] && H5I_GROUP(H5I_cache_g[i]->id)==grp_type) {
|
||||
|
||||
cur = H5I_cache_g[i];
|
||||
fprintf(stderr, " Entry-%d, ID=%lu\n", i, cur->id);
|
||||
|
||||
switch(grp_type) {
|
||||
case H5I_GROUP:
|
||||
ent = H5G_entof((H5G_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATASET:
|
||||
ent = H5D_entof((H5D_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATATYPE:
|
||||
ent = H5T_entof((H5T_t*)cur->obj_ptr);
|
||||
break;
|
||||
default:
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
|
||||
"unknown data object");
|
||||
}/* switch*/
|
||||
|
||||
fprintf(stderr, "name = %s\n",ent->name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* List */
|
||||
fprintf(stderr, "List:\n");
|
||||
for (i=0; i<grp_ptr->hash_size; i++) {
|
||||
for (cur=grp_ptr->id_list[i]; cur; cur=next) {
|
||||
|
||||
switch(grp_type) {
|
||||
|
||||
case H5I_GROUP:
|
||||
ent = H5G_entof((H5G_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATASET:
|
||||
ent = H5D_entof((H5D_t*)cur->obj_ptr);
|
||||
break;
|
||||
case H5I_DATATYPE:
|
||||
ent = H5T_entof((H5T_t*)cur->obj_ptr);
|
||||
break;
|
||||
default:
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
|
||||
"unknown data object");
|
||||
}/* switch*/
|
||||
|
||||
/* can be NULL in case of named datatypes */
|
||||
if (ent)
|
||||
{
|
||||
fprintf(stderr, "id = %lu\n",(unsigned long)(cur->id));
|
||||
fprintf(stderr, "name = %s\n",ent->name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
#endif /* H5I_DEBUG_OUTPUT */
|
@ -51,12 +51,9 @@ typedef int hid_t;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public API functions */
|
||||
H5_DLL H5I_type_t H5Iget_type(hid_t id);
|
||||
H5_DLL ssize_t H5Iget_name(hid_t object_id, char *name/*out*/, size_t size);
|
||||
H5_DLL herr_t H5Idebug_name(hid_t id);
|
||||
H5_DLL herr_t H5Idebug_grp(H5I_type_t grp);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
14
src/H5MM.c
14
src/H5MM.c
@ -98,18 +98,20 @@ done:
|
||||
char *
|
||||
H5MM_xstrdup(const char *s)
|
||||
{
|
||||
char *ret_value;
|
||||
char *ret_value=NULL;
|
||||
|
||||
/* Use FUNC_ENTER_NOINIT here to avoid performance issues */
|
||||
FUNC_ENTER_NOINIT(H5MM_xstrdup);
|
||||
|
||||
if (!s)
|
||||
HGOTO_DONE(NULL);
|
||||
ret_value = H5MM_malloc(HDstrlen(s) + 1);
|
||||
assert (ret_value);
|
||||
HDstrcpy(ret_value, s);
|
||||
if (s) {
|
||||
ret_value = H5MM_malloc(HDstrlen(s) + 1);
|
||||
assert (ret_value);
|
||||
HDstrcpy(ret_value, s);
|
||||
} /* end if */
|
||||
|
||||
#ifdef LATER
|
||||
done:
|
||||
#endif /* LATER */
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
@ -269,8 +269,8 @@ done:
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -311,10 +311,7 @@ H5O_close(H5G_entry_t *obj_ent)
|
||||
|
||||
|
||||
/* Free the ID to name buffers */
|
||||
if ( obj_ent->name )
|
||||
obj_ent->name = H5MM_xfree(obj_ent->name);
|
||||
if ( obj_ent->old_name )
|
||||
obj_ent->old_name = H5MM_xfree(obj_ent->old_name);
|
||||
H5G_free_ent_name(obj_ent);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
|
@ -1108,8 +1108,8 @@ done:
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added `id to name' support.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1126,13 +1126,15 @@ H5O_dtype_set_share (H5F_t UNUSED *f, void *_mesg/*in,out*/,
|
||||
assert (sh);
|
||||
assert (!sh->in_gh);
|
||||
|
||||
dt->ent = sh->u.ent;
|
||||
/* Shallow copy the symbol table entry */
|
||||
dt->ent = sh->u.ent;
|
||||
|
||||
dt->ent.name = NULL;
|
||||
dt->ent.old_name = NULL;
|
||||
|
||||
dt->state = H5T_STATE_NAMED;
|
||||
/* Reset the names of the copied symbol table entry */
|
||||
dt->ent.name = NULL;
|
||||
dt->ent.old_name = NULL;
|
||||
|
||||
/* Note that the datatype is a named datatype */
|
||||
dt->state = H5T_STATE_NAMED;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE (ret_value);
|
||||
|
52
src/H5T.c
52
src/H5T.c
@ -5360,7 +5360,7 @@ H5T_open_oid (H5G_entry_t *ent)
|
||||
|
||||
/* Mark the type as named and open */
|
||||
dt->state = H5T_STATE_OPEN;
|
||||
dt->ent = *ent;
|
||||
dt->ent = *ent;
|
||||
|
||||
/* Set return value */
|
||||
ret_value=dt;
|
||||
@ -5406,9 +5406,9 @@ done:
|
||||
* Robb Matzke, 20 May 1999
|
||||
* Now able to copy opaque types.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 21 Sep 2002
|
||||
* Added a deep copy of the symbol table entry
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 21 Sep 2002
|
||||
* Added a deep copy of the symbol table entry
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5T_t *
|
||||
@ -5428,8 +5428,8 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
|
||||
if (NULL==(new_dt = H5FL_ALLOC(H5T_t,0)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
||||
|
||||
/* Copy actual information */
|
||||
*new_dt = *old_dt;
|
||||
/* Copy actual information */
|
||||
*new_dt = *old_dt;
|
||||
|
||||
/* Copy parent information */
|
||||
if (new_dt->parent)
|
||||
@ -5576,10 +5576,9 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
|
||||
/*deep copy of the symbol table entry*/
|
||||
if (H5G_ent_copy(&(old_dt->ent),&(new_dt->ent))<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to copy entry");
|
||||
/* Deep copy of the symbol table entry */
|
||||
if (H5G_ent_copy(&(old_dt->ent),&(new_dt->ent))<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to copy entry");
|
||||
|
||||
/* Set return value */
|
||||
ret_value=new_dt;
|
||||
@ -5720,15 +5719,15 @@ done:
|
||||
* Monday, December 8, 1997
|
||||
*
|
||||
* Modifications:
|
||||
* Robb Matzke, 1999-04-27
|
||||
* This function fails if the datatype state is IMMUTABLE.
|
||||
* Robb Matzke, 1999-04-27
|
||||
* This function fails if the datatype state is IMMUTABLE.
|
||||
*
|
||||
* Robb Matzke, 1999-05-20
|
||||
* Closes opaque types also.
|
||||
* Robb Matzke, 1999-05-20
|
||||
* Closes opaque types also.
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added "ID to name" support
|
||||
*
|
||||
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
|
||||
* Added "ID to name" support
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
@ -5783,7 +5782,7 @@ H5T_close(H5T_t *dt)
|
||||
break;
|
||||
}
|
||||
|
||||
/*Free the ID to name buffer */
|
||||
/*Free the ID to name buffer */
|
||||
H5G_free_ent_name(&(dt->ent));
|
||||
|
||||
/* Free the datatype struct */
|
||||
@ -7529,9 +7528,6 @@ done:
|
||||
* Friday, Dec 7, 2001
|
||||
*
|
||||
* Modifications:
|
||||
* Pedro Vicente
|
||||
* Tuesday, Sep 3, 2002
|
||||
* Added 'else'
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -7545,14 +7541,13 @@ H5T_is_immutable(H5T_t *dt)
|
||||
assert(dt);
|
||||
|
||||
if(dt->state == H5T_STATE_IMMUTABLE)
|
||||
ret_value = TRUE;
|
||||
else
|
||||
ret_value = FALSE;
|
||||
ret_value = TRUE;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T_is_named
|
||||
*
|
||||
@ -7569,7 +7564,6 @@ done:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
htri_t
|
||||
H5T_is_named(H5T_t *dt)
|
||||
{
|
||||
@ -7579,17 +7573,13 @@ H5T_is_named(H5T_t *dt)
|
||||
|
||||
assert(dt);
|
||||
|
||||
if( dt->state == H5T_STATE_OPEN || dt->state == H5T_STATE_NAMED )
|
||||
ret_value = TRUE;
|
||||
else
|
||||
ret_value = FALSE;
|
||||
if(dt->state == H5T_STATE_OPEN || dt->state == H5T_STATE_NAMED)
|
||||
ret_value = TRUE;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
|
@ -22,7 +22,7 @@ typedef struct s1_t {
|
||||
#define NY 5
|
||||
|
||||
|
||||
int check_name( char *name, const char* check )
|
||||
static int check_name( char *name, const char* check )
|
||||
{
|
||||
|
||||
int ret = HDstrcmp( name, check );
|
||||
@ -1428,8 +1428,6 @@ int main( void )
|
||||
|
||||
PASSED();
|
||||
|
||||
#if 1
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Test H5Iget_name with H5Glink symbolic and move target
|
||||
@ -1622,7 +1620,6 @@ int main( void )
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
/* Close file */
|
||||
H5Fclose( file_id );
|
||||
|
Loading…
x
Reference in New Issue
Block a user