[svn-r50] ./src/H5G.c

Commented out H5G_basename(). Fixed a bug in H5G_namei() and
	H5G_insert().

./src/H5O.c
	Fixed a bug in H5O_modify()
This commit is contained in:
Robb Matzke 1997-08-29 11:58:58 -05:00
parent 969654ce45
commit 9ada2de83a
2 changed files with 15 additions and 10 deletions

View File

@ -99,6 +99,7 @@ H5G_component (const char *name, size_t *size_p)
*
*-------------------------------------------------------------------------
*/
#if 0
static const char *
H5G_basename (const char *name, size_t *size_p)
{
@ -122,6 +123,7 @@ H5G_basename (const char *name, size_t *size_p)
if (size_p) *size_p = strcspn (s, "/");
return s;
}
#endif
/*-------------------------------------------------------------------------
@ -251,11 +253,11 @@ H5G_namei (hdf5_file_t *f, H5G_entry_t *cwd, const char *name,
aside = TRUE;
}
H5O_reset (H5O_NAME, &mesg);
} else {
/* component not found */
if (dir_ent) *dir_ent = *dir;
HRETURN_ERROR (H5E_DIRECTORY, H5E_NOTFOUND, -2);
}
/* component not found */
if (dir_ent) *dir_ent = *dir;
HRETURN_ERROR (H5E_DIRECTORY, H5E_NOTFOUND, -2);
}
/* next component */
@ -637,7 +639,9 @@ H5G_insert (hdf5_file_t *f, H5G_entry_t *cwd, H5G_entry_t *dir_ent,
if (f->root_sym->header<=0) {
H5O_name_t name_mesg;
name_mesg.s = rest;
if (H5O_modify (f, ent->header, ent, NULL, H5O_NAME, 0, &name_mesg)<0) {
if (H5O_modify (f, ent->header, ent, NULL, H5O_NAME, 0, &name_mesg)<0 &&
H5O_modify (f, ent->header, ent, NULL, H5O_NAME, H5O_NEW_MESG,
&name_mesg)<0) {
/* cannot add/change name message */
HRETURN_ERROR (H5E_DIRECTORY, H5E_CANTINIT, FAIL);
}

View File

@ -728,15 +728,15 @@ H5O_modify (hdf5_file_t *f, haddr_t addr, H5G_entry_t *ent,
}
/* Count similar messages */
for (idx=sequence=0; idx<oh->nmesgs; idx++) {
for (idx=0,sequence=-1; idx<oh->nmesgs; idx++) {
if (type->id != oh->mesg[idx].type->id) continue;
if (sequence==overwrite) break;
sequence++;
if (++sequence==overwrite) break;
}
/* Was the right message found? */
if (overwrite>=0 && sequence!=overwrite) {
HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, FAIL);
if (overwrite>=0 &&
(idx>=oh->nmesgs || sequence!=overwrite)) {
HRETURN_ERROR (H5E_OHDR, H5E_NOTFOUND, FAIL); /*message not found*/
}
/* Allocate space for the new message */
@ -745,6 +745,7 @@ H5O_modify (hdf5_file_t *f, haddr_t addr, H5G_entry_t *ent,
H5O_ALIGN (size, oh->alignment);
idx = H5O_alloc (f, oh, type, size);
if (idx<0) HRETURN_ERROR (H5E_OHDR, H5E_CANTINIT, FAIL);
sequence++;
}
/* Copy the native value into the object header */