[ctypes-commit] misc/misc import.c,1.2,1.3
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-01-04 12:48:16
|
Update of /cvsroot/ctypes/misc/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5164 Modified Files: import.c Log Message: *** empty log message *** Index: import.c =================================================================== RCS file: /cvsroot/ctypes/misc/misc/import.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** import.c 4 Jan 2005 12:25:45 -0000 1.2 --- import.c 4 Jan 2005 12:48:01 -0000 1.3 *************** *** 1534,1555 **** char dirname[MAXPATHLEN + 1]; int dirlen; ! char *cp; if (Py_GETENV("PYTHONCASEOK") != NULL) return 1; ! /* XXX check size */ strcpy(dirname, PyString_AS_STRING(fname)); ! cp = strrchr(dirname, SEP); ! if (cp) ! *cp = '\0'; ! else ! dirname[0] = '\0'; ! ! dirlen = strlen(dirname); ! /* Copy the dir component into dirname; substitute "." if empty */ ! if (dirlen <= 0) { dirname[0] = '.'; dirname[1] = '\0'; } --- 1534,1551 ---- char dirname[MAXPATHLEN + 1]; int dirlen; ! char *nameWithExt; if (Py_GETENV("PYTHONCASEOK") != NULL) return 1; ! /* XXX check size of dirname buffer */ strcpy(dirname, PyString_AS_STRING(fname)); ! nameWithExt = strrchr(dirname, SEP); ! if (nameWithExt) ! *nameWithExt++ = '\0'; ! else { dirname[0] = '.'; dirname[1] = '\0'; + nameWithExt = PyString_AS_STRING(fname); } *************** *** 1557,1570 **** dirp = opendir(dirname); if (dirp) { - char *nameWithExt = PyString_AS_STRING(fname) + len - namelen; while ((dp = readdir(dirp)) != NULL) { ! const int thislen = ! #ifdef _DIRENT_HAVE_D_NAMELEN ! dp->d_namlen; ! #else ! strlen(dp->d_name); ! #endif ! if (thislen >= namelen && ! strcmp(dp->d_name, nameWithExt) == 0) { (void)closedir(dirp); return 1; /* Found */ --- 1553,1558 ---- dirp = opendir(dirname); if (dirp) { while ((dp = readdir(dirp)) != NULL) { ! if (strcmp(dp->d_name, nameWithExt) == 0) { (void)closedir(dirp); return 1; /* Found */ |