From 4af66b09e03af4e9b0b6a1293dfe746f48106aba Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 22 Jul 2016 17:43:18 -0500 Subject: [svn-r30219] Description: More warning cleaups: down to 770 warnings (from ~940) in 134 files (from 148), with 28 unique kinds of warnings (from 31). Tested on: MacOSX/64 10.11.5 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5Aint.c | 22 +- src/H5Defl.c | 8 +- src/H5FDmulti.c | 24 +- src/H5FS.c | 2 +- src/H5FSpkg.h | 2 +- src/H5FSsection.c | 2 +- src/H5Fprivate.h | 2 +- src/H5Gnode.c | 2 +- src/H5Gpkg.h | 2 +- src/H5Oprivate.h | 2 +- src/H5Spoint.c | 10 +- src/H5Tvlen.c | 10 +- test/big.c | 8 +- test/dt_arith.c | 30 +-- test/file_image.c | 6 +- test/tgenprop.c | 6 +- test/th5s.c | 20 +- test/tselect.c | 30 +-- tools/h5import/h5import.c | 28 +- tools/h5repack/h5repack.c | 509 ++++++++++++++++++------------------- tools/h5repack/h5repack.h | 16 +- tools/h5repack/h5repack_main.c | 4 +- tools/h5repack/h5repack_opttable.c | 306 +++++++++++----------- tools/h5repack/h5repack_parse.c | 238 ++++++++--------- tools/h5repack/h5repacktst.c | 194 ++++++-------- tools/misc/h5mkgrp.c | 4 +- tools/misc/vds/UC_1.h | 29 --- tools/misc/vds/UC_1_one_dim_gen.c | 36 ++- tools/misc/vds/UC_2.h | 41 --- tools/misc/vds/UC_2_two_dims_gen.c | 44 +++- tools/misc/vds/UC_3.h | 4 - tools/misc/vds/UC_4_printf_gen.c | 4 +- tools/misc/vds/UC_5_stride_gen.c | 6 +- 33 files changed, 799 insertions(+), 852 deletions(-) diff --git a/src/H5Aint.c b/src/H5Aint.c index 2730b0b..1b7b830 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1920,15 +1920,16 @@ H5A_t * H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, hid_t dxpl_id) { - H5A_t *attr_dst = NULL; - - /* for dataype conversion */ + H5A_t *attr_dst = NULL; /* Destination attribute */ hid_t tid_src = -1; /* Datatype ID for source datatype */ hid_t tid_dst = -1; /* Datatype ID for destination datatype */ hid_t tid_mem = -1; /* Datatype ID for memory datatype */ void *buf = NULL; /* Buffer for copying data */ void *reclaim_buf = NULL; /* Buffer for reclaiming data */ hid_t buf_sid = -1; /* ID for buffer dataspace */ + hssize_t sdst_nelmts; /* # of elements in destination attribute (signed) */ + size_t dst_nelmts; /* # of elements in destination attribute */ + size_t dst_dt_size; /* Size of destination attribute datatype */ H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2014,12 +2015,17 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si if(attr_dst->shared->dt_size != attr_src->shared->dt_size || attr_dst->shared->ds_size != attr_src->shared->ds_size) *recompute_size = TRUE; + /* Get # of elements for destination attribute's dataspace */ + if((sdst_nelmts = H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid") + H5_CHECKED_ASSIGN(dst_nelmts, size_t, sdst_nelmts, hssize_t); + + /* Get size of destination attribute's datatype */ + if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size") + /* Compute the size of the data */ - /* NOTE: This raises warnings. If we are going to be serious about - * expecting overflow here, we should implement testing similar to - * that described in CERT bulletins INT30-C and INT32-C. - */ - H5_CHECKED_ASSIGN(attr_dst->shared->data_size, size_t, H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds) * H5T_get_size(attr_dst->shared->dt), hssize_t); + attr_dst->shared->data_size = dst_nelmts * dst_dt_size; /* Copy (& convert) the data, if necessary */ if(attr_src->shared->data) { diff --git a/src/H5Defl.c b/src/H5Defl.c index cf1b36c..387cbe3 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -286,13 +286,13 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size HDassert(buf); if(u >= efl->nused) HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip)) HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") if((fd = HDopen(full_name, O_RDONLY, 0)) < 0) HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0) HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size); @@ -378,7 +378,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz HDassert(buf); if(u >= efl->nused) HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip)) HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") @@ -388,7 +388,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz else HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") } /* end if */ - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0) HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 0e49813..d0dfab3 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -44,16 +44,22 @@ #endif /* Loop through all mapped files */ -#define UNIQUE_MEMBERS(MAP,LOOPVAR) { \ - H5FD_mem_t _unmapped, LOOPVAR; \ - unsigned _seen[H5FD_MEM_NTYPES]; \ +#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) { \ + H5FD_mem_t ITER, LOOPVAR; \ + unsigned SEEN[H5FD_MEM_NTYPES]; \ \ - memset(_seen, 0, sizeof _seen); \ - for (_unmapped=H5FD_MEM_SUPER; _unmapped0 && LOOPVARfa.memb_map, mt1) { - UNIQUE_MEMBERS(file->fa.memb_map, mt2) { + UNIQUE_MEMBERS2(file->fa.memb_map, mt2) { if (file->fa.memb_addr[mt1]fa.memb_addr[mt2] && (HADDR_UNDEF==file->memb_next[mt1] || file->memb_next[mt1]>file->fa.memb_addr[mt2])) { diff --git a/src/H5FS.c b/src/H5FS.c index 19ff8e4..c3b45d2 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -606,7 +606,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Set immutable free list parameters */ - H5_CHECKED_ASSIGN(fspace->nclasses, unsigned, nclasses, size_t); + H5_CHECKED_ASSIGN(fspace->nclasses, uint16_t, nclasses, size_t); if(nclasses > 0) { if(NULL == (fspace->sect_cls = H5FL_SEQ_MALLOC(H5FS_section_class_t, nclasses))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section class array") diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index eafe3c2..54029cc 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -85,7 +85,7 @@ H5FS_METADATA_PREFIX_SIZE \ \ /* Free space serialized sections specific fields */ \ - + H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \ + + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \ ) diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 5638f4f..4697bd50 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -144,7 +144,7 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); /* Set non-zero values */ sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size); - sinfo->sect_prefix_size = (size_t)H5FS_SINFO_PREFIX_SIZE(f); + sinfo->sect_prefix_size = H5FS_SINFO_PREFIX_SIZE(f); sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8; sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size); #ifdef H5FS_SINFO_DEBUG diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 34a5277..8c27edd 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -409,7 +409,7 @@ #endif #if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T) # define H5F_OVERFLOW_HSIZET2OFFT(X) \ - ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(HDoff_t)-1))) + ((hsize_t)(X) >= (hsize_t)((hsize_t)1 << (8 * sizeof(HDoff_t) - 1))) #else # define H5F_OVERFLOW_HSIZET2OFFT(X) 0 #endif diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 4d299dc..89d1df8 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -715,7 +715,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, md_key->offset = ent.name_off; } /* end if */ else { - idx -= H5F_SYM_LEAF_K(f); + idx -= (int)H5F_SYM_LEAF_K(f); insert_into = snrt; if(idx == (int)H5F_SYM_LEAF_K(f)) { rt_key->offset = ent.name_off; diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 4cb6f9b..c994da3 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -55,7 +55,7 @@ + 2 /* Number of symbols */ \ \ /* Entries */ \ - + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY_FILE(f)) \ + + ((2 * H5F_SYM_LEAF_K(f)) * (unsigned)H5G_SIZEOF_ENTRY_FILE(f)) \ ) diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 44b4998..0acac8c 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -349,7 +349,7 @@ typedef struct H5O_link_t { typedef struct H5O_efl_entry_t { size_t name_offset; /*offset of name within heap */ char *name; /*malloc'd name */ - off_t offset; /*offset of data within file */ + HDoff_t offset; /*offset of data within file */ hsize_t size; /*size allocated within file */ } H5O_efl_entry_t; diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 0f85110..1531bac 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1125,10 +1125,10 @@ H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) if(((hssize_t)node->pnt[u] + space->select.offset[u]) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") - if(start[u] > (node->pnt[u] + space->select.offset[u])) - start[u] = node->pnt[u] + space->select.offset[u]; - if(end[u] < (node->pnt[u] + space->select.offset[u])) - end[u] = node->pnt[u] + space->select.offset[u]; + if(start[u] > (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u])) + start[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]); + if(end[u] < (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u])) + end[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]); } /* end for */ node = node->next; } /* end while */ @@ -1703,7 +1703,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, while(NULL != node) { /* Compute the offset of each selected point in the buffer */ for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) { - loc += (node->pnt[i] + space->select.offset[i]) * acc; + loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc; acc *= dims[i]; } /* end for */ diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 0ed8209..d198d50 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -243,7 +243,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) * of an address in this file, plus 4 bytes for the size of a heap * ID. Memory size is different */ - dt->shared->size = 4 + H5F_SIZEOF_ADDR(f) + 4; + dt->shared->size = 4 + (size_t)H5F_SIZEOF_ADDR(f) + 4; /* Set up the function pointers to access the VL information on disk */ /* VL sequences and VL strings are stored identically on disk, so use the same functions */ @@ -801,7 +801,7 @@ H5T_vlen_disk_getptr(void H5_ATTR_UNUSED *vl) static htri_t H5T_vlen_disk_isnull(const H5F_t *f, void *_vl) { - uint8_t *vl=(uint8_t *)_vl; /* Pointer to the disk VL information */ + uint8_t *vl = (uint8_t *)_vl; /* Pointer to the disk VL information */ haddr_t addr; /* Sequence's heap address */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -810,12 +810,12 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl) HDassert(vl); /* Skip the sequence's length */ - vl+=4; + vl += 4; /* Get the heap address */ - H5F_addr_decode(f,(const uint8_t **)&vl,&addr); + H5F_addr_decode(f, (const uint8_t **)&vl, &addr); - FUNC_LEAVE_NOAPI(addr==0 ? TRUE : FALSE) + FUNC_LEAVE_NOAPI(addr == 0 ? TRUE : FALSE) } /* end H5T_vlen_disk_isnull() */ diff --git a/test/big.c b/test/big.c index 7a3fd21..0505e54 100644 --- a/test/big.c +++ b/test/big.c @@ -129,8 +129,8 @@ randll(hsize_t limit, int current_index) /* does not overlap with any previous writes */ while(overlap != 0 && tries < MAX_TRIES) { - acc = HDrandom(); - acc *= HDrandom(); + acc = (hsize_t)HDrandom(); + acc *= (hsize_t)HDrandom(); acc = acc % limit; overlap = 0; @@ -508,7 +508,7 @@ reader(char *filename, hid_t fapl) if('#' != ln[0]) break; i = (int)HDstrtol(ln + 1, &s, 10); - hs_offset[0] = HDstrtoll(s, NULL, 0); + hs_offset[0] = HDstrtoull(s, NULL, 0); HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); HDfflush(stdout); @@ -801,7 +801,7 @@ main (int ac, char **av) /* seed = (unsigned long)1155438845; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); #endif /* QAK */ - HDsrandom(seed); + HDsrandom((unsigned)seed); /* run VFD-specific test */ if(H5FD_SEC2 == driver) { diff --git a/test/dt_arith.c b/test/dt_arith.c index 639ad52..e258b77 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -3094,8 +3094,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if (FLT_FLOAT==dst_type) { hw_f = (float)(*((double*)aligned)); hw = (unsigned char*)&hw_f; - underflow = HDfabs(*((double*)aligned)) < FLT_MIN; - overflow = HDfabs(*((double*)aligned)) > FLT_MAX; + underflow = HDfabs(*((double*)aligned)) < (double)FLT_MIN; + overflow = HDfabs(*((double*)aligned)) > (double)FLT_MAX; } else if (FLT_DOUBLE==dst_type) { hw_d = *((double*)aligned); hw = (unsigned char*)&hw_d; @@ -3109,12 +3109,12 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) } else { HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double)); if (FLT_FLOAT==dst_type) { - hw_f = *((long double*)aligned); + hw_f = (float)*((long double*)aligned); hw = (unsigned char*)&hw_f; underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN; overflow = HDfabsl(*((long double*)aligned)) > FLT_MAX; } else if (FLT_DOUBLE==dst_type) { - hw_d = *((long double*)aligned); + hw_d = (double)*((long double*)aligned); hw = (unsigned char*)&hw_d; underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN; overflow = HDfabsl(*((long double*)aligned)) > DBL_MAX; @@ -3227,15 +3227,15 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) long double x; HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); /* dst is largest float, no need to check underflow. */ - check_mant[0] = HDfrexpl(x, check_expo+0); - check_mant[1] = HDfrexpl(hw_ld, check_expo+1); + check_mant[0] = (double)HDfrexpl(x, check_expo+0); + check_mant[1] = (double)HDfrexpl(hw_ld, check_expo+1); #endif } /* Special check for denormalized values */ if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) { - int expo_diff=check_expo[0]-check_expo[1]; - int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; - double epsilon=1.0F; + int expo_diff = check_expo[0] - check_expo[1]; + int valid_bits = (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1; + double epsilon = 1.0F; /* Re-scale the mantissas based on any exponent difference */ if(expo_diff!=0) @@ -3249,8 +3249,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) continue; } /* end if */ else { - if (check_expo[0]==check_expo[1] && - HDfabs(check_mant[0]-check_mant[1])= 0, "HDopen() failed."); if(user) { + HDoff_t off; + /* Position at userblock */ - ret = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET); - VERIFY(ret >= 0, "HDlseek() failed."); + off = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET); + VERIFY(off >= 0, "HDlseek() failed."); } /* read the test file from disk into the buffer */ diff --git a/test/tgenprop.c b/test/tgenprop.c index b670c0d..e6f9692 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -784,7 +784,7 @@ test_genprop_basic_list_prop(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) + if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -821,7 +821,7 @@ test_genprop_basic_list_prop(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE)) + if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); @@ -1241,7 +1241,7 @@ test_genprop_list_callback(void) ret = H5Pget(lid1, PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ - if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE)) + if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); diff --git a/test/th5s.c b/test/th5s.c index a478803..664c23a 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -551,18 +551,18 @@ test_h5s_zero_dim(void) MESSAGE(5, ("Testing Dataspace with zero dimension size\n")); /* Initialize the data */ - for(i=0; i= (unsigned)(start[0] + real_offset[0]) && u < (unsigned)(start[0] + count[0] + real_offset[0])) - && (v >= (unsigned)(start[1] + real_offset[1]) && v < (unsigned)(start[1] + count[1] + real_offset[1]))) { + if((u >= (unsigned)((hssize_t)start[0] + real_offset[0]) && u < (unsigned)((hssize_t)(start[0] + count[0]) + real_offset[0])) + && (v >= (unsigned)((hssize_t)start[1] + real_offset[1]) && v < (unsigned)((hssize_t)(start[1] + count[1]) + real_offset[1]))) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); } /* end if */ @@ -7288,8 +7288,8 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Set the coordinates of the selection (with the offset) */ for(u = 0, num_points = 0; u < (unsigned)count[0]; u++) for(v = 0; v < (unsigned)count[1]; v++, num_points++) { - points[num_points][0] = (hsize_t)(u + start[0] + real_offset[0]); - points[num_points][1] = (hsize_t)(v + start[1] + real_offset[1]); + points[num_points][0] = (hsize_t)((hssize_t)(u + start[0]) + real_offset[0]); + points[num_points][1] = (hsize_t)((hssize_t)(v + start[1]) + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7379,7 +7379,7 @@ test_select_fill_hyper_regular(hssize_t *offset) for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { for(w = 0; w < (unsigned)num_points; w++) { - if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) { + if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); break; @@ -7396,8 +7396,8 @@ test_select_fill_hyper_regular(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_points; u++) { - points[u][0] = (hsize_t)(points[u][0] + real_offset[0]); - points[u][1] = (hsize_t)(points[u][1] + real_offset[1]); + points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]); + points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -7502,7 +7502,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++) for(v = 0; v < SPACE7_DIM2; v++, tbuf++) { for(w = 0; w < (unsigned)num_points; w++) { - if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) { + if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) { if(*tbuf != (unsigned)fill_value) TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value); break; @@ -7519,8 +7519,8 @@ test_select_fill_hyper_irregular(hssize_t *offset) /* Add in the offset */ for(u = 0; u < (unsigned)num_iter_points; u++) { - iter_points[u][0] = (hsize_t)(iter_points[u][0] + real_offset[0]); - iter_points[u][1] = (hsize_t)(iter_points[u][1] + real_offset[1]); + iter_points[u][0] = (hsize_t)((hssize_t)iter_points[u][0] + real_offset[0]); + iter_points[u][1] = (hsize_t)((hssize_t)iter_points[u][1] + real_offset[1]); } /* end for */ /* Iterate through selection, verifying correct data */ @@ -13652,9 +13652,9 @@ test_hyper_unlim(void) VERIFY(start2[0], start[0], "H5Sget_select_bounds"); VERIFY(start2[1], start[1], "H5Sget_select_bounds"); VERIFY(start2[2], start[2], "H5Sget_select_bounds"); - VERIFY(count2[0], start[0] + (stride[0] * (count[0] - (hsize_t)1)) + block[0] - (hsize_t)1, "H5Sget_select_bounds"); + VERIFY(count2[0], (long)(start[0] + (stride[0] * (count[0] - 1)) + block[0] - 1), "H5Sget_select_bounds"); VERIFY(count2[1], H5S_UNLIMITED, "H5Sget_select_bounds"); - VERIFY(count2[2], start[2] + (stride[2] * (count[2] - (hsize_t)1)) + block[2] - (hsize_t)1, "H5Sget_select_bounds"); + VERIFY(count2[2], (long)(start[2] + (stride[2] * (count[2] - 1)) + block[2] - 1), "H5Sget_select_bounds"); /* Close the dataspace */ ret = H5Sclose(sid); diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 9617df3..d1aab0c 100644 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -1439,7 +1439,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif if (HDstrcmp("H5T_VARIABLE;", temp)) { char *more = temp; - ival = HDstrtol(more, &more, 10); + ival = (int)HDstrtol(more, &more, 10); if (getInputSize(in, ival) == -1) { (void) HDfprintf(stderr, err5b, infile); goto error; @@ -2279,13 +2279,13 @@ static int parseDimensions(struct Input *in, char *strm) HDstrncpy(temp, strm, sizeof(temp)); temp[sizeof(temp) - 1] = '\0'; in->sizeOfDimension[i++] - = HDstrtol(HDstrtok (temp, delimiter), NULL, BASE_10); + = HDstrtoull(HDstrtok (temp, delimiter), NULL, BASE_10); while (1) { token = HDstrtok (NULL, delimiter); if (token == NULL) break; - in->sizeOfDimension[i++] = HDstrtol(token, NULL, BASE_10); + in->sizeOfDimension[i++] = HDstrtoull(token, NULL, BASE_10); } return (0); } @@ -3121,7 +3121,7 @@ static int getRank(struct Input *in, FILE *strm) /* same as getChunkedDimensionSizes. But defined separately for extensibility */ static int getDimensionSizes(struct Input *in, FILE *strm) { - int ival; + unsigned long long ullval; int i = 0; const char *err1 = "Unable to allocate dynamic memory.\n"; @@ -3132,8 +3132,8 @@ static int getDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%d", (&ival)) == 1) - in->sizeOfDimension[i++] = ival; + while (fscanf(strm, "%llu", (&ullval)) == 1) + in->sizeOfDimension[i++] = ullval; if (in->rank != i) { (void) HDfprintf(stderr, "%s", err2); @@ -3144,7 +3144,7 @@ static int getDimensionSizes(struct Input *in, FILE *strm) /* same as getDimensionSizes. But defined separately for extensibility */ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) { - int ival; + unsigned long long ullval; int i = 0; const char *err1 = "Unable to allocate dynamic memory.\n"; @@ -3156,8 +3156,8 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%d", (&ival)) == 1) - in->sizeOfChunk[i++] = ival; + while (fscanf(strm, "%llu", (&ullval)) == 1) + in->sizeOfChunk[i++] = ullval; if (in->rank != i) { (void) HDfprintf(stderr, "%s", err2); @@ -3174,7 +3174,7 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) static int getMaximumDimensionSizes(struct Input *in, FILE *strm) { - int ival; + long long llval; int i = 0; const char *err1 = "Unable to allocate dynamic memory.\n"; @@ -3186,11 +3186,11 @@ static int getMaximumDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%d", (&ival)) == 1) { - if (ival == -1) + while (fscanf(strm, "%lld", (&llval)) == 1) { + if (llval == -1) in->maxsizeOfDimension[i++] = H5S_UNLIMITED; else - in->maxsizeOfDimension[i++] = ival; + in->maxsizeOfDimension[i++] = (hsize_t)llval; } if (in->rank != i) { @@ -3927,7 +3927,7 @@ static int process(struct Options *opt) return (-1); } HDfclose(extfile); - H5Pset_external(proplist, in->externFilename, (off_t) 0, numOfElements * in->inputSize / 8); + H5Pset_external(proplist, in->externFilename, (off_t)0, numOfElements * (hsize_t)in->inputSize / 8); } /* create dataspace */ diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index b915d3a..ef2085c 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -122,35 +122,36 @@ int h5repack_end(pack_opt_t *options) { * *------------------------------------------------------------------------- */ -int h5repack_addfilter(const char* str, pack_opt_t *options) { - obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */ - filter_info_t filter; /* filter info for the current -f option entry */ - int n_objs; /* number of objects in the current -f or -l option entry */ - int is_glb; /* is the filter global */ - - /* parse the -f option */ - if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) - return -1; - - /* if it applies to all objects */ - if (is_glb) { - int n; - - n = options->n_filter_g++; /* increase # of global filters */ - - if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { - error_msg("maximum number of filters exceeded for <%s>\n", str); - HDfree(obj_list); - return -1; - } - - options->filter_g[n] = filter; - } - else - options_add_filter(obj_list, n_objs, filter, options->op_tbl); - - HDfree(obj_list); - return 0; +int +h5repack_addfilter(const char* str, pack_opt_t *options) +{ + obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */ + filter_info_t filter; /* filter info for the current -f option entry */ + unsigned n_objs; /* number of objects in the current -f or -l option entry */ + int is_glb; /* is the filter global */ + + /* parse the -f option */ + if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) + return -1; + + /* if it applies to all objects */ + if (is_glb) { + int n; + + n = options->n_filter_g++; /* increase # of global filters */ + if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { + error_msg("maximum number of filters exceeded for <%s>\n", str); + HDfree(obj_list); + return -1; + } + + options->filter_g[n] = filter; + } + else + options_add_filter(obj_list, n_objs, filter, options->op_tbl); + + HDfree(obj_list); + return 0; } /*------------------------------------------------------------------------- @@ -162,59 +163,53 @@ int h5repack_addfilter(const char* str, pack_opt_t *options) { * *------------------------------------------------------------------------- */ - -int h5repack_addlayout(const char* str, pack_opt_t *options) { - - obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */ - int n_objs; /*number of objects in the current -t or -c option entry */ - pack_info_t pack; /*info about layout to extract from parse */ - int j; - int ret_value = -1; - - init_packobject(&pack); - - if (options->all_layout == 1) { - error_msg( - "invalid layout input: 'all' option \ - is present with other objects <%s>\n", - str); - return ret_value; - } - - /* parse the layout option */ - obj_list = parse_layout(str, &n_objs, &pack, options); - if (obj_list) { - - /* set layout option */ - options->layout_g = pack.layout; - - /* no individual dataset specified */ - if (options->all_layout == 1) { - if (pack.layout == H5D_CHUNKED) { - /* -2 means the NONE option, remove chunking - and set the global layout to contiguous */ - if (pack.chunk.rank == -2) { - options->layout_g = H5D_CONTIGUOUS; - } - /* otherwise set the global chunking type */ - else { - options->chunk_g.rank = pack.chunk.rank; - for (j = 0; j < pack.chunk.rank; j++) - options->chunk_g.chunk_lengths[j] = - pack.chunk.chunk_lengths[j]; - } - } - } - - /* individual dataset specified */ - if (options->all_layout == 0) - ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); - - HDfree(obj_list); - ret_value = 0; - } - - return ret_value; +int +h5repack_addlayout(const char* str, pack_opt_t *options) +{ + obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */ + unsigned n_objs; /*number of objects in the current -t or -c option entry */ + pack_info_t pack; /*info about layout to extract from parse */ + int j; + int ret_value = -1; + + init_packobject(&pack); + + if (options->all_layout == 1) { + error_msg( "invalid layout input: 'all' option is present with other objects <%s>\n", str); + return ret_value; + } + + /* parse the layout option */ + obj_list = parse_layout(str, &n_objs, &pack, options); + if (obj_list) { + /* set layout option */ + options->layout_g = pack.layout; + + /* no individual dataset specified */ + if (options->all_layout == 1) { + if (pack.layout == H5D_CHUNKED) { + /* -2 means the NONE option, remove chunking + and set the global layout to contiguous */ + if (pack.chunk.rank == -2) + options->layout_g = H5D_CONTIGUOUS; + /* otherwise set the global chunking type */ + else { + options->chunk_g.rank = pack.chunk.rank; + for (j = 0; j < pack.chunk.rank; j++) + options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j]; + } + } + } + + /* individual dataset specified */ + if (options->all_layout == 0) + ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); + + HDfree(obj_list); + ret_value = 0; + } + + return ret_value; } /* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr() @@ -370,201 +365,201 @@ done: * *------------------------------------------------------------------------- */ -int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, - trav_table_t *travt, pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ +int +copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, + trav_table_t *travt, pack_opt_t *options) +{ + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ - size_t msize; /* size of type */ - void *buf = NULL; /* data buffer */ - hsize_t nelmts; /* number of elements in dataset */ - int rank; /* rank of dataset */ - htri_t is_named; /* Whether the datatype is named */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - char name[255]; - H5O_info_t oinfo; /* object info */ - int j; - unsigned u; - hbool_t is_ref = 0; - H5T_class_t type_class = -1; - - if (H5Oget_info(loc_in, &oinfo) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oget_info failed"); - - /*------------------------------------------------------------------------- - * copy all attributes - *------------------------------------------------------------------------- - */ - for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { - /* open attribute */ - if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, - H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); - - /* get name */ - if (H5Aget_name(attr_id, (size_t) 255, name) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); - - /* get the file datatype */ - if ((ftype_id = H5Aget_type(attr_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_type failed"); - - /* Check if the datatype is committed */ - if ((is_named = H5Tcommitted(ftype_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tcommitted failed"); + hid_t attr_out = -1; /* attr ID */ + hid_t space_id = -1; /* space ID */ + hid_t ftype_id = -1; /* file type ID */ + hid_t wtype_id = -1; /* read/write type ID */ + size_t msize; /* size of type */ + void *buf = NULL; /* data buffer */ + hsize_t nelmts; /* number of elements in dataset */ + int rank; /* rank of dataset */ + htri_t is_named; /* Whether the datatype is named */ + hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ + char name[255]; + H5O_info_t oinfo; /* object info */ + int j; + unsigned u; + hbool_t is_ref = 0; + H5T_class_t type_class = -1; + + if (H5Oget_info(loc_in, &oinfo) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); + + /*------------------------------------------------------------------------- + * copy all attributes + *------------------------------------------------------------------------- + */ + for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { + /* open attribute */ + if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); + + /* get name */ + if (H5Aget_name(attr_id, (size_t) 255, name) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + + /* get the file datatype */ + if ((ftype_id = H5Aget_type(attr_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); + + /* Check if the datatype is committed */ + if ((is_named = H5Tcommitted(ftype_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); if (is_named && travt) { - hid_t fidout; + hid_t fidout; - /* Create out file id */ - if ((fidout = H5Iget_file_id(loc_out)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Iget_file_id failed"); + /* Create out file id */ + if ((fidout = H5Iget_file_id(loc_out)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed"); - /* Copy named dt */ - if ((wtype_id = copy_named_datatype(ftype_id, fidout, - named_dt_head_p, travt, options)) < 0) { - H5Fclose(fidout); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_named_datatype failed"); + /* Copy named dt */ + if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) { + H5Fclose(fidout); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); } /* end if */ - if (H5Fclose(fidout) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fclose failed"); + if (H5Fclose(fidout) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); } /* end if */ - else { - if (options->use_native == 1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - } /* end else */ - - /* get the dataspace handle */ - if ((space_id = H5Aget_space(attr_id)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_space failed"); - - /* get dimensions */ - if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - nelmts = 1; - for (j = 0; j < rank; j++) - nelmts *= dims[j]; - - if ((msize = H5Tget_size(wtype_id)) == 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed"); - - /*------------------------------------------------------------------------- - * object references are a special case. We cannot just copy the buffers, - * but instead we recreate the reference. - * This is done on a second sweep of the file that just copies the referenced - * objects at copy_refs_attr() - *------------------------------------------------------------------------- - */ - type_class = H5Tget_class(wtype_id); - is_ref = (type_class == H5T_REFERENCE); - if (type_class == H5T_VLEN || type_class == H5T_ARRAY) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); - H5Tclose(base_type); - } - - if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(wtype_id); - for (j = 0; j < nmembers; j++) { - hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j); - H5T_class_t mtclass = H5Tget_class(mtid); - H5Tclose(mtid); - - if (mtclass == H5T_REFERENCE) { - is_ref = 1; - break; - } - } /* for (j=0; iuse_native == 1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + } /* end else */ + + /* get the dataspace handle */ + if ((space_id = H5Aget_space(attr_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); + + /* get dimensions */ + if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + + nelmts = 1; + for (j = 0; j < rank; j++) + nelmts *= dims[j]; + + if ((msize = H5Tget_size(wtype_id)) == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + /*------------------------------------------------------------------------- + * object references are a special case. We cannot just copy the buffers, + * but instead we recreate the reference. + * This is done on a second sweep of the file that just copies the referenced + * objects at copy_refs_attr() + *------------------------------------------------------------------------- + */ + type_class = H5Tget_class(wtype_id); + is_ref = (type_class == H5T_REFERENCE); + if (type_class == H5T_VLEN || type_class == H5T_ARRAY) { + hid_t base_type = -1; + + base_type = H5Tget_super(ftype_id); + is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); + H5Tclose(base_type); + } + + if (type_class == H5T_COMPOUND) { + int nmembers = H5Tget_nmembers(wtype_id); + + for (j = 0; j < nmembers; j++) { + hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j); + H5T_class_t mtclass = H5Tget_class(mtid); + H5Tclose(mtid); + + if (mtclass == H5T_REFERENCE) { + is_ref = 1; + break; + } + } /* for (j=0; iverbose) - printf(FORMAT_OBJ_ATTR, "attr", name); - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (H5Tclose(ftype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); + + /*close*/ + if (H5Aclose(attr_out) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + + /* Check if we have VL data and string in the attribute's datatype that must + * be reclaimed */ + if (TRUE == h5tools_detect_vlen(wtype_id)) + H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); + HDfree(buf); + buf = NULL; + } /*H5T_REFERENCE*/ + + if (options->verbose) + printf(FORMAT_OBJ_ATTR, "attr", name); + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + if (H5Tclose(ftype_id) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); if (H5Tclose(wtype_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); if (H5Sclose(space_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if (H5Aclose(attr_id) < 0) - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); } /* u */ - return 0; + return 0; done: - H5E_BEGIN_TRY - { - if (buf) { - /* Check if we have VL data and string in the attribute's datatype that must - * be reclaimed */ - if (TRUE == h5tools_detect_vlen(wtype_id)) - H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); - - /* Free buf */ - HDfree(buf); - } /* end if */ + H5E_BEGIN_TRY { + if (buf) { + /* Check if we have VL data and string in the attribute's datatype that must + * be reclaimed */ + if (TRUE == h5tools_detect_vlen(wtype_id)) + H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf); + + /* Free buf */ + HDfree(buf); + } /* end if */ - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Sclose(space_id); - H5Aclose(attr_id); - H5Aclose(attr_out); - } H5E_END_TRY; + H5Tclose(ftype_id); + H5Tclose(wtype_id); + H5Sclose(space_id); + H5Aclose(attr_id); + H5Aclose(attr_out); + } H5E_END_TRY; - return ret_value; + return ret_value; } /* end copy_attr() */ /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 329be1f..d2ab923 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -82,9 +82,9 @@ typedef struct { /* store a table of all objects */ typedef struct { - unsigned int size; - unsigned int nelems; - pack_info_t *objs; + unsigned int size; + unsigned int nelems; + pack_info_t *objs; } pack_opttbl_t; @@ -114,7 +114,7 @@ typedef struct { hsize_t ublock_size; /* user block size */ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ hsize_t threshold; /* alignment threshold for H5Pset_alignment */ - hsize_t alignment ; /* alignment for H5Pset_alignment */ + hsize_t alignment; /* alignment for H5Pset_alignment */ H5F_file_space_type_t fs_strategy; /* File space handling strategy */ hsize_t fs_threshold; /* Free space section threshold */ } pack_opt_t; @@ -210,11 +210,11 @@ int apply_filters(const char* name, /* object name from traverse list */ int options_table_init( pack_opttbl_t **tbl ); int options_table_free( pack_opttbl_t *table ); int options_add_layout( obj_list_t *obj_list, - int n_objs, + unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table ); int options_add_filter ( obj_list_t *obj_list, - int n_objs, + unsigned n_objs, filter_info_t filt, pack_opttbl_t *table ); pack_info_t* options_get_object( const char *path, @@ -226,13 +226,13 @@ pack_info_t* options_get_object( const char *path, */ obj_list_t* parse_filter(const char *str, - int *n_objs, + unsigned *n_objs, filter_info_t *filt, pack_opt_t *options, int *is_glb); obj_list_t* parse_layout(const char *str, - int *n_objs, + unsigned *n_objs, pack_info_t *pack, /* info about object */ pack_opt_t *options); diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index e903435..0998f20 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -428,7 +428,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) { break; case 'm': - options->min_comp = HDatoi( opt_arg ); + options->min_comp = HDstrtoull(opt_arg , NULL, 0); if ((int) options->min_comp <= 0) { error_msg("invalid minimum compress size <%s>\n", opt_arg); h5tools_setstatus(EXIT_FAILURE); @@ -515,7 +515,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) { break; case 'a': - options->alignment = HDatol( opt_arg ); + options->alignment = HDstrtoull(opt_arg , NULL, 0); if (options->alignment < 1) { error_msg("invalid alignment size\n", opt_arg); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index b54e887..8c98b76 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -105,21 +105,22 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, * *------------------------------------------------------------------------- */ - -static int aux_inctable(pack_opttbl_t *table, int n_objs) { - unsigned int i; - - table->size += n_objs; - table->objs = - (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); - if (table->objs == NULL) { - error_msg("not enough memory for options table\n"); - return -1; - } - for (i = table->nelems; i < table->size; i++) { - init_packobject(&table->objs[i]); - } - return 0; +static int +aux_inctable(pack_opttbl_t *table, unsigned n_objs) +{ + unsigned u; + + table->size += n_objs; + table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); + if (table->objs == NULL) { + error_msg("not enough memory for options table\n"); + return -1; + } + + for (u = table->nelems; u < table->size; u++) + init_packobject(&table->objs[u]); + + return 0; } @@ -183,80 +184,77 @@ int options_table_free(pack_opttbl_t *table) { * *------------------------------------------------------------------------- */ - -int options_add_layout(obj_list_t *obj_list, int n_objs, pack_info_t *pack, - pack_opttbl_t *table) { - unsigned int i, I; - int j, added = 0, found = 0; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems + n_objs >= table->size) { - if (aux_inctable(table, n_objs) < 0) - return -1; - } - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems > 0) { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - /* linear table search */ - for (i = 0; i < table->nelems; i++) { - /*already on the table */ - if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { - /* already chunk info inserted for this one; exit */ - if (table->objs[i].chunk.rank > 0) { - error_msg( - "chunk information already inserted for <%s>\n", - obj_list[j].obj); - HDexit(EXIT_FAILURE); - } - /* insert the layout info */ - else { - aux_tblinsert_layout(table, i, pack); - found = 1; - break; - } - } /* if */ - } /* i */ - - if (found == 0) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_layout(table, I, pack); - } - /* cases where we have an already inserted name but there is a new name also - example: - -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 - dset1 is already inserted, but dset2 must also be - */ - else if (found == 1 - && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_layout(table, I, pack); - } - } /* j */ - } - - /* first time insertion */ - else { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_layout(table, I, pack); - - } - } - - table->nelems += added; - - return 0; +int +options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, + pack_opttbl_t *table) +{ + unsigned i, j, I; + unsigned added = 0; + hbool_t found = FALSE; + + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems + n_objs >= table->size) + if (aux_inctable(table, n_objs) < 0) + return -1; + + /* search if this object is already in the table; "path" is the key */ + if (table->nelems > 0) { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + /* linear table search */ + for (i = 0; i < table->nelems; i++) { + /*already on the table */ + if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { + /* already chunk info inserted for this one; exit */ + if (table->objs[i].chunk.rank > 0) { + error_msg("chunk information already inserted for <%s>\n", obj_list[j].obj); + HDexit(EXIT_FAILURE); + } + /* insert the layout info */ + else { + aux_tblinsert_layout(table, i, pack); + found = TRUE; + break; + } + } /* if */ + } /* i */ + + if (!found) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_layout(table, I, pack); + } + /* cases where we have an already inserted name but there is a new name also + example: + -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 + dset1 is already inserted, but dset2 must also be + */ + else + if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_layout(table, I, pack); + } + } /* j */ + } + /* first time insertion */ + else { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_layout(table, I, pack); + } + } + + table->nelems += added; + + return 0; } /*------------------------------------------------------------------------- @@ -268,71 +266,71 @@ int options_add_layout(obj_list_t *obj_list, int n_objs, pack_info_t *pack, * *------------------------------------------------------------------------- */ - -int options_add_filter(obj_list_t *obj_list, int n_objs, filter_info_t filt, - pack_opttbl_t *table) { - - unsigned int i, I; - int j, added = 0, found = 0; - - /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems + n_objs >= table->size) { - if (aux_inctable(table, n_objs) < 0) - return -1; - } - - /* search if this object is already in the table; "path" is the key */ - if (table->nelems > 0) { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - /* linear table search */ - for (i = 0; i < table->nelems; i++) { - /*already on the table */ - if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { - /* insert */ - aux_tblinsert_filter(table, i, filt); - found = 1; - break; - } /* if */ - } /* i */ - - if (found == 0) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_filter(table, I, filt); - } - /* cases where we have an already inserted name but there is a new name also - example: - -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 - dset1 is already inserted, but dset2 must also be - */ - else if (found == 1 - && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { - /* keep the grow in a temp var */ - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_filter(table, I, filt); - } - } /* j */ - } - - /* first time insertion */ - else { - /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) { - I = table->nelems + added; - added++; - HDstrcpy(table->objs[I].path, obj_list[j].obj); - aux_tblinsert_filter(table, I, filt); - } - } - - table->nelems += added; - - return 0; +int +options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, + pack_opttbl_t *table) +{ + unsigned int i, j, I; + unsigned added = 0; + hbool_t found = FALSE; + + /* increase the size of the collection by N_OBJS if necessary */ + if (table->nelems + n_objs >= table->size) + if (aux_inctable(table, n_objs) < 0) + return -1; + + /* search if this object is already in the table; "path" is the key */ + if (table->nelems > 0) { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + /* linear table search */ + for (i = 0; i < table->nelems; i++) { + /*already on the table */ + if (HDstrcmp(obj_list[j].obj, table->objs[i].path) == 0) { + /* insert */ + aux_tblinsert_filter(table, i, filt); + found = TRUE; + break; + } /* if */ + } /* i */ + + if (!found) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_filter(table, I, filt); + } + /* cases where we have an already inserted name but there is a new name also + example: + -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 + dset1 is already inserted, but dset2 must also be + */ + else + if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) { + /* keep the grow in a temp var */ + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_filter(table, I, filt); + } + } /* j */ + } + + /* first time insertion */ + else { + /* go tru the supplied list of names */ + for (j = 0; j < n_objs; j++) { + I = table->nelems + added; + added++; + HDstrcpy(table->objs[I].path, obj_list[j].obj); + aux_tblinsert_filter(table, I, filt); + } + } + + table->nelems += added; + + return 0; } /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 1d71c13..c65a311 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -44,23 +44,22 @@ * *------------------------------------------------------------------------- */ - - obj_list_t* parse_filter(const char *str, - int *n_objs, + unsigned *n_objs, filter_info_t *filt, pack_opt_t *options, int *is_glb) { - unsigned i, u; + size_t i, m, u; char c; - size_t len=HDstrlen(str); - int j, m, n, k, l, p, r, q, end_obj=-1, no_param=0; + size_t len = HDstrlen(str); + int k, l, p, r, q, end_obj = -1, no_param = 0; + unsigned j, n; char sobj[MAX_NC_NAME]; char scomp[10]; char stype[6]; char smask[3]; - obj_list_t* obj_list=NULL; + obj_list_t* obj_list = NULL; unsigned pixels_per_block; @@ -69,66 +68,60 @@ obj_list_t* parse_filter(const char *str, *is_glb = 0; /* check for the end of object list and number of objects */ - for ( i = 0, n = 0; i < len; i++) - { + for(i = 0, n = 0; i < len; i++) { c = str[i]; - if ( c==':' ) - { - end_obj=i; - } - if ( c==',' ) - { + if(c == ':') + end_obj = (int)i; + if(c == ',') n++; - } } - if (end_obj==-1) /* missing : */ - { + /* Check for missing : */ + if(end_obj == -1) { /* apply to all objects */ - options->all_filter=1; + options->all_filter = 1; *is_glb = 1; } n++; - obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); - if (obj_list==NULL) - { + obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t)); + if(obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; } - *n_objs=n; + *n_objs = n; /* get object list */ - for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) - { - c = str[j]; - sobj[k] = c; - if ( c==',' || j==end_obj-1) - { - if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; - HDstrcpy(obj_list[n].obj,sobj); - HDmemset(sobj,0,sizeof(sobj)); - n++; - k=-1; + if(end_obj > 0) + for(j = 0, k = 0, n = 0; j < (unsigned)end_obj; j++, k++) { + c = str[j]; + sobj[k] = c; + if(c == ',' || j == (unsigned)(end_obj - 1)) { + if(c==',') + sobj[k]='\0'; + else + sobj[k+1]='\0'; + HDstrcpy(obj_list[n].obj,sobj); + HDmemset(sobj,0,sizeof(sobj)); + n++; + k=-1; + } } - } /* nothing after : */ - if (end_obj+1==(int)len) - { - if (obj_list) HDfree(obj_list); + if(end_obj + 1 == (int)len) { + if(obj_list) + HDfree(obj_list); error_msg("input Error: Invalid compression type in <%s>\n",str); HDexit(EXIT_FAILURE); } /* get filter additional parameters */ - m=0; - for ( i=end_obj+1, k=0, j=0; i\n",str); HDexit(EXIT_FAILURE); } if (l==-1) stype[m]=c; - else - { - smask[l]=c; + else { + smask[l] = c; l++; - if (l==2) - { - smask[l]='\0'; - i=len-1; /* end */ + if(l == 2) { + smask[l] = '\0'; + i = len - 1; /* end */ (*n_objs)--; /* we counted an extra ',' */ if (HDstrcmp(smask,"NN")==0) filt->cd_values[j++]=H5_SZIP_NN_OPTION_MASK; else if (HDstrcmp(smask,"EC")==0) filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK; - else - { + else { error_msg("szip mask must be 'NN' or 'EC' \n"); HDexit(EXIT_FAILURE); } @@ -213,7 +200,7 @@ obj_list_t* parse_filter(const char *str, u++; /* skip ',' */ } c = str[u]; - if (!isdigit(c) && l==-1) + if (!HDisdigit(c) && l==-1) { if (obj_list) HDfree(obj_list); error_msg("compression parameter is not a digit in <%s>\n",str); @@ -258,40 +245,34 @@ obj_list_t* parse_filter(const char *str, l=-1; /* filter number index check */ p=-1; /* CD_VAL count check */ r=-1; /* CD_VAL check */ - for ( m=0,q=0,u=i+1; ufiltn=atoi(stype); - l=0; + if(l == -1) { + filt->filtn = HDatoi(stype); + l = 0; } - else if (p==-1) - { - filt->cd_nelmts=atoi(stype); - p=0; + else if(p == -1) { + filt->cd_nelmts = HDstrtoull(stype , NULL, 0); + p = 0; } else - r=0; - q=0; + r = 0; + q = 0; u++; /* skip ',' */ } c = str[u]; - if (!isdigit(c) && l==-1) - { - if (obj_list) HDfree(obj_list); + if(!HDisdigit(c) && l == -1) { + if(obj_list) + HDfree(obj_list); error_msg("filter number parameter is not a digit in <%s>\n",str); HDexit(EXIT_FAILURE); } - stype[q]=c; - if (l==0 && p==0) - { - if (r==0) - filt->cd_values[j++]=atoi(stype); + stype[q] = c; + if(l == 0 && p == 0) { + if(r == 0) + filt->cd_values[j++] = (unsigned)HDstrtoul(stype , NULL, 0); } - } /* u */ stype[q]='\0'; @@ -309,7 +290,7 @@ obj_list_t* parse_filter(const char *str, for ( m=0,u=i+1; u\n",str); HDexit(EXIT_FAILURE); @@ -320,9 +301,7 @@ obj_list_t* parse_filter(const char *str, stype[m]='\0'; } /*if */ - - - filt->cd_values[j++]=atoi(stype); + filt->cd_values[j++] = (unsigned)HDstrtoul(stype , NULL, 0); i+=m; /* jump */ } else if (i==len-1) @@ -442,17 +421,18 @@ obj_list_t* parse_filter(const char *str, * User Defined Filter *------------------------------------------------------------------------- */ - else if (HDstrcmp(scomp,"UD")==0) - { - if (filt->cd_nelmts != j) - { /* parameters does not match count */ - if (obj_list) HDfree(obj_list); + else if(HDstrcmp(scomp, "UD") == 0) { + /* parameters does not match count */ + if(filt->cd_nelmts != j) { + if(obj_list) + HDfree(obj_list); error_msg("incorrect number of compression parameters in <%s>\n",str); HDexit(EXIT_FAILURE); } } else { - if (obj_list) HDfree(obj_list); + if(obj_list) + HDfree(obj_list); error_msg("invalid filter type in <%s>\n",str); HDexit(EXIT_FAILURE); } @@ -516,8 +496,7 @@ obj_list_t* parse_filter(const char *str, return obj_list; } - - + /*------------------------------------------------------------------------- * Function: parse_layout * @@ -540,36 +519,30 @@ obj_list_t* parse_filter(const char *str, *------------------------------------------------------------------------- */ obj_list_t* parse_layout(const char *str, - int *n_objs, + unsigned *n_objs, pack_info_t *pack, /* info about layout needed */ pack_opt_t *options) { - obj_list_t* obj_list=NULL; - unsigned i; + obj_list_t* obj_list = NULL; + unsigned i, j, n; char c; - size_t len=HDstrlen(str); - int j, n, k, end_obj=-1, c_index; + size_t len = HDstrlen(str); + int k, end_obj = -1, c_index; char sobj[MAX_NC_NAME]; char sdim[10]; char slayout[10]; - HDmemset(sdim, '\0', sizeof(sdim)); HDmemset(sobj, '\0', sizeof(sobj)); HDmemset(slayout, '\0', sizeof(slayout)); /* check for the end of object list and number of objects */ - for ( i=0, n=0; i 0) + for(j = 0, k = 0, n = 0; j < (unsigned)end_obj; j++, k++) { + c = str[j]; + sobj[k] = c; + if(c == ',' || j == (unsigned)(end_obj - 1)) { + if(c == ',') + sobj[k] = '\0'; + else + sobj[k + 1] = '\0'; + HDstrcpy(obj_list[n].obj,sobj); + HDmemset(sobj,0,sizeof(sobj)); + n++; + k=-1; + } } - } /* nothing after : */ if (end_obj+1==(int)len) @@ -609,8 +584,7 @@ obj_list_t* parse_layout(const char *str, } /* get layout info */ - for ( j=end_obj+1, n=0; n<=5; j++,n++) - { + for(j = (unsigned)(end_obj + 1), n = 0; n <= 5; j++, n++) { if (n==5) { slayout[n]='\0'; /*cut string */ @@ -642,20 +616,18 @@ obj_list_t* parse_layout(const char *str, */ k=0; - if (j>(int)len) - { + if(j > len) { if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> Chunk dimensions missing\n",str); HDexit(EXIT_FAILURE); } - for ( i=j, c_index=0; ichunk.chunk_lengths[c_index]=atoi(sdim); + pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim , NULL, 0); if (pack->chunk.chunk_lengths[c_index]==0) { if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", @@ -687,7 +659,7 @@ obj_list_t* parse_layout(const char *str, } else { - pack->chunk.chunk_lengths[c_index]=atoi(sdim); + pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim , NULL, 0); if (pack->chunk.chunk_lengths[c_index]==0){ if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 07ea676..82b45fc 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -3421,7 +3421,7 @@ make_userblock(void) /* Initialize userblock data */ for(u = 0; u < USERBLOCK_SIZE; u++) - ub[u] = 'a' + (char)(u % 26); + ub[u] = (char)('a' + (char)(u % 26)); /* Re-open HDF5 file, as "plain" file */ if((fd = HDopen(FNAME16, O_WRONLY, 0644)) < 0) @@ -3534,7 +3534,7 @@ make_userblock_file(void) /* initialize userblock data */ for(u = 0; u < USERBLOCK_SIZE; u++) - ub[u] = 'a' + (char)(u % 26); + ub[u] = (char)('a' + (char)(u % 26)); /* open file */ if((fd = HDopen(FNAME_UB,O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0) @@ -3591,7 +3591,8 @@ int write_dset_in(hid_t loc_id, hid_t sid=-1; hid_t tid=-1; hid_t pid=-1; - int val, i, j, k, n; + unsigned i, j; + int val, k, n; float f; /* create 1D attributes with dimension [2], 2 elements */ @@ -3646,13 +3647,10 @@ int write_dset_in(hid_t loc_id, */ - if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<2; j++) - { - buf1[i][j]='z'; - } + if(make_diffs) { + for(i = 0; i < 2; i++) + for(j = 0; j < 2; j++) + buf1[i][j] = 'z'; } @@ -3675,10 +3673,9 @@ int write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - buf2[i]=buf2[1]=0; + if(make_diffs) { + for(i = 0; i < 2; i++) + buf2[i] = buf2[1] = 0; } if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) @@ -3693,11 +3690,10 @@ int write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf3[i].a=0; buf3[i].b=0; + if(make_diffs) { + for(i = 0; i < 2; i++) { + buf3[i].a = 0; + buf3[i].b = 0; } } @@ -3716,12 +3712,9 @@ int write_dset_in(hid_t loc_id, */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf45[i]=GREEN; - } + if(make_diffs) { + for(i = 0; i < 2; i++) + buf45[i] = GREEN; } if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) @@ -3813,13 +3806,10 @@ int write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - for (j=0; j<3; j++) - { - buf6[i][j]=0; - } + if(make_diffs) { + for(i = 0; i < 2; i++) + for(j = 0; j < 3; j++) + buf6[i][j] = 0; } if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0) @@ -3880,12 +3870,10 @@ int write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - if (make_diffs) - { - for (i=0; i<2; i++) - { - buf7[i]=0; - buf8[i]=0; + if(make_diffs) { + for(i = 0; i < 2; i++) { + buf7[i] = 0; + buf8[i] = 0; } } @@ -4008,16 +3996,13 @@ int write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ n = 0; - for(i = 0; i < 3; i++) - { - for(j = 0; j < 2; j++) - { - int l; + for(i = 0; i < 3; i++) { + for(j = 0; j < 2; j++) { + unsigned l; buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) - { + for(l = 0; l < i + 1; l++) { if(make_diffs) ((int *)buf52[i][j].p)[l] = 0; else @@ -4128,11 +4113,13 @@ int write_dset_in(hid_t loc_id, n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) buf23[i][j][k]=0; - else buf23[i][j][k]=n++; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + if(make_diffs) + buf23[i][j][k] = 0; + else + buf23[i][j][k] = (char)(n++); } } } @@ -4164,16 +4151,16 @@ int write_dset_in(hid_t loc_id, */ n=1; - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { - for (k = 0; k < 2; k++) { - if (make_diffs) { - buf33[i][j][k].a=0; - buf33[i][j][k].b=0; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + if(make_diffs) { + buf33[i][j][k].a = 0; + buf33[i][j][k].b = 0; } else { - buf33[i][j][k].a=n++; - buf33[i][j][k].b=n++; + buf33[i][j][k].a = (char)(n++); + buf33[i][j][k].b = n++; } } } @@ -4227,18 +4214,14 @@ int write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ n = 0; - for(i = 0; i < 4; i++) - { - for(j = 0; j < 3; j++) - { - for(k = 0; k < 2; k++) - { - int l; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + unsigned l; buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); - for(l = 0; l < i + 1; l++) - { + for(l = 0; l < i + 1; l++) { if(make_diffs) ((int *)buf53[i][j][k].p)[l] = 0; else @@ -4274,10 +4257,8 @@ int write_dset_in(hid_t loc_id, n = 1; - for(i = 0; i < 24; i++) - { - for(j = 0; j < (int)dimarray[0]; j++) - { + for(i = 0; i < 24; i++) { + for(j = 0; j < dimarray[0]; j++) { if(make_diffs) buf63[i][j] = 0; else @@ -4316,13 +4297,10 @@ int write_dset_in(hid_t loc_id, if (write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0) goto out; - return 0; - out: - H5E_BEGIN_TRY - { + H5E_BEGIN_TRY { H5Pclose(pid); H5Sclose(sid); H5Dclose(did); @@ -4471,7 +4449,8 @@ int write_attr_in(hid_t loc_id, hid_t aid = -1; hid_t sid = -1; hid_t tid = -1; - int val, i, j, k, n; + int val, j, k, n; + unsigned i; float f; /* create 1D attributes with dimension [2], 2 elements */ @@ -5021,16 +5000,17 @@ int write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ n=0; - for (i = 0; i < 3; i++) - { - for (j = 0; j < 2; j++) - { - int l; + for(i = 0; i < 3; i++) { + for(j = 0; j < 2; j++) { + unsigned l; + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); - for (l = 0; l < i + 1; l++) - if (make_diffs)((int *)buf52[i][j].p)[l] = 0; - else ((int *)buf52[i][j].p)[l] = n++; + for(l = 0; l < i + 1; l++) + if(make_diffs) + ((int *)buf52[i][j].p)[l] = 0; + else + ((int *)buf52[i][j].p)[l] = n++; } } @@ -5239,14 +5219,13 @@ int write_attr_in(hid_t loc_id, */ n=1; - for (i = 0; i < 4; i++) - { - for (j = 0; j < 3; j++) - { - for (k = 0; k < 2; k++) - { - if (make_diffs) buf23[i][j][k]=0; - else buf23[i][j][k]=n++; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + if(make_diffs) + buf23[i][j][k] = 0; + else + buf23[i][j][k] = (char)(n++); } } } @@ -5308,21 +5287,16 @@ int write_attr_in(hid_t loc_id, */ n=1; - for (i = 0; i < 4; i++) - { - for (j = 0; j < 3; j++) - { - for (k = 0; k < 2; k++) - { - if (make_diffs) - { - buf33[i][j][k].a=0; - buf33[i][j][k].b=0; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + if(make_diffs) { + buf33[i][j][k].a = 0; + buf33[i][j][k].b = 0; } - else - { - buf33[i][j][k].a=n++; - buf33[i][j][k].b=n++; + else { + buf33[i][j][k].a = (char)(n++); + buf33[i][j][k].b = n++; } } } @@ -5491,14 +5465,13 @@ int write_attr_in(hid_t loc_id, { for (k = 0; k < 2; k++) { - int l; + unsigned l; + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)i + 1; for (l = 0; l < i + 1; l++) if (make_diffs) - { ((int *)buf53[i][j][k].p)[l] = 0; - } else ((int *)buf53[i][j][k].p)[l] = n++; } @@ -5622,8 +5595,7 @@ int write_attr_in(hid_t loc_id, return 0; out: - H5E_BEGIN_TRY - { + H5E_BEGIN_TRY { H5Aclose(aid); H5Sclose(sid); H5Tclose(tid); diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 1c1bba1..ad2d306 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -63,7 +63,7 @@ param_t params; /* Command line parameter settings */ static void leave(int ret) { - int curr_group; + size_t curr_group; if (params.fname) HDfree (params.fname); @@ -180,7 +180,7 @@ parse_command_line(int argc, const char *argv[], param_t *parms) } /* end if */ /* Allocate space for the group name pointers */ - parms->ngroups = (argc - opt_ind); + parms->ngroups = (size_t)(argc - opt_ind); parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *)); /* Retrieve the group names */ diff --git a/tools/misc/vds/UC_1.h b/tools/misc/vds/UC_1.h index 24299d4..2150cfa 100644 --- a/tools/misc/vds/UC_1.h +++ b/tools/misc/vds/UC_1.h @@ -93,7 +93,6 @@ static hsize_t UC_1_DIMS[UC_1_N_SOURCES][RANK] = { {0, UC_1_SM_HEIGHT, UC_1_WIDTH}, {0, UC_1_LG_HEIGHT, UC_1_WIDTH} }; -static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH}; /* Maximum size of datasets, both source and VDS */ static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = { @@ -104,18 +103,6 @@ static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = { {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH}, {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH} }; -static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH}; - -/* Planes */ -static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = { - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, - {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, - {1, UC_1_LG_HEIGHT, UC_1_WIDTH} -}; -static hsize_t UC_1_VDS_PLANE[RANK] = {1, UC_1_FULL_HEIGHT, UC_1_WIDTH}; /* File names for source datasets */ static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = { @@ -127,24 +114,8 @@ static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = { {"1_f.h5"} }; -/* VDS file name */ -static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5"; - /* Dataset names */ -static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; -static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; - -/* Fill values */ -static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = { - -1, - -2, - -3, - -4, - -5, - -6 -}; -static int UC_1_VDS_FILL_VALUE = -9; #endif /* UC_1_H */ diff --git a/tools/misc/vds/UC_1_one_dim_gen.c b/tools/misc/vds/UC_1_one_dim_gen.c index ee56622..f47b982 100644 --- a/tools/misc/vds/UC_1_one_dim_gen.c +++ b/tools/misc/vds/UC_1_one_dim_gen.c @@ -27,6 +27,36 @@ #include "UC_common.h" #include "UC_1.h" +static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH}; +static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH}; + +/* Planes */ +static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = { + {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, + {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, + {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, + {1, UC_1_LG_HEIGHT, UC_1_WIDTH}, + {1, UC_1_SM_HEIGHT, UC_1_WIDTH}, + {1, UC_1_LG_HEIGHT, UC_1_WIDTH} +}; + +/* VDS file name */ +static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5"; + +/* Dataset names */ +static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset"; +static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset"; + +/* Fill values */ +static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = { + -1, + -2, + -3, + -4, + -5, + -6 +}; +static int UC_1_VDS_FILL_VALUE = -9; int main(void) @@ -44,7 +74,7 @@ main(void) hsize_t extent[RANK]; /* dataset extents */ hsize_t start[RANK]; /* starting point for hyperslab */ - int map_start = -1; /* starting point in the VDS map */ + hsize_t map_start = 0; /* starting point in the VDS map */ int *buffer = NULL; /* data buffer */ hsize_t count = 0; /* number of elements in a plane */ @@ -53,7 +83,7 @@ main(void) int i; /* iterator */ int j; /* iterator */ - int k; /* iterator */ + hsize_t k; /* iterator */ /* Start by creating the virtual dataset (VDS) dataspace and creation @@ -136,7 +166,7 @@ main(void) for(k = 0; k < count; k++) buffer[k] = value; - start[0] = j; + start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0) diff --git a/tools/misc/vds/UC_2.h b/tools/misc/vds/UC_2.h index 8b9f19a..fe3f350 100644 --- a/tools/misc/vds/UC_2.h +++ b/tools/misc/vds/UC_2.h @@ -79,7 +79,6 @@ static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = { {0, UC_2_D_HEIGHT, UC_2_WIDTH}, {0, UC_2_E_HEIGHT, UC_2_WIDTH} }; -static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; /* Maximum size of datasets, both source and VDS */ static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = { @@ -89,36 +88,6 @@ static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = { {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH}, {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH} }; -static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; - -/* Positions of source datasets in the VDS */ -static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = { - /* A */ {0, 0, 0}, - /* B */ {0, UC_2_A_HEIGHT, 0}, - /* C */ {0, UC_2_AB_HEIGHT, 0}, - /* D */ {0, 0, UC_2_WIDTH}, - /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH} -}; - -/* Planes */ -static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = { - {1, UC_2_A_HEIGHT, UC_2_WIDTH}, - {1, UC_2_B_HEIGHT, UC_2_WIDTH}, - {1, UC_2_C_HEIGHT, UC_2_WIDTH}, - {1, UC_2_D_HEIGHT, UC_2_WIDTH}, - {1, UC_2_E_HEIGHT, UC_2_WIDTH} -}; -static hsize_t UC_2_VDS_SUB_IMAGE[RANK] = {1, UC_2_FULL_HEIGHT, UC_2_WIDTH}; -static hsize_t UC_2_VDS_PLANE[RANK] = {1, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; - -/* Chunk dimensions */ -static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = { - {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH}, - {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH} -}; /* File names for source datasets */ static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = { @@ -137,15 +106,5 @@ static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = { #define UC_2_SOURCE_DSET_PATH "/source_dset" #define UC_2_VDS_DSET_NAME "vds_dset" -/* Fill values */ -static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = { - -1, - -2, - -3, - -4, - -5 -}; -static int UC_2_VDS_FILL_VALUE = -9; - #endif /* UC_2_H */ diff --git a/tools/misc/vds/UC_2_two_dims_gen.c b/tools/misc/vds/UC_2_two_dims_gen.c index c3dfa65..d08cc5f 100644 --- a/tools/misc/vds/UC_2_two_dims_gen.c +++ b/tools/misc/vds/UC_2_two_dims_gen.c @@ -27,6 +27,46 @@ #include "UC_common.h" #include "UC_2.h" +static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; +static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH}; + +/* Positions of source datasets in the VDS */ +static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = { + /* A */ {0, 0, 0}, + /* B */ {0, UC_2_A_HEIGHT, 0}, + /* C */ {0, UC_2_AB_HEIGHT, 0}, + /* D */ {0, 0, UC_2_WIDTH}, + /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH} +}; + +/* Planes */ +static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = { + {1, UC_2_A_HEIGHT, UC_2_WIDTH}, + {1, UC_2_B_HEIGHT, UC_2_WIDTH}, + {1, UC_2_C_HEIGHT, UC_2_WIDTH}, + {1, UC_2_D_HEIGHT, UC_2_WIDTH}, + {1, UC_2_E_HEIGHT, UC_2_WIDTH} +}; + +/* Chunk dimensions */ +static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = { + {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH}, + {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH} +}; + +/* Fill values */ +static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = { + -1, + -2, + -3, + -4, + -5 +}; +static int UC_2_VDS_FILL_VALUE = -9; + int main(void) { @@ -51,7 +91,7 @@ main(void) int i; /* iterator */ int j; /* iterator */ - int k; /* iterator */ + hsize_t k; /* iterator */ /* Start by creating the virtual dataset (VDS) dataspace and creation @@ -132,7 +172,7 @@ main(void) for(k = 0; k < count; k++) buffer[k] = value; - start[0] = j; + start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0) diff --git a/tools/misc/vds/UC_3.h b/tools/misc/vds/UC_3.h index a27c3cf..0654a48 100644 --- a/tools/misc/vds/UC_3.h +++ b/tools/misc/vds/UC_3.h @@ -60,10 +60,6 @@ static hsize_t UC_32_POSITIONS[UC_2_N_SOURCES][RANK] = { /* E */ {0, 8, 12} }; -/* Planes */ -static hsize_t UC_31_VDS_PLANE[RANK] = {1, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH}; -static hsize_t UC_32_VDS_PLANE[RANK] = {1, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH}; - /* VDS file names */ #define UC_31_VDS_FILE_NAME "3_1_vds.h5" #define UC_32_VDS_FILE_NAME "3_2_vds.h5" diff --git a/tools/misc/vds/UC_4_printf_gen.c b/tools/misc/vds/UC_4_printf_gen.c index c0bb6b5..d067d47 100644 --- a/tools/misc/vds/UC_4_printf_gen.c +++ b/tools/misc/vds/UC_4_printf_gen.c @@ -51,7 +51,7 @@ main(void) int i; /* iterator */ int j; /* iterator */ - int k; /* iterator */ + hsize_t k; /* iterator */ /************************************ * Create source files and datasets * @@ -112,7 +112,7 @@ main(void) for(k = 0; k < n; k++) buffer[k] = value; - start[0] = j; + start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0) diff --git a/tools/misc/vds/UC_5_stride_gen.c b/tools/misc/vds/UC_5_stride_gen.c index 9fa4908..38d24a6 100644 --- a/tools/misc/vds/UC_5_stride_gen.c +++ b/tools/misc/vds/UC_5_stride_gen.c @@ -44,7 +44,7 @@ main(void) hsize_t start[RANK]; /* starting point for hyperslab */ hsize_t stride[RANK]; /* hypserslab stride */ hsize_t count[RANK]; /* hypserslab count */ - int map_start = -1; /* starting point in the VDS map */ + hsize_t map_start = 0; /* starting point in the VDS map */ int *buffer = NULL; /* data buffer */ int value = -1; /* value written to datasets */ @@ -53,7 +53,7 @@ main(void) int i; /* iterator */ int j; /* iterator */ - int k; /* iterator */ + hsize_t k; /* iterator */ /* Start by creating the virtual dataset (VDS) dataspace and creation * property list. The individual source datasets are then created @@ -143,7 +143,7 @@ main(void) for(k = 0; k < n; k++) buffer[k] = value; - start[0] = j; + start[0] = (hsize_t)j; start[1] = 0; start[2] = 0; if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0) -- cgit v0.12