From 0be6aa9957e6b27f6256660f3bd032969f2c56f4 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Tue, 18 Aug 2020 23:52:53 +0300 Subject: [PATCH] Get back -Wsign-compare and fix sources according to it Signed-off-by: makise-homura --- CMakeLists.txt | 4 ---- library/ssl_msg.c | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fb4d364d..d2cf44629 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,10 +179,6 @@ if(CMAKE_COMPILER_IS_GNU) if(C_COMPILER_SUPPORTS_WSIGNED_ONE_BIT_FIELD) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-signed-one-bit-field") endif() - CHECK_C_COMPILER_FLAG("-Wno-sign-compare" C_COMPILER_SUPPORTS_WSIGN_COMPARE) - if(C_COMPILER_SUPPORTS_WSIGN_COMPARE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-sign-compare") - endif() set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") diff --git a/library/ssl_msg.c b/library/ssl_msg.c index d32afac56..259a71d2f 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -2048,7 +2048,7 @@ int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want ) if( ret < 0 ) return( ret ); - if ( (size_t)ret > len || ( INT_MAX > SIZE_MAX && ret > SIZE_MAX ) ) + if ( (size_t)ret > len || ( INT_MAX > SIZE_MAX && (size_t)ret > SIZE_MAX ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "f_recv returned %d bytes but only %lu were requested", @@ -2102,7 +2102,7 @@ int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl ) if( ret <= 0 ) return( ret ); - if( (size_t)ret > ssl->out_left || ( INT_MAX > SIZE_MAX && ret > SIZE_MAX ) ) + if( (size_t)ret > ssl->out_left || ( INT_MAX > SIZE_MAX && (size_t)ret > SIZE_MAX ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "f_send returned %d bytes but only %lu bytes were sent",