https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7513cc9fca146b3da11b78160abe5c031bad9c89

commit 7513cc9fca146b3da11b78160abe5c031bad9c89
Author:     Jérôme Gardou <jerome.gar...@reactos.org>
AuthorDate: Mon Apr 12 10:28:11 2021 +0200
Commit:     Jérôme Gardou <zefk...@users.noreply.github.com>
CommitDate: Wed Apr 28 13:10:23 2021 +0200

    [PSDK] Do not compare to max value if we can make sure that the value fits 
in target type
    
    This fixes clang warning -Wtautological-constant-out-of-range-compare
---
 sdk/include/psdk/intsafe.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/include/psdk/intsafe.h b/sdk/include/psdk/intsafe.h
index 2dc0954b152..6404ed33663 100644
--- a/sdk/include/psdk/intsafe.h
+++ b/sdk/include/psdk/intsafe.h
@@ -259,7 +259,7 @@ INTSAFE_NAME(_Name)( \
     _In_ _TypeFrom Input, \
     _Out_ _Deref_out_range_(==, Input) _TypeTo *pOutput) \
 { \
-    if (Input <= _TypeTo ## _MAX) \
+    if ((sizeof(_TypeFrom) < sizeof(_TypeTo)) || (Input <= _TypeTo ## _MAX)) \
     { \
         *pOutput = (_TypeTo)Input; \
         return INTSAFE_SUCCESS; \

Reply via email to