From 1a6eff809b4d5e97aa1d93d21be5c807a5649468 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Tue, 15 Apr 2003 20:59:04 +0000 Subject: Corrected use of types to make compilation compatible with VC++5. --- ChangeLog | 2 ++ win/tclWinTime.c | 74 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49f4224..fc6eda9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ * makefile.vc: Updated makefile.vc to conform with Mo DeJong's changes to Makefile.in and tclWinPipe.c on 2003-04-14. Now passes TCL_PIPE_DLL in place of TCL_DBGX. + * win/tclWinTime.c: Corrected use of types to make compilation + compatible with VC++5. 2003-04-15 Vince Darley diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 975b78f..826fae5 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.16 2003/04/14 02:36:58 mdejong Exp $ + * RCS: @(#) $Id: tclWinTime.c,v 1.17 2003/04/15 20:59:10 kennykb Exp $ */ #include "tclWinInt.h" @@ -89,9 +89,9 @@ typedef struct TimeInfo { * Data used in developing the estimate of performance counter * frequency */ - ULONGLONG fileTimeSample[SAMPLES]; + Tcl_WideUInt fileTimeSample[SAMPLES]; /* Last 64 samples of system time */ - LONGLONG perfCounterSample[SAMPLES]; + Tcl_WideInt perfCounterSample[SAMPLES]; /* Last 64 samples of performance counter */ int sampleNo; /* Current sample number */ @@ -106,10 +106,10 @@ static TimeInfo timeInfo = { (HANDLE) NULL, (HANDLE) NULL, #ifdef HAVE_CAST_TO_UNION - (LARGE_INTEGER) (LONGLONG) 0, + (LARGE_INTEGER) (Tcl_WideInt) 0, (ULARGE_INTEGER) (DWORDLONG) 0, - (LARGE_INTEGER) (LONGLONG) 0, - (LARGE_INTEGER) (LONGLONG) 0, + (LARGE_INTEGER) (Tcl_WideInt) 0, + (LARGE_INTEGER) (Tcl_WideInt) 0, #else 0, 0, @@ -132,13 +132,13 @@ static void StopCalibration _ANSI_ARGS_(( ClientData )); static DWORD WINAPI CalibrationThread _ANSI_ARGS_(( LPVOID arg )); static void UpdateTimeEachSecond _ANSI_ARGS_(( void )); static void ResetCounterSamples _ANSI_ARGS_(( - ULONGLONG fileTime, - LONGLONG perfCounter, - LONGLONG perfFreq + Tcl_WideUInt fileTime, + Tcl_WideInt perfCounter, + Tcl_WideInt perfFreq )); -static LONGLONG AccumulateSample _ANSI_ARGS_(( - LONGLONG perfCounter, - ULONGLONG fileTime +static Tcl_WideInt AccumulateSample _ANSI_ARGS_(( + Tcl_WideInt perfCounter, + Tcl_WideUInt fileTime )); /* @@ -307,10 +307,10 @@ Tcl_GetTime(timePtr) if ( timeInfo.perfCounterAvailable /* The following lines would do an exact match on * crystal frequency: - * && timeInfo.nominalFreq.QuadPart != (LONGLONG) 1193182 - * && timeInfo.nominalFreq.QuadPart != (LONGLONG) 3579545 + * && timeInfo.nominalFreq.QuadPart != (Tcl_WideInt) 1193182 + * && timeInfo.nominalFreq.QuadPart != (Tcl_WideInt) 3579545 */ - && timeInfo.nominalFreq.QuadPart > (LONGLONG) 15000000 ) { + && timeInfo.nominalFreq.QuadPart > (Tcl_WideInt) 15000000 ) { timeInfo.perfCounterAvailable = FALSE; } @@ -358,7 +358,7 @@ Tcl_GetTime(timePtr) LARGE_INTEGER curCounter; /* Current performance counter */ - LONGLONG curFileTime; + Tcl_WideInt curFileTime; /* Current estimated time, expressed * as 100-ns ticks since the Windows epoch */ @@ -366,7 +366,7 @@ Tcl_GetTime(timePtr) /* Posix epoch expressed as 100-ns ticks * since the windows epoch */ - LONGLONG usecSincePosixEpoch; + Tcl_WideInt usecSincePosixEpoch; /* Current microseconds since Posix epoch */ posixEpoch.LowPart = 0xD53E8000; @@ -832,15 +832,15 @@ UpdateTimeEachSecond() LARGE_INTEGER curFileTime; /* File time at the time this callback * was scheduled. */ - LONGLONG estFreq; /* Estimated perf counter frequency */ + Tcl_WideInt estFreq; /* Estimated perf counter frequency */ - LONGLONG vt0; /* Tcl time right now */ - LONGLONG vt1; /* Tcl time one second from now */ + Tcl_WideInt vt0; /* Tcl time right now */ + Tcl_WideInt vt1; /* Tcl time one second from now */ - LONGLONG tdiff; /* Difference between system clock and + Tcl_WideInt tdiff; /* Difference between system clock and * Tcl time. */ - LONGLONG driftFreq; /* Frequency needed to drift virtual time + Tcl_WideInt driftFreq; /* Frequency needed to drift virtual time * into step over 1 second */ /* @@ -873,7 +873,7 @@ UpdateTimeEachSecond() */ estFreq = AccumulateSample( curPerfCounter.QuadPart, - (ULONGLONG) curFileTime.QuadPart ); + (Tcl_WideUInt) curFileTime.QuadPart ); /* * We want to adjust things so that time appears to be continuous. @@ -947,11 +947,11 @@ UpdateTimeEachSecond() */ static void -ResetCounterSamples( ULONGLONG fileTime, +ResetCounterSamples( Tcl_WideUInt fileTime, /* Current file time */ - LONGLONG perfCounter, + Tcl_WideInt perfCounter, /* Current performance counter */ - LONGLONG perfFreq ) + Tcl_WideInt perfFreq ) /* Target performance frequency */ { int i; @@ -991,26 +991,26 @@ ResetCounterSamples( ULONGLONG fileTime, * probably run slow in the first case). */ -static LONGLONG -AccumulateSample( LONGLONG perfCounter, - ULONGLONG fileTime ) +static Tcl_WideInt +AccumulateSample( Tcl_WideInt perfCounter, + Tcl_WideUInt fileTime ) { - ULONGLONG workFTSample; /* File time sample being removed + Tcl_WideUInt workFTSample; /* File time sample being removed * from or added to the circular buffer */ - LONGLONG workPCSample; /* Performance counter sample being + Tcl_WideInt workPCSample; /* Performance counter sample being * removed from or added to the circular * buffer */ - ULONGLONG lastFTSample; /* Last file time sample recorded */ + Tcl_WideUInt lastFTSample; /* Last file time sample recorded */ - LONGLONG lastPCSample; /* Last performance counter sample recorded */ + Tcl_WideInt lastPCSample; /* Last performance counter sample recorded */ - LONGLONG FTdiff; /* Difference between last FT and current */ + Tcl_WideInt FTdiff; /* Difference between last FT and current */ - LONGLONG PCdiff; /* Difference between last PC and current */ + Tcl_WideInt PCdiff; /* Difference between last PC and current */ - LONGLONG estFreq; /* Estimated performance counter frequency */ + Tcl_WideInt estFreq; /* Estimated performance counter frequency */ /* Test for jumps and reset the samples if we have one. */ @@ -1042,7 +1042,7 @@ AccumulateSample( LONGLONG perfCounter, estFreq = 10000000 * ( perfCounter - workPCSample ) / ( fileTime - workFTSample ); timeInfo.perfCounterSample[ timeInfo.sampleNo ] = perfCounter; - timeInfo.fileTimeSample[ timeInfo.sampleNo ] = (LONGLONG) fileTime; + timeInfo.fileTimeSample[ timeInfo.sampleNo ] = (Tcl_WideInt) fileTime; /* Advance the sample number */ -- cgit v0.12