Merge pull request #2573 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:develop_minor to develop

* commit 'ae07c9ba2429a9c49291bcd9f02c0ce36b0a60ce':
  Replaced a few calls to HDmemcpy with H5MM_memcpy, which does overlap checking.
  Removed HDgets macros since gets was deprecated in C99 and removed in C11 (gets() is not used in our repo).
This commit is contained in:
Dana Robinson 2020-05-15 11:56:23 -05:00
commit 26780517e6
5 changed files with 15 additions and 12 deletions

View File

@ -189,10 +189,10 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
/* Set the native fields */
if(shim_data->fields & H5O_INFO_HDR)
HDmemcpy(&(oinfo.hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
H5MM_memcpy(&(oinfo.hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
if(shim_data->fields & H5O_INFO_META_SIZE) {
HDmemcpy(&(oinfo.meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
HDmemcpy(&(oinfo.meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
H5MM_memcpy(&(oinfo.meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
H5MM_memcpy(&(oinfo.meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
}
}
@ -279,10 +279,10 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params,
/* Set the native fields */
if(fields & H5O_INFO_HDR)
HDmemcpy(&(oinfo->hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
H5MM_memcpy(&(oinfo->hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t));
if(fields & H5O_INFO_META_SIZE) {
HDmemcpy(&(oinfo->meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
HDmemcpy(&(oinfo->meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
H5MM_memcpy(&(oinfo->meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t));
H5MM_memcpy(&(oinfo->meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t));
} /* end if */
} /* end if */

View File

@ -800,7 +800,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_
HDassert(dst_size);
/* Copy header manually */
HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE);
H5MM_memcpy(q, p, H5R_ENCODE_HEADER_SIZE);
p += H5R_ENCODE_HEADER_SIZE;
q += H5R_ENCODE_HEADER_SIZE;
blob_size -= H5R_ENCODE_HEADER_SIZE;
@ -860,7 +860,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
} /* end if */
/* Copy header manually so that it does not get encoded into the blob */
HDmemcpy(q, p, H5R_ENCODE_HEADER_SIZE);
H5MM_memcpy(q, p, H5R_ENCODE_HEADER_SIZE);
p += H5R_ENCODE_HEADER_SIZE;
q += H5R_ENCODE_HEADER_SIZE;
src_size -= H5R_ENCODE_HEADER_SIZE;

View File

@ -1030,9 +1030,12 @@ typedef off_t h5_stat_size_t;
#ifndef HDgetrusage
#define HDgetrusage(X,S) getrusage(X,S)
#endif /* HDgetrusage */
#ifndef HDgets
#define HDgets(S) gets(S)
/* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */
#ifdef HDgets
#undef HDgets
#endif /* HDgets */
#ifndef HDgettimeofday
#define HDgettimeofday(S,P) gettimeofday(S,P)
#endif /* HDgettimeofday */

View File

@ -213,7 +213,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDgetpwnam(S) getpwnam(S)
#define HDgetpwuid(U) getpwuid(U)
#define HDgetrusage(X,S) getrusage(X,S)
#define HDgets(S) gets(S)
/* Don't define a macro for gets() - it was removed in C11 */
#ifdef H5_HAVE_WIN32_API
H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)

View File

@ -228,7 +228,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDgetpwnam(S) getpwnam(S)
#define HDgetpwuid(U) getpwuid(U)
#define HDgetrusage(X,S) getrusage(X,S)
#define HDgets(S) gets(S)
/* Don't define a macro for gets() - it was removed in C11 */
#ifdef H5_HAVE_WIN32_API
H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)