diff -r -u Python-3.1.3-old/Modules/posixmodule.c Python-3.1.3-new/Modules/posixmodule.c --- Python-3.1.3-old/Modules/posixmodule.c 2010-11-26 17:04:40 +0000 +++ Python-3.1.3-new/Modules/posixmodule.c 2010-11-28 11:02:28 +0000 @@ -947,7 +947,15 @@ int st_ctime_nsec; }; -static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */ +/* Seconds between 1.1.1601 and 1.1.1970 */ +static __int64 secs_between_epochs = +#if defined _MSC_VER + 11644473600i64; +#elif defined __GNUC__ + 11644473600LL; +#else + 11644473600; +#endif static void FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, int *time_out, int* nsec_out) @@ -1005,19 +1013,22 @@ } /* Emulate GetFileAttributesEx[AW] on Windows 95 */ -static int checked = 0; -static BOOL (CALLBACK *gfaxa)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID); -static BOOL (CALLBACK *gfaxw)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +typedef BOOL (CALLBACK *gfaxa_t)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +typedef BOOL (CALLBACK *gfaxw_t)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); + +static HINSTANCE hKernel32 = NULL; +static gfaxa_t gfaxa; +static gfaxw_t gfaxw; + static void -check_gfax() +check_gfax(void) { - HINSTANCE hKernel32; - if (checked) - return; - checked = 1; - hKernel32 = GetModuleHandle("KERNEL32"); - *(FARPROC*)&gfaxa = GetProcAddress(hKernel32, "GetFileAttributesExA"); - *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); + if (hKernel32 != NULL) + return; + + hKernel32 = GetModuleHandle("KERNEL32"); + gfaxa = (gfaxa_t)GetProcAddress(hKernel32, "GetFileAttributesExA"); + gfaxw = (gfaxw_t)GetProcAddress(hKernel32, "GetFileAttributesExW"); } static BOOL @@ -1097,7 +1108,7 @@ available and either succeeds to gives an error other than that it isn't implemented. */ check_gfax(); - if (gfaxa) { + if (gfaxw) { result = gfaxw(pszFile, level, pv); if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) return result; diff -r -u Python-3.1.3-old/PC/dl_nt.c Python-3.1.3-new/PC/dl_nt.c --- Python-3.1.3-old/PC/dl_nt.c 2010-05-09 16:14:22 +0000 +++ Python-3.1.3-new/PC/dl_nt.c 2010-11-28 10:29:16 +0000 @@ -44,9 +44,9 @@ static PFN_ADDREFACTCTX pfnAddRefActCtx = NULL; static PFN_RELEASEACTCTX pfnReleaseActCtx = NULL; -void _LoadActCtxPointers() +void _LoadActCtxPointers(void) { - HINSTANCE hKernel32 = GetModuleHandleW(L"kernel32.dll"); + HINSTANCE hKernel32 = GetModuleHandle("KERNEL32"); if (hKernel32) pfnGetCurrentActCtx = (PFN_GETCURRENTACTCTX) GetProcAddress(hKernel32, "GetCurrentActCtx"); // If we can't load GetCurrentActCtx (ie, pre XP) , don't bother with the rest. @@ -58,7 +58,7 @@ } } -ULONG_PTR _Py_ActivateActCtx() +ULONG_PTR _Py_ActivateActCtx(void) { ULONG_PTR ret = 0; if (PyWin_DLLhActivationContext && pfnActivateActCtx) diff -r -u Python-3.1.3-old/Python/dynload_win.c Python-3.1.3-new/Python/dynload_win.c --- Python-3.1.3-old/Python/dynload_win.c 2010-05-09 16:14:22 +0000 +++ Python-3.1.3-new/Python/dynload_win.c 2010-11-28 10:17:40 +0000 @@ -12,7 +12,7 @@ #include // "activation context" magic - see dl_nt.c... -extern ULONG_PTR _Py_ActivateActCtx(); +extern ULONG_PTR _Py_ActivateActCtx(void); void _Py_DeactivateActCtx(ULONG_PTR cookie); const struct filedescr _PyImport_DynLoadFiletab[] = { @@ -28,7 +28,7 @@ /* Case insensitive string compare, to avoid any dependencies on particular C RTL implementations */ -static int strcasecmp (char *string1, char *string2) +static int py_strcasecmp (char *string1, char *string2) { int first, second; @@ -176,7 +176,7 @@ char pathbuf[260]; LPTSTR dummy; unsigned int old_mode; - ULONG_PTR cookie = 0; + /* We use LoadLibraryEx so Windows looks for dependent DLLs in directory of pathname first. However, Windows95 can sometimes not work correctly unless the absolute @@ -261,7 +261,7 @@ import_python = GetPythonImport(hDLL); if (import_python && - strcasecmp(buffer,import_python)) { + py_strcasecmp(buffer,import_python)) { PyOS_snprintf(buffer, sizeof(buffer), "Module use of %.150s conflicts " "with this version of Python.",