From ad80fae3cc0ece39f510612083cabacd9e059aeb Mon Sep 17 00:00:00 2001 From: Kimmy Mu Date: Mon, 6 Jan 2020 12:17:10 -0600 Subject: Merge pull request #2071 in HDFFV/hdf5 from ~KMU/hdf5:bugfix/intel_warnings to develop * commit '0a2bb11b248df6841daabca3970df5d8504adfc7': address problems from comments fix and address comments change according to previous comments add missing piece remove unnecessary check macro fix intel compile warnings Revert "fix warnings from Intel compiler" Revert "fix warnings and some text alignment" Revert "let hdf5 pick up the right compiler in Intel environment" Revert "fix issues from previous PR comments" Revert "using a different MACRO" using a different MACRO fix issues from previous PR comments let hdf5 pick up the right compiler in Intel environment fix warnings and some text alignment fix warnings from Intel compiler --- bin/warnhist | 19 +++++++++++++++---- hl/tools/gif2h5/decompress.c | 2 +- src/H5Aint.c | 2 +- src/H5B2cache.c | 9 ++++++--- src/H5B2int.c | 14 +++++++------- src/H5Dchunk.c | 14 ++++++-------- src/H5EAcache.c | 12 ++++++++---- src/H5FAcache.c | 6 ++++-- src/H5FScache.c | 8 ++++---- src/H5Fprivate.h | 2 +- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 2 +- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 4 ++-- src/H5Oginfo.c | 4 ++-- src/H5Oint.c | 4 ++-- src/H5Olayout.c | 2 +- src/H5Olinfo.c | 2 +- src/H5Olink.c | 2 +- src/H5Osdspace.c | 2 +- src/H5Rint.c | 2 +- src/H5SMcache.c | 2 +- src/H5SMmessage.c | 2 +- src/H5Shyper.c | 2 +- src/H5Sprivate.h | 2 +- src/H5Sselect.c | 4 ++-- src/H5Tbit.c | 4 ++-- src/H5Ztrans.c | 2 +- test/dsets.c | 8 ++++---- test/dtypes.c | 4 ++-- test/h5test.c | 3 +-- test/ntypes.c | 2 +- test/th5s.c | 13 +++++++------ test/tsohm.c | 8 ++++---- testpar/t_dset.c | 2 +- testpar/t_mpi.c | 10 +++++----- tools/lib/h5diff.c | 2 +- tools/lib/h5diff_attr.c | 2 +- tools/src/h5import/h5import.c | 6 +++--- tools/test/h5diff/dynlib_diff.c | 4 ++-- tools/test/h5dump/dynlib_dump.c | 4 ++-- tools/test/h5dump/h5dumpgentest.c | 20 ++++++++++---------- tools/test/h5ls/dynlib_ls.c | 4 ++-- tools/test/h5repack/h5repackgentest.c | 4 ++-- tools/test/perform/pio_engine.c | 6 +++--- tools/test/perform/pio_perf.c | 4 ++-- 47 files changed, 131 insertions(+), 113 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index a8dcd97..a88474b 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -206,8 +206,13 @@ while (<>) { ($last_c_name, $toss) = split /\:/, $_; } + # Retain C/C++ compile line, which comes with the line of warning + if($_ =~ /.*[A-Za-z0-9_]\.[chC]\(.*[0-9]\):.*#.*/) { + $last_c_name = $_; + } + # Skip lines that don't have the word "warning" - next if $_ !~ /[Ww]arning:/; + next if $_ !~ /[Ww]arning/; # Skip warnings from linker next if $_ =~ /ld: warning:/; @@ -257,11 +262,16 @@ while (<>) { } elsif($_ =~ /^\".*, line [0-9]+: *[Ww]arning:.*/) { ($name, $toss, $warning, $extra, $extra2) = split /\:/, $_; ($name, $line) = split /\,/, $name; - $name =~ s/^\"//g; - $name =~ s/\"$//g; - $line =~ s/^\s*line\s*//g; + $name =~ s/^\"//g; + $name =~ s/\"$//g; + $line =~ s/^\s*line\s*//g; # print "name:'", $name, "'-'", $line, "'\n"; # print "warning:'", $warning, "'\n"; + # Check for Intel icc warning + } elsif($_ =~ /.*[A-Za-z0-9_]\.[chC]\(.*[0-9]\):.*#.*/) { + ($last_c_name, $toss, $warning) = split /\:/, $last_c_name; + ($name, $line) = split /\(/, $last_c_name; + $line =~ s/\)//g; } else { # Check for 'character offset' field appended to file & line # # (This is probably specific to GCC) @@ -331,6 +341,7 @@ while (<>) { # Convert all quotes to ' $warning =~ s/‘/'/g; $warning =~ s/’/'/g; + $warning =~ s/"/'/g; # # These skipped messages & "genericizations" may be specific to GCC diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 55081c3..8cd8a8e 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -173,7 +173,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; - Interlace = GifImageDesc->PackedField & 0x40; + Interlace = (uint8_t)(GifImageDesc->PackedField & 0x40); /* * Note that I ignore the possible existence of a local color map. I'm diff --git a/src/H5Aint.c b/src/H5Aint.c index 67f914f..046af87 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2025,7 +2025,7 @@ H5A__set_version(const H5F_t *f, H5A_t *attr) version = H5O_ATTR_VERSION_1; /* Write out basic version */ /* Upgrade to the version indicated by the file's low bound if higher */ - version = MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); + version = (uint8_t)MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 2a77bd5..65286e6 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,8 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - *image++ = hdr->cls->id; + HDassert(hdr->cls->id <= 255); + *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +819,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - *image++ = internal->hdr->cls->id; + HDassert(internal->hdr->cls->id <= 255); + *image++ = (uint8_t)internal->hdr->cls->id; HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ @@ -1219,7 +1221,8 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - *image++ = leaf->hdr->cls->id; + HDassert(leaf->hdr->cls->id <= 255); + *image++ = (uint8_t)leaf->hdr->cls->id; HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for leaf node */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 2d77276..ea03ed6 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -239,7 +239,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, old_node_nrec = internal->node_ptrs[idx].node_nrec; /* Determine "middle" record to promote to internal node */ - mid_record = old_node_nrec / 2; + mid_record = (uint16_t)(old_node_nrec / 2); /* Copy "upper half" of records to new child */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), @@ -507,8 +507,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if(*left_nrec < *right_nrec) { /* Moving record from right node to left */ - uint16_t new_right_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for right child */ - uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */ + uint16_t new_right_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for right child */ + uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */ /* Copy record from parent node down into left child */ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); @@ -558,8 +558,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, else { /* Moving record from left node to right */ - uint16_t new_left_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for left child */ - uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ + uint16_t new_left_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for left child */ + uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ /* Sanity check */ HDassert(*left_nrec > *right_nrec); @@ -762,8 +762,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, { /* Compute new # of records in each node */ unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2); - uint16_t new_middle_nrec = (uint16_t)(total_nrec - 2) / 3; - uint16_t new_left_nrec = (uint16_t)((total_nrec - 2) - new_middle_nrec) / 2; + uint16_t new_middle_nrec = (uint16_t)((total_nrec - 2) / 3); + uint16_t new_left_nrec = (uint16_t)(((total_nrec - 2) - new_middle_nrec) / 2); uint16_t new_right_nrec = (uint16_t)((total_nrec - 2) - (unsigned)(new_left_nrec + new_middle_nrec)); uint16_t curr_middle_nrec = *middle_nrec; diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index afb9545..2e4a3f6 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2166,7 +2166,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) /* Iterate over each chunk in the chunk list */ curr_node = H5SL_first(fm->sel_chunks); while(curr_node) { - hssize_t schunk_points; /* Number of elements in chunk selection */ + hsize_t chunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ @@ -2177,12 +2177,12 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") - schunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); + chunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &schunk_points) < 0) + if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &chunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") - mem_sel_start[0] += schunk_points; + mem_sel_start[0] += chunk_points; /* Get the next chunk node in the skip list */ curr_node = H5SL_next(curr_node); @@ -5651,9 +5651,8 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */ unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */ hsize_t chunk_index; - int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Compute the index for this chunk */ chunk_index = H5VM_array_offset_pre(rank, udata->common.layout->down_chunks, chunk_rec->scaled); @@ -5661,8 +5660,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Set it in the userdata to return */ udata->chunk_addr[chunk_index] = chunk_rec->chunk_addr; -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(H5_ITER_CONT) } /* H5D__chunk_addrmap_cb() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index da67e6b..1fd9c44 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,8 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - *image++ = hdr->cparam.cls->id; + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -875,7 +876,8 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ - *image++ = iblock->hdr->cparam.cls->id; + HDassert(iblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)iblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, iblock->hdr->addr); @@ -1284,7 +1286,8 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_SBLOCK_VERSION; /* Extensible array type */ - *image++ = sblock->hdr->cparam.cls->id; + HDassert(sblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)sblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, sblock->hdr->addr); @@ -1698,7 +1701,8 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ - *image++ = dblock->hdr->cparam.cls->id; + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, dblock->hdr->addr); diff --git a/src/H5FAcache.c b/src/H5FAcache.c index f440efe..2f0d1b4 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -417,7 +417,8 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5FA_HDR_VERSION; /* Fixed array type */ - *image++ = hdr->cparam.cls->id; + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -805,7 +806,8 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5FA_DBLOCK_VERSION; /* Fixed array type */ - *image++ = dblock->hdr->cparam.cls->id; + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, dblock->hdr->addr); diff --git a/src/H5FScache.c b/src/H5FScache.c index b520458..cb0abe9 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -735,7 +735,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, *image++ = H5FS_HDR_VERSION; /* Client ID */ - *image++ = fspace->client; + H5_CHECKED_ASSIGN(*image++, uint8_t, fspace->client, int); /* Total space tracked */ H5F_ENCODE_LENGTH(f, image, fspace->tot_space); @@ -1046,8 +1046,8 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Walk through the image, deserializing sections */ do { - hsize_t sect_size; /* Current section size */ - size_t node_count; /* # of sections of this size */ + hsize_t sect_size = 0; /* Current section size */ + size_t node_count = 0; /* # of sections of this size */ size_t u; /* Local index variable */ /* The number of sections of this node's size */ @@ -1061,7 +1061,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Loop over nodes of this size */ for(u = 0; u < node_count; u++) { H5FS_section_info_t *new_sect; /* Section that was deserialized */ - haddr_t sect_addr; /* Address of free space section in the address space */ + haddr_t sect_addr = 0; /* Address of free space section in the address space */ unsigned sect_type; /* Type of free space section */ unsigned des_flags; /* Flags from deserialize callback */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 75ef0a9..f0c28ca 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -93,7 +93,7 @@ typedef struct H5F_t H5F_t; for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ *_p++ = (uint8_t)(_n & 0xff); \ for (/*void*/; _i < 8; _i++) \ - *_p++ = (n) < 0 ? 0xff : 0; \ + *_p++ = (uint8_t)((n) < 0 ? 0xff : 0); \ (p) = (uint8_t*)(p)+8; \ } diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 6f174bb..d6eecd7 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -481,7 +481,7 @@ H5HF_get_id_type_test(const void *_id, unsigned char *obj_type) HDassert(obj_type); /* Get the type for a heap ID */ - *obj_type = *id & H5HF_ID_TYPE_MASK; + *obj_type = (uint8_t)(*id & H5HF_ID_TYPE_MASK); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_get_id_type_test() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 7f4f17f..23aba09 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -194,7 +194,7 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *p++ = H5O_AINFO_VERSION; /* The flags for the attribute indices */ - flags = ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0; + flags = (unsigned char)(ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0); flags = (unsigned char)(flags | (ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0)); *p++ = flags; diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 878cb8a..573bb7a 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -329,7 +329,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) /* The character encoding for the attribute's name, in later versions */ if(attr->shared->version >= H5O_ATTR_VERSION_3) - *p++ = attr->shared->encoding; + *p++ = (uint8_t)attr->shared->encoding; /* Write the name including null terminator */ H5MM_memcpy(p, attr->shared->name, name_len); diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 36a993f..89d936b 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -407,10 +407,10 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) if(fill->version < H5O_FILL_VERSION_3) { /* Space allocation time */ - *p++ = fill->alloc_time; + *p++ = (uint8_t)fill->alloc_time; /* Fill value writing time */ - *p++ = fill->fill_time; + *p++ = (uint8_t)fill->fill_time; /* Whether fill value is defined */ *p++ = (uint8_t)fill->fill_defined; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 2fc239c..f7979b6 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -222,8 +222,8 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(p); HDassert(fsinfo); - *p++ = (uint8_t)fsinfo->version; /* message version */ - *p++ = fsinfo->strategy; /* File space strategy */ + *p++ = (uint8_t)fsinfo->version; /* message version */ + *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 4b34a52..d6190c6 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -171,7 +171,7 @@ static herr_t H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg; - unsigned char flags; /* Flags for encoding group info */ + unsigned char flags = 0; /* Flags for encoding group info */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -183,7 +183,7 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, *p++ = H5O_GINFO_VERSION; /* The flags for the group info */ - flags = ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0; + flags = (unsigned char)(ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0); flags = (unsigned char)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0)); *p++ = flags; diff --git a/src/H5Oint.c b/src/H5Oint.c index 4328596..855c935 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -239,7 +239,7 @@ H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx version = H5O_VERSION_1; /* Upgrade to the version indicated by the file's low bound if higher */ - version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); + version = (uint8_t)MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) @@ -2321,7 +2321,7 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list") /* Mask off non-"user visible" flags */ - ohdr_flags = oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES); + H5_CHECKED_ASSIGN(ohdr_flags, uint8_t, oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES), int); /* Set object header flags */ if(H5P_set(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 138f219..2a2a07b 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -570,7 +570,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, H5O_LAYOUT_VERSION_3 : mesg->version); /* Layout class */ - *p++ = mesg->type; + *p++ = (uint8_t)mesg->type; /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 9827b6a..a2f88d9 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -203,7 +203,7 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *p++ = H5O_LINFO_VERSION; /* The flags for the link indices */ - index_flags = linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0; + index_flags = (uint8_t)(linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0); index_flags = (uint8_t)(index_flags | (linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0)); *p++ = index_flags; diff --git a/src/H5Olink.c b/src/H5Olink.c index 4bd952b..1f0c6c7 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -316,7 +316,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con /* Store the type of a non-default link */ if(link_flags & H5O_LINK_STORE_LINK_TYPE) - *p++ = lnk->type; + *p++ = (uint8_t)lnk->type; /* Store the link creation order in the file, if its valid */ if(lnk->corder_valid) diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index b4f00ea..33310dc 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -257,7 +257,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) /* Dataspace type */ if(sdim->version > H5O_SDSPACE_VERSION_1) - *p++ = sdim->type; + *p++ = (uint8_t)sdim->type; else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index 384be19..b67efc3 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1020,7 +1020,7 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") /* Set new reference */ - ref->type = (H5R_type_t)*p++; + ref->type = (int8_t)*p++; if(ref->type <= H5R_BADTYPE || ref->type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 49ce2b4..ee28fa4 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -397,7 +397,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len, *image++ = H5SM_LIST_VERSION; /* Is message index a list or a B-tree? */ - *image++ = table->indexes[u].index_type; + *image++ = (uint8_t)table->indexes[u].index_type; /* Type of messages in the index */ UINT16ENCODE(image, table->indexes[u].mesg_types); diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 0cca6bb..e085204 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -298,7 +298,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) /* Sanity check */ HDassert(ctx); - *raw++ = message->location; + *raw++ = (uint8_t)message->location; UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 3dc1b39..4a84c41 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3687,7 +3687,7 @@ H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_ /* Determine the encoding size */ enc2 = H5S__hyper_get_enc_size_real(max2); - *enc_size = MAX(enc1, enc2); + *enc_size = (uint8_t)MAX(enc1, enc2); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index f29319f..a61c505 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -238,7 +238,7 @@ H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *spac H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf); H5_DLL htri_t H5S_select_valid(const H5S_t *space); -H5_DLL hssize_t H5S_get_select_npoints(const H5S_t *space); +H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space); H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset); H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 6c8b898..9814e38 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -431,7 +431,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -H5_ATTR_PURE hssize_t +H5_ATTR_PURE hsize_t H5S_get_select_npoints(const H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -439,7 +439,7 @@ H5S_get_select_npoints(const H5S_t *space) /* Check args */ HDassert(space); - FUNC_LEAVE_NOAPI((hssize_t)space->select.num_elem) + FUNC_LEAVE_NOAPI(space->select.num_elem) } /* end H5S_get_select_npoints() */ diff --git a/src/H5Tbit.c b/src/H5Tbit.c index df6d2c3..c6c1777 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -363,7 +363,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) /* The middle bytes */ while (size >= 8) { - buf[idx++] = value ? 0xff : 0x00; + buf[idx++] = (uint8_t)(value ? 0xff : 0x00); size -= 8; } @@ -532,7 +532,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) acc = buf[idx]; acc++; carry = acc & 0x100; - buf[idx] = acc & 0xff; + buf[idx] = (uint8_t)(acc & 0xff); idx++; size -= 8; } diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 6d07513..2245bd3 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -324,7 +324,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); #define H5Z_XFORM_DO_OP5(TYPE, SIZE) \ { \ - TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ + TYPE val = (TYPE)((tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val); \ H5VM_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ } diff --git a/test/dsets.c b/test/dsets.c index 88eb720..1948eb1 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -5293,7 +5293,7 @@ test_types(hid_t file) (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || (dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i=0; ib = (i*8+1) & 0x7fff; - s_ptr->d = (i*8+6) & 0x7fff; + s_ptr->b = (int16_t)((i*8+1) & 0x7fff); + s_ptr->d = (int16_t)((i*8+6) & 0x7fff); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/h5test.c b/test/h5test.c index 309d8cb..c54f7c7 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1320,8 +1320,7 @@ h5_dump_info_object(MPI_Info info) int flag; int i, nkeys; - HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); + HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); if (info==MPI_INFO_NULL){ HDprintf("object is MPI_INFO_NULL\n"); } diff --git a/test/ntypes.c b/test/ntypes.c index 34558f5..f1d2449 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2484,7 +2484,7 @@ test_opaque_dtype(hid_t file) TEST_ERROR; for(i = 0; i < sizeof(wbuf); i++) - wbuf[i] = (unsigned char)0xff ^ (unsigned char)i; + wbuf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Sclose(space) < 0) TEST_ERROR; diff --git a/test/th5s.c b/test/th5s.c index 747e741..7e1e547 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1739,12 +1739,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) case CONFIG_16: stride = POWER16 - 1; block = 4; - expected_enc_size = expected_version == 3 ? 2 : 4; + expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4); break; case CONFIG_32: stride = POWER32 - 1; block = 4; - expected_enc_size = expected_version == 3 ? 4 : 8; + expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8); break; default: @@ -1765,12 +1765,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) case CONFIG_16: stride = POWER16 - 1; block = POWER16 - 2; - expected_enc_size = expected_version == 3 ? 2 : 4; + expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4); break; case CONFIG_32: stride = POWER32 - 1; block = POWER32 - 2; - expected_enc_size = expected_version == 3 ? 4 : 8; + expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8); break; default: HDassert(0); @@ -1912,7 +1912,7 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) for(config = CONFIG_8; config <= CONFIG_32; config++) { hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */ uint32_t expected_version = 0; /* Expected version for selection info */ - uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */ + uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */ start = 0; count = 2; @@ -1984,7 +1984,8 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); /* Verify the version and encoded size expected for the configuration */ - ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail); + HDassert(expected_enc_size <= 255); + ret = test_h5s_check_encoding(fapl, sid, expected_version, (uint8_t)expected_enc_size, expected_to_fail); CHECK(ret, FAIL, "test_h5s_check_encoding"); } /* for config */ diff --git a/test/tsohm.c b/test/tsohm.c index a064940..c126608 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3342,11 +3342,11 @@ test_sohm_extlink(void) static int verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) { - hid_t file_id = -1; - hid_t orig_space_id = -1; + hid_t file_id = H5I_INVALID_HID; + hid_t orig_space_id = H5I_INVALID_HID; hid_t space1_id, space2_id, space3_id; - hid_t dcpl_id = -1; - hid_t dset1_id, dset2_id, dset3_id; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID; hsize_t dims1[] = {1, 2}; hsize_t max_dims[] = {H5S_UNLIMITED, 2}; hsize_t dims2[] = {5, 2}; diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 6c91a41..832a47f 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -3806,7 +3806,7 @@ test_no_collective_cause_mode_filter(int selection_mode) uint32_t no_collective_cause_global_expected = 0; const char * filename; - const char * test_name; + const char * test_name = "I/O"; hbool_t is_chunked=1; int mpi_size = -1; int mpi_rank = -1; diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 890a918..91b8f8c 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -303,7 +303,7 @@ static int test_mpio_gb_file(char *filename) { mpi_rank, mpi_off, mpi_off); /* set data to some trivial pattern for easy verification */ for (j = 0; j < MB; j++) - *(buf + j) = i * mpi_size + mpi_rank; + H5_CHECKED_ASSIGN(*(buf + j), int8_t, i * mpi_size + mpi_rank, int); if (VERBOSE_MED) HDfprintf(stdout, "proc %d: writing %d bytes at offset %lld\n", @@ -351,7 +351,7 @@ static int test_mpio_gb_file(char *filename) { mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); INFO((mrc == MPI_SUCCESS), "GB size file read"); - expected = i * mpi_size + (mpi_size - mpi_rank - 1); + H5_CHECKED_ASSIGN(expected, int8_t, i * mpi_size + (mpi_size - mpi_rank - 1), int); vrfyerrs = 0; for (j = 0; j < MB; j++) { if ((*(buf + j) != expected) @@ -526,7 +526,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { * ==================================================*/ irank = 0; for (i = 0; i < DIMSIZE; i++) - writedata[i] = irank * DIMSIZE + i; + H5_CHECKED_ASSIGN(writedata[i], uint8_t, irank * DIMSIZE + i, int) mpi_off = irank * DIMSIZE; /* Only one process writes */ @@ -597,7 +597,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { return 1; }; for (i = 0; i < DIMSIZE; i++) { - expect_val = irank * DIMSIZE + i; + H5_CHECKED_ASSIGN(expect_val, uint8_t, irank * DIMSIZE + i, int); if (readdata[i] != expect_val) { PRINTID; HDprintf("read data[%d:%d] got %02x, expect %02x\n", irank, i, @@ -697,7 +697,7 @@ static int test_mpio_derived_dtype(char *filename) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); retcode = 0; for (i = 0; i < 3; i++) - buf[i] = i + 1; + H5_CHECKED_ASSIGN(buf[i], int8_t, i + 1, int); if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b22af18..58e3740 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -907,7 +907,7 @@ h5diff(const char *fname1, parallel_print("file1 file2\n"); parallel_print("---------------------------------------\n"); for(u = 0; u < match_list->nobjs; u++) { - char c1, c2; + int c1, c2; c1 = (match_list->objs[u].flags[0]) ? 'x' : ' '; c2 = (match_list->objs[u].flags[1]) ? 'x' : ' '; parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index cd906af..1972d10 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -273,7 +273,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t parallel_print(" obj1 obj2\n"); parallel_print(" --------------------------------------\n"); for(i = 0; i < (unsigned int) table_lp->nattrs; i++) { - char c1, c2; + int c1, c2; c1 = (table_lp->attrs[i].exist[0]) ? 'x' : ' '; c2 = (table_lp->attrs[i].exist[1]) ? 'x' : ' '; parallel_print("%5c %6c %-15s\n", c1, c2, table_lp->attrs[i].name); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 1eef5ab..bd1689f 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4707,14 +4707,14 @@ static int process(struct Options *opt) return (0); } -uint16_t swap_uint16( uint16_t val) +uint16_t swap_uint16(uint16_t val) { - return (val << 8) | (val >> 8); + return (uint16_t)((val << 8) | (val >> 8)); } int16_t swap_int16(int16_t val) { - return (val << 8) | ((val >> 8) & 0xFF); + return (int16_t)((val << 8) | ((val >> 8) & 0xFF)); } uint32_t swap_uint32(uint32_t val) diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 571452e..661a6dc 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -69,7 +69,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +78,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 571452e..661a6dc 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -69,7 +69,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +78,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 4ceed73..6cf2916 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -2565,7 +2565,7 @@ static void gent_bitfields(void) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (uint8_t)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -2579,7 +2579,7 @@ static void gent_bitfields(void) (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (uint8_t)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -9814,7 +9814,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for (i = 0; i < nelmts; i++) { - buf[i] = (uint8_t)0xff ^ (uint8_t)i; + buf[i] = (uint8_t)(0xff ^ i); } H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); H5Dclose(dset); @@ -9829,7 +9829,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for (i = 0; i < nelmts; i++) { - buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16); + buf2[i] = (uint16_t)(0xffff ^ (i * 16)); } H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); H5Dclose(dset); @@ -9879,7 +9879,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) - buf[i] = (uint8_t)0xff ^ (uint8_t)i; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); H5Dclose(dset); } @@ -9895,7 +9895,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) - buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16); + H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); H5Dclose(dset); @@ -9918,8 +9918,8 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { - buf5[i].a = (uint8_t)0xff ^ (uint8_t)i; - buf5[i].b = (uint16_t)0xffff ^ (uint16_t)(i * 16); + H5_CHECKED_ASSIGN(buf5[i].a, uint8_t, 0xff ^ i, size_t); + H5_CHECKED_ASSIGN(buf5[i].b, uint16_t, 0xffff ^ (i * 16), size_t); buf5[i].c = (uint32_t)0xffffffff ^ (uint32_t)(i * 32); buf5[i].d = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64); } @@ -10488,7 +10488,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -10497,7 +10497,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 571452e..661a6dc 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -69,7 +69,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +78,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index aaac285..77fb28a 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -266,7 +266,7 @@ generate_uint8be(hbool_t external) { for (i = 0, n = 0; i < dims[0]; i++) { for (j = 0; j < dims[1]; j++) { for (k = 0; k < dims[2]; k++, n++) { - wdata[n] = n * ((n & 1) ? (-1) : (1)); + wdata[n] = (uint8_t)((n & 1) ? -n : n); } } } @@ -296,7 +296,7 @@ generate_f32le(hbool_t external) { /* Generate values */ for (i = 0, k = 0, n = 0; i < dims[0]; i++) { for (j = 0; j < dims[1]; j++, k++, n++) { - wdata[k] = n * 801.1 * ((k % 5 == 1) ? (-1) : (1)); + wdata[k] = (float)(n * 801.1 * ((k % 5 == 1) ? (-1) : (1))); } } diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 77c04ab..5d8474b 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -208,7 +208,7 @@ do_pio(parameters param) bsize = buf_size; /* Actual buffer size */ } else { - snbytes = (off_t)sqrt(nbytes); /* General dataset size */ + snbytes = (off_t)sqrt((double)nbytes); /* General dataset size */ bsize = buf_size * blk_size; /* Actual buffer size */ } @@ -601,7 +601,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* nbytes is always the number of bytes per dataset (1D or 2D). If the dataspace is 2D, snbytes is the size of a side of the dataset square. */ - snbytes = (off_t)sqrt(nbytes); + snbytes = (off_t)sqrt((double)nbytes); /* Contiguous Pattern: */ if (!parms->interleaved) { @@ -1577,7 +1577,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* nbytes is always the number of bytes per dataset (1D or 2D). If the dataspace is 2D, snbytes is the size of a side of the 'dataset square'. */ - snbytes = (off_t)sqrt(nbytes); + snbytes = (off_t)sqrt((double)nbytes); bsize = buf_size * blk_size; diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 9f4d116..5977731 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -1155,9 +1155,9 @@ report_parameters(struct options *opts) recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(pow(opts->num_bpp * opts->min_num_procs,2) + recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->min_num_procs),2) * opts->num_dsets), ":"); - recover_size_and_print((long long)(pow(opts->num_bpp * opts->max_num_procs,2) + recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->max_num_procs),2) * opts->num_dsets), "\n"); HDfprintf(output, "rank %d: Transfer buffer size=", rank); -- cgit v0.12