From 06aa7b6641ec24acfc9810f50d06b526a0eeef7d Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 10 Oct 2013 16:57:04 -0500 Subject: [svn-r24285] Eliminate several "passing argument ... with different width due to prototype" warnings by casting constants to size_t where expected by string functions. Tested on jam, koala,ostrich and platypus with h5committest. --- src/H5.c | 2 +- src/H5Gint.c | 2 +- src/H5Gname.c | 4 ++-- src/H5Pfapl.c | 2 +- src/H5system.c | 4 ++-- test/file_image.c | 2 +- tools/lib/h5tools.c | 24 ++++++++++++------------ tools/lib/h5tools_str.c | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/H5.c b/src/H5.c index 03d82a8..49a0aea 100644 --- a/src/H5.c +++ b/src/H5.c @@ -722,7 +722,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); if(*substr) { - HDstrncat(lib_str, "-", 1); + HDstrncat(lib_str, "-", (size_t)1); HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1); } /* end if */ if (HDstrcmp(lib_str, H5_lib_vers_info_g)){ diff --git a/src/H5Gint.c b/src/H5Gint.c index fe8b995..6f42cc2 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -992,7 +992,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) /* Add the path separator to the current path */ HDassert(udata->path[udata->curr_path_len] == '\0'); - HDstrncpy(&(udata->path[udata->curr_path_len]), "/", 2); + HDstrncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2); udata->curr_path_len++; /* Attempt to get the link info for this group */ diff --git a/src/H5Gname.c b/src/H5Gname.c index 1d2644b..bbeddb6 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -325,7 +325,7 @@ H5G_build_fullpath(const char *prefix, const char *name) /* Build full path */ HDstrncpy(full_path, prefix, orig_path_len + 1); if(need_sep) - HDstrncat(full_path, "/", 1); + HDstrncat(full_path, "/", (size_t)1); HDstrncat(full_path, name, name_len); /* Create reference counted string for path */ @@ -1331,7 +1331,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * /* If there's a buffer provided, copy into it, up to the limit of its size */ if(name) { /* Copy the initial path separator */ - HDstrncpy(name, "/", 2); + HDstrncpy(name, "/", (size_t)2); /* Append the rest of the path */ /* (less one character, for the initial path separator) */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a416b00..6955a60 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2472,7 +2472,7 @@ H5P__facc_cache_config_cmp(const void *_config1, const void *_config2, size_t UN if(config1->close_trace_file > config2->close_trace_file) HGOTO_DONE(1); if((ret_value = HDstrncmp(config1->trace_file_name, config2->trace_file_name, - H5AC__MAX_TRACE_FILE_NAME_LEN + 1)) != 0) + (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1))) != 0) HGOTO_DONE(ret_value); if(config1->evictions_enabled < config2->evictions_enabled) HGOTO_DONE(-1); diff --git a/src/H5system.c b/src/H5system.c index 4280066..614b8b9 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -201,7 +201,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) if(sizeof(hsize_t) < sizeof(long)) modifier[0] = '\0'; else if(sizeof(hsize_t) == sizeof(long)) - HDstrncpy(modifier, "l", 2); + HDstrncpy(modifier, "l", (size_t)2); else HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1); break; @@ -211,7 +211,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) if(sizeof(size_t) < sizeof(long)) modifier[0] = '\0'; else if(sizeof(size_t) == sizeof(long)) - HDstrncpy(modifier, "l", 2); + HDstrncpy(modifier, "l", (size_t)2); else HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1); break; diff --git a/test/file_image.c b/test/file_image.c index d4056a7..b1b9d47 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -557,7 +557,7 @@ test_core(void) /* Append ".copy" to the filename from the source directory */ VERIFY(HDstrlen(filename) < (1023 - 5), "file name too long."); - HDstrncpy(copied_filename, filename, 1023); + HDstrncpy(copied_filename, filename, (size_t)1023); copied_filename[1023] = '\0'; HDstrcat(copied_filename, ".copy"); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d9a1827..1794342 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -878,18 +878,18 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); } } if (elmtno == 0 && secnum == 0 && info->line_1st) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); } else if (secnum && info->line_cont) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); } else { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); } templength = h5tools_str_len(&prefix); @@ -897,7 +897,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -973,18 +973,18 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); } } if (elmtno == 0 && secnum == 0 && info->line_1st) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); } else if (secnum && info->line_cont) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); } else { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); } templength = h5tools_str_len(&prefix); @@ -992,7 +992,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -1049,7 +1049,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, if (stream == NULL) return dimension_break; - s = h5tools_str_fmt(buffer, 0, "%s"); + s = h5tools_str_fmt(buffer, (size_t)0, "%s"); /* * If the element would split on multiple lines if printed at our @@ -1203,7 +1203,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, int secnum; /*section sequence number */ int multiline; /*datum was multiline */ - s = h5tools_str_fmt(buffer, 0, "%s"); + s = h5tools_str_fmt(buffer, (size_t)0, "%s"); /* * If the element would split on multiple lines if printed at our diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 9bacd19..34142d4 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -352,7 +352,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, } /* Add prefix and suffix to the index */ - return h5tools_str_fmt(str, 0, OPT(info->idx_fmt, "%s: ")); + return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); } /*------------------------------------------------------------------------- @@ -412,7 +412,7 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, } /* Add prefix and suffix to the index */ - return h5tools_str_fmt(str, 0, OPT(info->idx_fmt, "%s: ")); + return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); } /*------------------------------------------------------------------------- -- cgit v0.12