From 371a27f01eecd3bdd456d24ee630f5f281fbfb93 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 18 Apr 2015 21:48:06 -0500 Subject: [svn-r26843] Description: Minor code & warning cleanups. Tested on: MacOSX/64 10.10.2 (amazon) w/serial & parallel Linux/32 2.6.18 (jam) w/serial & parallel --- src/H5Dchunk.c | 7 ++++--- src/H5Dpkg.h | 2 +- src/H5Oprivate.h | 4 ++-- src/H5VMprivate.h | 23 +++++++++++++++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index e99f00f..6c7c5d5 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2523,7 +2523,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t point_of_no_return = TRUE; ent->chunk = NULL; } /* end else */ - H5_ASSIGN_OVERFLOW(nbytes, udata.chunk_block.length, uint32_t, size_t); + H5_ASSIGN_OVERFLOW(nbytes, udata.chunk_block.length, hsize_t, size_t); if(H5Z_pipeline(&(dset->shared->dcpl_cache.pline), 0, &(udata.filter_mask), dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &alloc, &buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed") @@ -2532,7 +2532,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t if(nbytes > ((size_t)0xffffffff)) HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") #endif /* H5_SIZEOF_SIZE_T > 4 */ - H5_ASSIGN_OVERFLOW(udata.chunk_block.length, nbytes, size_t, uint32_t); + H5_ASSIGN_OVERFLOW(udata.chunk_block.length, nbytes, size_t, hsize_t); /* Indicate that the chunk must be allocated */ must_alloc = TRUE; @@ -2565,7 +2565,8 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Write the data to the file */ HDassert(H5F_addr_defined(udata.chunk_block.offset)); - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, udata.chunk_block.length, dxpl_id, buf) < 0) + H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t); + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index fa59412..769fec1 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -83,7 +83,7 @@ typedef struct H5D_type_info_t { /* Computed/derived values */ size_t src_type_size; /* Size of source type */ - size_t dst_type_size; /* Size of destination type*/ + size_t dst_type_size; /* Size of destination type */ size_t max_type_size; /* Size of largest source/destination type */ hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */ hbool_t is_xform_noop; /* Whether the data transform is a NOOP */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index e3a2d33..3707367 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -424,8 +424,8 @@ typedef struct H5O_layout_chunk_t { uint32_t dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in elements */ uint32_t size; /* Size of chunk in bytes */ hsize_t nchunks; /* Number of chunks in dataset */ - hsize_t chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in dataset dimensions */ - hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ + hsize_t chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in each dataset dimension */ + hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ } H5O_layout_chunk_t; typedef struct H5O_layout_t { diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 20821b2..dbe39ca 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -410,6 +410,29 @@ H5VM_log2_of2(uint32_t n) /*------------------------------------------------------------------------- + * Function: H5VM_power2up + * + * Purpose: Round up a number to the next power of 2 + * + * Return: Return the number which is a power of 2 + * + * Programmer: Vailin Choi; Nov 2014 + * + *------------------------------------------------------------------------- + */ +static H5_inline hsize_t UNUSED +H5VM_power2up(hsize_t n) +{ + hsize_t ret_value = 1; /* Return value */ + + while(ret_value < n) + ret_value <<= 1; + + return(ret_value); +} /* H5VM_power2up */ + + +/*------------------------------------------------------------------------- * Function: H5VM_limit_enc_size * * Purpose: Determine the # of bytes needed to encode values within a -- cgit v0.12