summaryrefslogtreecommitdiff
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-06-29 11:27:03 +0000
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2009-06-29 11:27:03 +0000
commitea68390d80b394f94ca34c150f1452e55e21c882 (patch)
treec46fdc0cb725573ab4c0f6e00df192d3efce979a /Modules/posixmodule.c
parente0929d4d36a1cd98c597a7d87205b23aa5040734 (diff)
downloadcpython-ea68390d80b394f94ca34c150f1452e55e21c882.tar.gz
Issue #4856: Py_GetFileAttributesEx[AW] are not needed because GetFileAttributesEx[AW]
won't fail with ERROR_CALL_NOT_IMPLEMENTED on win NT. Reviewed by Amaury Forgeot d'Arc.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c60
1 files changed, 2 insertions, 58 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 3dd324116f..19c809d185 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -959,68 +959,13 @@ attributes_from_dir_w(LPCWSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad)
return TRUE;
}
-static BOOL WINAPI
-Py_GetFileAttributesExA(LPCSTR pszFile,
- GET_FILEEX_INFO_LEVELS level,
- LPVOID pv)
-{
- BOOL result;
- LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv;
- /* First try to use the system's implementation, if that is
- available and either succeeds to gives an error other than
- that it isn't implemented. */
- result = GetFileAttributesExA(pszFile, level, pv);
- if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
- return result;
- /* It's either not present, or not implemented.
- Emulate using FindFirstFile. */
- if (level != GetFileExInfoStandard) {
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
- /* Use GetFileAttributes to validate that the file name
- does not contain wildcards (which FindFirstFile would
- accept). */
- if (GetFileAttributesA(pszFile) == 0xFFFFFFFF)
- return FALSE;
- return attributes_from_dir(pszFile, pfad);
-}
-
-static BOOL WINAPI
-Py_GetFileAttributesExW(LPCWSTR pszFile,
- GET_FILEEX_INFO_LEVELS level,
- LPVOID pv)
-{
- BOOL result;
- LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv;
- /* First try to use the system's implementation, if that is
- available and either succeeds to gives an error other than
- that it isn't implemented. */
- result = GetFileAttributesExW(pszFile, level, pv);
- if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
- return result;
- /* It's either not present, or not implemented.
- Emulate using FindFirstFile. */
- if (level != GetFileExInfoStandard) {
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
- /* Use GetFileAttributes to validate that the file name
- does not contain wildcards (which FindFirstFile would
- accept). */
- if (GetFileAttributesW(pszFile) == 0xFFFFFFFF)
- return FALSE;
- return attributes_from_dir_w(pszFile, pfad);
-}
-
static int
win32_stat(const char* path, struct win32_stat *result)
{
WIN32_FILE_ATTRIBUTE_DATA info;
int code;
char *dot;
- /* XXX not supported on Win95 and NT 3.x */
- if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) {
+ if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) {
if (GetLastError() != ERROR_SHARING_VIOLATION) {
/* Protocol violation: we explicitly clear errno, instead of
setting it to a POSIX error. Callers should use GetLastError. */
@@ -1057,8 +1002,7 @@ win32_wstat(const wchar_t* path, struct win32_stat *result)
int code;
const wchar_t *dot;
WIN32_FILE_ATTRIBUTE_DATA info;
- /* XXX not supported on Win95 and NT 3.x */
- if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) {
+ if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) {
if (GetLastError() != ERROR_SHARING_VIOLATION) {
/* Protocol violation: we explicitly clear errno, instead of
setting it to a POSIX error. Callers should use GetLastError. */