From febd3dcaf881ca5654a1331196686b5a4e948402 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 2 Jun 2009 13:43:32 +0000 Subject: [PATCH] added wxUINTn_MAX constants; document them together with the existing wxINTn_MIN/MAX ones git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 10 ++++++++-- interface/wx/defs.h | 28 ++++++++++++++++++++++++++++ src/propgrid/props.cpp | 10 +--------- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 8c99a2c7de..a557cea9c3 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -916,16 +916,20 @@ typedef wxUint16 wxWord; /* also define C99-like sized MIN/MAX constants */ #define wxINT8_MIN CHAR_MIN #define wxINT8_MAX CHAR_MAX +#define wxUINT8_MAX UCHAR_MAX #define wxINT16_MIN SHRT_MIN #define wxINT16_MAX SHRT_MAX +#define wxUINT16_MAX USHRT_MAX #if SIZEOF_INT == 4 #define wxINT32_MIN INT_MIN #define wxINT32_MAX INT_MAX + #define wxUINT32_MAX UINT_MAX #elif SIZEOF_LONG == 4 #define wxINT32_MIN LONG_MIN #define wxINT32_MAX LONG_MAX + #define wxUINT32_MAX ULONG_MAX #else #error "Unknown 32 bit type" #endif @@ -933,11 +937,13 @@ typedef wxUint16 wxWord; typedef wxUint32 wxDword; #ifdef LLONG_MAX - #define wxINT64_MAX LLONG_MAX #define wxINT64_MIN LLONG_MIN + #define wxINT64_MAX LLONG_MAX + #define wxUINT64_MAX ULLONG_MAX #else - #define wxINT64_MAX wxLL(9223372036854775807) #define wxINT64_MIN (wxLL(-9223372036854775807)-1) + #define wxINT64_MAX wxLL(9223372036854775807) + #define wxUINT64_MAX wxULL(0xFFFFFFFFFFFFFFFF) #endif /* 64 bit */ diff --git a/interface/wx/defs.h b/interface/wx/defs.h index 924470bed1..cb756d8ca2 100644 --- a/interface/wx/defs.h +++ b/interface/wx/defs.h @@ -776,6 +776,34 @@ enum wxUpdateUI }; +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +/** + C99-like sized MIN/MAX constants for all integer types. + + For each @c n in the set 8, 16, 32, 64 we define @c wxINTn_MIN, @c + wxINTn_MAX and @c wxUINTc_MAX (@c wxUINTc_MIN is always 0 and so is not + defined). + */ +//@{ +#define wxINT8_MIN CHAR_MIN +#define wxINT8_MAX CHAR_MAX +#define wxUINT8_MAX UCHAR_MAX + +#define wxINT16_MIN SHRT_MIN +#define wxINT16_MAX SHRT_MAX +#define wxUINT16_MAX USHRT_MAX + +#define wxINT32_MIN INT_MIN-or-LONG_MIN +#define wxINT32_MAX INT_MAX-or-LONG_MAX +#define wxUINT32_MAX UINT_MAX-or-LONG_MAX + +#define wxINT64_MIN LLONG_MIN +#define wxINT64_MAX LLONG_MAX +#define wxUINT64_MAX ULLONG_MAX +//@} // ---------------------------------------------------------------------------- // types diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index d1bd9eaf38..97d5c1ad45 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -478,21 +478,13 @@ bool wxUIntProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(ar return false; } -#ifdef ULLONG_MAX - #define wxUINT64_MAX ULLONG_MAX - #define wxUINT64_MIN wxULL(0) -#else - #define wxUINT64_MAX wxULL(0xFFFFFFFFFFFFFFFF) - #define wxUINT64_MIN wxULL(0) -#endif - bool wxUIntProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& validationInfo ) const { // Check for min/max wxULongLong_t ll; if ( wxPGVariantToULongLong(value, &ll) ) { - wxULongLong_t min = wxUINT64_MIN; + wxULongLong_t min = 0; wxULongLong_t max = wxUINT64_MAX; wxVariant variant; -- 2.45.2