diff options
author | wtchang%redhat.com <devnull@localhost> | 2005-04-29 18:16:27 +0000 |
---|---|---|
committer | wtchang%redhat.com <devnull@localhost> | 2005-04-29 18:16:27 +0000 |
commit | 534ec8348cb2060eff293e2d9e86cd593aa72f22 (patch) | |
tree | a5b82e39504da56feae6ca84a707dfef79bb3e8d | |
parent | c2253114487fa4ffde175ac524ec1c6630b0eae3 (diff) | |
download | nspr-hg-534ec8348cb2060eff293e2d9e86cd593aa72f22.tar.gz |
Bugzilla Bug 291724: removed the workaround for a very old Windows NT 4.0
bug. The workaround modified _tzset related global variables in Microsoft
CRT directly and relied on undocumented properties of the buffers that
_tzname[0] and _tzname[1] point to. r=darin. a=asa for mozilla1.8b2 and
aviary1.1a.
Modified files: ntmisc.c ntthread.c w95thred.c
Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rw-r--r-- | pr/src/md/windows/ntmisc.c | 69 | ||||
-rw-r--r-- | pr/src/md/windows/ntthread.c | 3 | ||||
-rw-r--r-- | pr/src/md/windows/w95thred.c | 4 |
3 files changed, 1 insertions, 75 deletions
diff --git a/pr/src/md/windows/ntmisc.c b/pr/src/md/windows/ntmisc.c index 849bbbe0..8433da02 100644 --- a/pr/src/md/windows/ntmisc.c +++ b/pr/src/md/windows/ntmisc.c @@ -68,8 +68,6 @@ PRIntn _PR_MD_PUT_ENV(const char *name) ************************************************************************** */ -#include <sys/timeb.h> - /* *----------------------------------------------------------------------- * @@ -96,71 +94,6 @@ PR_Now(void) } /* - * The following code works around a bug in NT (Netscape Bugsplat - * Defect ID 47942). - * - * In Windows NT 3.51 and 4.0, if the local time zone does not practice - * daylight savings time, e.g., Arizona, Taiwan, and Japan, the global - * variables that _ftime() and localtime() depend on have the wrong - * default values: - * _tzname[0] "PST" - * _tzname[1] "PDT" - * _daylight 1 - * _timezone 28800 - * - * So at startup time, we need to invoke _PR_Win32InitTimeZone(), which - * on NT sets these global variables to the correct values (obtained by - * calling GetTimeZoneInformation(). - */ - -#include <time.h> /* for _tzname, _daylight, _timezone */ - -void -_PR_Win32InitTimeZone(void) -{ - OSVERSIONINFO version; - TIME_ZONE_INFORMATION tzinfo; - - version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (GetVersionEx(&version) != FALSE) { - /* Only Windows NT needs this hack */ - if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) { - return; - } - } - - if (GetTimeZoneInformation(&tzinfo) == 0xffffffff) { - return; /* not much we can do if this failed */ - } - - /* - * I feel nervous about modifying these globals. I hope that no - * other thread is reading or modifying these globals simultaneously - * during nspr initialization. - * - * I am assuming that _tzname[0] and _tzname[1] point to static buffers - * and that the buffers are at least 32 byte long. My experiments show - * this is true, but of course this is undocumented. --wtc - * - * Convert time zone names from WCHAR to CHAR and copy them to - * the static buffers pointed to by _tzname[0] and _tzname[1]. - * Ignore conversion errors, because it is _timezone and _daylight - * that _ftime() and localtime() really depend on. - */ - - WideCharToMultiByte(CP_ACP, 0, tzinfo.StandardName, -1, _tzname[0], - 32, NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, tzinfo.DaylightName, -1, _tzname[1], - 32, NULL, NULL); - - /* _timezone is in seconds. tzinfo.Bias is in minutes. */ - - _timezone = tzinfo.Bias * 60; - _daylight = tzinfo.DaylightBias ? 1 : 0; - return; -} - -/* *********************************************************************** *********************************************************************** * @@ -691,8 +624,8 @@ PRInt32 _MD_GetMemMapAlignment(void) return info.dwAllocationGranularity; } -#include "prlog.h" extern PRLogModuleInfo *_pr_shma_lm; + void * _MD_MemMap( PRFileMap *fmap, PROffset64 offset, diff --git a/pr/src/md/windows/ntthread.c b/pr/src/md/windows/ntthread.c index e53b3ab9..4c8fa624 100644 --- a/pr/src/md/windows/ntthread.c +++ b/pr/src/md/windows/ntthread.c @@ -38,8 +38,6 @@ #include "primpl.h" #include <process.h> /* for _beginthreadex() */ -extern void _PR_Win32InitTimeZone(void); /* defined in ntmisc.c */ - /* --- globals ------------------------------------------------ */ PRLock *_pr_schedLock = NULL; _PRInterruptTable _pr_interruptTable[] = { { 0 } }; @@ -116,7 +114,6 @@ _PR_MD_EARLY_INIT() _MD_NEW_LOCK( &_nt_idleLock ); _nt_idleCount = 0; PR_INIT_CLIST(&_nt_idleList); - _PR_Win32InitTimeZone(); #if 0 /* Make the clock tick at least once per millisecond */ diff --git a/pr/src/md/windows/w95thred.c b/pr/src/md/windows/w95thred.c index 8671d825..a8d5f068 100644 --- a/pr/src/md/windows/w95thred.c +++ b/pr/src/md/windows/w95thred.c @@ -38,8 +38,6 @@ #include "primpl.h" #include <process.h> /* for _beginthreadex() */ -extern void _PR_Win32InitTimeZone(void); /* defined in ntmisc.c */ - /* --- globals ------------------------------------------------ */ #ifdef _PR_USE_STATIC_TLS __declspec(thread) struct PRThread *_pr_thread_last_run; @@ -56,8 +54,6 @@ _PRInterruptTable _pr_interruptTable[] = { { 0 } }; void _PR_MD_EARLY_INIT() { - _PR_Win32InitTimeZone(); - #ifndef _PR_USE_STATIC_TLS _pr_currentThreadIndex = TlsAlloc(); _pr_lastThreadIndex = TlsAlloc(); |