From daf41a1547accd08cb2e0a0ba22c735c7bef663e Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 22 Oct 2009 08:32:21 +0000 Subject: Fix [Bug 2883712] by factoring out the problem code. --- ChangeLog | 38 +++++++++++++++++++++----------------- macosx/ttkMacOSXTheme.c | 12 +++++++++--- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index c137173..f728108 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,13 @@ +2009-10-22 Donal K. Fellows + + * macosx/ttkMacOSXTheme.c (RangeToFactor): [Bug 2883712]: Factor out + some common code and make sure that it is 64-bit correct. + 2009-10-21 Jan Nijtmans - * win/Makefile.in: Bug fix for #2875562 - * win/winMain.c: Make sure that winMain.c and tkAppInit.c - * unix/tkAppInit.c are never compiled with stubs. + * win/Makefile.in: [Bug 2875562]: Make sure that winMain.c and + * win/winMain.c: tkAppInit.c are never compiled with stubs. + * unix/tkAppInit.c: 2009-10-20 Don Porter @@ -16,9 +21,8 @@ 2009-10-20 Andreas Kupries - * library/msgs/pl.msg: Applied patch to Polish message catalog - created and submitted by Pawel Pawlak (via - JeffH). + * library/msgs/pl.msg: Applied patch to Polish message catalog created + and submitted by Pawel Pawlak (via JeffH). 2009-10-18 Donal K. Fellows @@ -333,7 +337,7 @@ 2009-06-29 Daniel Steffen Merge of TkAqua Cocoa port - *** POTENTIAL INCOMPATIBILITY *** + *** POTENTIAL INCOMPATIBILITY *** * macosx/tkMacOSX.h: Large-scale rewrite of TkAqua migrating * macosx/tkMacOSXBitmap.c: all use of deprecated Carbon API to @@ -532,9 +536,9 @@ * library/images/lamp.svg: Added an SVG version of the Tk lamp and * library/images/lamp.png: a pre-rendered PNG version. - * win/rc/wish.ico: Wish gets a new icon using the SVG lamp and the - * win/rc/tk.ico: tk dll gets the tcl rendered feather. This - provides improved icons for Vista/Windows 7. + * win/rc/wish.ico: Wish gets a new icon using the SVG lamp and the tk + * win/rc/tk.ico: dll gets the tcl rendered feather. This provides + improved icons for Vista/Windows 7. 2009-05-05 Donal K. Fellows @@ -897,17 +901,17 @@ * unix/tcl.m4: Corrected a typo ($(SHLIB_VERSION) should be ${SHLIB_VERSION}). * unix/configure: Autoconf 2.59 - + 2009-01-19 Kevin B. Kenny * unix/Makefile.in: Added a CONFIG_INSTALL_DIR parameter so that * unix/tcl.m4: distributors can control where tclConfig.sh goes. Made the installation of 'ldAix' conditional upon actually being on an AIX system. Allowed for downstream packagers to customize - SHLIB_VERSION on BSD-derived systems. + SHLIB_VERSION on BSD-derived systems. Thanks to Stuart Cassoff for [Patch 907924]. * unix/configure: Autoconf 2.59 - + 2009-01-16 Don Porter * generic/tk.h: Bump patchlevel to 8.6b1.1 to distinguish @@ -1149,8 +1153,8 @@ * macosx/tkMacOSXFont.h: * macosx/Wish.xcodeproj/project.pbxproj: * library/fontchooser.tcl (new): - * library/tclIndex: - * library/msgs/de.msg: + * library/tclIndex: + * library/msgs/de.msg: * library/msgs/en.msg: * tests/fontchooser.test (new): * tests/winDialog.test: @@ -1247,7 +1251,7 @@ 2008-12-04 Donal K. Fellows - * doc/ttk_button.n, doc/ttk_checkbutton.n, doc/ttk_menubutton.n: + * doc/ttk_button.n, doc/ttk_checkbutton.n, doc/ttk_menubutton.n: * doc/ttk_radiobutton.n: Added mention of the Toolbutton style to all widgets that can sensibly make use of it. @@ -1596,7 +1600,7 @@ library/ttk/entry.tcl, library/ttk/paned.tcl, library/ttk/sizegrip.tcl, library/treeview.tcl: Add correct platform-specific cursors for OSX [Bug 2054562] - Expanded set of symbolic cursors. Use correct cursor for + Expanded set of symbolic cursors. Use correct cursor for ttk::entry and ttk::combobox widgets [Bug 1534835] 2008-10-28 Don Porter 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, -- cgit v0.12