summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c71
1 files changed, 35 insertions, 36 deletions
diff --git a/src/H5O.c b/src/H5O.c
index f318b92..a3b1618 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -716,11 +716,10 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh)
assert(!H5F_addr_defined(oh->chunk[cont->chunkno].addr));
cont->size = oh->chunk[cont->chunkno].size;
- /* Free the space we'd previously reserved to hold this chunk */
- H5MF_free_reserved(f, cont->size);
+ /* Free the space we'd reserved in the file to hold this chunk */
+ H5MF_free_reserved(f, (hsize_t)cont->size);
- if (HADDR_UNDEF==(cont->addr=H5MF_alloc(f,
- H5FD_MEM_OHDR, dxpl_id, (hsize_t)cont->size)))
+ if (HADDR_UNDEF==(cont->addr=H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)cont->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for object header data");
oh->chunk[cont->chunkno].addr = cont->addr;
}
@@ -822,7 +821,7 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh)
assert(oh);
/* Verify that node is clean */
- assert (oh->cache_info.dirty==0);
+ assert (oh->cache_info.dirty==FALSE);
/* destroy chunks */
for (i = 0; i < oh->nchunks; i++) {
@@ -914,7 +913,7 @@ H5O_clear(H5O_t *oh)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_reset(hid_t type_id, void *native)
+H5O_reset(unsigned type_id, void *native)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
herr_t ret_value; /* Return value */
@@ -922,7 +921,7 @@ H5O_reset(hid_t type_id, void *native)
FUNC_ENTER_NOAPI(H5O_reset,FAIL);
/* check args */
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
@@ -994,7 +993,7 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_free (hid_t type_id, void *mesg)
+H5O_free (unsigned type_id, void *mesg)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
void * ret_value; /* Return value */
@@ -1002,7 +1001,7 @@ H5O_free (hid_t type_id, void *mesg)
FUNC_ENTER_NOAPI(H5O_free, NULL);
/* check args */
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
@@ -1075,7 +1074,7 @@ H5O_free_real(const H5O_class_t *type, void *mesg)
*-------------------------------------------------------------------------
*/
void *
-H5O_copy (hid_t type_id, const void *mesg, void *dst)
+H5O_copy (unsigned type_id, const void *mesg, void *dst)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
void *ret_value; /* Return value */
@@ -1083,7 +1082,7 @@ H5O_copy (hid_t type_id, const void *mesg, void *dst)
FUNC_ENTER_NOAPI(H5O_copy, NULL);
/* check args */
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
@@ -1251,7 +1250,7 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5O_count (H5G_entry_t *ent, hid_t type_id, hid_t dxpl_id)
+H5O_count (H5G_entry_t *ent, unsigned type_id, hid_t dxpl_id)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
int ret_value; /* Return value */
@@ -1262,7 +1261,7 @@ H5O_count (H5G_entry_t *ent, hid_t type_id, hid_t dxpl_id)
assert (ent);
assert (ent->file);
assert (H5F_addr_defined(ent->header));
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert (type);
@@ -1353,7 +1352,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5O_exists(H5G_entry_t *ent, hid_t type_id, int sequence, hid_t dxpl_id)
+H5O_exists(H5G_entry_t *ent, unsigned type_id, int sequence, hid_t dxpl_id)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
htri_t ret_value; /* Return value */
@@ -1362,7 +1361,7 @@ H5O_exists(H5G_entry_t *ent, hid_t type_id, int sequence, hid_t dxpl_id)
assert(ent);
assert(ent->file);
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
assert(sequence>=0);
@@ -1463,7 +1462,7 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_read(H5G_entry_t *ent, hid_t type_id, int sequence, void *mesg, hid_t dxpl_id)
+H5O_read(H5G_entry_t *ent, unsigned type_id, int sequence, void *mesg, hid_t dxpl_id)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
void *ret_value; /* Return value */
@@ -1474,7 +1473,7 @@ H5O_read(H5G_entry_t *ent, hid_t type_id, int sequence, void *mesg, hid_t dxpl_i
assert(ent);
assert(ent->file);
assert(H5F_addr_defined(ent->header));
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
assert(sequence >= 0);
@@ -1708,7 +1707,7 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5O_modify(H5G_entry_t *ent, hid_t type_id, int overwrite,
+H5O_modify(H5G_entry_t *ent, unsigned type_id, int overwrite,
unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
@@ -1720,7 +1719,7 @@ H5O_modify(H5G_entry_t *ent, hid_t type_id, int overwrite,
assert(ent);
assert(ent->file);
assert(H5F_addr_defined(ent->header));
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
assert(mesg);
@@ -1961,7 +1960,7 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hid_t type_id, unsigned flags,
+H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned flags,
const void *mesg)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
@@ -1972,7 +1971,7 @@ H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hid_t type_id, unsigned flags,
/* check args */
assert(f);
assert(oh);
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
assert(0==(flags & ~H5O_FLAG_BITS));
@@ -2413,7 +2412,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_remove(H5G_entry_t *ent, hid_t type_id, int sequence, hid_t dxpl_id)
+H5O_remove(H5G_entry_t *ent, unsigned type_id, int sequence, hid_t dxpl_id)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
herr_t ret_value; /* Return value */
@@ -2424,7 +2423,7 @@ H5O_remove(H5G_entry_t *ent, hid_t type_id, int sequence, hid_t dxpl_id)
assert(ent);
assert(ent->file);
assert(H5F_addr_defined(ent->header));
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert(type);
@@ -2540,9 +2539,9 @@ done:
* that message will be extended with the chunk. Otherwise a
* new null message is created.
*
- * F is the file into which the new chunk will be written. It is
- * included to ensure that there is enough space to extend this
- * chunk.
+ * F is the file in which the chunk will be written. It is
+ * included to ensure that there is enough space to extend
+ * this chunk.
*
* Return: Success: Message index for null message which
* is large enough to hold SIZE bytes.
@@ -2585,15 +2584,15 @@ H5O_alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size)
for (idx=0; idx<oh->nmesgs; idx++) {
if (oh->mesg[idx].chunkno==chunkno) {
if (H5O_NULL_ID == oh->mesg[idx].type->id &&
- (oh->mesg[idx].raw + oh->mesg[idx].raw_size ==
- oh->chunk[chunkno].image + oh->chunk[chunkno].size)) {
+ (oh->mesg[idx].raw + oh->mesg[idx].raw_size ==
+ oh->chunk[chunkno].image + oh->chunk[chunkno].size)) {
delta = MAX (H5O_MIN_SIZE, aligned_size - oh->mesg[idx].raw_size);
assert (delta=H5O_ALIGN (delta));
/* Reserve space in the file to hold the increased chunk size */
- if( H5MF_reserve(f, delta) < 0 )
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "unable to reserve space for chunk");
+ if( H5MF_reserve(f, (hsize_t)delta) < 0 )
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "unable to reserve space in file");
oh->mesg[idx].dirty = TRUE;
oh->mesg[idx].raw_size += delta;
@@ -2626,7 +2625,7 @@ H5O_alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size)
delta = MAX(H5O_MIN_SIZE, aligned_size+H5O_SIZEOF_MSGHDR(f));
delta = H5O_ALIGN(delta);
- if( H5MF_reserve(f, delta) < 0 )
+ if( H5MF_reserve(f, (hsize_t)delta) < 0 )
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "unable to reserve space in file");
/* create a new null message */
@@ -2768,7 +2767,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
assert (size == H5O_ALIGN (size));
/* Reserve space in the file to hold the new chunk */
- if( H5MF_reserve(f, size) < 0 )
+ if( H5MF_reserve(f, (hsize_t)size) < 0 )
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "unable to reserve space in file for new chunk");
/*
@@ -3072,7 +3071,7 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5O_raw_size(hid_t type_id, H5F_t *f, const void *mesg)
+H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
size_t ret_value; /* Return value */
@@ -3080,7 +3079,7 @@ H5O_raw_size(hid_t type_id, H5F_t *f, const void *mesg)
FUNC_ENTER_NOAPI(H5O_raw_size,0);
/* Check args */
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert (type);
assert (type->raw_size);
@@ -3116,7 +3115,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_share(hid_t type_id, H5F_t *f, const void *mesg, H5O_shared_t *share)
+H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
herr_t ret_value; /* Return value */
@@ -3124,7 +3123,7 @@ H5O_get_share(hid_t type_id, H5F_t *f, const void *mesg, H5O_shared_t *share)
FUNC_ENTER_NOAPI(H5O_get_share,FAIL);
/* Check args */
- assert(type_id>=0 && type_id<(hid_t)(sizeof(message_type_g)/sizeof(message_type_g[0])));
+ assert(type_id<NELMTS(message_type_g));
type=message_type_g[type_id]; /* map the type ID to the actual type object */
assert (type);
assert (type->get_share);