diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-11-28 18:51:23 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-11-28 18:51:23 (GMT) |
commit | 1687720a5fe51d32e1544371eaa75af162f35a31 (patch) | |
tree | a876648b981f58cd0299ee4754ae4e6620a6b1f1 /src | |
parent | 0bd83631d5ed24fe948a273e8a4d4bd8f128a86c (diff) | |
download | hdf5-1687720a5fe51d32e1544371eaa75af162f35a31.zip hdf5-1687720a5fe51d32e1544371eaa75af162f35a31.tar.gz hdf5-1687720a5fe51d32e1544371eaa75af162f35a31.tar.bz2 |
[svn-r12991] Description:
Reduce the size of some of the group information to more reasonable bounds.
(16-bit values instead of 32-bit values).
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Oginfo.c | 24 | ||||
-rw-r--r-- | src/H5Opkg.h | 8 | ||||
-rw-r--r-- | src/H5Oprivate.h | 8 | ||||
-rw-r--r-- | src/H5Pgcpl.c | 14 |
4 files changed, 34 insertions, 20 deletions
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index f7c834f..95a19ab 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -119,12 +119,12 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p) ginfo->track_corder = (flags & H5O_GINFO_FLAG_TRACK_CORDER) ? TRUE : FALSE; /* Get the max. # of links to store compactly & the min. # of links to store densely */ - UINT32DECODE(p, ginfo->max_compact) - UINT32DECODE(p, ginfo->min_dense) + UINT16DECODE(p, ginfo->max_compact) + UINT16DECODE(p, ginfo->min_dense) /* Get the estimated # of entries & name lengths */ - UINT32DECODE(p, ginfo->est_num_entries) - UINT32DECODE(p, ginfo->est_name_len) + UINT16DECODE(p, ginfo->est_num_entries) + UINT16DECODE(p, ginfo->est_name_len) /* Set return value */ ret_value = ginfo; @@ -174,12 +174,12 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) *p++ = flags; /* Store the max. # of links to store compactly & the min. # of links to store densely */ - UINT32ENCODE(p, ginfo->max_compact) - UINT32ENCODE(p, ginfo->min_dense) + UINT16ENCODE(p, ginfo->max_compact) + UINT16ENCODE(p, ginfo->min_dense) /* Estimated # of entries & name lengths */ - UINT32ENCODE(p, ginfo->est_num_entries) - UINT32ENCODE(p, ginfo->est_name_len) + UINT16ENCODE(p, ginfo->est_num_entries) + UINT16ENCODE(p, ginfo->est_name_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_ginfo_encode() */ @@ -257,10 +257,10 @@ H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg) /* Set return value */ ret_value = 1 + /* Version */ 1 + /* Flags */ - 4 + /* "Max compact" links */ - 4 + /* "Min dense" links */ - 4 + /* Estimated # of entries in group */ - 4; /* Estimated length of name of entry in group */ + 2 + /* "Max compact" links */ + 2 + /* "Min dense" links */ + 2 + /* Estimated # of entries in group */ + 2; /* Estimated length of name of entry in group */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_ginfo_size() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 18a0804..657da10 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -188,22 +188,22 @@ struct H5O_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ /* first field in structure */ - /* General information */ + /* General information (stored) */ unsigned version; /*version number */ unsigned nlink; /*link count */ - /* Time information */ + /* Time information (stored) */ time_t atime; /*access time */ time_t mtime; /*modification time */ time_t ctime; /*change time */ - /* Message management */ + /* Message management (stored, indirectly) */ size_t nmesgs; /*number of messages */ size_t alloc_nmesgs; /*number of message slots */ H5O_mesg_t *mesg; /*array of messages */ size_t skipped_mesg_size; /*size of skipped messages (for sanity checking) */ - /* Chunk management */ + /* Chunk management (not stored) */ size_t nchunks; /*number of chunks */ size_t alloc_nchunks; /*chunks allocated */ H5O_chunk_t *chunk; /*array of chunks */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 05b85e3..61fa573 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -315,12 +315,12 @@ typedef struct H5O_ginfo_t { 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 */ + uint16_t max_compact; /* Maximum # of compact links */ + uint16_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 */ + uint16_t est_num_entries; /* Estimated # of entries in group */ + uint16_t est_name_len; /* Estimated length of entry name */ } H5O_ginfo_t; /* diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 16046db..cc9449a 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -235,6 +235,14 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens FUNC_ENTER_API(H5Pset_link_phase_change, FAIL) H5TRACE3("e","iIuIu",plist_id,max_compact,min_dense); + /* Range check values */ + if(max_compact < min_dense) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be >= min dense value") + if(max_compact > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be < 65536") + if(min_dense > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min dense value must be < 65536") + /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") @@ -329,6 +337,12 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name FUNC_ENTER_API(H5Pset_est_link_info, FAIL) H5TRACE3("e","iIuIu",plist_id,est_num_entries,est_name_len); + /* Range check values */ + if(est_num_entries > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. number of entries must be < 65536") + if(est_name_len > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. name length must be < 65536") + /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") |