diff options
author | kmu <kmu@hdfgroup.org> | 2019-11-26 23:23:58 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2019-11-26 23:23:58 (GMT) |
commit | 2bb0f52edfdd0ce11595ee673a934f306ca5c4fa (patch) | |
tree | 9be4fa9e5b48e88f993723daf1b13ebd03219f66 | |
parent | 4c8a2f726a2eb47a937430e28994db8be1b87b00 (diff) | |
download | hdf5-2bb0f52edfdd0ce11595ee673a934f306ca5c4fa.zip hdf5-2bb0f52edfdd0ce11595ee673a934f306ca5c4fa.tar.gz hdf5-2bb0f52edfdd0ce11595ee673a934f306ca5c4fa.tar.bz2 |
Revert "fix issues from previous PR comments"
This reverts commit d242a900f420b040e364f6c0976c01593e955db3.
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; i<sizeof buf; i++) ASSIGN_TO_SMALLER_SIZE(buf[i], unsigned char, 0xff ^ i, size_t); + for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; @@ -5307,7 +5307,7 @@ test_types(hid_t file) (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || (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); + for(i=0; i<sizeof buf; 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; @@ -5322,7 +5322,7 @@ test_types(hid_t file) (dset = H5Dcreate2(grp, "opaque_1", 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; if(H5Tclose(type) < 0) goto error; diff --git a/test/dtypes.c b/test/dtypes.c index 5369351..5238306 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1216,8 +1216,8 @@ test_compound_6(void) orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)((void *)orig)) + i; - 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); + 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 <stdlib.h> #include <stdio.h> #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 <stdlib.h> #include <stdio.h> #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 <stdlib.h> #include <stdio.h> #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))); } } } |