From 8b9338ab57eec0cc8fa5a36c44d7b28e52e9a466 Mon Sep 17 00:00:00 2001 From: kmu Date: Thu, 7 Nov 2019 14:34:13 -0600 Subject: fix warnings from Intel compiler --- bin/warnhist | 17 +++++++++++++---- hl/src/H5LTanalyze.c | 10 +++++----- hl/tools/gif2h5/decompress.c | 2 +- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 14 +++++++------- src/H5Dchunk.c | 3 +-- src/H5Dint.c | 2 +- src/H5EAcache.c | 8 ++++---- src/H5FAcache.c | 4 ++-- src/H5FScache.c | 2 +- src/H5Fprivate.h | 4 ++-- src/H5Gint.c | 2 +- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 2 +- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 2 +- src/H5Oginfo.c | 2 +- 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/H5Tbit.c | 4 ++-- src/H5Ztrans.c | 2 +- test/dsets.c | 8 ++++---- test/dtypes.c | 4 ++-- test/ntypes.c | 2 +- test/th5s.c | 6 +++--- test/tsohm.c | 2 +- testpar/t_dset.c | 2 +- testpar/t_mpi.c | 10 +++++----- tools/lib/h5diff.c | 10 ++++++++-- tools/lib/h5diff_attr.c | 10 ++++++++-- tools/src/h5import/h5import.c | 4 ++-- 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, 120 insertions(+), 100 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 7e56246..507477d 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -205,8 +205,12 @@ while (<>) { ($last_c_name, $toss) = split /\:/, $_; } + 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:/; @@ -256,11 +260,15 @@ 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"; + } 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) @@ -330,6 +338,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/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 2219263..7e8ff31 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1176,12 +1176,12 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = (YY_CHAR)yy_ec[YY_SC_TO_UI(*yy_cp)]; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1831,12 +1831,12 @@ static int yy_get_next_buffer (void) for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (YY_CHAR)(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1859,7 +1859,7 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 544); diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 6668c22..713ca7e 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 = (unsigned char)(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 2b43a64..2a0c782 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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..09bb389 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ 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; + *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ 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; + *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 +1219,7 @@ 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; + *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 53ca7d1..ecb0f9c 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2193,7 +2193,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) schunk_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, &(const hsize_t)schunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") mem_sel_start[0] += schunk_points; @@ -5676,7 +5676,6 @@ 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) } /* H5D__chunk_addrmap_cb() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 772a150..bd87c7f 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2197,7 +2197,7 @@ H5D_nameof(const H5D_t *dataset) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : NULL) + FUNC_LEAVE_NOAPI((H5G_name_t *)(dataset ? &(dataset->path) : NULL)) } /* end H5D_nameof() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index da67e6b..7b1968e 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ 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; + *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 +875,7 @@ 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; + *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 +1284,7 @@ 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; + *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 +1698,7 @@ 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; + *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..e142ae2 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -417,7 +417,7 @@ 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; + *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 +805,7 @@ 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; + *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..fbdada2 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; + *image++ = (uint8_t)fspace->client; /* Total space tracked */ H5F_ENCODE_LENGTH(f, image, fspace->tot_space); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index c9a1b25..9ad33b2 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; \ } @@ -184,7 +184,7 @@ typedef struct H5F_t H5F_t; n = 0; \ (p) += l; \ for (_i = 0; _i < l; _i++) \ - n = (n << 8) | *(--p); \ + n = (uint16_t)((n << 8) | *(--p)); \ (p) += l; \ } diff --git a/src/H5Gint.c b/src/H5Gint.c index 049c696..c7ac1d1 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -583,7 +583,7 @@ H5G_nameof(const H5G_t *grp) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(grp ? &(grp->path) : NULL) + FUNC_LEAVE_NOAPI((H5G_name_t *)(grp ? &(grp->path) : NULL)) } /* end H5G_nameof() */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 6f174bb..9eb8ed2 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 = (unsigned char)(*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 f685a00c..b7d4dd5 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 0cc58a6..cb75bc3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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 e5e6741..fd62aa2 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -224,7 +224,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(fsinfo); *p++ = (uint8_t)fsinfo->version; /* message version */ - *p++ = fsinfo->strategy; /* File space strategy */ + *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..abe7879 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -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 ecf347c..9d4c066 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)]) @@ -2368,7 +2368,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); + ohdr_flags = (uint8_t)(oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES)); /* 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..475f66f 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 = (unsigned char)(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 443a245..77227ec 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -993,7 +993,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)((H5R_type_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 9feb8de..cfcc5ac 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3674,7 +3674,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/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..50ac947 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) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ H5VM_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ } diff --git a/test/dsets.c b/test/dsets.c index 21d5431..b32c5b6 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 = (short)((i*8+1) & 0x7fff); + s_ptr->d = (short)((i*8+6) & 0x7fff); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); 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 1a4456a..ed02c16 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1583,7 +1583,7 @@ test_h5s_encode1(void) ****************************************************************/ static herr_t test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, - uint32_t expected_version, uint8_t expected_enc_size, hbool_t expected_to_fail) + uint32_t expected_version, uint32_t expected_enc_size, hbool_t expected_to_fail) { char *buf = NULL; /* Pointer to the encoded buffer */ size_t buf_size; /* Size of the encoded buffer */ @@ -1697,7 +1697,7 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) unsigned unlim; /* H5S_UNLIMITED setting or not */ herr_t ret; /* Generic return value */ 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 */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataspace encoding of regular hyperslabs\n")); @@ -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; diff --git a/test/tsohm.c b/test/tsohm.c index a064940..0fc273b 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3346,7 +3346,7 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) hid_t orig_space_id = -1; hid_t space1_id, space2_id, space3_id; hid_t dcpl_id = -1; - hid_t dset1_id, dset2_id, dset3_id; + hid_t dset1_id, dset2_id = -1, dset3_id = -1; 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..2bb2336 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; + *(buf + j) = (char)(i * mpi_size + mpi_rank); 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); + expected = (char)(i * mpi_size + (mpi_size - mpi_rank - 1)); 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; + writedata[i] = (unsigned char)(irank * DIMSIZE + i); 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; + expect_val = (unsigned char)(irank * DIMSIZE + i); 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; + buf[i] = (char)(i + 1); 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 c2153e5..5acdde8 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -908,8 +908,14 @@ h5diff(const char *fname1, parallel_print("---------------------------------------\n"); for(u = 0; u < match_list->nobjs; u++) { char c1, c2; - c1 = (match_list->objs[u].flags[0]) ? 'x' : ' '; - c2 = (match_list->objs[u].flags[1]) ? 'x' : ' '; + if (match_list->objs[u].flags[0]) + c1 = 'x'; + else + c1 = ' '; + if (match_list->objs[u].flags[1]) + c2 = 'x'; + else + c2 = ' '; parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name); } /* end for */ parallel_print ("\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 351e6ab..a648be1 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -274,8 +274,14 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t parallel_print(" --------------------------------------\n"); for(i = 0; i < (unsigned int) table_lp->nattrs; i++) { char c1, c2; - c1 = (table_lp->attrs[i].exist[0]) ? 'x' : ' '; - c2 = (table_lp->attrs[i].exist[1]) ? 'x' : ' '; + if (table_lp->attrs[i].exist[0]) + c1 = 'x'; + else + c1 = ' '; + if (table_lp->attrs[i].exist[1]) + c2 = 'x'; + else + c2 = ' '; parallel_print("%5c %6c %-15s\n", c1, c2, table_lp->attrs[i].name); } /* end for */ } diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 1eef5ab..40b812f 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4709,12 +4709,12 @@ static int process(struct Options *opt) 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 (uint16_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..4f2d435 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 = (char)(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 = (char)(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..4f2d435 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 = (char)(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 = (char)(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 ad70770..85fe754 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] = (unsigned char)(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] = (unsigned char)(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; + buf[i] = (uint8_t)(0xff ^ i); 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); + buf2[i] = (uint16_t)(0xffff ^ (i * 16)); 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); + buf5[i].a = (uint8_t)(0xff ^ i); + buf5[i].b = (uint16_t)(0xffff ^ (i * 16)); 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; + *int_ptr = (char)(temp - MULTIPLIER); 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; + *int_ptr = (char)(temp + MULTIPLIER); 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..4f2d435 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 = (char)(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 = (char)(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..f476a16 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 * ((n & 1) ? (-1) : (1))); } } } @@ -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 From d06474c4e1ba8628f896e57e619d4b142e6ba8b0 Mon Sep 17 00:00:00 2001 From: kmu Date: Mon, 11 Nov 2019 10:49:37 -0600 Subject: fix warnings and some text alignment --- test/h5test.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/test/h5test.c b/test/h5test.c index c8f4132..1faf02d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1318,23 +1318,21 @@ h5_dump_info_object(MPI_Info info) { char key[MPI_MAX_INFO_KEY+1]; char value[MPI_MAX_INFO_VAL+1]; - int flag; - int i, nkeys; + int flag; + int i, nkeys; - HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); - if (info==MPI_INFO_NULL){ - HDprintf("object is MPI_INFO_NULL\n"); + 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"); } else { - MPI_Info_get_nkeys(info, &nkeys); - HDprintf("object has %d items\n", nkeys); - for (i=0; i Date: Thu, 14 Nov 2019 09:28:03 -0600 Subject: let hdf5 pick up the right compiler in Intel environment --- config/gnu-cxxflags | 21 ++++++----- config/gnu-flags | 5 ++- config/intel-cxxflags | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ config/linux-gnulibc1 | 3 ++ 4 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 config/intel-cxxflags diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index e0f2999..744f56d 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -28,29 +28,32 @@ if test X = "X$cxx_flags_set"; then # filter it out. # icc beginning with version 12 includes a "gcc version compatiblilty" # string, causing the gcc H5_CFLAGS to be erroneously added. The line - # "grep -v 'icc version'" causes the discarding of any output - # containing 'icc version'. The cc_version for icc is correctly determined - # and flags added in the intel-flags script. + # "grep -v 'icpc version'" causes the discarding of any output + # containing 'icpc version'. The line "grep -v 'icpc.orig version'" + # causes the discarding of any output containing 'icpc.orig version'. + # The cxx_version for icc is correctly determined + # and flags added in the intel-cxxflags script. cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep -v 'PathScale' |\ grep -v 'icc version' |\ + grep -v 'icpc version' |\ + grep -v 'icpc.orig version' |\ grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*\).*/\1/'` cxx_version=`echo $cxx_version |sed 's/[-a-z]//g'` if test X = "X$cxx_vendor" -a X != "X$cxx_version"; then - cxx_vendor=g++ + cxx_vendor=g++ fi if test "-" != "$cxx_vendor-$cxx_version"; then - echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" + echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" fi # Some version numbers cxx_vers_major=`echo $cxx_version | cut -f1 -d.` cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` - test -n "$cc_vers_major" || cxx_vers_major=0 - test -n "$cc_vers_minor" || cxx_vers_minor=0 - test -n "$cc_vers_patch" || cxx_vers_patch=0 - cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` + test -n "$cxx_vers_major" || cxx_vers_major=0 + test -n "$cxx_vers_minor" || cxx_vers_minor=0 + test -n "$cxx_vers_patch" || cxx_vers_patch=0 fi # Common g++ flags for various situations diff --git a/config/gnu-flags b/config/gnu-flags index 6355ccf..7a6686e 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -29,10 +29,13 @@ if test "X-" = "X-$cc_flags_set"; then # icc beginning with version 12 includes a "gcc version compatiblilty" # string, causing the gcc H5_CFLAGS to be erroneously added. The line # "grep -v 'icc version'" causes the discarding of any output - # containing 'icc version'. The cc_version for icc is correctly determined + # containing 'icc version'. The line "grep -v 'icc.orig version'" causes + # the discarding of any output containing 'icc.orig version'. + # The cc_version for icc is correctly determined # and flags added in the intel-flags script. cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 | grep -v 'PathScale' |\ grep -v 'icc version' |\ + grep -v 'icc.orig version' |\ grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` cc_version=`echo $cc_version |sed 's/[-a-z]//g'` diff --git a/config/intel-cxxflags b/config/intel-cxxflags new file mode 100644 index 0000000..97fe021 --- /dev/null +++ b/config/intel-cxxflags @@ -0,0 +1,102 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# Intel icc compiler or a derivative. It is careful not to do anything +# if the compiler is not Intel; otherwise `cxx_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for icpc +# icpc unless a compiler version is already known +# +# cxx_vendor: The compiler name: icpc +# cxx_version: Version number: 18.0.1 +# +if test X = "X$cxx_flags_set"; then + cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 |grep 'Version'`" + if test X != "X$cxx_version"; then + cxx_vendor=icpc + cxx_version=`echo $cxx_version |sed 's/.*Version \([-a-z0-9\.\-]*\).*/\1/'` + echo "compiler '$CXX' is Intel $cxx_vendor-$cxx_version" + + # Some version numbers + # Intel version numbers are of the form: "major.minor" + cxx_vers_major=`echo $cxx_version | cut -f1 -d.` + cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` + cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` + test -n "$cxx_vers_major" || cxx_vers_major=0 + test -n "$cxx_vers_minor" || cxx_vers_minor=0 + test -n "$cxx_vers_patch" || cxx_vers_patch=0 + fi +fi + +# Common Intel flags for various situations +if test "X-icpc" = "X-$cxx_vendor"; then + # Insert section about version specific problems from compiler flags here, + # if necessary. + + arch= + # Architecture-specific flags + # Nothing currently. (Uncomment code below and modify to add any) + #case "$host_os-$host_cpu" in + # *-i686) + # arch="-march=i686" + # ;; + #esac + + # Host-specific flags + # Nothing currently. (Uncomment code below and modify to add any) + #case "`hostname`" in + # sleipnir.ncsa.uiuc.edu) + # arch="$arch -pipe" + # ;; + #esac + + # General + # Default to C99 standard. + H5_CFLAGS="$H5_CFLAGS $arch -std=c99 -Wcheck -Wall" + + # Production + PROD_CFLAGS= + + # Debug + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS= + + # Symbols + SYMBOLS_CFLAGS="-g" + NO_SYMBOLS_CFLAGS="-Wl,-s" + + # Profiling + # Use this for profiling with gprof + PROFILE_CFLAGS="-p" + + # Optimization + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-O0" + NO_OPT_CFLAGS="-O0" + + # Flags are set + cxx_flags_set=yes + +fi + +# Version specific ICC flags +# TODO + +# Clear cxx info if no flags set +if test "X-$cxx_flags_set" = "X-"; then + cxx_vendor= + cxx_version= +fi diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 39225e7..bf5915a 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -194,6 +194,9 @@ fi # Figure out GNU CXX compiler flags . $srcdir/config/gnu-cxxflags +# Figure out Intel CXX compiler flags +. $srcdir/config/intel-cxxflags + # compiler version strings # check if the compiler_version_info is already set -- cgit v0.12 From d242a900f420b040e364f6c0976c01593e955db3 Mon Sep 17 00:00:00 2001 From: kmu Date: Mon, 25 Nov 2019 12:48:51 -0600 Subject: fix issues from previous PR comments --- hl/src/H5LTanalyze.c | 10 +++++----- hl/tools/gif2h5/decompress.c | 2 +- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 2 +- src/H5Dchunk.c | 8 ++++---- src/H5Dint.c | 2 +- src/H5EAcache.c | 2 +- src/H5FAcache.c | 1 + src/H5FScache.c | 8 ++++---- src/H5Fprivate.h | 10 +++++----- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 5 +++-- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 1 + src/H5Oginfo.c | 2 +- src/H5Oint.c | 2 +- src/H5Olayout.c | 2 +- src/H5Olinfo.c | 2 +- src/H5Olink.c | 2 +- src/H5Osdspace.c | 5 +++-- src/H5Rint.c | 2 +- src/H5SMcache.c | 2 +- src/H5SMmessage.c | 2 +- src/H5Shyper.c | 2 +- src/H5Tbit.c | 4 ++-- test/dsets.c | 6 +++--- test/dtypes.c | 4 ++-- test/ntypes.c | 2 +- test/tsohm.c | 8 ++++---- testpar/t_mpi.c | 10 +++++----- tools/src/h5import/h5import.c | 12 +++++++++--- tools/test/h5diff/dynlib_diff.c | 5 +++-- tools/test/h5dump/dynlib_dump.c | 5 +++-- tools/test/h5dump/h5dumpgentest.c | 16 ++++++++-------- tools/test/h5ls/dynlib_ls.c | 3 ++- tools/test/h5repack/h5repackgentest.c | 2 +- 38 files changed, 90 insertions(+), 77 deletions(-) diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 7e8ff31..2219263 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1176,12 +1176,12 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = (YY_CHAR)yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1831,12 +1831,12 @@ static int yy_get_next_buffer (void) for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (YY_CHAR)(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1859,7 +1859,7 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 544); diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 713ca7e..f8c86f6 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 = (unsigned char)(GifImageDesc->PackedField & 0x40); + ASSIGN_TO_SMALLER_SIZE(Interlace, unsigned char, GifImageDesc->PackedField & 0x40, int); /* * 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 2a0c782..ecbbd48 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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 = (uint8_t)MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); + ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); /* Version bounds check */ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 09bb389..fe4827d 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - *image++ = (uint8_t)hdr->cls->id; + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cls->id, int); /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - *image++ = (uint8_t)internal->hdr->cls->id; + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, internal->hdr->cls->id, int); HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ @@ -1219,7 +1219,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - *image++ = (uint8_t)leaf->hdr->cls->id; + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, leaf->hdr->cls->id, int); 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 ea03ed6..ff835eb 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 = (uint16_t)(old_node_nrec / 2); + ASSIGN_TO_SMALLER_SIZE(mid_record, uint16_t, old_node_nrec / 2, int); /* Copy "upper half" of records to new child */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ecb0f9c..d28beb8 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2180,7 +2180,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 schunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ @@ -2191,9 +2191,9 @@ 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); + schunk_points = (hsize_t)H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &(const hsize_t)schunk_points) < 0) + if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &schunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") mem_sel_start[0] += schunk_points; @@ -5668,7 +5668,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) 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); diff --git a/src/H5Dint.c b/src/H5Dint.c index bd87c7f..772a150 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2197,7 +2197,7 @@ H5D_nameof(const H5D_t *dataset) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI((H5G_name_t *)(dataset ? &(dataset->path) : NULL)) + FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : NULL) } /* end H5D_nameof() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 7b1968e..b51d29e 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - *image++ = (uint8_t)hdr->cparam.cls->id; + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index e142ae2..2b5187d 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -418,6 +418,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Fixed array type */ *image++ = (uint8_t)hdr->cparam.cls->id; + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FScache.c b/src/H5FScache.c index fbdada2..d4f77f4 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++ = (uint8_t)fspace->client; + ASSIGN_TO_SMALLER_SIZE(*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 = 1; /* Current section size */ + size_t node_count = 1; /* # 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 = 1; /* 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 9ad33b2..0fe1867 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -178,19 +178,19 @@ typedef struct H5F_t H5F_t; /* Decode a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define DECODE_VAR(p, n, l) { \ +# define DECODE_VAR(p, typ, n, l) { \ size_t _i; \ \ n = 0; \ (p) += l; \ for (_i = 0; _i < l; _i++) \ - n = (uint16_t)((n << 8) | *(--p)); \ + n = (typ)((n << 8) | *(--p)); \ (p) += l; \ } /* Decode a variable-sized buffer into a 32-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ -# define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) +# define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, uint32_t, n, l) # define INT64DECODE(p, n) { \ /* WE DON'T CHECK FOR OVERFLOW! */ \ @@ -216,14 +216,14 @@ typedef struct H5F_t H5F_t; /* Decode a variable-sized buffer into a 64-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ -# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) +# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, uint64_t, n, l) /* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ # define UINT64DECODE_VARLEN(p, n) { \ unsigned _s = *(p)++; \ \ - UINT64DECODE_VAR(p, n, _s); \ + UINT64DECODE_VAR(p, uint64_t, n, _s); \ } # define H5_DECODE_UNSIGNED(p, n) { \ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 9eb8ed2..b0291b8 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 = (unsigned char)(*id & H5HF_ID_TYPE_MASK); + ASSIGN_TO_SMALLER_SIZE(*obj_type, unsigned char, *id & H5HF_ID_TYPE_MASK, int); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_get_id_type_test() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 23aba09..d923a9f 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 = (unsigned char)(ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0); + ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); 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 b7d4dd5..2697959 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -328,8 +328,9 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) UINT16ENCODE(p, attr->shared->ds_size); /* The character encoding for the attribute's name, in later versions */ - if(attr->shared->version >= H5O_ATTR_VERSION_3) - *p++ = (uint8_t)attr->shared->encoding; + if(attr->shared->version >= H5O_ATTR_VERSION_3) { + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, attr->shared->encoding, int); + } /* 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 cb75bc3..14b12db 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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++ = (uint8_t)fill->alloc_time; + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->alloc_time, int); /* Fill value writing time */ - *p++ = (uint8_t)fill->fill_time; + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->fill_time, int); /* Whether fill value is defined */ *p++ = (uint8_t)fill->fill_defined; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index fd62aa2..82afa96 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -225,6 +225,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fsinfo->strategy, unsigned); *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 abe7879..027f33c 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -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 = (unsigned char)(ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0); + ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0, int); 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 9d4c066..b923605 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 = (uint8_t)MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); + ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); /* Version bounds check */ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 2a2a07b..143f49e 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++ = (uint8_t)mesg->type; + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, mesg->type, int); /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 475f66f..f605e8e 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 = (unsigned char)(linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0); + ASSIGN_TO_SMALLER_SIZE(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); 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 1f0c6c7..3453565 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++ = (uint8_t)lnk->type; + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, lnk->type, int); /* 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 33310dc..7b6c444 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -256,8 +256,9 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) *p++ = (uint8_t)flags; /* Dataspace type */ - if(sdim->version > H5O_SDSPACE_VERSION_1) - *p++ = (uint8_t)sdim->type; + if(sdim->version > H5O_SDSPACE_VERSION_1) { + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, sdim->type, int); + } else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index 77227ec..a318ddc 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -993,7 +993,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 = (int8_t)((H5R_type_t)*p++); + ASSIGN_TO_SMALLER_SIZE(ref->type, int8_t, (H5R_type_t)*p++, int); 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 ee28fa4..40692cd 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++ = (uint8_t)table->indexes[u].index_type; + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, table->indexes[u].index_type, int); /* Type of messages in the index */ UINT16ENCODE(image, table->indexes[u].mesg_types); diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index e085204..2a04423 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++ = (uint8_t)message->location; + ASSIGN_TO_SMALLER_SIZE(*raw++, uint8_t, message->location, int); UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index cfcc5ac..0f73e7b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3674,7 +3674,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 = (uint8_t)MAX(enc1, enc2); + ASSIGN_TO_SMALLER_SIZE(*enc_size, uint8_t, MAX(enc1, enc2), int); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index c6c1777..1a7ea9b 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++] = (uint8_t)(value ? 0xff : 0x00); + ASSIGN_TO_SMALLER_SIZE(buf[idx++], uint8_t, value ? 0xff : 0x00, int); 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] = (uint8_t)(acc & 0xff); + ASSIGN_TO_SMALLER_SIZE(buf[idx], uint8_t, acc & 0xff, unsigned); idx++; size -= 8; } diff --git a/test/dsets.c b/test/dsets.c index b32c5b6..15d319c 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 = (short)((i*8+1) & 0x7fff); - s_ptr->d = (short)((i*8+6) & 0x7fff); + ASSIGN_TO_SMALLER_SIZE(s_ptr->b, short, (i*8+1) & 0x7fff, int); + ASSIGN_TO_SMALLER_SIZE(s_ptr->d, short, (i*8+6) & 0x7fff, int); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/ntypes.c b/test/ntypes.c index f1d2449..03eefe6 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 ^ i); + ASSIGN_TO_SMALLER_SIZE(wbuf[i], unsigned char, 0xff ^ i, size_t); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Sclose(space) < 0) TEST_ERROR; diff --git a/test/tsohm.c b/test/tsohm.c index 0fc273b..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 = -1, dset3_id = -1; + 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_mpi.c b/testpar/t_mpi.c index 2bb2336..79eda60 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) = (char)(i * mpi_size + mpi_rank); + ASSIGN_TO_SMALLER_SIZE(*(buf + j), char, 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 = (char)(i * mpi_size + (mpi_size - mpi_rank - 1)); + ASSIGN_TO_SMALLER_SIZE(expected, char, 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] = (unsigned char)(irank * DIMSIZE + i); + ASSIGN_TO_SMALLER_SIZE(writedata[i], unsigned char, 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 = (unsigned char)(irank * DIMSIZE + i); + ASSIGN_TO_SMALLER_SIZE(expect_val, unsigned char, 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] = (char)(i + 1); + ASSIGN_TO_SMALLER_SIZE(buf[i], char, 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/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 40b812f..2cd826b 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4707,14 +4707,20 @@ static int process(struct Options *opt) return (0); } -uint16_t swap_uint16( uint16_t val) +uint16_t swap_uint16(uint16_t val) { - return (uint16_t)((val << 8) | (val >> 8)); + uint16_t ret; + + ASSIGN_TO_SMALLER_SIZE(ret, uint16_t, (val << 8) | (val >> 8), int); + return ret; } int16_t swap_int16(int16_t val) { - return (uint16_t)((val << 8) | ((val >> 8) & 0xFF)); + uint16_t ret; + + ASSIGN_TO_SMALLER_SIZE(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int); + return ret; } uint32_t swap_uint32(uint32_t val) diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 4f2d435..5989b38 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -16,6 +16,7 @@ #include #include #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,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 = (char)(temp - MULTIPLIER); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +79,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 = (char)(temp + MULTIPLIER); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); 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 4f2d435..5989b38 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -16,6 +16,7 @@ #include #include #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,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 = (char)(temp - MULTIPLIER); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +79,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 = (char)(temp + MULTIPLIER); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 85fe754..2f8c1a6 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 ^ i); + ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); 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 ^ i); + ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); 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 ^ i); + ASSIGN_TO_SMALLER_SIZE(buf[i], uint8_t, 0xff ^ i, size_t); } 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 ^ (i * 16)); + ASSIGN_TO_SMALLER_SIZE(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); } 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 ^ i); + ASSIGN_TO_SMALLER_SIZE(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 ^ (i * 16)); + ASSIGN_TO_SMALLER_SIZE(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 ^ i); - buf5[i].b = (uint16_t)(0xffff ^ (i * 16)); + ASSIGN_TO_SMALLER_SIZE(buf5[i].a, uint8_t, 0xff ^ i, size_t); + ASSIGN_TO_SMALLER_SIZE(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); } diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 4f2d435..089b78f 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -16,6 +16,7 @@ #include #include #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,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 = (char)(temp - MULTIPLIER); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index f476a16..f3cb7d9 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] = (uint8_t)(n * ((n & 1) ? (-1) : (1))); + ASSIGN_TO_SMALLER_SIZE(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); } } } -- cgit v0.12 From fc61b7a9f3a38331809ebcb6247482943947cdb8 Mon Sep 17 00:00:00 2001 From: kmu Date: Mon, 25 Nov 2019 15:17:55 -0600 Subject: using a different MACRO --- bin/warnhist | 2 ++ hl/tools/gif2h5/decompress.c | 3 ++- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 2 +- src/H5EAcache.c | 2 +- src/H5FAcache.c | 2 +- src/H5FScache.c | 2 +- src/H5Fprivate.h | 3 ++- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 14 +++++++------- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 10 +++++----- src/H5Oginfo.c | 10 +++++----- src/H5Oint.c | 2 +- src/H5Olayout.c | 2 +- src/H5Olinfo.c | 2 +- src/H5Olink.c | 18 +++++++++--------- src/H5Osdspace.c | 14 +++++++------- src/H5Rint.c | 2 +- src/H5SMcache.c | 17 +++++++++-------- src/H5SMmessage.c | 8 ++++---- src/H5Shyper.c | 6 +++--- src/H5Tbit.c | 10 +++++----- test/dsets.c | 6 +++--- test/dtypes.c | 4 ++-- test/ntypes.c | 2 +- testpar/t_mpi.c | 10 +++++----- tools/src/h5import/h5import.c | 4 ++-- tools/test/h5diff/dynlib_diff.c | 4 ++-- tools/test/h5dump/dynlib_dump.c | 4 ++-- tools/test/h5dump/h5dumpgentest.c | 16 ++++++++-------- tools/test/h5ls/dynlib_ls.c | 2 +- tools/test/h5repack/h5repackgentest.c | 2 +- 35 files changed, 103 insertions(+), 98 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 507477d..6ed529a 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -205,6 +205,7 @@ 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 = $_; } @@ -265,6 +266,7 @@ while (<>) { $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; diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index f8c86f6..5532fb5 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -12,6 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include +#include "H5private.h" #include "gif.h" @@ -173,7 +174,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; - ASSIGN_TO_SMALLER_SIZE(Interlace, unsigned char, GifImageDesc->PackedField & 0x40, int); + H5_CHECKED_ASSIGN(Interlace, unsigned char, GifImageDesc->PackedField & 0x40, int); /* * 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 ecbbd48..54c17ee 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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 */ - ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); + H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); /* Version bounds check */ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index fe4827d..7d163bf 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cls->id, int); + H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cls->id, int); /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, internal->hdr->cls->id, int); + H5_CHECKED_ASSIGN(*image++, uint8_t, internal->hdr->cls->id, int); HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ @@ -1219,7 +1219,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, leaf->hdr->cls->id, int); + H5_CHECKED_ASSIGN(*image++, uint8_t, leaf->hdr->cls->id, int); 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 ff835eb..932f5f3 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 */ - ASSIGN_TO_SMALLER_SIZE(mid_record, uint16_t, old_node_nrec / 2, int); + H5_CHECKED_ASSIGN(mid_record, uint16_t, old_node_nrec / 2, int); /* Copy "upper half" of records to new child */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), diff --git a/src/H5EAcache.c b/src/H5EAcache.c index b51d29e..9a76f4a 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); + H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 2b5187d..30d19e8 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -418,7 +418,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Fixed array type */ *image++ = (uint8_t)hdr->cparam.cls->id; - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); + H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FScache.c b/src/H5FScache.c index d4f77f4..28c35e4 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 */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, fspace->client, int); + H5_CHECKED_ASSIGN(*image++, uint8_t, fspace->client, int); /* Total space tracked */ H5F_ENCODE_LENGTH(f, image, fspace->tot_space); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0fe1867..d6410a7 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -29,7 +29,8 @@ typedef struct H5F_t H5F_t; #include "H5VLpublic.h" /* Virtual Object Layer */ /* Private headers needed by this file */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_PARALLEL #include "H5Pprivate.h" /* Property lists */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index b0291b8..585a1bf 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 */ - ASSIGN_TO_SMALLER_SIZE(*obj_type, unsigned char, *id & H5HF_ID_TYPE_MASK, int); + H5_CHECKED_ASSIGN(*obj_type, unsigned char, *id & H5HF_ID_TYPE_MASK, int); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_get_id_type_test() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index d923a9f..a0730e8 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 */ - ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); + H5_CHECKED_ASSIGN(flags, unsigned char, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); 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 2697959..634069c 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -16,12 +16,12 @@ #define H5S_FRIEND /*suppress error about including H5Spkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Spkg.h" /* Dataspaces */ /* PRIVATE PROTOTYPES */ static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg); @@ -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) { - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, attr->shared->encoding, int); + H5_CHECKED_ASSIGN(*p++, uint8_t, attr->shared->encoding, int); } /* Write the name including null terminator */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 14b12db..93f2a65 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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 */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->alloc_time, int); + H5_CHECKED_ASSIGN(*p++, uint8_t, fill->alloc_time, int); /* Fill value writing time */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->fill_time, int); + H5_CHECKED_ASSIGN(*p++, uint8_t, fill->fill_time, int); /* Whether fill value is defined */ *p++ = (uint8_t)fill->fill_defined; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 82afa96..4bd8fff 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -25,11 +25,11 @@ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Opkg.h" /* Object headers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ static void *H5O_fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, @@ -225,7 +225,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fsinfo->strategy, unsigned); + H5_CHECKED_ASSIGN(*p++, uint8_t, fsinfo->strategy, unsigned); *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 027f33c..f4dfa6d 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -22,13 +22,13 @@ *------------------------------------------------------------------------- */ -#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Opkg.h" /* Object headers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ @@ -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 */ - ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0, int); + H5_CHECKED_ASSIGN(flags, unsigned char, ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0, int); 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 b923605..0e69bfa 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 */ - ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); + H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); /* Version bounds check */ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 143f49e..069ee7c 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 */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, mesg->type, int); + H5_CHECKED_ASSIGN(*p++, uint8_t, mesg->type, int); /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index f605e8e..9e57185 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 */ - ASSIGN_TO_SMALLER_SIZE(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); + H5_CHECKED_ASSIGN(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); 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 3453565..6076556 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -24,17 +24,17 @@ #define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5L_FRIEND /*suppress error about including H5Lpkg */ -#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lpkg.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ @@ -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) - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, lnk->type, int); + H5_CHECKED_ASSIGN(*p++, uint8_t, lnk->type, int); /* 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 7b6c444..b7a95f5 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -15,13 +15,13 @@ #define H5S_FRIEND /*prevent warning from including H5Spkg.h */ #include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Gprivate.h" /* Groups */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Gprivate.h" /* Groups */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Spkg.h" /* Dataspaces */ /* PRIVATE PROTOTYPES */ @@ -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) { - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, sdim->type, int); + H5_CHECKED_ASSIGN(*p++, uint8_t, sdim->type, int); } else { *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index a318ddc..96f33ef 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -993,7 +993,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 */ - ASSIGN_TO_SMALLER_SIZE(ref->type, int8_t, (H5R_type_t)*p++, int); + H5_CHECKED_ASSIGN(ref->type, int8_t, (H5R_type_t)*p++, int); 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 40692cd..448e128 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -32,13 +32,14 @@ /***********/ /* Headers */ /***********/ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5SMpkg.h" /* Shared object header messages */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5SMpkg.h" /* Shared object header messages */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -397,7 +398,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? */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, table->indexes[u].index_type, int); + H5_CHECKED_ASSIGN(*image++, uint8_t, table->indexes[u].index_type, int); /* Type of messages in the index */ UINT16ENCODE(image, table->indexes[u].mesg_types); diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 2a04423..9e1eee2 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -22,9 +22,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object Headers */ #include "H5SMpkg.h" /* Shared object header messages */ @@ -298,7 +298,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) /* Sanity check */ HDassert(ctx); - ASSIGN_TO_SMALLER_SIZE(*raw++, uint8_t, message->location, int); + H5_CHECKED_ASSIGN(*raw++, uint8_t, message->location, int); UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 0f73e7b..f3f9b9f 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -30,8 +30,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspace functions */ @@ -3674,7 +3674,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); - ASSIGN_TO_SMALLER_SIZE(*enc_size, uint8_t, MAX(enc1, enc2), int); + H5_CHECKED_ASSIGN(*enc_size, uint8_t, MAX(enc1, enc2), int); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 1a7ea9b..d2f5657 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -21,9 +21,9 @@ #include "H5private.h" /*generic functions */ #include "H5Eprivate.h" /*error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Tpkg.h" /*data-type functions */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Tpkg.h" /*data-type functions */ +#include "H5WBprivate.h" /* Wrapped Buffers */ @@ -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) { - ASSIGN_TO_SMALLER_SIZE(buf[idx++], uint8_t, value ? 0xff : 0x00, int); + H5_CHECKED_ASSIGN(buf[idx++], uint8_t, value ? 0xff : 0x00, int); 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; - ASSIGN_TO_SMALLER_SIZE(buf[idx], uint8_t, acc & 0xff, unsigned); + H5_CHECKED_ASSIGN(buf[idx], uint8_t, acc & 0xff, unsigned); idx++; size -= 8; } diff --git a/test/dsets.c b/test/dsets.c index 15d319c..b228932 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, short, (i*8+1) & 0x7fff, int); - ASSIGN_TO_SMALLER_SIZE(s_ptr->d, short, (i*8+6) & 0x7fff, int); + H5_CHECKED_ASSIGN(s_ptr->b, short, (i*8+1) & 0x7fff, int); + H5_CHECKED_ASSIGN(s_ptr->d, short, (i*8+6) & 0x7fff, int); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/ntypes.c b/test/ntypes.c index 03eefe6..99bc155 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++) - ASSIGN_TO_SMALLER_SIZE(wbuf[i], unsigned char, 0xff ^ i, size_t); + H5_CHECKED_ASSIGN(wbuf[i], unsigned char, 0xff ^ i, size_t); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Sclose(space) < 0) TEST_ERROR; diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 79eda60..d2090e5 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++) - ASSIGN_TO_SMALLER_SIZE(*(buf + j), char, i * mpi_size + mpi_rank, int); + H5_CHECKED_ASSIGN(*(buf + j), char, 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"); - ASSIGN_TO_SMALLER_SIZE(expected, char, i * mpi_size + (mpi_size - mpi_rank - 1), int); + H5_CHECKED_ASSIGN(expected, char, 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++) - ASSIGN_TO_SMALLER_SIZE(writedata[i], unsigned char, irank * DIMSIZE + i, int) + H5_CHECKED_ASSIGN(writedata[i], unsigned char, 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++) { - ASSIGN_TO_SMALLER_SIZE(expect_val, unsigned char, irank * DIMSIZE + i, int); + H5_CHECKED_ASSIGN(expect_val, unsigned char, 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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], char, i + 1, int); + H5_CHECKED_ASSIGN(buf[i], char, 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/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 2cd826b..aa17878 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4711,7 +4711,7 @@ uint16_t swap_uint16(uint16_t val) { uint16_t ret; - ASSIGN_TO_SMALLER_SIZE(ret, uint16_t, (val << 8) | (val >> 8), int); + H5_CHECKED_ASSIGN(ret, uint16_t, (val << 8) | (val >> 8), int); return ret; } @@ -4719,7 +4719,7 @@ int16_t swap_int16(int16_t val) { uint16_t ret; - ASSIGN_TO_SMALLER_SIZE(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int); + H5_CHECKED_ASSIGN(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int); return ret; } diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 5989b38..1b98068 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -70,7 +70,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); + H5_CHECKED_ASSIGN(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,7 +79,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); + H5_CHECKED_ASSIGN(*int_ptr, char, temp + MULTIPLIER, int); 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 5989b38..1b98068 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -70,7 +70,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); + H5_CHECKED_ASSIGN(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,7 +79,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); + H5_CHECKED_ASSIGN(*int_ptr, char, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 2f8c1a6..152798b 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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); + H5_CHECKED_ASSIGN(buf[i], unsigned char, 0xff ^ i, size_t); 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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); + H5_CHECKED_ASSIGN(buf[i], unsigned char, 0xff ^ i, size_t); 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++) { - ASSIGN_TO_SMALLER_SIZE(buf[i], uint8_t, 0xff ^ i, size_t); + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); } 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++) { - ASSIGN_TO_SMALLER_SIZE(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); + H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); } 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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], uint8_t, 0xff ^ i, size_t); + 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++) - ASSIGN_TO_SMALLER_SIZE(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); + 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++) { - ASSIGN_TO_SMALLER_SIZE(buf5[i].a, uint8_t, 0xff ^ i, size_t); - ASSIGN_TO_SMALLER_SIZE(buf5[i].b, uint16_t, 0xffff ^ (i * 16), size_t); + 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); } diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 089b78f..ad0cd0e 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -70,7 +70,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); + H5_CHECKED_ASSIGN(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index f3cb7d9..c2398b6 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++) { - ASSIGN_TO_SMALLER_SIZE(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); + H5_CHECKED_ASSIGN(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); } } } -- cgit v0.12 From 4c8a2f726a2eb47a937430e28994db8be1b87b00 Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 26 Nov 2019 17:23:34 -0600 Subject: Revert "using a different MACRO" This reverts commit fc61b7a9f3a38331809ebcb6247482943947cdb8. --- bin/warnhist | 2 -- hl/tools/gif2h5/decompress.c | 3 +-- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 2 +- src/H5EAcache.c | 2 +- src/H5FAcache.c | 2 +- src/H5FScache.c | 2 +- src/H5Fprivate.h | 3 +-- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 14 +++++++------- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 10 +++++----- src/H5Oginfo.c | 10 +++++----- src/H5Oint.c | 2 +- src/H5Olayout.c | 2 +- src/H5Olinfo.c | 2 +- src/H5Olink.c | 18 +++++++++--------- src/H5Osdspace.c | 14 +++++++------- src/H5Rint.c | 2 +- src/H5SMcache.c | 17 ++++++++--------- src/H5SMmessage.c | 8 ++++---- src/H5Shyper.c | 6 +++--- src/H5Tbit.c | 10 +++++----- test/dsets.c | 6 +++--- test/dtypes.c | 4 ++-- test/ntypes.c | 2 +- testpar/t_mpi.c | 10 +++++----- tools/src/h5import/h5import.c | 4 ++-- tools/test/h5diff/dynlib_diff.c | 4 ++-- tools/test/h5dump/dynlib_dump.c | 4 ++-- tools/test/h5dump/h5dumpgentest.c | 16 ++++++++-------- tools/test/h5ls/dynlib_ls.c | 2 +- tools/test/h5repack/h5repackgentest.c | 2 +- 35 files changed, 98 insertions(+), 103 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 6ed529a..507477d 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -205,7 +205,6 @@ 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 = $_; } @@ -266,7 +265,6 @@ while (<>) { $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; diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 5532fb5..f8c86f6 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -12,7 +12,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include -#include "H5private.h" #include "gif.h" @@ -174,7 +173,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; - H5_CHECKED_ASSIGN(Interlace, unsigned char, GifImageDesc->PackedField & 0x40, int); + ASSIGN_TO_SMALLER_SIZE(Interlace, unsigned char, GifImageDesc->PackedField & 0x40, int); /* * 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 54c17ee..ecbbd48 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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 */ - H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); + ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); /* Version bounds check */ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 7d163bf..fe4827d 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cls->id, int); + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cls->id, int); /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, internal->hdr->cls->id, int); + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, internal->hdr->cls->id, int); HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ @@ -1219,7 +1219,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, leaf->hdr->cls->id, int); + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, leaf->hdr->cls->id, int); 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 932f5f3..ff835eb 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 */ - H5_CHECKED_ASSIGN(mid_record, uint16_t, old_node_nrec / 2, int); + ASSIGN_TO_SMALLER_SIZE(mid_record, uint16_t, old_node_nrec / 2, int); /* Copy "upper half" of records to new child */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 9a76f4a..b51d29e 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 30d19e8..2b5187d 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -418,7 +418,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Fixed array type */ *image++ = (uint8_t)hdr->cparam.cls->id; - H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 28c35e4..d4f77f4 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 */ - H5_CHECKED_ASSIGN(*image++, uint8_t, fspace->client, int); + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, fspace->client, int); /* Total space tracked */ H5F_ENCODE_LENGTH(f, image, fspace->tot_space); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index d6410a7..0fe1867 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -29,8 +29,7 @@ typedef struct H5F_t H5F_t; #include "H5VLpublic.h" /* Virtual Object Layer */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_PARALLEL #include "H5Pprivate.h" /* Property lists */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 585a1bf..b0291b8 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 */ - H5_CHECKED_ASSIGN(*obj_type, unsigned char, *id & H5HF_ID_TYPE_MASK, int); + ASSIGN_TO_SMALLER_SIZE(*obj_type, unsigned char, *id & H5HF_ID_TYPE_MASK, int); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_get_id_type_test() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index a0730e8..d923a9f 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 */ - H5_CHECKED_ASSIGN(flags, unsigned char, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); + ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); 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 634069c..2697959 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -16,12 +16,12 @@ #define H5S_FRIEND /*suppress error about including H5Spkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Spkg.h" /* Dataspaces */ /* PRIVATE PROTOTYPES */ static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg); @@ -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) { - H5_CHECKED_ASSIGN(*p++, uint8_t, attr->shared->encoding, int); + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, attr->shared->encoding, int); } /* Write the name including null terminator */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 93f2a65..14b12db 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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 */ - H5_CHECKED_ASSIGN(*p++, uint8_t, fill->alloc_time, int); + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->alloc_time, int); /* Fill value writing time */ - H5_CHECKED_ASSIGN(*p++, uint8_t, fill->fill_time, int); + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->fill_time, int); /* Whether fill value is defined */ *p++ = (uint8_t)fill->fill_defined; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 4bd8fff..82afa96 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -25,11 +25,11 @@ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Opkg.h" /* Object headers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ static void *H5O_fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, @@ -225,7 +225,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ - H5_CHECKED_ASSIGN(*p++, uint8_t, fsinfo->strategy, unsigned); + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fsinfo->strategy, unsigned); *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 f4dfa6d..027f33c 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -22,13 +22,13 @@ *------------------------------------------------------------------------- */ -#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Opkg.h" /* Object headers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ @@ -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 */ - H5_CHECKED_ASSIGN(flags, unsigned char, ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0, int); + ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0, int); 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 0e69bfa..b923605 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 */ - H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); + ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); /* Version bounds check */ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 069ee7c..143f49e 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 */ - H5_CHECKED_ASSIGN(*p++, uint8_t, mesg->type, int); + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, mesg->type, int); /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 9e57185..f605e8e 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 */ - H5_CHECKED_ASSIGN(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); + ASSIGN_TO_SMALLER_SIZE(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); 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 6076556..3453565 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -24,17 +24,17 @@ #define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5L_FRIEND /*suppress error about including H5Lpkg */ -#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lpkg.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ @@ -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) - H5_CHECKED_ASSIGN(*p++, uint8_t, lnk->type, int); + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, lnk->type, int); /* 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 b7a95f5..7b6c444 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -15,13 +15,13 @@ #define H5S_FRIEND /*prevent warning from including H5Spkg.h */ #include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Gprivate.h" /* Groups */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Gprivate.h" /* Groups */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Spkg.h" /* Dataspaces */ /* PRIVATE PROTOTYPES */ @@ -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) { - H5_CHECKED_ASSIGN(*p++, uint8_t, sdim->type, int); + ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, sdim->type, int); } else { *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index 96f33ef..a318ddc 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -993,7 +993,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 */ - H5_CHECKED_ASSIGN(ref->type, int8_t, (H5R_type_t)*p++, int); + ASSIGN_TO_SMALLER_SIZE(ref->type, int8_t, (H5R_type_t)*p++, int); 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 448e128..40692cd 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -32,14 +32,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5SMpkg.h" /* Shared object header messages */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5SMpkg.h" /* Shared object header messages */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -398,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? */ - H5_CHECKED_ASSIGN(*image++, uint8_t, table->indexes[u].index_type, int); + ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, table->indexes[u].index_type, int); /* Type of messages in the index */ UINT16ENCODE(image, table->indexes[u].mesg_types); diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 9e1eee2..2a04423 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -22,9 +22,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object Headers */ #include "H5SMpkg.h" /* Shared object header messages */ @@ -298,7 +298,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) /* Sanity check */ HDassert(ctx); - H5_CHECKED_ASSIGN(*raw++, uint8_t, message->location, int); + ASSIGN_TO_SMALLER_SIZE(*raw++, uint8_t, message->location, int); UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index f3f9b9f..0f73e7b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -30,8 +30,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspace functions */ @@ -3674,7 +3674,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); - H5_CHECKED_ASSIGN(*enc_size, uint8_t, MAX(enc1, enc2), int); + ASSIGN_TO_SMALLER_SIZE(*enc_size, uint8_t, MAX(enc1, enc2), int); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index d2f5657..1a7ea9b 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -21,9 +21,9 @@ #include "H5private.h" /*generic functions */ #include "H5Eprivate.h" /*error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Tpkg.h" /*data-type functions */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Tpkg.h" /*data-type functions */ +#include "H5WBprivate.h" /* Wrapped Buffers */ @@ -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) { - H5_CHECKED_ASSIGN(buf[idx++], uint8_t, value ? 0xff : 0x00, int); + ASSIGN_TO_SMALLER_SIZE(buf[idx++], uint8_t, value ? 0xff : 0x00, int); 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; - H5_CHECKED_ASSIGN(buf[idx], uint8_t, acc & 0xff, unsigned); + ASSIGN_TO_SMALLER_SIZE(buf[idx], uint8_t, acc & 0xff, unsigned); idx++; size -= 8; } diff --git a/test/dsets.c b/test/dsets.c index b228932..15d319c 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, short, (i*8+1) & 0x7fff, int); - H5_CHECKED_ASSIGN(s_ptr->d, short, (i*8+6) & 0x7fff, int); + ASSIGN_TO_SMALLER_SIZE(s_ptr->b, short, (i*8+1) & 0x7fff, int); + ASSIGN_TO_SMALLER_SIZE(s_ptr->d, short, (i*8+6) & 0x7fff, int); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/ntypes.c b/test/ntypes.c index 99bc155..03eefe6 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++) - H5_CHECKED_ASSIGN(wbuf[i], unsigned char, 0xff ^ i, size_t); + ASSIGN_TO_SMALLER_SIZE(wbuf[i], unsigned char, 0xff ^ i, size_t); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Sclose(space) < 0) TEST_ERROR; diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index d2090e5..79eda60 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++) - H5_CHECKED_ASSIGN(*(buf + j), char, i * mpi_size + mpi_rank, int); + ASSIGN_TO_SMALLER_SIZE(*(buf + j), char, 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"); - H5_CHECKED_ASSIGN(expected, char, i * mpi_size + (mpi_size - mpi_rank - 1), int); + ASSIGN_TO_SMALLER_SIZE(expected, char, 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++) - H5_CHECKED_ASSIGN(writedata[i], unsigned char, irank * DIMSIZE + i, int) + ASSIGN_TO_SMALLER_SIZE(writedata[i], unsigned char, 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++) { - H5_CHECKED_ASSIGN(expect_val, unsigned char, irank * DIMSIZE + i, int); + ASSIGN_TO_SMALLER_SIZE(expect_val, unsigned char, 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++) - H5_CHECKED_ASSIGN(buf[i], char, i + 1, int); + ASSIGN_TO_SMALLER_SIZE(buf[i], char, 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/src/h5import/h5import.c b/tools/src/h5import/h5import.c index aa17878..2cd826b 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4711,7 +4711,7 @@ uint16_t swap_uint16(uint16_t val) { uint16_t ret; - H5_CHECKED_ASSIGN(ret, uint16_t, (val << 8) | (val >> 8), int); + ASSIGN_TO_SMALLER_SIZE(ret, uint16_t, (val << 8) | (val >> 8), int); return ret; } @@ -4719,7 +4719,7 @@ int16_t swap_int16(int16_t val) { uint16_t ret; - H5_CHECKED_ASSIGN(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int); + ASSIGN_TO_SMALLER_SIZE(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int); return ret; } diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 1b98068..5989b38 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -70,7 +70,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; - H5_CHECKED_ASSIGN(*int_ptr, char, temp - MULTIPLIER, int); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,7 +79,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; - H5_CHECKED_ASSIGN(*int_ptr, char, temp + MULTIPLIER, int); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); 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 1b98068..5989b38 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -70,7 +70,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; - H5_CHECKED_ASSIGN(*int_ptr, char, temp - MULTIPLIER, int); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,7 +79,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; - H5_CHECKED_ASSIGN(*int_ptr, char, temp + MULTIPLIER, int); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 152798b..2f8c1a6 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++) - H5_CHECKED_ASSIGN(buf[i], unsigned char, 0xff ^ i, size_t); + ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); 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++) - H5_CHECKED_ASSIGN(buf[i], unsigned char, 0xff ^ i, size_t); + ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); 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++) { - H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); + ASSIGN_TO_SMALLER_SIZE(buf[i], uint8_t, 0xff ^ i, size_t); } 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++) { - H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); + ASSIGN_TO_SMALLER_SIZE(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); } 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++) - H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); + ASSIGN_TO_SMALLER_SIZE(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++) - H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); + ASSIGN_TO_SMALLER_SIZE(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++) { - 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); + ASSIGN_TO_SMALLER_SIZE(buf5[i].a, uint8_t, 0xff ^ i, size_t); + ASSIGN_TO_SMALLER_SIZE(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); } diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index ad0cd0e..089b78f 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -70,7 +70,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; - H5_CHECKED_ASSIGN(*int_ptr, char, temp - MULTIPLIER, int); + ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index c2398b6..f3cb7d9 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++) { - H5_CHECKED_ASSIGN(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); + ASSIGN_TO_SMALLER_SIZE(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); } } } -- cgit v0.12 From 2bb0f52edfdd0ce11595ee673a934f306ca5c4fa Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 26 Nov 2019 17:23:58 -0600 Subject: Revert "fix issues from previous PR comments" This reverts commit d242a900f420b040e364f6c0976c01593e955db3. --- hl/src/H5LTanalyze.c | 10 +++++----- hl/tools/gif2h5/decompress.c | 2 +- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 2 +- src/H5Dchunk.c | 8 ++++---- src/H5Dint.c | 2 +- src/H5EAcache.c | 2 +- src/H5FAcache.c | 1 - src/H5FScache.c | 8 ++++---- src/H5Fprivate.h | 10 +++++----- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 5 ++--- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 1 - src/H5Oginfo.c | 2 +- src/H5Oint.c | 2 +- src/H5Olayout.c | 2 +- src/H5Olinfo.c | 2 +- src/H5Olink.c | 2 +- src/H5Osdspace.c | 5 ++--- src/H5Rint.c | 2 +- src/H5SMcache.c | 2 +- src/H5SMmessage.c | 2 +- src/H5Shyper.c | 2 +- src/H5Tbit.c | 4 ++-- test/dsets.c | 6 +++--- test/dtypes.c | 4 ++-- test/ntypes.c | 2 +- test/tsohm.c | 8 ++++---- testpar/t_mpi.c | 10 +++++----- tools/src/h5import/h5import.c | 12 +++--------- tools/test/h5diff/dynlib_diff.c | 5 ++--- tools/test/h5dump/dynlib_dump.c | 5 ++--- tools/test/h5dump/h5dumpgentest.c | 16 ++++++++-------- tools/test/h5ls/dynlib_ls.c | 3 +-- tools/test/h5repack/h5repackgentest.c | 2 +- 38 files changed, 77 insertions(+), 90 deletions(-) diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 2219263..7e8ff31 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1176,12 +1176,12 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = (YY_CHAR)yy_ec[YY_SC_TO_UI(*yy_cp)]; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1831,12 +1831,12 @@ static int yy_get_next_buffer (void) for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (YY_CHAR)(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1859,7 +1859,7 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 544); diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index f8c86f6..713ca7e 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; - ASSIGN_TO_SMALLER_SIZE(Interlace, unsigned char, GifImageDesc->PackedField & 0x40, int); + Interlace = (unsigned char)(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 ecbbd48..2a0c782 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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 */ - ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); + 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 fe4827d..09bb389 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cls->id, int); + *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, internal->hdr->cls->id, int); + *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 +1219,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, leaf->hdr->cls->id, int); + *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 ff835eb..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 */ - ASSIGN_TO_SMALLER_SIZE(mid_record, uint16_t, old_node_nrec / 2, int); + 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), diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index d28beb8..ecb0f9c 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2180,7 +2180,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) { - hsize_t schunk_points; /* Number of elements in chunk selection */ + hssize_t schunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ @@ -2191,9 +2191,9 @@ 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 = (hsize_t)H5S_GET_SELECT_NPOINTS(chunk_info->fspace); + schunk_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, &(const hsize_t)schunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") mem_sel_start[0] += schunk_points; @@ -5668,7 +5668,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) hsize_t chunk_index; int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC /* Compute the index for this chunk */ chunk_index = H5VM_array_offset_pre(rank, udata->common.layout->down_chunks, chunk_rec->scaled); diff --git a/src/H5Dint.c b/src/H5Dint.c index 772a150..bd87c7f 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2197,7 +2197,7 @@ H5D_nameof(const H5D_t *dataset) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : NULL) + FUNC_LEAVE_NOAPI((H5G_name_t *)(dataset ? &(dataset->path) : NULL)) } /* end H5D_nameof() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index b51d29e..7b1968e 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); + *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 2b5187d..e142ae2 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -418,7 +418,6 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Fixed array type */ *image++ = (uint8_t)hdr->cparam.cls->id; - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ diff --git a/src/H5FScache.c b/src/H5FScache.c index d4f77f4..fbdada2 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 */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, fspace->client, int); + *image++ = (uint8_t)fspace->client; /* 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 = 1; /* Current section size */ - size_t node_count = 1; /* # of sections of this size */ + hsize_t sect_size; /* Current section size */ + size_t node_count; /* # 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 = 1; /* Address of free space section in the address space */ + haddr_t sect_addr; /* 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 0fe1867..9ad33b2 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -178,19 +178,19 @@ typedef struct H5F_t H5F_t; /* Decode a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ -# define DECODE_VAR(p, typ, n, l) { \ +# define DECODE_VAR(p, n, l) { \ size_t _i; \ \ n = 0; \ (p) += l; \ for (_i = 0; _i < l; _i++) \ - n = (typ)((n << 8) | *(--p)); \ + n = (uint16_t)((n << 8) | *(--p)); \ (p) += l; \ } /* Decode a variable-sized buffer into a 32-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ -# define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, uint32_t, n, l) +# define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) # define INT64DECODE(p, n) { \ /* WE DON'T CHECK FOR OVERFLOW! */ \ @@ -216,14 +216,14 @@ typedef struct H5F_t H5F_t; /* Decode a variable-sized buffer into a 64-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ -# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, uint64_t, n, l) +# define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) /* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ # define UINT64DECODE_VARLEN(p, n) { \ unsigned _s = *(p)++; \ \ - UINT64DECODE_VAR(p, uint64_t, n, _s); \ + UINT64DECODE_VAR(p, n, _s); \ } # define H5_DECODE_UNSIGNED(p, n) { \ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index b0291b8..9eb8ed2 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 */ - ASSIGN_TO_SMALLER_SIZE(*obj_type, unsigned char, *id & H5HF_ID_TYPE_MASK, int); + *obj_type = (unsigned char)(*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 d923a9f..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 */ - ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); + 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 2697959..b7d4dd5 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -328,9 +328,8 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) UINT16ENCODE(p, attr->shared->ds_size); /* The character encoding for the attribute's name, in later versions */ - if(attr->shared->version >= H5O_ATTR_VERSION_3) { - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, attr->shared->encoding, int); - } + if(attr->shared->version >= H5O_ATTR_VERSION_3) + *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 14b12db..cb75bc3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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 */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->alloc_time, int); + *p++ = (uint8_t)fill->alloc_time; /* Fill value writing time */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fill->fill_time, int); + *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 82afa96..fd62aa2 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -225,7 +225,6 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, fsinfo->strategy, unsigned); *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 027f33c..abe7879 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -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 */ - ASSIGN_TO_SMALLER_SIZE(flags, unsigned char, ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0, int); + 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 b923605..9d4c066 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 */ - ASSIGN_TO_SMALLER_SIZE(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); + 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)]) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 143f49e..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 */ - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, mesg->type, int); + *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 f605e8e..475f66f 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 */ - ASSIGN_TO_SMALLER_SIZE(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); + index_flags = (unsigned char)(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 3453565..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) - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, lnk->type, int); + *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 7b6c444..33310dc 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -256,9 +256,8 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) *p++ = (uint8_t)flags; /* Dataspace type */ - if(sdim->version > H5O_SDSPACE_VERSION_1) { - ASSIGN_TO_SMALLER_SIZE(*p++, uint8_t, sdim->type, int); - } + if(sdim->version > H5O_SDSPACE_VERSION_1) + *p++ = (uint8_t)sdim->type; else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index a318ddc..77227ec 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -993,7 +993,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 */ - ASSIGN_TO_SMALLER_SIZE(ref->type, int8_t, (H5R_type_t)*p++, int); + ref->type = (int8_t)((H5R_type_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 40692cd..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? */ - ASSIGN_TO_SMALLER_SIZE(*image++, uint8_t, table->indexes[u].index_type, int); + *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 2a04423..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); - ASSIGN_TO_SMALLER_SIZE(*raw++, uint8_t, message->location, int); + *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 0f73e7b..cfcc5ac 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3674,7 +3674,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); - ASSIGN_TO_SMALLER_SIZE(*enc_size, uint8_t, MAX(enc1, enc2), int); + *enc_size = (uint8_t)MAX(enc1, enc2); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 1a7ea9b..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) { - ASSIGN_TO_SMALLER_SIZE(buf[idx++], uint8_t, value ? 0xff : 0x00, int); + 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; - ASSIGN_TO_SMALLER_SIZE(buf[idx], uint8_t, acc & 0xff, unsigned); + buf[idx] = (uint8_t)(acc & 0xff); idx++; size -= 8; } diff --git a/test/dsets.c b/test/dsets.c index 15d319c..b32c5b6 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, short, (i*8+1) & 0x7fff, int); - ASSIGN_TO_SMALLER_SIZE(s_ptr->d, short, (i*8+6) & 0x7fff, int); + s_ptr->b = (short)((i*8+1) & 0x7fff); + s_ptr->d = (short)((i*8+6) & 0x7fff); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/ntypes.c b/test/ntypes.c index 03eefe6..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++) - ASSIGN_TO_SMALLER_SIZE(wbuf[i], unsigned char, 0xff ^ i, size_t); + 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/tsohm.c b/test/tsohm.c index c126608..0fc273b 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 = H5I_INVALID_HID; - hid_t orig_space_id = H5I_INVALID_HID; + hid_t file_id = -1; + hid_t orig_space_id = -1; hid_t space1_id, space2_id, space3_id; - hid_t dcpl_id = H5I_INVALID_HID; - hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID; + hid_t dcpl_id = -1; + hid_t dset1_id, dset2_id = -1, dset3_id = -1; hsize_t dims1[] = {1, 2}; hsize_t max_dims[] = {H5S_UNLIMITED, 2}; hsize_t dims2[] = {5, 2}; diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 79eda60..2bb2336 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++) - ASSIGN_TO_SMALLER_SIZE(*(buf + j), char, i * mpi_size + mpi_rank, int); + *(buf + j) = (char)(i * mpi_size + mpi_rank); 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"); - ASSIGN_TO_SMALLER_SIZE(expected, char, i * mpi_size + (mpi_size - mpi_rank - 1), int); + expected = (char)(i * mpi_size + (mpi_size - mpi_rank - 1)); 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++) - ASSIGN_TO_SMALLER_SIZE(writedata[i], unsigned char, irank * DIMSIZE + i, int) + writedata[i] = (unsigned char)(irank * DIMSIZE + i); 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++) { - ASSIGN_TO_SMALLER_SIZE(expect_val, unsigned char, irank * DIMSIZE + i, int); + expect_val = (unsigned char)(irank * DIMSIZE + i); 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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], char, i + 1, int); + buf[i] = (char)(i + 1); if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 2cd826b..40b812f 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4707,20 +4707,14 @@ static int process(struct Options *opt) return (0); } -uint16_t swap_uint16(uint16_t val) +uint16_t swap_uint16( uint16_t val) { - uint16_t ret; - - ASSIGN_TO_SMALLER_SIZE(ret, uint16_t, (val << 8) | (val >> 8), int); - return ret; + return (uint16_t)((val << 8) | (val >> 8)); } int16_t swap_int16(int16_t val) { - uint16_t ret; - - ASSIGN_TO_SMALLER_SIZE(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int); - return ret; + return (uint16_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 5989b38..4f2d435 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -16,7 +16,6 @@ #include #include #include "H5PLextern.h" -#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -70,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); + *int_ptr = (char)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); + *int_ptr = (char)(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 5989b38..4f2d435 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -16,7 +16,6 @@ #include #include #include "H5PLextern.h" -#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -70,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); + *int_ptr = (char)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp + MULTIPLIER, int); + *int_ptr = (char)(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 2f8c1a6..85fe754 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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); + buf[i] = (unsigned char)(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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); + buf[i] = (unsigned char)(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++) { - ASSIGN_TO_SMALLER_SIZE(buf[i], uint8_t, 0xff ^ i, size_t); + 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++) { - ASSIGN_TO_SMALLER_SIZE(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); + 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++) - ASSIGN_TO_SMALLER_SIZE(buf[i], uint8_t, 0xff ^ i, size_t); + buf[i] = (uint8_t)(0xff ^ i); 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++) - ASSIGN_TO_SMALLER_SIZE(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); + buf2[i] = (uint16_t)(0xffff ^ (i * 16)); 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++) { - ASSIGN_TO_SMALLER_SIZE(buf5[i].a, uint8_t, 0xff ^ i, size_t); - ASSIGN_TO_SMALLER_SIZE(buf5[i].b, uint16_t, 0xffff ^ (i * 16), size_t); + buf5[i].a = (uint8_t)(0xff ^ i); + buf5[i].b = (uint16_t)(0xffff ^ (i * 16)); buf5[i].c = (uint32_t)0xffffffff ^ (uint32_t)(i * 32); buf5[i].d = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64); } diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 089b78f..4f2d435 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -16,7 +16,6 @@ #include #include #include "H5PLextern.h" -#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -70,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; - ASSIGN_TO_SMALLER_SIZE(*int_ptr, char, temp - MULTIPLIER, int); + *int_ptr = (char)(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 f3cb7d9..f476a16 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++) { - ASSIGN_TO_SMALLER_SIZE(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); + wdata[n] = (uint8_t)(n * ((n & 1) ? (-1) : (1))); } } } -- cgit v0.12 From e971c0afa158af877b937eff615732b9262cb421 Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 26 Nov 2019 17:24:11 -0600 Subject: Revert "let hdf5 pick up the right compiler in Intel environment" This reverts commit 3613ec7296a782c86ea5f0706a5a0cb51602abc9. --- config/gnu-cxxflags | 21 +++++------ config/gnu-flags | 5 +-- config/intel-cxxflags | 102 -------------------------------------------------- config/linux-gnulibc1 | 3 -- 4 files changed, 10 insertions(+), 121 deletions(-) delete mode 100644 config/intel-cxxflags diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 744f56d..e0f2999 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -28,32 +28,29 @@ if test X = "X$cxx_flags_set"; then # filter it out. # icc beginning with version 12 includes a "gcc version compatiblilty" # string, causing the gcc H5_CFLAGS to be erroneously added. The line - # "grep -v 'icpc version'" causes the discarding of any output - # containing 'icpc version'. The line "grep -v 'icpc.orig version'" - # causes the discarding of any output containing 'icpc.orig version'. - # The cxx_version for icc is correctly determined - # and flags added in the intel-cxxflags script. + # "grep -v 'icc version'" causes the discarding of any output + # containing 'icc version'. The cc_version for icc is correctly determined + # and flags added in the intel-flags script. cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep -v 'PathScale' |\ grep -v 'icc version' |\ - grep -v 'icpc version' |\ - grep -v 'icpc.orig version' |\ grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*\).*/\1/'` cxx_version=`echo $cxx_version |sed 's/[-a-z]//g'` if test X = "X$cxx_vendor" -a X != "X$cxx_version"; then - cxx_vendor=g++ + cxx_vendor=g++ fi if test "-" != "$cxx_vendor-$cxx_version"; then - echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" + echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" fi # Some version numbers cxx_vers_major=`echo $cxx_version | cut -f1 -d.` cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` - test -n "$cxx_vers_major" || cxx_vers_major=0 - test -n "$cxx_vers_minor" || cxx_vers_minor=0 - test -n "$cxx_vers_patch" || cxx_vers_patch=0 + test -n "$cc_vers_major" || cxx_vers_major=0 + test -n "$cc_vers_minor" || cxx_vers_minor=0 + test -n "$cc_vers_patch" || cxx_vers_patch=0 + cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` fi # Common g++ flags for various situations diff --git a/config/gnu-flags b/config/gnu-flags index 7a6686e..6355ccf 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -29,13 +29,10 @@ if test "X-" = "X-$cc_flags_set"; then # icc beginning with version 12 includes a "gcc version compatiblilty" # string, causing the gcc H5_CFLAGS to be erroneously added. The line # "grep -v 'icc version'" causes the discarding of any output - # containing 'icc version'. The line "grep -v 'icc.orig version'" causes - # the discarding of any output containing 'icc.orig version'. - # The cc_version for icc is correctly determined + # containing 'icc version'. The cc_version for icc is correctly determined # and flags added in the intel-flags script. cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 | grep -v 'PathScale' |\ grep -v 'icc version' |\ - grep -v 'icc.orig version' |\ grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` cc_version=`echo $cc_version |sed 's/[-a-z]//g'` diff --git a/config/intel-cxxflags b/config/intel-cxxflags deleted file mode 100644 index 97fe021..0000000 --- a/config/intel-cxxflags +++ /dev/null @@ -1,102 +0,0 @@ -# -*- shell-script -*- -# -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - - -# This file should be sourced into configure if the compiler is the -# Intel icc compiler or a derivative. It is careful not to do anything -# if the compiler is not Intel; otherwise `cxx_flags_set' is set to `yes' -# - -# Get the compiler version in a way that works for icpc -# icpc unless a compiler version is already known -# -# cxx_vendor: The compiler name: icpc -# cxx_version: Version number: 18.0.1 -# -if test X = "X$cxx_flags_set"; then - cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 |grep 'Version'`" - if test X != "X$cxx_version"; then - cxx_vendor=icpc - cxx_version=`echo $cxx_version |sed 's/.*Version \([-a-z0-9\.\-]*\).*/\1/'` - echo "compiler '$CXX' is Intel $cxx_vendor-$cxx_version" - - # Some version numbers - # Intel version numbers are of the form: "major.minor" - cxx_vers_major=`echo $cxx_version | cut -f1 -d.` - cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` - cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` - test -n "$cxx_vers_major" || cxx_vers_major=0 - test -n "$cxx_vers_minor" || cxx_vers_minor=0 - test -n "$cxx_vers_patch" || cxx_vers_patch=0 - fi -fi - -# Common Intel flags for various situations -if test "X-icpc" = "X-$cxx_vendor"; then - # Insert section about version specific problems from compiler flags here, - # if necessary. - - arch= - # Architecture-specific flags - # Nothing currently. (Uncomment code below and modify to add any) - #case "$host_os-$host_cpu" in - # *-i686) - # arch="-march=i686" - # ;; - #esac - - # Host-specific flags - # Nothing currently. (Uncomment code below and modify to add any) - #case "`hostname`" in - # sleipnir.ncsa.uiuc.edu) - # arch="$arch -pipe" - # ;; - #esac - - # General - # Default to C99 standard. - H5_CFLAGS="$H5_CFLAGS $arch -std=c99 -Wcheck -Wall" - - # Production - PROD_CFLAGS= - - # Debug - # NDEBUG is handled explicitly in configure - DEBUG_CFLAGS= - - # Symbols - SYMBOLS_CFLAGS="-g" - NO_SYMBOLS_CFLAGS="-Wl,-s" - - # Profiling - # Use this for profiling with gprof - PROFILE_CFLAGS="-p" - - # Optimization - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS="-O0" - NO_OPT_CFLAGS="-O0" - - # Flags are set - cxx_flags_set=yes - -fi - -# Version specific ICC flags -# TODO - -# Clear cxx info if no flags set -if test "X-$cxx_flags_set" = "X-"; then - cxx_vendor= - cxx_version= -fi diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index bf5915a..39225e7 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -194,9 +194,6 @@ fi # Figure out GNU CXX compiler flags . $srcdir/config/gnu-cxxflags -# Figure out Intel CXX compiler flags -. $srcdir/config/intel-cxxflags - # compiler version strings # check if the compiler_version_info is already set -- cgit v0.12 From bfbd613f53af476fd83ac9e2bfb5855e659eef65 Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 26 Nov 2019 17:24:24 -0600 Subject: Revert "fix warnings and some text alignment" This reverts commit d06474c4e1ba8628f896e57e619d4b142e6ba8b0. --- test/h5test.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/h5test.c b/test/h5test.c index 1faf02d..c8f4132 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1318,21 +1318,23 @@ h5_dump_info_object(MPI_Info info) { char key[MPI_MAX_INFO_KEY+1]; char value[MPI_MAX_INFO_VAL+1]; - int flag; - int i, nkeys; + int flag; + int i, nkeys; - 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"); + HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, + MPI_MAX_INFO_VAL); + if (info==MPI_INFO_NULL){ + HDprintf("object is MPI_INFO_NULL\n"); } else { - MPI_Info_get_nkeys(info, &nkeys); - HDprintf("object has %d items\n", nkeys); - for (i=0; i Date: Tue, 26 Nov 2019 17:24:48 -0600 Subject: Revert "fix warnings from Intel compiler" This reverts commit 8b9338ab57eec0cc8fa5a36c44d7b28e52e9a466. --- bin/warnhist | 17 ++++------------- hl/src/H5LTanalyze.c | 10 +++++----- hl/tools/gif2h5/decompress.c | 2 +- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 14 +++++++------- src/H5Dchunk.c | 3 ++- src/H5Dint.c | 2 +- src/H5EAcache.c | 8 ++++---- src/H5FAcache.c | 4 ++-- src/H5FScache.c | 2 +- src/H5Fprivate.h | 4 ++-- src/H5Gint.c | 2 +- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 2 +- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 2 +- src/H5Oginfo.c | 2 +- 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/H5Tbit.c | 4 ++-- src/H5Ztrans.c | 2 +- test/dsets.c | 8 ++++---- test/dtypes.c | 4 ++-- test/ntypes.c | 2 +- test/th5s.c | 6 +++--- test/tsohm.c | 2 +- testpar/t_dset.c | 2 +- testpar/t_mpi.c | 10 +++++----- tools/lib/h5diff.c | 10 ++-------- tools/lib/h5diff_attr.c | 10 ++-------- tools/src/h5import/h5import.c | 4 ++-- 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, 100 insertions(+), 120 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 507477d..7e56246 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -205,12 +205,8 @@ while (<>) { ($last_c_name, $toss) = split /\:/, $_; } - 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:/; @@ -260,15 +256,11 @@ 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"; - } 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) @@ -338,7 +330,6 @@ 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/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 7e8ff31..2219263 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1176,12 +1176,12 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = (YY_CHAR)yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1831,12 +1831,12 @@ static int yy_get_next_buffer (void) for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (YY_CHAR)(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; @@ -1859,7 +1859,7 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 545 ) - yy_c = (YY_CHAR)yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 544); diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 713ca7e..6668c22 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 = (unsigned char)(GifImageDesc->PackedField & 0x40); + Interlace = 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 2a0c782..2b43a64 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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 = (uint8_t)MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); + version = 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 09bb389..2a77bd5 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - *image++ = (uint8_t)hdr->cls->id; + *image++ = hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - *image++ = (uint8_t)internal->hdr->cls->id; + *image++ = 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 +1219,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - *image++ = (uint8_t)leaf->hdr->cls->id; + *image++ = 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 ea03ed6..2d77276 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 = (uint16_t)(old_node_nrec / 2); + mid_record = 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 ecb0f9c..53ca7d1 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2193,7 +2193,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) schunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &(const hsize_t)schunk_points) < 0) + if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &schunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") mem_sel_start[0] += schunk_points; @@ -5676,6 +5676,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) } /* H5D__chunk_addrmap_cb() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index bd87c7f..772a150 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2197,7 +2197,7 @@ H5D_nameof(const H5D_t *dataset) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI((H5G_name_t *)(dataset ? &(dataset->path) : NULL)) + FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : NULL) } /* end H5D_nameof() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 7b1968e..da67e6b 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - *image++ = (uint8_t)hdr->cparam.cls->id; + *image++ = hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -875,7 +875,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ - *image++ = (uint8_t)iblock->hdr->cparam.cls->id; + *image++ = 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 +1284,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_SBLOCK_VERSION; /* Extensible array type */ - *image++ = (uint8_t)sblock->hdr->cparam.cls->id; + *image++ = 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 +1698,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ - *image++ = (uint8_t)dblock->hdr->cparam.cls->id; + *image++ = 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 e142ae2..f440efe 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -417,7 +417,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5FA_HDR_VERSION; /* Fixed array type */ - *image++ = (uint8_t)hdr->cparam.cls->id; + *image++ = hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -805,7 +805,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5FA_DBLOCK_VERSION; /* Fixed array type */ - *image++ = (uint8_t)dblock->hdr->cparam.cls->id; + *image++ = 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 fbdada2..b520458 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++ = (uint8_t)fspace->client; + *image++ = fspace->client; /* Total space tracked */ H5F_ENCODE_LENGTH(f, image, fspace->tot_space); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 9ad33b2..c9a1b25 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++ = (uint8_t)((n) < 0 ? 0xff : 0); \ + *_p++ = (n) < 0 ? 0xff : 0; \ (p) = (uint8_t*)(p)+8; \ } @@ -184,7 +184,7 @@ typedef struct H5F_t H5F_t; n = 0; \ (p) += l; \ for (_i = 0; _i < l; _i++) \ - n = (uint16_t)((n << 8) | *(--p)); \ + n = (n << 8) | *(--p); \ (p) += l; \ } diff --git a/src/H5Gint.c b/src/H5Gint.c index c7ac1d1..049c696 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -583,7 +583,7 @@ H5G_nameof(const H5G_t *grp) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI((H5G_name_t *)(grp ? &(grp->path) : NULL)) + FUNC_LEAVE_NOAPI(grp ? &(grp->path) : NULL) } /* end H5G_nameof() */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 9eb8ed2..6f174bb 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 = (unsigned char)(*id & H5HF_ID_TYPE_MASK); + *obj_type = *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 23aba09..7f4f17f 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 = (unsigned char)(ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0); + flags = 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 b7d4dd5..f685a00c 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++ = (uint8_t)attr->shared->encoding; + *p++ = 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 cb75bc3..0cc58a6 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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++ = (uint8_t)fill->alloc_time; + *p++ = fill->alloc_time; /* Fill value writing time */ - *p++ = (uint8_t)fill->fill_time; + *p++ = 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 fd62aa2..e5e6741 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -224,7 +224,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(fsinfo); *p++ = (uint8_t)fsinfo->version; /* message version */ - *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ + *p++ = 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 abe7879..4b34a52 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -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 = (unsigned char)(ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0); + flags = 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 9d4c066..ecf347c 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 = (uint8_t)MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); + version = 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)]) @@ -2368,7 +2368,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 = (uint8_t)(oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES)); + ohdr_flags = oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES); /* 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 2a2a07b..138f219 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++ = (uint8_t)mesg->type; + *p++ = mesg->type; /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 475f66f..9827b6a 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 = (unsigned char)(linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0); + index_flags = 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 1f0c6c7..4bd952b 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++ = (uint8_t)lnk->type; + *p++ = 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 33310dc..b4f00ea 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++ = (uint8_t)sdim->type; + *p++ = sdim->type; else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index 77227ec..443a245 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -993,7 +993,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 = (int8_t)((H5R_type_t)*p++); + ref->type = (H5R_type_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 ee28fa4..49ce2b4 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++ = (uint8_t)table->indexes[u].index_type; + *image++ = 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 e085204..0cca6bb 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++ = (uint8_t)message->location; + *raw++ = message->location; UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index cfcc5ac..9feb8de 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3674,7 +3674,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 = (uint8_t)MAX(enc1, enc2); + *enc_size = MAX(enc1, enc2); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index c6c1777..df6d2c3 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++] = (uint8_t)(value ? 0xff : 0x00); + buf[idx++] = 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] = (uint8_t)(acc & 0xff); + buf[idx] = acc & 0xff; idx++; size -= 8; } diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 50ac947..6d07513 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 = (TYPE)((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ + TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ H5VM_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ } diff --git a/test/dsets.c b/test/dsets.c index b32c5b6..21d5431 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 = (short)((i*8+1) & 0x7fff); - s_ptr->d = (short)((i*8+6) & 0x7fff); + s_ptr->b = (i*8+1) & 0x7fff; + s_ptr->d = (i*8+6) & 0x7fff; } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/ntypes.c b/test/ntypes.c index f1d2449..34558f5 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 ^ i); + wbuf[i] = (unsigned char)0xff ^ (unsigned char)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 ed02c16..1a4456a 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1583,7 +1583,7 @@ test_h5s_encode1(void) ****************************************************************/ static herr_t test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, - uint32_t expected_version, uint32_t expected_enc_size, hbool_t expected_to_fail) + uint32_t expected_version, uint8_t expected_enc_size, hbool_t expected_to_fail) { char *buf = NULL; /* Pointer to the encoded buffer */ size_t buf_size; /* Size of the encoded buffer */ @@ -1697,7 +1697,7 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) unsigned unlim; /* H5S_UNLIMITED setting or not */ herr_t ret; /* Generic return value */ uint32_t expected_version = 0; /* Expected version for selection info */ - uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */ + uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataspace encoding of regular hyperslabs\n")); @@ -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 */ - uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */ + uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */ start = 0; count = 2; diff --git a/test/tsohm.c b/test/tsohm.c index 0fc273b..a064940 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3346,7 +3346,7 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) hid_t orig_space_id = -1; hid_t space1_id, space2_id, space3_id; hid_t dcpl_id = -1; - hid_t dset1_id, dset2_id = -1, dset3_id = -1; + hid_t dset1_id, dset2_id, dset3_id; 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 832a47f..6c91a41 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 = "I/O"; + const char * test_name; 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 2bb2336..890a918 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) = (char)(i * mpi_size + mpi_rank); + *(buf + j) = i * mpi_size + mpi_rank; 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 = (char)(i * mpi_size + (mpi_size - mpi_rank - 1)); + expected = i * mpi_size + (mpi_size - mpi_rank - 1); 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] = (unsigned char)(irank * DIMSIZE + i); + writedata[i] = irank * DIMSIZE + i; 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 = (unsigned char)(irank * DIMSIZE + i); + expect_val = irank * DIMSIZE + i; 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] = (char)(i + 1); + buf[i] = i + 1; 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 5acdde8..c2153e5 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -908,14 +908,8 @@ h5diff(const char *fname1, parallel_print("---------------------------------------\n"); for(u = 0; u < match_list->nobjs; u++) { char c1, c2; - if (match_list->objs[u].flags[0]) - c1 = 'x'; - else - c1 = ' '; - if (match_list->objs[u].flags[1]) - c2 = 'x'; - else - 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); } /* end for */ parallel_print ("\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index a648be1..351e6ab 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -274,14 +274,8 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t parallel_print(" --------------------------------------\n"); for(i = 0; i < (unsigned int) table_lp->nattrs; i++) { char c1, c2; - if (table_lp->attrs[i].exist[0]) - c1 = 'x'; - else - c1 = ' '; - if (table_lp->attrs[i].exist[1]) - c2 = 'x'; - else - 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); } /* end for */ } diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 40b812f..1eef5ab 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4709,12 +4709,12 @@ static int process(struct Options *opt) uint16_t swap_uint16( uint16_t val) { - return (uint16_t)((val << 8) | (val >> 8)); + return (val << 8) | (val >> 8); } int16_t swap_int16(int16_t val) { - return (uint16_t)((val << 8) | ((val >> 8) & 0xFF)); + return (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 4f2d435..571452e 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 = (char)(temp - MULTIPLIER); + *int_ptr = 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 = (char)(temp + MULTIPLIER); + *int_ptr = 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 4f2d435..571452e 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 = (char)(temp - MULTIPLIER); + *int_ptr = 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 = (char)(temp + MULTIPLIER); + *int_ptr = 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 85fe754..ad70770 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 ^ 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; @@ -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 ^ 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; @@ -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 ^ i); + buf[i] = (uint8_t)0xff ^ (uint8_t)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 ^ (i * 16)); + buf2[i] = (uint16_t)0xffff ^ (uint16_t)(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 ^ i); + buf[i] = (uint8_t)0xff ^ (uint8_t)i; 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 ^ (i * 16)); + buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16); 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 ^ i); - buf5[i].b = (uint16_t)(0xffff ^ (i * 16)); + buf5[i].a = (uint8_t)0xff ^ (uint8_t)i; + buf5[i].b = (uint16_t)0xffff ^ (uint16_t)(i * 16); 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 = (char)(temp - MULTIPLIER); + *int_ptr = temp - MULTIPLIER; 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 = (char)(temp + MULTIPLIER); + *int_ptr = temp + MULTIPLIER; 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 4f2d435..571452e 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 = (char)(temp - MULTIPLIER); + *int_ptr = 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 = (char)(temp + MULTIPLIER); + *int_ptr = 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 f476a16..aaac285 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] = (uint8_t)(n * ((n & 1) ? (-1) : (1))); + wdata[n] = n * ((n & 1) ? (-1) : (1)); } } } @@ -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] = (float)(n * 801.1 * ((k % 5 == 1) ? (-1) : (1))); + wdata[k] = 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 5d8474b..77c04ab 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((double)nbytes); /* General dataset size */ + snbytes = (off_t)sqrt(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((double)nbytes); + snbytes = (off_t)sqrt(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((double)nbytes); + snbytes = (off_t)sqrt(nbytes); bsize = buf_size * blk_size; diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 5977731..9f4d116 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((double)(opts->num_bpp * opts->min_num_procs),2) + recover_size_and_print((long long)(pow(opts->num_bpp * opts->min_num_procs,2) * opts->num_dsets), ":"); - recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->max_num_procs),2) + recover_size_and_print((long long)(pow(opts->num_bpp * opts->max_num_procs,2) * opts->num_dsets), "\n"); HDfprintf(output, "rank %d: Transfer buffer size=", rank); -- cgit v0.12 From 132fa33dad6badacec90e80768d8dc8e8aa33172 Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 3 Dec 2019 20:52:55 -0600 Subject: fix intel compile warnings --- bin/warnhist | 19 +++++++++++++++---- hl/tools/gif2h5/decompress.c | 3 ++- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 14 +++++++------- src/H5Dchunk.c | 5 ++--- src/H5EAcache.c | 8 ++++---- src/H5FAcache.c | 4 ++-- 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 | 2 +- src/H5Oginfo.c | 5 ++--- src/H5Oint.c | 4 ++-- src/H5Olayout.c | 2 +- src/H5Olinfo.c | 2 +- src/H5Olink.c | 2 +- src/H5Osdspace.c | 5 +++-- src/H5Rint.c | 2 +- src/H5SMcache.c | 2 +- src/H5SMmessage.c | 2 +- src/H5Shyper.c | 2 +- src/H5Tbit.c | 4 ++-- src/H5Ztrans.c | 2 +- test/dsets.c | 8 ++++---- test/dtypes.c | 5 +++-- test/h5test.c | 3 +-- test/ntypes.c | 2 +- test/th5s.c | 6 +++--- test/tsohm.c | 8 ++++---- testpar/t_dset.c | 2 +- testpar/t_mpi.c | 10 +++++----- tools/lib/h5diff.c | 10 ++++++++-- tools/lib/h5diff_attr.c | 10 ++++++++-- tools/src/h5import/h5import.c | 9 ++++++--- tools/test/h5diff/dynlib_diff.c | 5 +++-- tools/test/h5dump/dynlib_dump.c | 5 +++-- tools/test/h5dump/h5dumpgentest.c | 20 ++++++++++---------- tools/test/h5ls/dynlib_ls.c | 5 +++-- tools/test/h5repack/h5repackgentest.c | 4 ++-- tools/test/perform/pio_engine.c | 6 +++--- tools/test/perform/pio_perf.c | 4 ++-- 45 files changed, 134 insertions(+), 105 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 7e56246..6ed529a 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -205,8 +205,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:/; @@ -256,11 +261,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) @@ -330,6 +340,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 6668c22..b3e20ac 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -12,6 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include +#include "H5private.h" #include "gif.h" @@ -173,7 +174,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; - Interlace = GifImageDesc->PackedField & 0x40; + H5_CHECKED_ASSIGN(Interlace, uint8_t, GifImageDesc->PackedField & 0x40, int); /* * 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 436fced..831dab2 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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)]); + H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); /* 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..7d163bf 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cls->id, int); /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, internal->hdr->cls->id, int); HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ @@ -1219,7 +1219,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, leaf->hdr->cls->id, int); 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..932f5f3 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; + H5_CHECKED_ASSIGN(mid_record, uint16_t, old_node_nrec / 2, int); /* 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 4d139c7..62303bb 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2193,7 +2193,7 @@ 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); + schunk_points = (hsize_t)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) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") @@ -5670,7 +5670,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) 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); @@ -5678,7 +5678,6 @@ 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) } /* H5D__chunk_addrmap_cb() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index da67e6b..02b12e1 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -875,7 +875,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, iblock->hdr->cparam.cls->id, int); /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, iblock->hdr->addr); @@ -1284,7 +1284,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, sblock->hdr->cparam.cls->id, int); /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, sblock->hdr->addr); @@ -1698,7 +1698,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, dblock->hdr->cparam.cls->id, int); /* 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..7ea7fd6 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -417,7 +417,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -805,7 +805,7 @@ 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, dblock->hdr->cparam.cls->id, int); /* 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..28c35e4 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 = 1; /* Current section size */ + size_t node_count = 1; /* # 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 = 1; /* 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 e1a8a2f..eaf8093 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..7484961 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; + H5_CHECKED_ASSIGN(*obj_type, uint8_t, *id & H5HF_ID_TYPE_MASK, int); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_get_id_type_test() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 7f4f17f..d954973 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; + H5_CHECKED_ASSIGN(flags, uint8_t, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); 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..f3d0fa1 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; + H5_CHECKED_ASSIGN(*p++, uint8_t, attr->shared->encoding, int); /* 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 0cc58a6..93f2a65 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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; + H5_CHECKED_ASSIGN(*p++, uint8_t, fill->alloc_time, int); /* Fill value writing time */ - *p++ = fill->fill_time; + H5_CHECKED_ASSIGN(*p++, uint8_t, fill->fill_time, int); /* Whether fill value is defined */ *p++ = (uint8_t)fill->fill_defined; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index e5e6741..212475e 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -224,7 +224,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(fsinfo); *p++ = (uint8_t)fsinfo->version; /* message version */ - *p++ = fsinfo->strategy; /* File space strategy */ + H5_CHECKED_ASSIGN(*p++, uint8_t, fsinfo->strategy, unsigned); /* 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..a461613 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,8 +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)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0)); + H5_CHECKED_ASSIGN(flags, uint8_t, flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0), int); *p++ = flags; /* Store the max. # of links to store compactly & the min. # of links to store densely */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 0029976..0867318 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -240,7 +240,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)]); + H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); /* Version bounds check */ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) @@ -2379,7 +2379,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..069ee7c 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; + H5_CHECKED_ASSIGN(*p++, uint8_t, mesg->type, int); /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 9827b6a..9e57185 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; + H5_CHECKED_ASSIGN(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); 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..afa0947 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; + H5_CHECKED_ASSIGN(*p++, uint8_t, lnk->type, int); /* 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..83bc2b4 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -256,8 +256,9 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) *p++ = (uint8_t)flags; /* Dataspace type */ - if(sdim->version > H5O_SDSPACE_VERSION_1) - *p++ = sdim->type; + if(sdim->version > H5O_SDSPACE_VERSION_1) { + H5_CHECKED_ASSIGN(*p++, uint8_t, sdim->type, int); + } else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index 9fbc7ef..45c5a9d 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1002,7 +1002,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++; + H5_CHECKED_ASSIGN(ref->type, int8_t, (H5R_type_t)*p++, int); 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..218f1ae 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; + H5_CHECKED_ASSIGN(*image++, uint8_t, table->indexes[u].index_type, int); /* 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..4c0033c 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; + H5_CHECKED_ASSIGN(*raw++, uint8_t, message->location, int); UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index ab06eff..57fa043 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3688,7 +3688,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); + H5_CHECKED_ASSIGN(*enc_size, uint8_t, MAX(enc1, enc2), int); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index df6d2c3..073bb51 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; + H5_CHECKED_ASSIGN(buf[idx++], uint8_t, value ? 0xff : 0x00, int); 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; + H5_CHECKED_ASSIGN(buf[idx], uint8_t, acc & 0xff, unsigned); 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 aa84833..6cc38db 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; + H5_CHECKED_ASSIGN(s_ptr->b, int16_t, (i*8+1) & 0x7fff, int); + H5_CHECKED_ASSIGN(s_ptr->d, int16_t, (i*8+6) & 0x7fff, int); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/h5test.c b/test/h5test.c index c8f4132..fb1c408 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1321,8 +1321,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..82da8ce 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; + H5_CHECKED_ASSIGN(wbuf[i], uint8_t, 0xff ^ i, size_t); 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 1a4456a..ed02c16 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1583,7 +1583,7 @@ test_h5s_encode1(void) ****************************************************************/ static herr_t test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, - uint32_t expected_version, uint8_t expected_enc_size, hbool_t expected_to_fail) + uint32_t expected_version, uint32_t expected_enc_size, hbool_t expected_to_fail) { char *buf = NULL; /* Pointer to the encoded buffer */ size_t buf_size; /* Size of the encoded buffer */ @@ -1697,7 +1697,7 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) unsigned unlim; /* H5S_UNLIMITED setting or not */ herr_t ret; /* Generic return value */ 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 */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataspace encoding of regular hyperslabs\n")); @@ -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; 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 1b4bc56..dc33d58 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -911,8 +911,14 @@ h5diff(const char *fname1, parallel_print("---------------------------------------\n"); for(u = 0; u < match_list->nobjs; u++) { char c1, c2; - c1 = (match_list->objs[u].flags[0]) ? 'x' : ' '; - c2 = (match_list->objs[u].flags[1]) ? 'x' : ' '; + if (match_list->objs[u].flags[0]) + c1 = 'x'; + else + c1 = ' '; + if (match_list->objs[u].flags[1]) + c2 = 'x'; + else + c2 = ' '; parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name); } /* end for */ parallel_print ("\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 351e6ab..a648be1 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -274,8 +274,14 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t parallel_print(" --------------------------------------\n"); for(i = 0; i < (unsigned int) table_lp->nattrs; i++) { char c1, c2; - c1 = (table_lp->attrs[i].exist[0]) ? 'x' : ' '; - c2 = (table_lp->attrs[i].exist[1]) ? 'x' : ' '; + if (table_lp->attrs[i].exist[0]) + c1 = 'x'; + else + c1 = ' '; + if (table_lp->attrs[i].exist[1]) + c2 = 'x'; + else + c2 = ' '; parallel_print("%5c %6c %-15s\n", c1, c2, table_lp->attrs[i].name); } /* end for */ } diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 65c2359..c627b6d 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4707,14 +4707,17 @@ 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 & 0xff) << 8) | ((val & 0xff00) >> 8)); } int16_t swap_int16(int16_t val) { - return (val << 8) | ((val >> 8) & 0xFF); + int16_t ret; + + H5_CHECKED_ASSIGN(ret, int16_t, ((val & 0xff) << 8) | ((val & 0xff00) >> 8), int); + return ret; } 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..ceff5e1 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -16,6 +16,7 @@ #include #include #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,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 */ @@ -78,7 +79,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/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 571452e..ceff5e1 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -16,6 +16,7 @@ #include #include #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,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 */ @@ -78,7 +79,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/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index ad70770..29c8245 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; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); 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; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); 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; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); } 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); + H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); } 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..ceff5e1 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -16,6 +16,7 @@ #include #include #include "H5PLextern.h" +#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -69,7 +70,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 */ @@ -78,7 +79,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/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 87ca31c..80f1518 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)); + H5_CHECKED_ASSIGN(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); } } } @@ -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 From 189935ff260cae6fb4e061fa68bd7b93e219c635 Mon Sep 17 00:00:00 2001 From: kmu Date: Fri, 6 Dec 2019 14:12:57 -0600 Subject: remove unnecessary check macro --- hl/tools/gif2h5/decompress.c | 3 +-- src/H5Aint.c | 2 +- src/H5B2cache.c | 6 +++--- src/H5B2int.c | 2 +- src/H5EAcache.c | 8 ++++---- src/H5FAcache.c | 4 ++-- src/H5FScache.c | 6 +++--- src/H5HFtest.c | 2 +- src/H5Oainfo.c | 2 +- src/H5Oattr.c | 2 +- src/H5Ofill.c | 4 ++-- src/H5Ofsinfo.c | 4 ++-- src/H5Oginfo.c | 2 +- src/H5Oint.c | 2 +- src/H5Olayout.c | 2 +- src/H5Olinfo.c | 2 +- src/H5Olink.c | 2 +- src/H5Osdspace.c | 5 ++--- src/H5Rint.c | 2 +- src/H5SMcache.c | 2 +- src/H5SMmessage.c | 2 +- src/H5Shyper.c | 2 +- src/H5Tbit.c | 4 ++-- test/dsets.c | 8 ++++---- test/dtypes.c | 5 ++--- test/ntypes.c | 2 +- tools/src/h5import/h5import.c | 5 +---- tools/test/h5diff/dynlib_diff.c | 5 ++--- tools/test/h5dump/dynlib_dump.c | 5 ++--- tools/test/h5dump/h5dumpgentest.c | 8 ++++---- tools/test/h5ls/dynlib_ls.c | 5 ++--- 31 files changed, 53 insertions(+), 62 deletions(-) diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index b3e20ac..bd9a37d 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -12,7 +12,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include -#include "H5private.h" #include "gif.h" @@ -174,7 +173,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; - H5_CHECKED_ASSIGN(Interlace, uint8_t, GifImageDesc->PackedField & 0x40, int); + 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 831dab2..046d709 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2026,7 +2026,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 */ - H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]), int); + 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 7d163bf..09bb389 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cls->id, int); + *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +818,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, internal->hdr->cls->id, int); + *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 +1219,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, leaf->hdr->cls->id, int); + *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 932f5f3..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 */ - H5_CHECKED_ASSIGN(mid_record, uint16_t, old_node_nrec / 2, int); + 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), diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 02b12e1..7b1968e 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); + *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 +875,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, iblock->hdr->cparam.cls->id, int); + *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 +1284,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_SBLOCK_VERSION; /* Extensible array type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, sblock->hdr->cparam.cls->id, int); + *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 +1698,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, dblock->hdr->cparam.cls->id, int); + *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 7ea7fd6..e142ae2 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -417,7 +417,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5FA_HDR_VERSION; /* Fixed array type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, hdr->cparam.cls->id, int); + *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 +805,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5FA_DBLOCK_VERSION; /* Fixed array type */ - H5_CHECKED_ASSIGN(*image++, uint8_t, dblock->hdr->cparam.cls->id, int); + *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 28c35e4..cb0abe9 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -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 = 1; /* Current section size */ - size_t node_count = 1; /* # 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 = 1; /* 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/H5HFtest.c b/src/H5HFtest.c index 7484961..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 */ - H5_CHECKED_ASSIGN(*obj_type, uint8_t, *id & H5HF_ID_TYPE_MASK, int); + *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 d954973..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 */ - H5_CHECKED_ASSIGN(flags, uint8_t, ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0, int); + 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 f3d0fa1..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) - H5_CHECKED_ASSIGN(*p++, uint8_t, attr->shared->encoding, int); + *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 93f2a65..cb75bc3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,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 */ - H5_CHECKED_ASSIGN(*p++, uint8_t, fill->alloc_time, int); + *p++ = (uint8_t)fill->alloc_time; /* Fill value writing time */ - H5_CHECKED_ASSIGN(*p++, uint8_t, fill->fill_time, int); + *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 212475e..25a6754 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -223,8 +223,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 */ - H5_CHECKED_ASSIGN(*p++, uint8_t, fsinfo->strategy, unsigned); /* 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 a461613..237bf6c 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -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 */ - H5_CHECKED_ASSIGN(flags, uint8_t, flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0), int); + flags = (unsigned char)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0)); *p++ = flags; /* Store the max. # of links to store compactly & the min. # of links to store densely */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 0867318..7c922da 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -240,7 +240,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 */ - H5_CHECKED_ASSIGN(version, uint8_t, MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]), int); + 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)]) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 069ee7c..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 */ - H5_CHECKED_ASSIGN(*p++, uint8_t, mesg->type, int); + *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 9e57185..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 */ - H5_CHECKED_ASSIGN(index_flags, uint8_t, linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0, int); + 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 afa0947..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) - H5_CHECKED_ASSIGN(*p++, uint8_t, lnk->type, int); + *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 83bc2b4..33310dc 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -256,9 +256,8 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) *p++ = (uint8_t)flags; /* Dataspace type */ - if(sdim->version > H5O_SDSPACE_VERSION_1) { - H5_CHECKED_ASSIGN(*p++, uint8_t, sdim->type, int); - } + if(sdim->version > H5O_SDSPACE_VERSION_1) + *p++ = (uint8_t)sdim->type; else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Rint.c b/src/H5Rint.c index 45c5a9d..c015715 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1002,7 +1002,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 */ - H5_CHECKED_ASSIGN(ref->type, int8_t, (H5R_type_t)*p++, int); + 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 218f1ae..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? */ - H5_CHECKED_ASSIGN(*image++, uint8_t, table->indexes[u].index_type, int); + *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 4c0033c..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); - H5_CHECKED_ASSIGN(*raw++, uint8_t, message->location, int); + *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 57fa043..4796fb9 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3688,7 +3688,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); - H5_CHECKED_ASSIGN(*enc_size, uint8_t, MAX(enc1, enc2), int); + *enc_size = (uint8_t)MAX(enc1, enc2); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 073bb51..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) { - H5_CHECKED_ASSIGN(buf[idx++], uint8_t, value ? 0xff : 0x00, int); + 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; - H5_CHECKED_ASSIGN(buf[idx], uint8_t, acc & 0xff, unsigned); + buf[idx] = (uint8_t)(acc & 0xff); idx++; size -= 8; } diff --git a/test/dsets.c b/test/dsets.c index 6cc38db..b8cd1dc 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, int16_t, (i*8+1) & 0x7fff, int); - H5_CHECKED_ASSIGN(s_ptr->d, int16_t, (i*8+6) & 0x7fff, int); + 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/ntypes.c b/test/ntypes.c index 82da8ce..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++) - H5_CHECKED_ASSIGN(wbuf[i], uint8_t, 0xff ^ i, size_t); + 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/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index c627b6d..7ca12c2 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4714,10 +4714,7 @@ uint16_t swap_uint16(uint16_t val) int16_t swap_int16(int16_t val) { - int16_t ret; - - H5_CHECKED_ASSIGN(ret, int16_t, ((val & 0xff) << 8) | ((val & 0xff00) >> 8), int); - return ret; + return (uint16_t)(((val & 0xff) << 8) | ((val & 0xff00) >> 8)); } uint32_t swap_uint32(uint32_t val) diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index ceff5e1..661a6dc 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -16,7 +16,6 @@ #include #include #include "H5PLextern.h" -#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -70,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; - H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,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; - H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); + *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 ceff5e1..661a6dc 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -16,7 +16,6 @@ #include #include #include "H5PLextern.h" -#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -70,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; - H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,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; - H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); + *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 29c8245..ed0287c 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++) - H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); + 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++) - H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); + 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++) { - H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); + 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++) { - H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); + buf2[i] = (uint16_t)(0xffff ^ (i * 16)); } H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); H5Dclose(dset); diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index ceff5e1..661a6dc 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -16,7 +16,6 @@ #include #include #include "H5PLextern.h" -#include "H5private.h" #define H5Z_FILTER_DYNLIBUD 300 #define MULTIPLIER 3 @@ -70,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; - H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp - MULTIPLIER, int); + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -79,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; - H5_CHECKED_ASSIGN(*int_ptr, int8_t, temp + MULTIPLIER, int); + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ -- cgit v0.12 From 62badd9ebcda1d5c723750cccb09204836df9dd7 Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 10 Dec 2019 10:59:34 -0600 Subject: add missing piece --- src/H5Oginfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 237bf6c..d6190c6 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -183,6 +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 = (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; -- cgit v0.12 From a00d71b2e26c06a299ac92552b7887ca017fd4d3 Mon Sep 17 00:00:00 2001 From: kmu Date: Tue, 10 Dec 2019 12:10:49 -0600 Subject: change according to previous comments --- src/H5C.c | 3 +-- src/H5Dchunk.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index 3e0cf95..d6e2147 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -3856,7 +3856,7 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity checking */ HDassert(cache_ptr); @@ -3873,7 +3873,6 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, /* Update the stats for an unpin operation */ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__unpin_entry_real() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 2f95024..db234bb 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2179,7 +2179,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 schunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ @@ -2190,7 +2190,7 @@ 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 = (hsize_t)H5S_GET_SELECT_NPOINTS(chunk_info->fspace); + schunk_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) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") -- cgit v0.12 From 45a62b2d46523c15a7d2bc7f52db2b756b40df26 Mon Sep 17 00:00:00 2001 From: kmu Date: Wed, 11 Dec 2019 10:44:56 -0600 Subject: fix and address comments --- src/H5B2cache.c | 3 +++ src/H5C.c | 2 +- src/H5Dchunk.c | 11 +++++------ src/H5EAcache.c | 4 ++++ src/H5FAcache.c | 2 ++ test/cache_tagging.c | 2 ++ test/th5s.c | 15 ++++++++------- tools/lib/h5diff.c | 12 +++--------- tools/lib/h5diff_attr.c | 12 +++--------- tools/src/h5import/h5import.c | 4 ++-- tools/test/h5repack/h5repackgentest.c | 2 +- 11 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 09bb389..65286e6 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,6 +398,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ + HDassert(hdr->cls->id <= 255); *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ @@ -818,6 +819,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ + 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)); @@ -1219,6 +1221,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ + 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)); diff --git a/src/H5C.c b/src/H5C.c index d6e2147..e530eef 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -3856,7 +3856,7 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC /* Sanity checking */ HDassert(cache_ptr); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index db234bb..66b6676 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2179,7 +2179,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) { - hsize_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 */ @@ -2190,12 +2190,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 = (hsize_t)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); @@ -5665,7 +5665,6 @@ 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_NOERR @@ -5675,7 +5674,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; - 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 7b1968e..1fd9c44 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,6 +487,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ + HDassert(hdr->cparam.cls->id <= 255); *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ @@ -875,6 +876,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ + 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 */ @@ -1284,6 +1286,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_SBLOCK_VERSION; /* Extensible array type */ + 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 */ @@ -1698,6 +1701,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ + 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 */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index e142ae2..2f0d1b4 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -417,6 +417,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5FA_HDR_VERSION; /* Fixed array type */ + HDassert(hdr->cparam.cls->id <= 255); *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ @@ -805,6 +806,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5FA_DBLOCK_VERSION; /* Fixed array type */ + 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 */ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 7ce4e88..dad9426 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3836,12 +3836,14 @@ check_invalid_tag_application(void) return 0; +#if 0 error: #if H5C_DO_TAGGING_SANITY_CHECKS if(api_ctx_pushed) H5CX_pop(); #endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 1; +#endif } /* check_invalid_tag_application */ diff --git a/test/th5s.c b/test/th5s.c index 5ef5368..7e1e547 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1583,7 +1583,7 @@ test_h5s_encode1(void) ****************************************************************/ static herr_t test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, - uint32_t expected_version, uint32_t expected_enc_size, hbool_t expected_to_fail) + uint32_t expected_version, uint8_t expected_enc_size, hbool_t expected_to_fail) { char *buf = NULL; /* Pointer to the encoded buffer */ size_t buf_size; /* Size of the encoded buffer */ @@ -1697,7 +1697,7 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) unsigned unlim; /* H5S_UNLIMITED setting or not */ herr_t ret; /* Generic return value */ uint32_t expected_version = 0; /* Expected version for selection info */ - uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */ + uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataspace encoding of regular hyperslabs\n")); @@ -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); @@ -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/tools/lib/h5diff.c b/tools/lib/h5diff.c index 5acdde8..d0371c7 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -907,15 +907,9 @@ h5diff(const char *fname1, parallel_print("file1 file2\n"); parallel_print("---------------------------------------\n"); for(u = 0; u < match_list->nobjs; u++) { - char c1, c2; - if (match_list->objs[u].flags[0]) - c1 = 'x'; - else - c1 = ' '; - if (match_list->objs[u].flags[1]) - c2 = 'x'; - else - 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); } /* end for */ parallel_print ("\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index a648be1..8f5ab0f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -273,15 +273,9 @@ 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; - if (table_lp->attrs[i].exist[0]) - c1 = 'x'; - else - c1 = ' '; - if (table_lp->attrs[i].exist[1]) - c2 = 'x'; - else - 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); } /* end for */ } diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 179dac4..f2e264c 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4709,12 +4709,12 @@ static int process(struct Options *opt) uint16_t swap_uint16(uint16_t val) { - return (uint16_t)(((val & 0xff) << 8) | ((val & 0xff00) >> 8)); + return (uint16_t)((val << 8) | (val >> 8)); } int16_t swap_int16(int16_t val) { - return (uint16_t)(((val & 0xff) << 8) | ((val & 0xff00) >> 8)); + return (uint16_t)((val << 8) | ((val >> 8) & 0xFF)); } uint32_t swap_uint32(uint32_t val) diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index c2398b6..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++) { - H5_CHECKED_ASSIGN(wdata[n], uint8_t, n * ((n & 1) ? (-1) : (1)), int); + wdata[n] = (uint8_t)((n & 1) ? -n : n); } } } -- cgit v0.12 From 0a2bb11b248df6841daabca3970df5d8504adfc7 Mon Sep 17 00:00:00 2001 From: kmu Date: Wed, 11 Dec 2019 13:35:02 -0600 Subject: address problems from comments --- src/H5C.c | 1 + src/H5Dchunk.c | 2 +- src/H5Sprivate.h | 2 +- src/H5Sselect.c | 4 ++-- test/cache_tagging.c | 2 -- tools/src/h5import/h5import.c | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index e530eef..3e0cf95 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -3873,6 +3873,7 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, /* Update the stats for an unpin operation */ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__unpin_entry_real() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 66b6676..67f42f1 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2190,7 +2190,7 @@ 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") - chunk_points = (hsize_t)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, &chunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") 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/test/cache_tagging.c b/test/cache_tagging.c index dad9426..7ce4e88 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3836,14 +3836,12 @@ check_invalid_tag_application(void) return 0; -#if 0 error: #if H5C_DO_TAGGING_SANITY_CHECKS if(api_ctx_pushed) H5CX_pop(); #endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 1; -#endif } /* check_invalid_tag_application */ diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index f2e264c..bd1689f 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4714,7 +4714,7 @@ uint16_t swap_uint16(uint16_t val) int16_t swap_int16(int16_t val) { - return (uint16_t)((val << 8) | ((val >> 8) & 0xFF)); + return (int16_t)((val << 8) | ((val >> 8) & 0xFF)); } uint32_t swap_uint32(uint32_t val) -- cgit v0.12