diff options
author | Kevin B Kenny <kennykb@acm.org> | 2004-09-11 18:57:56 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2004-09-11 18:57:56 (GMT) |
commit | e1dec685e9bda26a664969e11607fabc328c582c (patch) | |
tree | 1d2452bcda99b379a6cff5ce3eb4924082bc5153 /generic | |
parent | 80f7a77b4a8d0abf89b50cc8fc656420bde8fed0 (diff) | |
download | tcl-e1dec685e9bda26a664969e11607fabc328c582c.zip tcl-e1dec685e9bda26a664969e11607fabc328c582c.tar.gz tcl-e1dec685e9bda26a664969e11607fabc328c582c.tar.bz2 |
* generic/tclClock.c (TclMktimeObjCmd): Corrected a bad check
for error return from 'mktime'.
* generic/tclObj.c (Tcl_GetIntFromObj): Corrected a problem where
demoting a wide to an int failed on a big-endian machine.
[Bug 1026125].
* tests/clock.test (clock-43.1): Added regression test for
error return from 'mktime'.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclClock.c | 7 | ||||
-rw-r--r-- | generic/tclObj.c | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index e348d58..2f54977 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.31 2004/09/08 15:38:33 kennykb Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.32 2004/09/11 18:57:56 kennykb Exp $ */ #include "tclInt.h" @@ -224,6 +224,7 @@ TclClockMktimeObjCmd( ClientData clientData, int i; struct tm toConvert; /* Time to be converted */ time_t convertedTime; /* Time converted from mktime */ + int localErrno; /* Convert parameters */ @@ -265,12 +266,14 @@ TclClockMktimeObjCmd( ClientData clientData, TzsetIfNecessary(); Tcl_MutexLock( &clockMutex ); + errno = 0; convertedTime = mktime( &toConvert ); + localErrno = errno; Tcl_MutexUnlock( &clockMutex ); /* Return the converted time, or an error if conversion fails */ - if ( convertedTime == -1 ) { + if ( localErrno != 0 ) { Tcl_SetObjResult ( interp, Tcl_NewStringObj( "time value too large/small to represent", diff --git a/generic/tclObj.c b/generic/tclObj.c index 7c9fb47..d681a26 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.65 2004/09/10 22:43:52 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.66 2004/09/11 18:57:56 kennykb Exp $ */ #include "tclInt.h" @@ -1961,7 +1961,7 @@ Tcl_GetIntFromObj(interp, objPtr, intPtr) } if (((long)((int)l)) == l) { - *intPtr = (int)objPtr->internalRep.longValue; + *intPtr = (int)l; return TCL_OK; } #ifndef TCL_WIDE_INT_IS_LONG |