Skip to content

Commit a3763c6

Browse files
committed
[PSDK][NDK] Use hex to define MIN/MAX constants like in native SDK
This fixes use of unary minus operator on unsigned type warning.
1 parent 2289deb commit a3763c6

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

ntoskrnl/ke/wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ KeWaitForSingleObject(IN PVOID Object,
470470
(Thread == CurrentObject->OwnerThread))
471471
{
472472
/* Just unwait this guy and exit */
473-
if (CurrentObject->Header.SignalState != (LONG)MINLONG)
473+
if (CurrentObject->Header.SignalState != MINLONG)
474474
{
475475
/* It has a normal signal state. Unwait and return */
476476
KiSatisfyMutantWait(CurrentObject, Thread);

sdk/include/ndk/umtypes.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ Header Name:
108108
//
109109
// Limits
110110
//
111-
#define MINCHAR (-128)
112-
#define MAXCHAR 127
113-
#define MINSHORT (-32768)
114-
#define MAXSHORT 32767
115-
#define MINLONG (-2147483648)
116-
#define MAXLONG 2147483647
111+
#define MINCHAR 0x80
112+
#define MAXCHAR 0x7f
113+
#define MINSHORT 0x8000
114+
#define MAXSHORT 0x7fff
115+
#define MINLONG 0x80000000
116+
#define MAXLONG 0x7fffffff
117117
#define MAXUCHAR 0xff
118118
#define MAXUSHORT 0xffff
119119
#define MAXULONG 0xffffffff

sdk/include/xdk/ntbasedef.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,12 @@ extern "C++" { \
735735
#define COMPILETIME_OR_5FLAGS(a,b,c,d,e) ((UINT)(a)|(UINT)(b)|(UINT)(c)|(UINT)(d)|(UINT)(e))
736736

737737
/* Type Limits */
738-
#define MINCHAR (-128)
739-
#define MAXCHAR 127
740-
#define MINSHORT (-32768)
741-
#define MAXSHORT 32767
742-
#define MINLONG (-2147483648)
743-
#define MAXLONG 2147483647
738+
#define MINCHAR 0x80
739+
#define MAXCHAR 0x7f
740+
#define MINSHORT 0x8000
741+
#define MAXSHORT 0x7fff
742+
#define MINLONG 0x80000000
743+
#define MAXLONG 0x7fffffff
744744
$if(_NTDEF_)
745745
#define MAXUCHAR 0xff
746746
#define MAXUSHORT 0xffff

0 commit comments

Comments
 (0)