Fixed -Wtautological-value-range-compare

This commit is contained in:
Armin Novak 2022-11-21 09:00:12 +01:00 committed by Martin Fleisz
parent 7c5652c15a
commit f81b3b05d2
2 changed files with 5 additions and 9 deletions

View File

@ -936,11 +936,9 @@ static BOOL rdg_read_all(rdpTls* tls, BYTE* buffer, size_t size,
static wStream* rdg_receive_packet(rdpRdg* rdg)
{
wStream* s;
const size_t header = sizeof(RdgPacketHeader);
size_t packetLength;
WINPR_ASSERT(header <= INT_MAX);
s = Stream_New(NULL, 1024);
wStream* s = Stream_New(NULL, 1024);
if (!s)
return NULL;
@ -1287,11 +1285,9 @@ static BOOL rdg_recv_auth_token(rdpCredsspAuth* auth, HttpResponse* response)
static BOOL rdg_skip_seed_payload(rdpTls* tls, SSIZE_T lastResponseLength,
rdg_http_encoding_context* transferEncoding)
{
BYTE seed_payload[10];
BYTE seed_payload[10] = { 0 };
const size_t size = sizeof(seed_payload);
WINPR_ASSERT(size < SSIZE_MAX);
/* Per [MS-TSGU] 3.3.5.1 step 4, after final OK response RDG server sends
* random "seed" payload of limited size. In practice it's 10 bytes.
*/

View File

@ -43,7 +43,7 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const BYTE* data, size_t length)
{
const BYTE* p = data;
size_t i, line, offset = 0;
const int maxlen = 20; /* 64bit SIZE_MAX as decimal */
const size_t maxlen = 20; /* 64bit SIZE_MAX as decimal */
/* String line length:
* prefix '[1234] '
* hexdump '01 02 03 04'
@ -52,7 +52,7 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const BYTE* data, size_t length)
* zero terminator '\0'
*/
const size_t blen =
((size_t)maxlen + 3) + (WINPR_HEXDUMP_LINE_LENGTH * 3) + 3 + WINPR_HEXDUMP_LINE_LENGTH + 1;
(maxlen + 3) + (WINPR_HEXDUMP_LINE_LENGTH * 3) + 3 + WINPR_HEXDUMP_LINE_LENGTH + 1;
size_t pos = 0;
char* buffer;
@ -60,7 +60,7 @@ void winpr_HexLogDump(wLog* log, UINT32 lvl, const BYTE* data, size_t length)
if (!WLog_IsLevelActive(log, lvl))
return;
if (!log || (maxlen < 0))
if (!log)
return;
buffer = malloc(blen);