summaryrefslogtreecommitdiffstats
path: root/compat/strtoll.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2002-02-24 02:53:25 (GMT)
committerdgp <dgp@users.sourceforge.net>2002-02-24 02:53:25 (GMT)
commita0211643722bd3be1a1b6a97595bfc96720edb98 (patch)
tree6218488a2214453fe2c2ddca22777e70958184f2 /compat/strtoll.c
parentf21907fb023f9ce87e222745ee167b897e08a98b (diff)
downloadtcl-a0211643722bd3be1a1b6a97595bfc96720edb98.zip
tcl-a0211643722bd3be1a1b6a97595bfc96720edb98.tar.gz
tcl-a0211643722bd3be1a1b6a97595bfc96720edb98.tar.bz2
* compat/strtoull.c (strtoull):
* compat/strtoll.c (strtoll): * compat/strtoul.c (strtoul): Fixed failure to handle leading sign symbols '+' and '-' and '0X' and raise overflow errors. [Bug 440916] Also corrects prototype and errno problems.
Diffstat (limited to 'compat/strtoll.c')
-rw-r--r--compat/strtoll.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/compat/strtoll.c b/compat/strtoll.c
index 2ae6b0a..ca00fd0 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.4 2002/02/22 09:04:48 dkf Exp $
+ * RCS: @(#) $Id: strtoll.c,v 1.5 2002/02/24 02:53:25 dgp Exp $
*/
#include "tcl.h"
@@ -22,7 +22,7 @@
/*
*----------------------------------------------------------------------
*
- * strtol --
+ * strtoll --
*
* Convert an ASCII string into an integer.
*
@@ -39,7 +39,11 @@
*----------------------------------------------------------------------
*/
+#if TCL_WIDE_INT_IS_LONG
+long long
+#else
Tcl_WideInt
+#endif
strtoll(string, endPtr, base)
CONST char *string; /* String of ASCII digits, possibly
* preceded by white space. For bases
@@ -72,6 +76,7 @@ strtoll(string, endPtr, base)
* Check for a sign.
*/
+ errno = 0;
if (*p == '-') {
p += 1;
uwResult = strtoull(p, endPtr, base);