From: Matthew Fernandez Date: Sat, 21 May 2022 03:08:35 +0000 (-0700) Subject: common: cast stat size results, squashing -Wsign-conversion warnings X-Git-Tag: 4.0.0~21^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=437b779d11e14bdd028aa3e0008031d3a2f4f40a;p=graphviz common: cast stat size results, squashing -Wsign-conversion warnings The `st_size` field coming out of the `stat` call is always non-negative. --- diff --git a/lib/common/psusershape.c b/lib/common/psusershape.c index a5cae11fa..abccefc74 100644 --- a/lib/common/psusershape.c +++ b/lib/common/psusershape.c @@ -74,9 +74,9 @@ static usershape_t *user_init(const char *str) us->name = str; us->macro_id = N_EPSF_files++; fstat(fileno(fp), &statbuf); - contents = us->data = N_GNEW(statbuf.st_size + 1, char); + contents = us->data = N_GNEW((size_t)statbuf.st_size + 1, char); fseek(fp, 0, SEEK_SET); - rc = fread(contents, statbuf.st_size, 1, fp); + rc = fread(contents, (size_t)statbuf.st_size, 1, fp); if (rc == 1) { contents[statbuf.st_size] = '\0'; dtinsert(EPSF_contents, us);