From: Paul Cornett Date: Wed, 9 Jan 2008 07:35:14 +0000 (+0000) Subject: avoid undefined behavior from token paste resulting in more than one token X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/94eff479bfad9fd9d1f65bd375ef4ea9bf667c43 avoid undefined behavior from token paste resulting in more than one token git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/defs.h b/include/wx/defs.h index 4d4b4bbf69..44704739c5 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -928,7 +928,7 @@ typedef wxUint32 wxDword; #define wxINT64_MIN LLONG_MIN #else #define wxINT64_MAX wxLL(9223372036854775807) - #define wxINT64_MIN wxLL(-9223372036854775807-1) + #define wxINT64_MIN (wxLL(-9223372036854775807)-1) #endif /* diff --git a/src/common/wxcrt.cpp b/src/common/wxcrt.cpp index 9ae281d008..c329848585 100644 --- a/src/common/wxcrt.cpp +++ b/src/common/wxcrt.cpp @@ -1039,12 +1039,9 @@ static wxLongLong_t wxCRT_DoStrtoll(const T* nptr, T** endptr, int base) if ( sign == wxT('-') ) { - if ( uval <= wxULL(wxINT64_MAX+1) ) + if (uval <= (wxULongLong_t)wxINT64_MAX + 1) { - if ( uval == wxULL(wxINT64_MAX+1)) - val = -((wxLongLong_t)wxINT64_MAX) - 1; - else - val = -((wxLongLong_t)uval); + val = -(wxLongLong_t)uval; } else {