From 87e64a237bf67100b6a36e60495908b5687ee95a Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 19 Oct 2007 03:35:49 +0000 Subject: [PATCH] [perl5] Clear errno before calls to strtol(), strtoul(), strtoll() and strtoull() which we check errno after to avoid seeing a junk value of errno if there isn't an error in the call. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10013 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 5 +++++ Lib/perl5/perlprimtypes.swg | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 1a73c520f..100f67b6f 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,11 @@ Version 1.3.32 (in progress) ============================ +10/19/2007: olly + [perl5] Clear errno before calls to strtol(), strtoul(), strtoll() + and strtoull() which we check errno after to avoid seeing a junk + value of errno if there isn't an error in the call. + 10/16/2007: wsfulton Deprecate %attribute_ref and replace with %attributeref. There is just an argument order change in order to maintain consistency with %attribute, from: diff --git a/Lib/perl5/perlprimtypes.swg b/Lib/perl5/perlprimtypes.swg index a4f0104ee..d075198e5 100644 --- a/Lib/perl5/perlprimtypes.swg +++ b/Lib/perl5/perlprimtypes.swg @@ -63,7 +63,9 @@ SWIG_AsVal_dec(long)(SV *obj, long* val) const char *nptr = SvPV(obj, PL_na); if (nptr) { char *endptr; - long v = strtol(nptr, &endptr,0); + long v; + errno = 0; + v = strtol(nptr, &endptr,0); if (errno == ERANGE) { errno = 0; return SWIG_OverflowError; @@ -121,7 +123,9 @@ SWIG_AsVal_dec(unsigned long)(SV *obj, unsigned long *val) const char *nptr = SvPV(obj, PL_na); if (nptr) { char *endptr; - unsigned long v = strtoul(nptr, &endptr,0); + unsigned long v; + errno = 0; + v = strtoul(nptr, &endptr,0); if (errno == ERANGE) { errno = 0; return SWIG_OverflowError; @@ -182,7 +186,9 @@ SWIG_AsVal_dec(long long)(SV *obj, long long *val) const char *nptr = SvPV(obj, PL_na); if (nptr) { char *endptr; - long long v = strtoll(nptr, &endptr,0); + long long v; + errno = 0; + v = strtoll(nptr, &endptr,0); if (errno == ERANGE) { errno = 0; return SWIG_OverflowError; @@ -252,7 +258,9 @@ SWIG_AsVal_dec(unsigned long long)(SV *obj, unsigned long long *val) const char *nptr = SvPV(obj, PL_na); if (nptr) { char *endptr; - unsigned long long v = strtoull(nptr, &endptr,0); + unsigned long long v; + errno = 0; + v = strtoull(nptr, &endptr,0); if (errno == ERANGE) { errno = 0; return SWIG_OverflowError;