summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-08-29 16:58:58 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-08-29 16:58:58 (GMT)
commit9ada2de83a7a4038e4b3d0e500360eb38ee6ecaa (patch)
treedb7a65c1bffc65e3d16f2e1c2c236e8fc813d64d /src
parent969654ce4518e753b0055aed7613461be5bf5210 (diff)
downloadhdf5-9ada2de83a7a4038e4b3d0e500360eb38ee6ecaa.zip
hdf5-9ada2de83a7a4038e4b3d0e500360eb38ee6ecaa.tar.gz
hdf5-9ada2de83a7a4038e4b3d0e500360eb38ee6ecaa.tar.bz2
[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()
Diffstat (limited to 'src')
-rw-r--r--src/H5G.c14
-rw-r--r--src/H5O.c11
2 files changed, 15 insertions, 10 deletions
diff --git a/src/H5G.c b/src/H5G.c
index cccd34e..b1441c6 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -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);
}
diff --git a/src/H5O.c b/src/H5O.c
index 0eb04bc..9e58f27 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -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 */