X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5b8ee5dec95988e3931c5394fbeb607e48fb2931..a4ea083bbdf710d3234dcbd2eafb5d0e078f8348:/src/common/longlong.cpp?ds=sidebyside diff --git a/src/common/longlong.cpp b/src/common/longlong.cpp index e951865bff..e57392b788 100644 --- a/src/common/longlong.cpp +++ b/src/common/longlong.cpp @@ -6,7 +6,6 @@ // not documented and is for private use only. // Modified by: // Created: 10.02.99 -// RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -133,6 +132,22 @@ wxULongLongNative& wxULongLongNative::operator=(const class wxULongLongWx &ll) } #endif +#ifdef __VISUALC6__ +double wxULongLongNative::ToDouble() const +{ + // Work around the problem of casting unsigned __int64 to double in VC6 + // (which for unknown reasons only manifests itself in DLL builds, i.e. + // when using /MD). + static const __int64 int64_t_max = 9223372036854775807i64; + if ( m_ll <= int64_t_max ) + return wx_truncate_cast(double, (wxLongLong_t)m_ll); + + double d = wx_truncate_cast(double, int64_t_max); + d += (__int64)(m_ll - int64_t_max - 1); // The cast is safe because of -1 + return d + 1; +} +#endif // __VISUALC6__ + #endif // wxUSE_LONGLONG_NATIVE // ============================================================================ @@ -1172,7 +1187,7 @@ void *wxULongLongWx::asArray(void) const while ( ll != 0 ) \ { \ long digit = (ll % 10).ToLong(); \ - result.Prepend((wxChar)(_T('0') - digit)); \ + result.Prepend((wxChar)(wxT('0') - digit)); \ ll /= 10; \ } \ } \ @@ -1181,15 +1196,15 @@ void *wxULongLongWx::asArray(void) const while ( ll != 0 ) \ { \ long digit = (ll % 10).ToLong(); \ - result.Prepend((wxChar)(_T('0') + digit)); \ + result.Prepend((wxChar)(wxT('0') + digit)); \ ll /= 10; \ } \ } \ \ if ( result.empty() ) \ - result = _T('0'); \ + result = wxT('0'); \ else if ( neg ) \ - result.Prepend(_T('-')); \ + result.Prepend(wxT('-')); \ \ return result; \ } @@ -1204,12 +1219,12 @@ void *wxULongLongWx::asArray(void) const \ while ( ll != 0 ) \ { \ - result.Prepend((wxChar)(_T('0') + (ll % 10).ToULong())); \ + result.Prepend((wxChar)(wxT('0') + (ll % 10).ToULong())); \ ll /= 10; \ } \ \ if ( result.empty() ) \ - result = _T('0'); \ + result = wxT('0'); \ \ return result; \ } @@ -1263,7 +1278,7 @@ WXDLLIMPEXP_BASE wxTextOutputStream& operator<< (wxTextOutputStream& o, const wx return o << ll.ToString(); } -#define READ_STRING_CHAR(s, idx, len) ((wxChar) ((idx!=len) ? s[idx++] : 0)) +#define READ_STRING_CHAR(s, idx, len) ((idx!=len) ? (wxChar)s[idx++] : wxT('\0')) WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxULongLong &ll) {