diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rwxr-xr-x | win/configure | 67 | ||||
-rw-r--r-- | win/configure.in | 12 | ||||
-rw-r--r-- | xlib/xcolors.c | 51 |
4 files changed, 115 insertions, 21 deletions
@@ -1,3 +1,9 @@ +2012-02-26 Jan Nijtmans <nijtmans@users.sf.net> + + * xlib/xcolors.c: Provide fallback for _strtoi64 + * win/configure.in: Detect whether _strtoi64 is available + * win/configure: (regenerated) + 2012-02-25 Jan Nijtmans <nijtmans@users.sf.net> * win/tkWinDialog.c: [Bug 1913750]: tk_chooseDirectory -initialdir diff --git a/win/configure b/win/configure index 0c1f6e7..4f5501c 100755 --- a/win/configure +++ b/win/configure @@ -4090,6 +4090,73 @@ fi +#------------------------------------------- +# Check for _strtoi64 +#------------------------------------------- + +echo "$as_me:$LINENO: checking availability of _strtoi64" >&5 +echo $ECHO_N "checking availability of _strtoi64... $ECHO_C" >&6 +if test "${tcl_have_strtoi64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +int +main () +{ +_strtoi64(0,0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_have_strtoi64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_have_strtoi64=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_have_strtoi64" >&5 +echo "${ECHO_T}$tcl_have_strtoi64" >&6 +if test $tcl_have_strtoi64 = no; then + +cat >>confdefs.h <<\_ACEOF +#define NO_STRTOI64 1 +_ACEOF + +fi + #-------------------------------------------------------------------- # Windows XP theme engine header for Ttk #-------------------------------------------------------------------- diff --git a/win/configure.in b/win/configure.in index e24e2af..deed37d 100644 --- a/win/configure.in +++ b/win/configure.in @@ -98,6 +98,18 @@ SC_CONFIG_CFLAGS AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H") AC_SUBST(MAN2TCLFLAGS) +#------------------------------------------- +# Check for _strtoi64 +#------------------------------------------- + +AC_CACHE_CHECK([availability of _strtoi64], tcl_have_strtoi64, [ + AC_TRY_LINK([#include <stdlib.h>], + [_strtoi64(0,0,0)], + tcl_have_strtoi64=yes, tcl_have_strtoi64=no)]) +if test $tcl_have_strtoi64 = no; then + AC_DEFINE(NO_STRTOI64, 1, [Is _strtoi64 function available?]) +fi + #-------------------------------------------------------------------- # Windows XP theme engine header for Ttk #-------------------------------------------------------------------- diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 0f3085c..3a48faa 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c @@ -13,13 +13,6 @@ #include "tkInt.h" /* - * This value will be set to the number of colors in the color table - * the first time it is needed. - */ - -static int numXColors = 0; - -/* * Forward declarations for functions used only in this file. */ @@ -789,7 +782,6 @@ static const XColorEntry xColors[] = { { "yellow3", 205, 205, 0 }, { "yellow4", 139, 139, 0 }, { "YellowGreen", 154, 205, 50 }, - { NULL, 0, 0, 0 } }; /* @@ -818,23 +810,11 @@ FindColor( int l, u, r, i = 0; /* - * Count the number of elements in the color array if we haven't done so - * yet. - */ - - if (numXColors == 0) { - const XColorEntry *ePtr; - for (ePtr = xColors; ePtr->name != NULL; ePtr++) { - numXColors++; - } - } - - /* * Perform a binary search on the sorted array of colors. */ l = 0; - u = numXColors - 1; + u = sizeof(xColors)/sizeof(xColors[0]) - 1; while (l <= u) { i = (l + u) / 2; r = strcasecmp(name, xColors[i].name); @@ -871,6 +851,35 @@ FindColor( *---------------------------------------------------------------------- */ +#ifdef __WIN32__ +# ifdef NO_STRTOI64 +/* This version only handles hex-strings without 0x prefix */ +static __int64 +_strtoi64(const char *spec, char **p, int base) +{ + __int64 result = 0; + char c; + while ((c = *spec)) { + if ((c >= '0') && (c <= '9')) { + c -= '0'; + } else if ((c >= 'A') && (c <= 'F')) { + c += (10 - 'A'); + } else if ((c >= 'a') && (c <= 'f')) { + c += (10 - 'a'); + } else { + break; + } + result = (result << 4) + c; + ++spec; + } + *p = (char *) spec; + return result; +} +# endif +#else +# define _strtoi64 strtoll +#endif + Status XParseColor( Display *display, |