From b9b3f3eda756d27cd1889d1bd1a3335d95613b21 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 7 Feb 2019 14:33:08 +0100 Subject: [PATCH] Fixed sign-compare warnings --- channels/smartcard/client/smartcard_operations.c | 11 ++++++++--- channels/smartcard/client/smartcard_pack.c | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index 4009b9f..47971f1 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -491,21 +491,26 @@ static DWORD filter_device_by_name_a(wLinkedList* list, LPSTR* mszReaders, DWORD static DWORD filter_device_by_name_w(wLinkedList* list, LPWSTR* mszReaders, DWORD cchReaders) { + int res; DWORD rc; LPSTR readers; if (LinkedList_Count(list) < 1) return cchReaders; - if (ConvertFromUnicode(CP_UTF8, 0, *mszReaders, (int)cchReaders, &readers, 0, NULL, - NULL) != cchReaders) + res = ConvertFromUnicode(CP_UTF8, 0, *mszReaders, (int)cchReaders, &readers, 0, NULL, + NULL); + + if ((res < 0) || ((DWORD)res != cchReaders)) return 0; free(*mszReaders); *mszReaders = NULL; rc = filter_device_by_name_a(list, &readers, cchReaders); - if (ConvertToUnicode(CP_UTF8, 0, readers, (int)rc, mszReaders, 0) != rc) + res = ConvertToUnicode(CP_UTF8, 0, readers, (int)rc, mszReaders, 0); + + if ((res < 0) || ((DWORD)res != rc)) rc = 0; free(readers); diff --git a/channels/smartcard/client/smartcard_pack.c b/channels/smartcard/client/smartcard_pack.c index 5cdc99f..fa95d76 100644 --- a/channels/smartcard/client/smartcard_pack.c +++ b/channels/smartcard/client/smartcard_pack.c @@ -804,7 +804,7 @@ LONG smartcard_pack_list_readers_return(SMARTCARD_DEVICE* smartcard, wStream* s, void smartcard_trace_list_readers_return(SMARTCARD_DEVICE* smartcard, ListReaders_Return* ret, BOOL unicode) { - int index; + size_t index; size_t length; char* mszA = NULL; @@ -1851,7 +1851,7 @@ LONG smartcard_pack_status_return(SMARTCARD_DEVICE* smartcard, wStream* s, Statu void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, Status_Return* ret, BOOL unicode) { - int index; + size_t index; size_t length; char* pbAtr = NULL; char* mszReaderNamesA = NULL; -- 2.7.4