From 59f2139df0bc30f13d38844cecc5e5dd60f83f8c Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Mon, 6 Apr 2020 14:16:25 +0200 Subject: [PATCH] Prefer unsigned types for non-negative numbers Use size_t for some variables that are array indices. Use unsigned for some variables that are counts of "small" things. This is a backport of commit 3c1c8ea3e7. Signed-off-by: Ronald Cron --- tests/suites/main_test.function | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function index 8f134ff98..1fc76bd30 100644 --- a/tests/suites/main_test.function +++ b/tests/suites/main_test.function @@ -262,14 +262,15 @@ int main(int argc, const char *argv[]) const char *default_filename = "TESTCASE_FILENAME"; const char *test_filename = NULL; const char **test_files = NULL; - int testfile_count = 0; + size_t testfile_count = 0; int option_verbose = 0; /* Other Local variables */ int arg_index = 1; const char *next_arg; - int testfile_index, ret, i, cnt; - int total_errors = 0, total_tests = 0, total_skipped = 0; + size_t testfile_index, i, cnt; + int ret; + unsigned total_errors = 0, total_tests = 0, total_skipped = 0; FILE *file; char buf[5000]; char *params[50]; @@ -347,7 +348,7 @@ int main(int argc, const char *argv[]) testfile_index < testfile_count; testfile_index++ ) { - int unmet_dep_count = 0; + size_t unmet_dep_count = 0; char *unmet_dependencies[20]; /* only filled when verbose != 0 */ test_filename = test_files[ testfile_index ]; @@ -516,7 +517,7 @@ int main(int argc, const char *argv[]) else mbedtls_fprintf( stdout, "FAILED" ); - mbedtls_fprintf( stdout, " (%d / %d tests (%d skipped))\n", + mbedtls_fprintf( stdout, " (%u / %u tests (%u skipped))\n", total_tests - total_errors, total_tests, total_skipped ); #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \