From 437b779d11e14bdd028aa3e0008031d3a2f4f40a Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 20 May 2022 20:08:35 -0700 Subject: [PATCH] common: cast stat size results, squashing -Wsign-conversion warnings The `st_size` field coming out of the `stat` call is always non-negative. --- lib/common/psusershape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.40.0