From 2534806dbf61a11a318e1e999e4ab37863602e2e Mon Sep 17 00:00:00 2001 From: davygrvy Date: Tue, 16 Dec 2003 02:55:38 +0000 Subject: * win/tclWinFile.c (TclpUtime) : utimbuf struct not a problem with Borland. * win/tclWinTime.c (TclpGetDate) : Borland's localtime() has a slight behavioral difference. From Helmut Giese [Patch 758097]. --- ChangeLog | 14 +++++++++++--- win/tclWinFile.c | 12 ++++++++++-- win/tclWinTime.c | 15 ++++++++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0391e4b..5fcdc8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,16 @@ 2003-12-15 David Gravereaux - * wintclsh.rc: Slight modification to the STRINGIFY macro to - support Borland's rc tool. From Helmut Giese - . + * win/tcl.rc: + * win/tclsh.rc: Slight modification to the STRINGIFY macro to + support Borland's rc tool. + + * win/tclWinFile.c (TclpUtime) : utimbuf struct not a problem + with Borland. + + * win/tclWinTime.c (TclpGetDate) : Borland's localtime() has + a slight behavioral difference. + + From Helmut Giese [Patch 758097]. 2003-12-14 David Gravereaux diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 697bff3..a000802 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.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: tclWinFile.c,v 1.57 2003/12/12 17:09:27 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.58 2003/12/16 02:55:38 davygrvy Exp $ */ //#define _WIN32_WINNT 0x0500 @@ -2505,12 +2505,20 @@ TclpUtime(pathPtr, tval) struct utimbuf *tval; /* New modification date structure */ { int res; +#ifndef __BORLANDC__ /* * Windows uses a slightly different structure name and, possibly, * contents, so we have to copy the information over */ struct _utimbuf buf; - +#else + /* + * Borland's compiler does not, but we still copy the content into a + * local variable using the 'generic' name + */ + struct utimbuf buf; +#endif + buf.actime = tval->actime; buf.modtime = tval->modtime; diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 39057cd..396adfa 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.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: tclWinTime.c,v 1.20 2003/08/27 19:50:07 davygrvy Exp $ + * RCS: @(#) $Id: tclWinTime.c,v 1.21 2003/12/16 02:55:38 davygrvy Exp $ */ #include "tclWinInt.h" @@ -561,7 +561,20 @@ TclpGetDate(t, useGMT) * algorithm ignores daylight savings time before the epoch. */ + /* + Hm, Borland's localtime manages to return NULL under certain + circumstances (e.g. wintime.test, test 1.2). Nobody tests for this, + since 'localtime' isn't supposed to do this, possibly leading to + crashes. + Patch: We only call this function if we are at least one day into + the epoch, else we handle it ourselves (like we do for times < 0). + H. Giese, June 2003 + */ +#ifdef __BORLANDC__ + if (*tp >= SECSPERDAY) { +#else if (*tp >= 0) { +#endif return localtime(tp); } -- cgit v0.12