diff options
-rw-r--r-- | src/H5Distore.c | 10 | ||||
-rw-r--r-- | src/H5Tconv.c | 56 | ||||
-rw-r--r-- | src/H5Zscaleoffset.c | 10 | ||||
-rw-r--r-- | test/dsets.c | 137 | ||||
-rw-r--r-- | tools/misc/h5debug.c | 28 |
5 files changed, 121 insertions, 120 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c index e4e9eee..b857e0c 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1056,7 +1056,7 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, unsigned filter_mask = lt_key->filter_mask; if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, edc_read, cb_struct, &nbytes, &buf_size, &buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, H5B_ITER_ERROR, "data pipeline read failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5B_ITER_ERROR, "data pipeline read failed") } /* end if */ /* Perform datatype conversion, if necessary */ @@ -1116,7 +1116,7 @@ H5D_istore_iter_copy(H5F_t *f_src, hid_t dxpl_id, const void *_lt_key, if(is_compressed && (is_vlen || fix_ref) ) { if(H5Z_pipeline(pline, 0, &(udata_dst.common.key.filter_mask), edc_read, cb_struct, &nbytes, &buf_size, &buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, H5B_ITER_ERROR, "output pipeline failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5B_ITER_ERROR, "output pipeline failed") udata_dst.common.key.nbytes = nbytes; udata->buf = buf; udata->buf_size = buf_size; @@ -1241,7 +1241,7 @@ H5D_istore_flush_entry(const H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_ } if (H5Z_pipeline(&(io_info->dset->shared->dcpl_cache.pline), 0, &(udata.common.key.filter_mask), io_info->dxpl_cache->err_detect, io_info->dxpl_cache->filter_cb, &(udata.common.key.nbytes), &alloc, &buf)<0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed") } /* @@ -1796,7 +1796,7 @@ H5D_istore_lock(const H5D_io_info_t *io_info, if(pline->nused) { if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->common.key.filter_mask), io_info->dxpl_cache->err_detect, io_info->dxpl_cache->filter_cb, &(udata->common.key.nbytes), &chunk_alloc, &chunk) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, NULL, "data pipeline read failed") } /* end if */ #ifdef H5D_ISTORE_DEBUG rdcc->nmisses++; @@ -2816,7 +2816,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Push the chunk through the filters */ if (H5Z_pipeline(&pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &buf_size, &chunk)<0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed") /* Keep the number of bytes the chunk turned in to */ chunk_size=nbytes; diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 183a3ee..0dd1d98 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3710,7 +3710,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (H5T_bit_find (s, src.u.f.epos, src.u.f.esize, H5T_BIT_LSB, TRUE)<0) { /* +0 or -0 */ - H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1); + H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, (size_t)1); H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, FALSE); H5T_bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE); goto padding; @@ -3729,14 +3729,14 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } if(except_ret == H5T_CONV_UNHANDLED) { - H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1); + H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, (size_t)1); H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE); H5T_bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE); /*If the destination no implied mantissa bit, we'll need to set *the 1st bit of mantissa to 1. The Intel-Linux long double is *this case.*/ if (H5T_NORM_NONE==dst.u.f.norm) - H5T_bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, 1, TRUE); + H5T_bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, (size_t)1, TRUE); } else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -3765,14 +3765,14 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } if(except_ret == H5T_CONV_UNHANDLED) { - H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1); + H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, (size_t)1); H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE); H5T_bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE); /*If the destination no implied mantissa bit, we'll need to set *the 1st bit of mantissa to 1. The Intel-Linux long double is *this case.*/ if (H5T_NORM_NONE==dst.u.f.norm) - H5T_bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, 1, TRUE); + H5T_bit_set (d, dst.u.f.mpos+dst.u.f.msize-1, (size_t)1, TRUE); } else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -3797,7 +3797,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) { /* There are many NaN values, so we just set all bits of * the significand. */ - H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1); + H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, (size_t)1); H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE); H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, TRUE); } else if(except_ret == H5T_CONV_HANDLED) { @@ -3834,7 +3834,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, msize = bitno; } else if (0==bitno) { msize = 1; - H5T_bit_set(s, src.u.f.mpos, 1, FALSE); + H5T_bit_set(s, src.u.f.mpos, (size_t)1, FALSE); } } else if (H5T_NORM_IMPLIED==src.u.f.norm) { msize = src.u.f.msize; @@ -3847,7 +3847,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * The sign for the destination is the same as the sign for the * source in all cases. */ - H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1); + H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, (size_t)1); /* * Calculate the true source exponent by adjusting according to @@ -3931,7 +3931,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, bitno = (ssize_t)(mrsh+msize - dst.u.f.msize); assert(bitno>=0 && (size_t)bitno<=msize); /*If the 1st bit being cut off is set and source isn't denormalized.*/ - if(H5T_bit_get_d(s, mpos+bitno-1, 1) && !denormalized) { + if(H5T_bit_get_d(s, mpos+bitno-1, (size_t)1) && !denormalized) { /*Don't do rounding if exponent is 111...110 and mantissa is 111...11. *To do rounding and increment exponent in this case will create an infinity value.*/ if((H5T_bit_find(s, mpos+bitno, msize-bitno, H5T_BIT_LSB, FALSE)>=0 || expo<expo_max-1)) { @@ -3939,7 +3939,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (carry) implied = 2; } - } else if(H5T_bit_get_d(s, mpos+bitno-1, 1) && denormalized) + } else if(H5T_bit_get_d(s, mpos+bitno-1, (size_t)1) && denormalized) /*For either source or destination, denormalized value doesn't increment carry.*/ H5T_bit_inc(s, mpos+bitno-1, 1+msize-bitno); } @@ -3953,7 +3953,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); } else if (mrsh==dst.u.f.msize+1) { H5T_bit_set(d, dst.u.f.mpos+1, dst.u.f.msize-1, FALSE); - H5T_bit_set(d, dst.u.f.mpos, 1, TRUE); + H5T_bit_set(d, dst.u.f.mpos, (size_t)1, TRUE); } else if (mrsh==dst.u.f.msize) { H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE); H5T_bit_set_d(d, dst.u.f.mpos, MIN(2, dst.u.f.msize), (hsize_t)implied); @@ -3961,7 +3961,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (mrsh>0) { H5T_bit_set(d, dst.u.f.mpos+dst.u.f.msize-mrsh, mrsh, FALSE); - H5T_bit_set_d(d, dst.u.f.mpos+dst.u.f.msize-mrsh, 2, + H5T_bit_set_d(d, dst.u.f.mpos+dst.u.f.msize-mrsh, (size_t)2, (hsize_t)implied); } if (mrsh+msize>=dst.u.f.msize) { @@ -4019,7 +4019,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (dst.offset>0) { assert (H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad); - H5T_bit_set (d, 0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad)); + H5T_bit_set (d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad)); } if (dst.offset+dst.prec!=8*dst_p->shared->size) { assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad); @@ -9634,7 +9634,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Find the sign bit value of the source. */ - sign = H5T_bit_get_d(s, src.u.f.sign, 1); + sign = H5T_bit_get_d(s, src.u.f.sign, (size_t)1); /* * Check for special cases: +0, -0, +Inf, -Inf, NaN @@ -9659,7 +9659,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) { if (H5T_SGN_2==dst.u.i.sign) - H5T_bit_set (d, dst.prec-1, 1, TRUE); + H5T_bit_set (d, dst.prec-1, (size_t)1, TRUE); } else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -9705,7 +9705,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) { if (H5T_SGN_2==dst.u.i.sign) - H5T_bit_set (d, dst.prec-1, 1, TRUE); + H5T_bit_set (d, dst.prec-1, (size_t)1, TRUE); } else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -9786,7 +9786,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * V V V V * buf[0] buf[1] buf[2] buf[3] */ - H5T_bit_copy(int_buf, 0, s, src.u.f.mpos, src.u.f.msize); + H5T_bit_copy(int_buf, (size_t)0, s, src.u.f.mpos, src.u.f.msize); /* * Restore the implicit bit for mantissa if it's implied. @@ -9801,13 +9801,13 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * 10...010111, expo=20, expo-msize=-3. Right-shift the sequence, we get * 00010...10. The last three bits were dropped. */ - H5T_bit_shift(int_buf, (ssize_t)(expo-src.u.f.msize), 0, buf_size*8); + H5T_bit_shift(int_buf, (ssize_t)(expo-src.u.f.msize), (size_t)0, buf_size*8); /* * If expo is less than mantissa size, the frantional value is dropped off * during conversion. Set exception type to be "truncate" */ - if (expo < src.u.f.msize && cb_struct.func) + if ((size_t)expo < src.u.f.msize && cb_struct.func) truncated = TRUE; /* @@ -9815,7 +9815,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * which is set? This is checked before converted to negative * integer. */ - sfirst = H5T_bit_find(int_buf, 0, 8*buf_size, H5T_BIT_MSB, TRUE); + sfirst = H5T_bit_find(int_buf, (size_t)0, 8*buf_size, H5T_BIT_MSB, TRUE); first = (size_t)sfirst; if(sfirst < 0) { @@ -9874,7 +9874,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) /*copy source value into it if case is ignored by user handler*/ - H5T_bit_copy (d, dst.offset, int_buf, 0, first+1); + H5T_bit_copy (d, dst.offset, int_buf, (size_t)0, first+1); else if(except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -9895,12 +9895,12 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) { /*If this case ignored by user handler*/ /*Convert to integer representation. Equivalent to ~(value - 1).*/ - H5T_bit_dec(int_buf, 0, 8*buf_size); - H5T_bit_neg(int_buf, 0, 8*buf_size); + H5T_bit_dec(int_buf, (size_t)0, 8*buf_size); + H5T_bit_neg(int_buf, (size_t)0, 8*buf_size); /*copy source value into destination*/ - H5T_bit_copy (d, dst.offset, int_buf, 0, dst.prec-1); - H5T_bit_set (d, (dst.offset + dst.prec-1), 1, TRUE); + H5T_bit_copy(d, dst.offset, int_buf, (size_t)0, dst.prec-1); + H5T_bit_set(d, (dst.offset + dst.prec-1), (size_t)1, TRUE); } else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") else if(except_ret == H5T_CONV_HANDLED) { @@ -9920,7 +9920,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } if(except_ret == H5T_CONV_UNHANDLED) - H5T_bit_set (d, (dst.offset + dst.prec-1), 1, TRUE); + H5T_bit_set (d, (dst.offset + dst.prec-1), (size_t)1, TRUE); else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") else if(except_ret == H5T_CONV_HANDLED) { @@ -9958,7 +9958,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_UNHANDLED) { /*copy source value into it if case is ignored by user handler*/ - H5T_bit_copy (d, dst.offset, int_buf, 0, first+1); + H5T_bit_copy (d, dst.offset, int_buf, (size_t)0, first+1); } else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") else if(except_ret == H5T_CONV_HANDLED) { @@ -9976,7 +9976,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (dst.offset>0) { assert (H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad); - H5T_bit_set (d, 0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad)); + H5T_bit_set(d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad)); } if (dst.offset+dst.prec!=8*dst_p->shared->size) { assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad); diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index fe82e9c..2c55188 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -775,9 +775,9 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get the filter's current parameters */ #ifdef H5_WANT_H5_V1_6_COMPAT - if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SCALEOFFSET,&flags,&cd_nelmts,cd_values,0,NULL)<0) + if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL) < 0) #else - if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SCALEOFFSET,&flags,&cd_nelmts,cd_values,0,NULL,NULL)<0) + if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) #endif HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get scaleoffset parameters") @@ -882,7 +882,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) } /* Modify the filter's parameters for this dataset */ - if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SCALEOFFSET, flags, H5Z_SCALEOFFSET_TOTAL_NPARMS, cd_values)<0) + if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_SCALEOFFSET, flags, (size_t)H5Z_SCALEOFFSET_TOTAL_NPARMS, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local scaleoffset parameters") done: @@ -1069,7 +1069,7 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu } /* before postprocess, get memory type */ - if((type = H5Z_scaleoffset_get_type(dtype_class, p.size, dtype_sign))==0) + if((type = H5Z_scaleoffset_get_type(dtype_class, (unsigned)p.size, dtype_sign)) == 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") /* postprocess after decompression */ @@ -1097,7 +1097,7 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu H5Z_scaleoffset_convert(*buf, d_nelmts, p.size); /* before preprocess, get memory type */ - if((type = H5Z_scaleoffset_get_type(dtype_class, p.size, dtype_sign))==0) + if((type = H5Z_scaleoffset_get_type(dtype_class, (unsigned)p.size, dtype_sign))==0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") /* preprocess before compression */ diff --git a/test/dsets.c b/test/dsets.c index 3dae7f0..9e79b41 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -358,7 +358,7 @@ test_simple_io(hid_t fapl) if ((space = H5Screate_simple(2, dims, NULL))<0) goto error; /* Create a small conversion buffer to test strip mining */ - tconv_buf = malloc (1000); + tconv_buf = HDmalloc((size_t)1000); xfer = H5Pcreate (H5P_DATASET_XFER); assert (xfer>=0); if (H5Pset_buffer (xfer, (size_t)1000, tconv_buf, NULL)<0) goto error; @@ -805,7 +805,7 @@ test_conv_buffer(hid_t fid) TESTING("data type conversion buffer size"); - cf = (CmpField *)calloc(1, sizeof(CmpField)); + cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField)); /* Populate the data members */ for (j = 0; j < DIM1; j++) @@ -854,7 +854,7 @@ test_conv_buffer(hid_t fid) if(H5Tinsert (ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5)<0) goto error; /* Read should succeed since library will set conversion buffer big enough */ - cfrR = (CmpFieldR *)calloc(1, sizeof(CmpFieldR)); + cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR)); if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR)<0) goto error; /* Read should fail since conversion buffer isn't big enough */ @@ -927,10 +927,10 @@ test_tconv(hid_t file) hsize_t dims[1]; hid_t space, dataset; - out = malloc (4*1000000); - assert (out); - in = malloc (4*1000000); - assert (in); + out = HDmalloc((size_t)(4 * 1000 * 1000)); + HDassert(out); + in = HDmalloc((size_t)(4 * 1000 * 1000)); + HDassert(in); TESTING("data type conversion"); @@ -1074,11 +1074,11 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) /* Get the filter's current parameters */ #ifdef H5_WANT_H5_V1_6_COMPAT - if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_BOGUS2,&flags,&cd_nelmts, - cd_values,0,NULL)<0) + if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_BOGUS2, &flags, &cd_nelmts, + cd_values, (size_t)0, NULL) < 0) #else - if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_BOGUS2,&flags,&cd_nelmts, - cd_values,0,NULL,NULL)<0) + if(H5Pget_filter_by_id(dcpl_id, H5Z_FILTER_BOGUS2, &flags, &cd_nelmts, + cd_values, (size_t)0, NULL, NULL) < 0) #endif return(FAIL); @@ -1093,8 +1093,8 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) cd_values[3]=add_on; /* Amount the data was modified by */ /* Modify the filter's parameters for this dataset */ - if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_BOGUS2, flags, BOGUS2_ALL_NPARMS, - cd_values)<0) + if(H5Pmodify_filter(dcpl_id, H5Z_FILTER_BOGUS2, flags, (size_t)BOGUS2_ALL_NPARMS, + cd_values) < 0) return(FAIL); return(SUCCEED); @@ -1210,17 +1210,17 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts, if(offset>nbytes || (offset+length)>nbytes || length<sizeof(unsigned int)) return 0; - data = HDmalloc(length); - HDmemset(data, (int)value, length); + data = HDmalloc((size_t)length); + HDmemset(data, (int)value, (size_t)length); if (flags & H5Z_FLAG_REVERSE) { /* Varify data is actually corrupted during read */ dst += offset; - if(HDmemcmp(data, dst, length)!=0) return 0; + if(HDmemcmp(data, dst, (size_t)length)!=0) return 0; *buf_size = nbytes; ret_value = nbytes; } else { /* Write corrupted data */ dst += offset; - HDmemcpy(dst, data, length); + HDmemcpy(dst, data, (size_t)length); *buf_size = nbytes; ret_value = *buf_size; } @@ -1324,10 +1324,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, * Create a small conversion buffer to test strip mining. We * might as well test all we can! */ - if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) goto error; - tconv_buf = malloc (1000); - if (H5Pset_buffer (dxpl, (size_t)1000, tconv_buf, NULL)<0) goto error; - if ((write_dxpl = H5Pcopy (dxpl))<0) TEST_ERROR; + if ((dxpl = H5Pcreate(H5P_DATASET_XFER))<0) goto error; + tconv_buf = HDmalloc((size_t)1000); + if (H5Pset_buffer(dxpl, (size_t)1000, tconv_buf, NULL)<0) goto error; + if ((write_dxpl = H5Pcopy(dxpl))<0) TEST_ERROR; if (if_fletcher32==DISABLE_FLETCHER32) { if(H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)<0) @@ -1912,7 +1912,7 @@ UNUSED if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; if (H5Zregister (H5Z_BOGUS)<0) goto error; - if (H5Pset_filter (dc, H5Z_FILTER_BOGUS, 0, 0, NULL)<0) goto error; + if(H5Pset_filter(dc, H5Z_FILTER_BOGUS, 0, (size_t)0, NULL) < 0) goto error; if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0) goto error; @@ -1927,7 +1927,7 @@ UNUSED puts("Testing Fletcher32 checksum(enabled for read)"); if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; - if (H5Pset_filter (dc,H5Z_FILTER_FLETCHER32,0,0,NULL)<0) goto error; + if(H5Pset_filter(dc, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0) goto error; /* Enable checksum during read */ if(test_filter_internal(file,DSET_FLETCHER32_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size)<0) goto error; @@ -1953,7 +1953,7 @@ UNUSED data_corrupt[2] = 27; if (H5Zregister (H5Z_CORRUPT)<0) goto error; - if (H5Pset_filter (dc, H5Z_FILTER_CORRUPT, 0, 3, data_corrupt)<0) goto error; + if(H5Pset_filter(dc, H5Z_FILTER_CORRUPT, 0, (size_t)3, data_corrupt) < 0) goto error; if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,DISABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size)<0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); @@ -2694,13 +2694,13 @@ test_nbit_float(hid_t file) #ifdef H5_HAVE_FILTER_NBIT /* Define user-defined single-precision floating-point type for dataset */ datatype = H5Tcopy(H5T_IEEE_F32BE); - if(H5Tset_fields(datatype, 26, 20, 6, 7, 13)<0) goto error; + if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error; offset = 7; if(H5Tset_offset(datatype,offset)<0) goto error; precision = 20; if(H5Tset_precision(datatype,precision)<0) goto error; - if(H5Tset_size(datatype, 4)<0) goto error; - if(H5Tset_ebias(datatype, 31)<0) goto error; + if(H5Tset_size(datatype, (size_t)4) < 0) goto error; + if(H5Tset_ebias(datatype, (size_t)31) < 0) goto error; /* Create the data space */ if ((space = H5Screate_simple(2, size, NULL))<0) goto error; @@ -2827,13 +2827,13 @@ test_nbit_double(hid_t file) #ifdef H5_HAVE_FILTER_NBIT /* Define user-defined doule-precision floating-point type for dataset */ datatype = H5Tcopy(H5T_IEEE_F64BE); - if(H5Tset_fields(datatype, 55, 46, 9, 5, 41)<0) goto error; + if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) goto error; offset = 5; if(H5Tset_offset(datatype,offset)<0) goto error; precision = 51; if(H5Tset_precision(datatype,precision)<0) goto error; - if(H5Tset_size(datatype, 8)<0) goto error; - if(H5Tset_ebias(datatype, 255)<0) goto error; + if(H5Tset_size(datatype, (size_t)8) < 0) goto error; + if(H5Tset_ebias(datatype, (size_t)255) < 0) goto error; /* Create the data space */ if ((space = H5Screate_simple(2, size, NULL))<0) goto error; @@ -3130,11 +3130,11 @@ test_nbit_compound(hid_t file) if(H5Tset_precision(s_tid,precision[2])<0) goto error; if(H5Tset_offset(s_tid,offset[2])<0) goto error; - if(H5Tset_fields(f_tid, 26, 20, 6, 7, 13)<0) goto error; - if(H5Tset_offset(f_tid, 7)<0) goto error; - if(H5Tset_precision(f_tid, 20)<0) goto error; - if(H5Tset_size(f_tid, 4)<0) goto error; - if(H5Tset_ebias(f_tid, 31)<0) goto error; + if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error; + if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error; + if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error; + if(H5Tset_size(f_tid, (size_t)4) < 0) goto error; + if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error; /* Create a memory compound datatype before setting the order */ mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); @@ -3346,11 +3346,11 @@ test_nbit_compound_2(hid_t file) if(H5Tset_precision(s_tid,precision[2])<0) goto error; if(H5Tset_offset(s_tid,offset[2])<0) goto error; - if(H5Tset_fields(f_tid, 26, 20, 6, 7, 13)<0) goto error; - if(H5Tset_offset(f_tid, 7)<0) goto error; - if(H5Tset_precision(f_tid, 20)<0) goto error; - if(H5Tset_size(f_tid, 4)<0) goto error; - if(H5Tset_ebias(f_tid, 31)<0) goto error; + if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error; + if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error; + if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error; + if(H5Tset_size(f_tid, (size_t)4) < 0) goto error; + if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error; /* Create a memory atomic compound datatype before setting the order */ mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); @@ -3490,6 +3490,8 @@ test_nbit_compound_2(hid_t file) for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { b_failed = 0; + d_failed = 0; + for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) if((new_data[i][j].b[m][n]&b_mask)!=(orig_data[i][j].b[m][n]&b_mask)) { @@ -3497,7 +3499,6 @@ test_nbit_compound_2(hid_t file) goto out; } - d_failed = 0; for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) if((new_data[i][j].d[m][n].i & i_mask)!=(orig_data[i][j].d[m][n].i & i_mask)|| @@ -3603,17 +3604,17 @@ test_nbit_compound_3(hid_t file) /* Define datatypes of members of compound datatype */ i_tid=H5Tcopy(H5T_NATIVE_INT); - if(H5Tset_precision(i_tid, 17)<0) goto error; + if(H5Tset_precision(i_tid, (size_t)17) < 0) goto error; str_tid=H5Tcopy(H5T_C_S1); - if(H5Tset_size(str_tid,30)<0) goto error; + if(H5Tset_size(str_tid, (size_t)30) < 0) goto error; vl_str_tid = H5Tcopy(H5T_C_S1); if(H5Tset_size(vl_str_tid,H5T_VARIABLE)<0) goto error; if((v_tid = H5Tvlen_create(H5T_NATIVE_UINT))<0) goto error; - if((o_tid = H5Tcreate(H5T_OPAQUE, 5))<0) goto error; + if((o_tid = H5Tcreate(H5T_OPAQUE, (size_t)5)) < 0) goto error; if(H5Tset_tag(o_tid, "testing opaque field")<0) goto error; /* Create a dataset compound datatype and insert some atomic types */ @@ -3644,8 +3645,8 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for(i = 0; i < size[0]; i++) { orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0); - strcpy(orig_data[i].str, "fixed-length C string"); - orig_data[i].vl_str = strdup("variable-length C string"); + HDstrcpy(orig_data[i].str, "fixed-length C string"); + orig_data[i].vl_str = HDstrdup("variable-length C string"); orig_data[i].v.p = HDmalloc((size_t)(i+1)*sizeof(unsigned int)); orig_data[i].v.len = (size_t)i+1; @@ -4688,7 +4689,7 @@ test_types(hid_t file) unsigned char buf[32]; TESTING("various datatypes"); - if ((grp=H5Gcreate(file, "typetests", 0))<0) goto error; + if((grp = H5Gcreate(file, "typetests", (size_t)0)) < 0) goto error; /* bitfield_1 */ nelmts = sizeof(buf); @@ -4719,28 +4720,28 @@ test_types(hid_t file) /* opaque_1 */ nelmts = sizeof(buf); - if ((type=H5Tcreate(H5T_OPAQUE, 1))<0 || - H5Tset_tag(type, "testing 1-byte opaque type")<0 || - (space=H5Screate_simple(1, &nelmts, NULL))<0 || - (dset=H5Dcreate(grp, "opaque_1", type, space, H5P_DEFAULT))<0) - goto error; - for (i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; - if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0) + if((type = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0 || + H5Tset_tag(type, "testing 1-byte opaque type") < 0 || + (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || + (dset = H5Dcreate(grp, "opaque_1", type, space, H5P_DEFAULT)) < 0) goto error; + for(i = 0; i < sizeof buf; i++) + buf[i] = (unsigned char)0xff ^ (unsigned char)i; + if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if (H5Sclose(space)<0) goto error; if (H5Tclose(type)<0) goto error; if (H5Dclose(dset)<0) goto error; /* opaque_2 */ nelmts = sizeof(buf)/4; - if ((type=H5Tcreate(H5T_OPAQUE, 4))<0 || - H5Tset_tag(type, "testing 4-byte opaque type")<0 || - (space=H5Screate_simple(1, &nelmts, NULL))<0 || - (dset=H5Dcreate(grp, "opaque_2", type, space, H5P_DEFAULT))<0) - goto error; - for (i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; - if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0) + if((type = H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0 || + H5Tset_tag(type, "testing 4-byte opaque type") < 0 || + (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || + (dset = H5Dcreate(grp, "opaque_2", type, space, H5P_DEFAULT)) < 0) goto error; + for(i = 0; i < sizeof buf; i++) + buf[i] = (unsigned char)0xff ^ (unsigned char)i; + if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if (H5Sclose(space)<0) goto error; if (H5Tclose(type)<0) goto error; if (H5Dclose(dset)<0) goto error; @@ -4815,7 +4816,7 @@ test_can_apply(hid_t file) printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } - if(H5Pset_filter (dcpl, H5Z_FILTER_BOGUS, 0, 0, NULL)<0) { + if(H5Pset_filter(dcpl, H5Z_FILTER_BOGUS, 0, (size_t)0, NULL) < 0) { H5_FAILED(); printf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; @@ -5195,7 +5196,7 @@ test_set_local(hid_t fapl) printf(" Line %d: Can't register 'set local' filter\n",__LINE__); goto error; } - if(H5Pset_filter (dcpl, H5Z_FILTER_BOGUS2, 0, BOGUS2_PERM_NPARMS, cd_values)<0) { + if(H5Pset_filter(dcpl, H5Z_FILTER_BOGUS2, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) { H5_FAILED(); printf(" Line %d: Can't set bogus2 filter\n",__LINE__); goto error; @@ -5542,9 +5543,9 @@ test_filter_delete(hid_t file) /* check if filter was deleted */ for (i=0; i<nfilters; i++) { #ifdef H5_WANT_H5_V1_6_COMPAT - filtn = H5Pget_filter(dcpl1,(unsigned)i,0,0,0,0,0); + filtn = H5Pget_filter(dcpl1, (unsigned)i, NULL, NULL, NULL, (size_t)0, NULL); #else - filtn = H5Pget_filter(dcpl1,(unsigned)i,0,0,0,0,0,NULL); + filtn = H5Pget_filter(dcpl1, (unsigned)i, NULL, NULL, NULL, (size_t)0, NULL, NULL); #endif if (H5Z_FILTER_DEFLATE==filtn) goto error; @@ -5655,8 +5656,8 @@ auxread_fdata(hid_t fid, const char *name) if (nelmts) { - buf=(void *) HDmalloc((unsigned)(nelmts*msize)); - if ( buf==NULL){ + buf = (void *)HDmalloc((size_t)(nelmts * msize)); + if(buf == NULL) { printf( "cannot read into memory\n" ); goto error; } @@ -6037,7 +6038,7 @@ main(void) goto error; /* Cause the library to emit initial messages */ - if((grp = H5Gcreate(file, "emit diagnostics", 0)) < 0) + if((grp = H5Gcreate(file, "emit diagnostics", (size_t)0)) < 0) goto error; if(H5Gset_comment(grp, ".", "Causes diagnostic messages to be emitted") < 0) goto error; diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 1518fb6..35a006f 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -132,25 +132,25 @@ main(int argc, char *argv[]) fprintf(stderr, "cannot read signature\n"); HDexit(3); } - if(!HDmemcmp(sig, H5F_SIGNATURE, H5F_SIGNATURE_LEN)) { + if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) { /* * Debug the file's super block. */ status = H5F_debug(f, H5P_DATASET_XFER_DEFAULT, stdout, 0, VCOL); - } else if(!HDmemcmp(sig, H5HL_MAGIC, H5HL_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5HL_SIZEOF_MAGIC)) { /* * Debug a local heap. */ status = H5HL_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); - } else if(!HDmemcmp (sig, H5HG_MAGIC, H5HG_SIZEOF_MAGIC)) { + } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5HG_SIZEOF_MAGIC)) { /* * Debug a global heap collection. */ status = H5HG_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); - } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, H5G_NODE_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC)) { /* * Debug a symbol table node. */ @@ -164,7 +164,7 @@ main(int argc, char *argv[]) status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); - } else if(!HDmemcmp(sig, H5B_MAGIC, H5B_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC)) { /* * Debug a B-tree. B-trees are debugged through the B-tree * subclass. The subclass identifier is the byte immediately @@ -203,7 +203,7 @@ main(int argc, char *argv[]) HDexit(4); } - } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, H5B2_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC)) { /* * Debug a v2 B-tree. B-trees are debugged through the B-tree * subclass. The subclass identifier is two bytes after the @@ -237,7 +237,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end switch */ - } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, H5B2_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC)) { /* * Debug a v2 B-tree. B-trees are debugged through the B-tree * subclass. The subclass identifier is the byte after the @@ -280,7 +280,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end switch */ - } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, H5B2_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC)) { /* * Debug a v2 B-tree. B-trees are debugged through the B-tree * subclass. The subclass identifier is the byte after the @@ -322,13 +322,13 @@ main(int argc, char *argv[]) HDexit(4); } /* end switch */ - } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, H5HF_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) { /* * Debug a fractal heap header. */ status = H5HF_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); - } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, H5HF_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) { /* * Debug a fractal heap direct block. */ @@ -343,7 +343,7 @@ main(int argc, char *argv[]) status = H5HF_dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, (size_t)extra2); - } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, H5HF_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) { /* * Debug a fractal heap indirect block. */ @@ -358,14 +358,14 @@ main(int argc, char *argv[]) status = H5HF_iblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, (unsigned)extra2); - } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, H5FS_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC)) { /* * Debug a free space header. */ status = H5FS_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); - } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, H5FS_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC)) { /* * Debug free space serialized sections. */ @@ -380,7 +380,7 @@ main(int argc, char *argv[]) status = H5FS_sects_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, extra2); - } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, H5O_SIZEOF_MAGIC)) { + } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5O_SIZEOF_MAGIC)) { /* * Debug v2 object header (which have signatures). */ |