From ae707bf53694039c55ae485a246b5f037caaf2df Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 22 Feb 2002 09:04:47 +0000 Subject: Const-ifying declarations of strtoll/strtoull and new compat code. --- ChangeLog | 10 ++++++++++ compat/strtoll.c | 12 ++++++------ compat/strtoull.c | 12 ++++++------ unix/tclUnixPort.h | 10 +++++----- win/tclWinPort.h | 10 +++++----- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73e8e08..9cc9ef8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-02-22 Donal K. Fellows + + * compat/strtoll.c (strtoll): + * compat/strtoull.c (strtoull): + * unix/tclUnixPort.h: + * win/tclWinPort.h: Const-ing 64-bit compatability declarations. + Note that the return pointer is non-const because it is entirely + legal for the functions to be called from somewhere that owns the + string being passed. Fixes problem reported by Larry Virden. + 2002-02-21 David Gravereaux * win/mkd.bat (removed): diff --git a/compat/strtoll.c b/compat/strtoll.c index 1105040..2ae6b0a 100644 --- a/compat/strtoll.c +++ b/compat/strtoll.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: strtoll.c,v 1.3 2002/02/15 23:42:12 kennykb Exp $ + * RCS: @(#) $Id: strtoll.c,v 1.4 2002/02/22 09:04:48 dkf Exp $ */ #include "tcl.h" @@ -41,7 +41,7 @@ Tcl_WideInt strtoll(string, endPtr, base) - char *string; /* String of ASCII digits, possibly + CONST char *string; /* String of ASCII digits, possibly * preceded by white space. For bases * greater than 10, either lower- or * upper-case digits may be used. @@ -55,8 +55,8 @@ strtoll(string, endPtr, base) * else means decimal. */ { - register char *p; - Tcl_WideInt result; + register CONST char *p; + Tcl_WideInt result = Tcl_LongAsWide(0); Tcl_WideUInt uwResult; /* @@ -64,7 +64,7 @@ strtoll(string, endPtr, base) */ p = string; - while (isspace(*p)) { + while (isspace(UCHAR(*p))) { p += 1; } @@ -100,7 +100,7 @@ strtoll(string, endPtr, base) } } if ((result == 0) && (endPtr != 0) && (*endPtr == p)) { - *endPtr = string; + *endPtr = (char *) string; } return result; } diff --git a/compat/strtoull.c b/compat/strtoull.c index af508d0..9544d71 100644 --- a/compat/strtoull.c +++ b/compat/strtoull.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: strtoull.c,v 1.3 2002/02/15 23:42:12 kennykb Exp $ + * RCS: @(#) $Id: strtoull.c,v 1.4 2002/02/22 09:04:48 dkf Exp $ */ #include "tcl.h" @@ -56,7 +56,7 @@ static char cvtIn[] = { Tcl_WideUInt strtoull(string, endPtr, base) - char *string; /* String of ASCII digits, possibly + CONST char *string; /* String of ASCII digits, possibly * preceded by white space. For bases * greater than 10, either lower- or * upper-case digits may be used. @@ -70,7 +70,7 @@ strtoull(string, endPtr, base) * else means decimal. */ { - register char *p; + register CONST char *p; register Tcl_WideUInt result = 0; register unsigned digit; register Tcl_WideUInt shifted; @@ -81,7 +81,7 @@ strtoull(string, endPtr, base) */ p = string; - while (isspace(*p)) { /* INTL: locale-dependent */ + while (isspace(UCHAR(*p))) { /* INTL: locale-dependent */ p += 1; } @@ -229,7 +229,7 @@ strtoull(string, endPtr, base) } if (endPtr != 0) { - *endPtr = p; + *endPtr = (char *) p; } return result; @@ -251,7 +251,7 @@ strtoull(string, endPtr, base) break; } } - *endPtr = p; + *endPtr = (char *) p; } return (Tcl_WideUInt)Tcl_LongAsWide(-1); } diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 0b994f2..57d23f2 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.22 2002/02/16 01:17:36 hobbs Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.23 2002/02/22 09:04:48 dkf Exp $ */ #ifndef _TCLUNIXPORT @@ -86,10 +86,10 @@ typedef off_t Tcl_SeekOffset; #endif #if !HAVE_STRTOLL && defined(TCL_WIDE_INT_TYPE) -EXTERN Tcl_WideInt strtoll _ANSI_ARGS_((char *string, char **endPtr, - int base)); -EXTERN Tcl_WideUInt strtoull _ANSI_ARGS_((char *string, char **endPtr, - int base)); +EXTERN Tcl_WideInt strtoll _ANSI_ARGS_((CONST char *string, + char **endPtr, int base)); +EXTERN Tcl_WideUInt strtoull _ANSI_ARGS_((CONST char *string, + char **endPtr, int base)); #endif #include diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 193e366..c1b3189 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPort.h,v 1.26 2002/02/15 14:28:51 dkf Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.27 2002/02/22 09:04:48 dkf Exp $ */ #ifndef _TCLWINPORT @@ -469,10 +469,10 @@ typedef int TclpMutex; #endif /* TCL_THREADS */ #ifdef TCL_WIDE_INT_TYPE -EXTERN Tcl_WideInt strtoll _ANSI_ARGS_((char *string, char **endPtr, - int base)); -EXTERN Tcl_WideUInt strtoull _ANSI_ARGS_((char *string, char **endPtr, - int base)); +EXTERN Tcl_WideInt strtoll _ANSI_ARGS_((CONST char *string, + char **endPtr, int base)); +EXTERN Tcl_WideUInt strtoull _ANSI_ARGS_((CONST char *string, + char **endPtr, int base)); #endif /* TCL_WIDE_INT_TYPE */ #ifndef INVALID_SET_FILE_POINTER -- cgit v0.12