summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Gprivate.h10
-rw-r--r--src/H5O.c3
-rw-r--r--src/H5Ocopy.c4
-rw-r--r--src/H5Odbg.c2
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Oprivate.h18
-rwxr-xr-xsrc/H5SM.c13
-rw-r--r--src/H5SMcache.c3
-rwxr-xr-xtest/objcopy.c2
9 files changed, 36 insertions, 21 deletions
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 807b971..b905ada 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -71,12 +71,13 @@
#define H5G_CRT_LINK_INFO_NAME "link info"
#define H5G_CRT_LINK_INFO_SIZE sizeof(H5O_linfo_t)
#define H5G_CRT_LINK_INFO_DEF {H5G_CRT_LINFO_INDEX_CORDER, \
- H5G_CRT_LINFO_NLINKS, \
H5G_CRT_LINFO_MIN_CORDER, \
H5G_CRT_LINFO_MAX_CORDER, \
+ H5G_CRT_LINFO_CORDER_BT2_ADDR, \
+ H5G_CRT_LINFO_NLINKS, \
H5G_CRT_LINFO_LINK_FHEAP_ADDR, \
- H5G_CRT_LINFO_NAME_BT2_ADDR, \
- H5G_CRT_LINFO_CORDER_BT2_ADDR}
+ H5G_CRT_LINFO_NAME_BT2_ADDR \
+ }
/* Defaults for group info values */
#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
@@ -94,7 +95,8 @@
H5G_CRT_GINFO_MAX_COMPACT, \
H5G_CRT_GINFO_MIN_DENSE, \
H5G_CRT_GINFO_EST_NUM_ENTRIES, \
- H5G_CRT_GINFO_EST_NAME_LEN}
+ H5G_CRT_GINFO_EST_NAME_LEN \
+ }
/* Type of operation being performed for call to H5G_name_replace() */
diff --git a/src/H5O.c b/src/H5O.c
index ff4e5a3..0ef5b43 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1299,7 +1299,8 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
/* adjust link count */
if(adjust < 0) {
- if(oh->nlink + adjust < 0)
+ /* Check for too large of an adjustment */
+ if((unsigned)(-adjust) > oh->nlink)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
oh->nlink += adjust;
oh_flags |= H5AC__DIRTIED_FLAG;
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index ea8f1c6..44baa9e 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -633,8 +633,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Increment object header's reference count, if any descendents have created links to link to this object */
if(addr_map->inc_ref_count) {
- H5_CHECK_OVERFLOW(addr_map->inc_ref_count, hsize_t, int);
- oh_dst->nlink += (int)addr_map->inc_ref_count;
+ H5_CHECK_OVERFLOW(addr_map->inc_ref_count, hsize_t, unsigned);
+ oh_dst->nlink += (unsigned)addr_map->inc_ref_count;
} /* end if */
/* Insert destination object header in cache */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 46a7a62..df40d65 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -266,7 +266,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Header size (in bytes):",
(unsigned)H5O_SIZEOF_HDR_OH(oh));
- HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of links:",
oh->nlink);
HDfprintf(stream, "%*s%-*s %Zu (%Zu)\n", indent, "", fwidth,
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 70474da..679e021 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -185,7 +185,7 @@ struct H5O_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
/* first field in structure */
unsigned version; /*version number */
- int nlink; /*link count */
+ unsigned nlink; /*link count */
size_t skipped_mesg_size; /*size of skipped messages (for sanity checking) */
size_t nmesgs; /*number of messages */
size_t alloc_nmesgs; /*number of message slots */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index b0c50dc..05b85e3 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -157,15 +157,20 @@ typedef struct H5O_shared_t {
* Link Info Message.
* (Contains dynamic information about links in a group)
* (Data structure in memory)
+ * (if the fields in this struct are changed, remember to change the default
+ * link info structure in src/H5Gprivate.h - QAK)
*/
typedef struct H5O_linfo_t {
+ /* (creation order info) */
hbool_t index_corder; /* Are creation order values indexed on links? */
- hsize_t nlinks; /* Number of links in the group */
int64_t min_corder; /* Current min. creation order value for group */
int64_t max_corder; /* Current max. creation order value for group */
+ haddr_t corder_bt2_addr; /* Address of v2 B-tree for indexing creation order values of links */
+
+ /* (storage management info) */
+ hsize_t nlinks; /* Number of links in the group */
haddr_t link_fheap_addr; /* Address of fractal heap for storing "dense" links */
haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of links */
- haddr_t corder_bt2_addr; /* Address of v2 B-tree for indexing creation order values of links */
} H5O_linfo_t;
/*
@@ -296,17 +301,24 @@ typedef struct H5O_bogus_t {
/*
* Group info message.
- * (Contains static information about a group)
+ * (Contains constant information about a group)
* (Data structure in memory)
+ * (if the fields in this struct are changed, remember to change the default
+ * group info structure in src/H5Gprivate.h - QAK)
*/
typedef struct H5O_ginfo_t {
/* "Old" format group info (not stored) */
uint32_t lheap_size_hint; /* Local heap size hint */
/* "New" format group info (stored) */
+ /* (creation order info) */
hbool_t track_corder; /* Are creation order values tracked on links? */
+
+ /* (storage management info) */
uint32_t max_compact; /* Maximum # of compact links */
uint32_t min_dense; /* Minimum # of "dense" links */
+
+ /* (initial object header size info) */
uint32_t est_num_entries; /* Estimated # of entries in group */
uint32_t est_name_len; /* Estimated length of entry name */
} H5O_ginfo_t;
diff --git a/src/H5SM.c b/src/H5SM.c
index 9e27d67..2984805 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -502,7 +502,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, unsigned type_id, void *mesg)
HGOTO_DONE(FALSE);
/* If the message isn't big enough, don't bother sharing it */
- if((mesg_size = H5O_mesg_size(type_id, f, mesg, 0)) <0)
+ if((mesg_size = H5O_mesg_size(type_id, f, mesg, 0)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unable to get OH message size")
if(mesg_size < 50) /* JAMES: arbitrary value. Make this per-index, along with index sizes? */
HGOTO_DONE(FALSE);
@@ -644,7 +644,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
/* See if the message is already in the index and get its location */
/* JAMES: should return a pointer to the message */
list_pos=H5SM_find_in_list(f, list, &key);
- if(list_pos != FAIL)
+ if(list_pos != UFAIL)
{
/* The message was in the index. Increment its reference count. */
++(list->messages[list_pos].ref_count);
@@ -811,7 +811,7 @@ H5SM_try_delete(H5F_t *f, hid_t dxpl_id, unsigned type_id, const H5O_shared_t *m
/* Find the correct index and try to delete from it */
if((index_num = H5SM_get_index(table, type_id)) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, HADDR_UNDEF, "unable to find correct SOHM index")
+ HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index")
/* JAMES: this triggers some warning on heping. "overflow in implicit constant conversion" */
if(H5SM_delete_from_index(f, dxpl_id, &(table->indexes[index_num]), type_id, mesg, &cache_flags) < 0)
@@ -832,7 +832,7 @@ done:
* Purpose: Find a message's location in a list
*
* Return: Number of messages remaining in the index on success
- * FAIL if message couldn't be found
+ * UFAIL if message couldn't be found
*
* Programmer: James Laird
* Tuesday, May 2, 2006
@@ -843,7 +843,8 @@ static hsize_t
H5SM_find_in_list(H5F_t *f, H5SM_list_t *list, const H5SM_mesg_key_t *key)
{
hsize_t x;
- hsize_t ret_value = FAIL;
+ hsize_t ret_value = UFAIL;
+
FUNC_ENTER_NOAPI_NOFUNC(H5SM_find_in_list)
HDassert(f);
@@ -929,7 +930,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header, uns
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Find the message in the list */
- if((list_pos = H5SM_find_in_list(f, list, &key)) == FAIL)
+ if((list_pos = H5SM_find_in_list(f, list, &key)) == UFAIL)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
--(list->messages[list_pos].ref_count);
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 85b46d5..e21757e 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -192,7 +192,7 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
{
size_t table_size; /* Size of SOHM master table on disk */
uint8_t *buf=NULL; /* Reading buffer */
- uint8_t *p; /* Pointer into input buffer */
+ const uint8_t *p; /* Pointer into input buffer */
uint8_t x; /* Counter variable for index headers */
H5SM_master_table_t *ret_value;
@@ -564,7 +564,6 @@ done:
} /* end of H5SM_clear_list */
-
/*-------------------------------------------------------------------------
* Function: H5SM_dest_list
*
diff --git a/test/objcopy.c b/test/objcopy.c
index 54d03d4..d1f081e 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -7069,7 +7069,7 @@ main(void)
nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG, FALSE, "H5Ocopy(): expand soft link");
nerrors += test_copy_option(my_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Ocopy(): shallow group copy");
nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG, FALSE, "H5Ocopy(): expand object reference");
- nerrors += test_copy_option(my_fapl, H5O_COPY_PRESERVE_NULL_FLAG, FALSE, "H5Gcopy(): preserve NULL messages");
+ nerrors += test_copy_option(my_fapl, H5O_COPY_PRESERVE_NULL_FLAG, FALSE, "H5Ocopy(): preserve NULL messages");
/* TODO: not implemented
nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Ocopy: expand external link");