From 982d7f931701e2d65182f798e9182139efd67ed7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 22 Oct 2009 11:18:02 +0000 Subject: [PATCH] Fix UseUintMax definition used by wxAny for VC6. The old code tried to work around the lack of unsigned __int64 to double conversion in VC6 by casting from UseUintMax to wxAnyBaseIntType but this was wrong as this value was -1 when cast to wxAnyBaseIntType (__int64) and so UseUintMaxF was defined as -1.0. Use a slightly uglier but simpler work around now: just define the constants as macros instead of (typed) variables and let the compiler deal with literal values on its own (which it does correctly). This fixes the unit test failure: conversion from double to unsigned always failed when using VC6. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/any.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/common/any.cpp b/src/common/any.cpp index 1b12110c3f..ff7b1c8a30 100644 --- a/src/common/any.cpp +++ b/src/common/any.cpp @@ -112,27 +112,23 @@ wxAnyValueType::wxAnyValueType() // // Define integer minimum and maximum as helpers #ifdef wxLongLong_t -const wxAnyBaseIntType UseIntMin = wxINT64_MIN; -const wxAnyBaseUintType UseIntMax = wxINT64_MAX; -const wxAnyBaseUintType UseUintMax = wxUINT64_MAX; + #define UseIntMin (wxINT64_MIN) + #define UseIntMax (wxINT64_MAX) + #define UseUintMax (wxUINT64_MAX) #else -const wxAnyBaseIntType UseIntMin = LONG_MIN; -const wxAnyBaseUintType UseUintMax = ULONG_MAX; -const wxAnyBaseUintType UseIntMax = LONG_MAX; + #define UseIntMin (LONG_MIN) + #define UseIntMax (LONG_MAX) + #define UseUintMax (ULONG_MAX) #endif +namespace +{ + const double UseIntMinF = static_cast(UseIntMin); -#ifndef __VISUALC6__ const double UseIntMaxF = static_cast(UseIntMax); const double UseUintMaxF = static_cast(UseUintMax); -#else -// VC6 doesn't implement conversion from unsigned __int64 to double -const wxAnyBaseIntType UseIntMax0 = static_cast(UseIntMax); -const wxAnyBaseIntType UseUintMax0 = static_cast(UseUintMax); -const double UseIntMaxF = static_cast(UseIntMax0); -const double UseUintMaxF = static_cast(UseUintMax0); -#endif +} // anonymous namespace bool wxAnyValueTypeImplInt::ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, -- 2.47.2