From 928bf71d2a5df4b68495c63ba6d55bf94590025f Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 1 Oct 2021 17:21:48 +1000 Subject: [PATCH] tools/bin2cpp: Fix 64-bit warnings --- tools/bin2cpp/bin2cpp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/bin2cpp/bin2cpp.cpp b/tools/bin2cpp/bin2cpp.cpp index 31273e7748..e62f86b9a5 100644 --- a/tools/bin2cpp/bin2cpp.cpp +++ b/tools/bin2cpp/bin2cpp.cpp @@ -105,8 +105,8 @@ int main(int argc, char* argv[]) strcpy(srcfile,argv[ARG_SRCFILE]); - int srcfn_len = strlen( srcfile ); - if( srcfile[srcfn_len-4] != '.' ) + const size_t srcfn_len = strlen( srcfile ); + if( srcfn_len < 4 || srcfile[srcfn_len-4] != '.' ) { printf( "ERROR : Malformed source filename. I'm a crap utility and I demand 3-letter extensions only!\n" ); return 18; @@ -166,7 +166,7 @@ int main(int argc, char* argv[]) } { - int len = strlen(fnameonly); + int len = static_cast(strlen(fnameonly)); const char* fnlast = &fnameonly[len]; while( --fnlast, --len, (len >= 0 && (*fnlast != '/')) );