diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-10-22 08:32:21 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-10-22 08:32:21 (GMT) |
commit | daf41a1547accd08cb2e0a0ba22c735c7bef663e (patch) | |
tree | 0f579affff4112654729367d4381bc7c36c2811d /macosx | |
parent | af8c392558252e9cc2550c8b32e5a254569f29eb (diff) | |
download | tk-daf41a1547accd08cb2e0a0ba22c735c7bef663e.zip tk-daf41a1547accd08cb2e0a0ba22c735c7bef663e.tar.gz tk-daf41a1547accd08cb2e0a0ba22c735c7bef663e.tar.bz2 |
Fix [Bug 2883712] by factoring out the problem code.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/ttkMacOSXTheme.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index bc8a35b..fd8f6d3 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -29,7 +29,7 @@ * top-level window, not to the Tk_Window. BoxToRect() * accounts for this. * - * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.28 2009/07/15 21:50:40 das Exp $ + * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.29 2009/10/22 08:32:23 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -46,6 +46,12 @@ #define HIOrientation kHIThemeOrientationNormal +#ifdef __LP64__ +#define RangeToFactor(maximum) (((double) (INT_MAX >> 1)) / (maximum)) +#else +#define RangeToFactor(maximum) (((double) (LONG_MAX >> 1)) / (maximum)) +#endif /* __LP64__ */ + /*---------------------------------------------------------------------- * +++ Utilities. */ @@ -627,7 +633,7 @@ static void TrackElementDraw( Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); Tcl_GetDoubleFromObj(NULL, elem->toObj, &to); Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); - factor = ((double)(LONG_MAX>>1))/(to - from); + factor = RangeToFactor(to - from); HIThemeTrackDrawInfo info = { .version = 0, @@ -739,7 +745,7 @@ static void PbarElementDraw( Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); - factor = ((double)(LONG_MAX>>1))/maximum; + factor = RangeToFactor(maximum); HIThemeTrackDrawInfo info = { .version = 0, |