From: Armin Fuerst Date: Sat, 6 Mar 2021 11:19:18 +0000 (+0100) Subject: apps: fix warning about size_t / int conversion X-Git-Tag: openssl-3.0.0-alpha15~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1c908f421b3466aecf980603132bcab89d1ce99;p=thirdparty%2Fopenssl.git apps: fix warning about size_t / int conversion Windows builds show the following warning: (..\apps\ca.c(2643): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data) Reviewed-by: Paul Dale Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14453) --- diff --git a/apps/include/apps.h b/apps/include/apps.h index a2826e60664..96b37ef95cb 100644 --- a/apps/include/apps.h +++ b/apps/include/apps.h @@ -212,7 +212,7 @@ typedef struct ca_db_st { } CA_DB; void app_bail_out(char *fmt, ...); -void* app_malloc(int sz, const char *what); +void *app_malloc(size_t sz, const char *what); BIGNUM *load_serial(const char *serialfile, int create, ASN1_INTEGER **retai); int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial, ASN1_INTEGER **retai); diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 69a98ecf37c..df4edfb837d 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -628,12 +628,12 @@ void app_bail_out(char *fmt, ...) exit(1); } -void* app_malloc(int sz, const char *what) +void *app_malloc(size_t sz, const char *what) { void *vp = OPENSSL_malloc(sz); if (vp == NULL) - app_bail_out("%s: Could not allocate %d bytes for %s\n", + app_bail_out("%s: Could not allocate %zu bytes for %s\n", opt_getprog(), sz, what); return vp; } diff --git a/test/testutil/apps_mem.c b/test/testutil/apps_mem.c index fa60bc68482..5c74a303858 100644 --- a/test/testutil/apps_mem.c +++ b/test/testutil/apps_mem.c @@ -11,7 +11,7 @@ /* shim that avoids sucking in too much from apps/apps.c */ -void* app_malloc(int sz, const char *what) +void *app_malloc(size_t sz, const char *what) { void *vp = OPENSSL_malloc(sz);