diff options
Diffstat (limited to 'PC')
-rw-r--r-- | PC/getpathp.c | 10 | ||||
-rw-r--r-- | PC/import_nt.c | 7 | ||||
-rw-r--r-- | PC/pyconfig.h | 10 |
3 files changed, 20 insertions, 7 deletions
diff --git a/PC/getpathp.c b/PC/getpathp.c index 3b4f452..0701d73 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -169,7 +169,8 @@ join(char *buffer, char *stuff) static int gotlandmark(char *landmark) { - int n, ok; + int ok; + Py_ssize_t n; n = strlen(prefix); join(prefix, landmark); @@ -302,10 +303,11 @@ getpythonregpath(HKEY keyBase, int skipcore) dataSize--; } if (ppPaths[index]) { - int len = _tcslen(ppPaths[index]); + Py_ssize_t len = _tcslen(ppPaths[index]); _tcsncpy(szCur, ppPaths[index], len); szCur += len; - dataSize -= len; + assert(dataSize > len); + dataSize -= (int)len; } } if (skipcore) @@ -632,7 +634,7 @@ calculate_path(void) char lookBuf[MAXPATHLEN+1]; char *look = buf - 1; /* 'buf' is at the end of the buffer */ while (1) { - int nchars; + Py_ssize_t nchars; char *lookEnd = look; /* 'look' will end up one character before the start of the path in question - even if this diff --git a/PC/import_nt.c b/PC/import_nt.c index f937df8..e7d152a 100644 --- a/PC/import_nt.c +++ b/PC/import_nt.c @@ -18,7 +18,7 @@ extern const char *PyWin_DLLVersionString; FILE *PyWin_FindRegisteredModule(const char *moduleName, struct filedescr **ppFileDesc, char *pathBuf, - int pathLen) + Py_ssize_t pathLen) { char *moduleKey; const char keyPrefix[] = "Software\\Python\\PythonCore\\"; @@ -53,13 +53,14 @@ FILE *PyWin_FindRegisteredModule(const char *moduleName, "Software\\Python\\PythonCore\\%s\\Modules\\%s%s", PyWin_DLLVersionString, moduleName, debugString); - modNameSize = pathLen; + assert(pathLen < INT_MAX); + modNameSize = (int)pathLen; regStat = RegQueryValue(keyBase, moduleKey, pathBuf, &modNameSize); if (regStat != ERROR_SUCCESS) { /* No user setting - lookup in machine settings */ keyBase = HKEY_LOCAL_MACHINE; /* be anal - failure may have reset size param */ - modNameSize = pathLen; + modNameSize = (int)pathLen; regStat = RegQueryValue(keyBase, moduleKey, pathBuf, &modNameSize); diff --git a/PC/pyconfig.h b/PC/pyconfig.h index bb16cfb..149cd6f 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -117,6 +117,14 @@ MS_CORE_DLL. #endif #endif /* MS_WIN64 */ +/* Define like size_t, omitting the "unsigned" */ +#ifdef MS_WIN64 +typedef __int64 ssize_t; +#else +typedef _W64 int ssize_t; +#endif +#define HAVE_SSIZE_T 1 + #if defined(MS_WIN32) && !defined(MS_WIN64) #ifdef _M_IX86 #define COMPILER _Py_PASTE_VERSION("32 bit (Intel)") @@ -253,6 +261,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ # define SIZEOF_OFF_T 4 # define SIZEOF_FPOS_T 8 # define SIZEOF_HKEY 8 +# define SIZEOF_SIZE_T 8 /* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG, sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t). On Win64 the second condition is not true, but if fpos_t replaces off_t @@ -267,6 +276,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ # define SIZEOF_OFF_T 4 # define SIZEOF_FPOS_T 8 # define SIZEOF_HKEY 4 +# define SIZEOF_SIZE_T 4 #endif #ifdef _DEBUG |