From 421bc875c5fac03b7ee11b4106ee385b4e3609f2 Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Tue, 10 Sep 2024 01:37:01 +0200 Subject: [PATCH] crypt_prog: fix warnings. - fix issue with variable shadowing - fix int <-> size_t conversion warning - fix size_t <-> unsigned int conversion warning Signed-off-by: Vitalii Koshura --- lib/crypt_prog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/crypt_prog.cpp b/lib/crypt_prog.cpp index 5e4d5878b0..d9b872dd6a 100644 --- a/lib/crypt_prog.cpp +++ b/lib/crypt_prog.cpp @@ -86,7 +86,7 @@ void usage() { } unsigned int random_int() { - unsigned int n; + unsigned int n = 0; #if defined(_WIN32) #if defined(__CYGWIN32__) HMODULE hLib=LoadLibrary((const char *)"ADVAPI32.DLL"); @@ -238,8 +238,8 @@ int main(int argc, char** argv) { if (retval) die("read_public_key"); f = fopen(argv[3], "r"); if (!f) die("fopen"); - int n = fread(cbuf, 1, 256, f); - cbuf[n] = 0; + size_t k = fread(cbuf, 1, 256, f); + cbuf[k] = 0; retval = check_string_signature(argv[2], cbuf, public_key, is_valid); if (retval) die("check_string_signature"); @@ -264,7 +264,7 @@ int main(int argc, char** argv) { if (retval) die("read_public_key"); strcpy((char*)buf2, "encryption test successful"); in.data = buf2; - in.len = strlen((char*)in.data); + in.len = static_cast(strlen((char*)in.data)); out.data = buf; encrypt_private(private_key, in, out); in = out;