diff options
author | MuQun Yang <ymuqun@hdfgroup.org> | 2002-05-06 16:44:06 (GMT) |
---|---|---|
committer | MuQun Yang <ymuqun@hdfgroup.org> | 2002-05-06 16:44:06 (GMT) |
commit | b757e8f9ace4b56418ecacf0376971bea847fa4f (patch) | |
tree | eeb6bac44358acb5b93b1806c412ea9a065d51d8 /src | |
parent | 3239989544c0f822fbf05642c0efc924234449b5 (diff) | |
download | hdf5-b757e8f9ace4b56418ecacf0376971bea847fa4f.zip hdf5-b757e8f9ace4b56418ecacf0376971bea847fa4f.tar.gz hdf5-b757e8f9ace4b56418ecacf0376971bea847fa4f.tar.bz2 |
[svn-r5359]
Purpose:
1. code clean-up
2. bug fix
Description:
1. windows complian data casting from large size to small size
use H5_ASSIGN_OVERFLOW and H5_CHECK_OVERFLOW to erase some warnings
2. in H5TB.c, cmp_addr is used to compare two different address. However, cmp_addr is defined as
an unsigned integer which may cause problems when the difference is negative.
Solution:
2. Use H5Fcmp_address macro to replace cmp_addr in H5TB.c.
Platforms tested:
linux 2.2.18 and windows 2000
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Shyper.c | 4 | ||||
-rw-r--r-- | src/H5TB.c | 8 | ||||
-rw-r--r-- | src/H5Tconv.c | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c index bfe53a3..e5b828c 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -493,7 +493,8 @@ H5S_hyper_block_read (H5S_hyper_node_t *node, H5S_hyper_io_info_t *io_info, hsiz * offset */ node->cinfo.rpos+=region_size*io_info->elmt_size; - node->cinfo.rleft-=region_size; + H5_ASSIGN_OVERFLOW(node->cinfo.rleft,node->cinfo.rleft-region_size,hsize_t,size_t); + /* node->cinfo.rleft-=region_size;*/ /* If we've read in all the elements from the block, throw it away */ if(node->cinfo.rleft==0 && (node->cinfo.wleft==0 || node->cinfo.wleft==node->cinfo.size)) { @@ -547,6 +548,7 @@ H5S_hyper_block_write (H5S_hyper_node_t *node, * offset */ node->cinfo.wpos+=region_size*io_info->elmt_size; + H5_ASSIGN_OVERFLOW(node->cinfo.wleft,node->cinfo.wleft-region_size,hsize_t,size_t); node->cinfo.wleft-=region_size; /* If we've read in all the elements from the block, throw it away */ @@ -60,6 +60,7 @@ #include "H5private.h" /*library */ #include "H5Eprivate.h" /*error handling */ +#include "H5Fprivate.h" /*File address macros */ #include "H5MMprivate.h" /*core memory management */ #include "H5FLprivate.h" /*free lists */ #include "H5TBprivate.h" /*threaded, balanced, binary trees */ @@ -1154,7 +1155,6 @@ H5TB_ffind(H5TB_NODE * root, void * key, unsigned fast_compare, H5TB_NODE ** pp) H5TB_NODE *parent = NULL; int side; int cmp = 1; - haddr_t cmp_addr = 1; H5TB_NODE *ret_value = NULL; FUNC_ENTER (H5TB_ffind, NULL); @@ -1162,9 +1162,9 @@ H5TB_ffind(H5TB_NODE * root, void * key, unsigned fast_compare, H5TB_NODE ** pp) switch(fast_compare) { case H5TB_FAST_HADDR_COMPARE: if (ptr) { - while (0 != (cmp_addr = (*(haddr_t *)key - *(haddr_t *)ptr->key))) { + while (0 != (cmp = H5F_addr_cmp(*(haddr_t *)key,*(haddr_t *)ptr->key))) { parent = ptr; - side = (cmp_addr < 0) ? LEFT : RIGHT; + side = (cmp < 0) ? LEFT : RIGHT; if (!HasChild(ptr, side)) break; ptr = ptr->link[side]; @@ -1174,7 +1174,7 @@ H5TB_ffind(H5TB_NODE * root, void * key, unsigned fast_compare, H5TB_NODE ** pp) *pp = parent; /* Set return value */ - ret_value= (0 == cmp_addr) ? ptr : NULL; + ret_value= (0 == cmp) ? ptr : NULL; break; case H5TB_FAST_INTN_COMPARE: diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 6db7550..0a6a49a 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1465,8 +1465,8 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, src_delta = src->size; bkg_stride = dst->size; } else { - src_delta = -(src->size); - bkg_stride = -(dst->size); + src_delta = -(int)(src->size);/*overflow shouldn't be possible */ + bkg_stride = -(int)(dst->size);/*overflow shouldn't be possible */ xbuf += (nelmts-1) * src->size; xbkg += (nelmts-1) * dst->size; } |