Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c44e28

Browse files
committed
Trent Mick: familiar simple Win64 patches
1 parent ab43fca commit 1c44e28

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

PC/getpathp.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static void
134134
reduce(dir)
135135
char *dir;
136136
{
137-
int i = strlen(dir);
137+
size_t i = strlen(dir);
138138
while (i > 0 && !is_sep(dir[i]))
139139
--i;
140140
dir[i] = '\0';
@@ -172,7 +172,7 @@ join(buffer, stuff)
172172
char *buffer;
173173
char *stuff;
174174
{
175-
int n, k;
175+
size_t n, k;
176176
if (is_sep(stuff[0]))
177177
n = 0;
178178
else {
@@ -207,7 +207,6 @@ search_for_prefix(argv0_path, landmark)
207207
char *argv0_path;
208208
char *landmark;
209209
{
210-
211210
/* Search from argv0_path, until landmark is found */
212211
strcpy(prefix, argv0_path);
213212
do {
@@ -244,7 +243,7 @@ getpythonregpath(HKEY keyBase, int skipcore)
244243
TCHAR *dataBuf = NULL;
245244
static const TCHAR keyPrefix[] = _T("Software\\Python\\PythonCore\\");
246245
static const TCHAR keySuffix[] = _T("\\PythonPath");
247-
int versionLen;
246+
size_t versionLen;
248247
DWORD index;
249248
TCHAR *keyBuf = NULL;
250249
TCHAR *keyBufPtr;
@@ -402,7 +401,7 @@ get_progpath()
402401
char *delim = strchr(path, DELIM);
403402

404403
if (delim) {
405-
int len = delim - path;
404+
size_t len = delim - path;
406405
strncpy(progpath, path, len);
407406
*(progpath + len) = '\0';
408407
}
@@ -429,7 +428,7 @@ calculate_path()
429428
{
430429
char argv0_path[MAXPATHLEN+1];
431430
char *buf;
432-
int bufsz;
431+
size_t bufsz;
433432
char *pythonhome = Py_GetPythonHome();
434433
char *envpath = getenv("PYTHONPATH");
435434

@@ -554,7 +553,7 @@ calculate_path()
554553
else {
555554
char *p = PYTHONPATH;
556555
char *q;
557-
int n;
556+
size_t n;
558557
for (;;) {
559558
q = strchr(p, DELIM);
560559
if (q == NULL)

PC/import_nt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ FILE *PyWin_FindRegisteredModule( const char *moduleName, struct filedescr **ppF
3333

3434
// Calculate the size for the sprintf buffer.
3535
// Get the size of the chars only, plus 1 NULL.
36-
int bufSize = sizeof(keyPrefix)-1 + strlen(PyWin_DLLVersionString) + sizeof(keySuffix) + strlen(moduleName) + sizeof(debugString) - 1;
36+
size_t bufSize = sizeof(keyPrefix)-1 + strlen(PyWin_DLLVersionString) + sizeof(keySuffix) + strlen(moduleName) + sizeof(debugString) - 1;
3737
// alloca == no free required, but memory only local to fn, also no heap fragmentation!
3838
moduleKey = alloca(bufSize);
3939
sprintf(moduleKey, "Software\\Python\\PythonCore\\%s\\Modules\\%s%s", PyWin_DLLVersionString, moduleName, debugString);
@@ -44,7 +44,7 @@ FILE *PyWin_FindRegisteredModule( const char *moduleName, struct filedescr **ppF
4444
return NULL;
4545
// use the file extension to locate the type entry.
4646
for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
47-
int extLen=strlen(fdp->suffix);
47+
size_t extLen = strlen(fdp->suffix);
4848
if (modNameSize>extLen && strnicmp(pathBuf+(modNameSize-extLen-1),fdp->suffix,extLen)==0)
4949
break;
5050
}

0 commit comments

Comments
 (0)