diff --git a/win32/win_opendir.c b/win32/win_opendir.c index 0c7c91edd..59a5979bd 100644 --- a/win32/win_opendir.c +++ b/win32/win_opendir.c @@ -45,6 +45,14 @@ SOFTWARE. #define FILE_NAME_NORMALIZED 0 #endif /* FILE_NAME_NORMALIZED */ +struct __dir +{ + struct dirent *entries; + intptr_t fd; + long int count; + long int index; +}; + int closedir(DIR *dirp) { struct __dir *data = NULL; @@ -327,52 +335,6 @@ DIR *opendir(const char *name) return dirp; } -DIR *_wopendir(const wchar_t *name) -{ - DIR *dirp = NULL; - wchar_t *wname = __get_buffer(); - int size = 0; - if (!wname) - { - errno = ENOMEM; - return NULL; - } - size = (int) wcslen(name); - if (size > NTFS_MAX_PATH) - { - free(wname); - return NULL; - } - memcpy(wname + 4, name, sizeof(wchar_t) * (size + 1)); - dirp = __internal_opendir(wname, size + 5); - free(wname); - return dirp; -} - -DIR *fdopendir(intptr_t fd) -{ - DIR *dirp = NULL; - wchar_t *wname = __get_buffer(); - int size = 0; - - if (!wname) - { - errno = ENOMEM; - return NULL; - } - size = GetFinalPathNameByHandleW((HANDLE) fd, wname + 4, NTFS_MAX_PATH, - FILE_NAME_NORMALIZED); - if (0 == size) - { - free(wname); - errno = ENOTDIR; - return NULL; - } - dirp = __internal_opendir(wname, size + 5); - free(wname); - return dirp; -} - struct dirent *readdir(DIR *dirp) { struct __dir *data = (struct __dir *) dirp; @@ -388,38 +350,4 @@ struct dirent *readdir(DIR *dirp) return NULL; } -void seekdir(DIR *dirp, long int offset) -{ - if (dirp) - { - struct __dir *data = (struct __dir *) dirp; - data->index = (offset < data->count) ? offset : data->index; - } -} - -void rewinddir(DIR *dirp) -{ - seekdir(dirp, 0); -} - -long int telldir(DIR *dirp) -{ - if (!dirp) - { - errno = EBADF; - return -1; - } - return ((struct __dir *) dirp)->count; -} - -intptr_t dirfd(DIR *dirp) -{ - if (!dirp) - { - errno = EINVAL; - return -1; - } - return ((struct __dir *) dirp)->fd; -} - #endif /* _WIN32 */ diff --git a/win32/win_opendir.h b/win32/win_opendir.h index 94c9d2c84..bfc626224 100644 --- a/win32/win_opendir.h +++ b/win32/win_opendir.h @@ -99,32 +99,12 @@ struct dirent char d_name[NAME_MAX]; }; -struct __dir -{ - struct dirent *entries; - intptr_t fd; - long int count; - long int index; -}; - int closedir(DIR *dirp); DIR *opendir(const char *name); -DIR *_wopendir(const wchar_t *name); - -DIR *fdopendir(intptr_t fd); - struct dirent *readdir(DIR *dirp); -void seekdir(DIR *dirp, long int offset); - -void rewinddir(DIR *dirp); - -long int telldir(DIR *dirp); - -intptr_t dirfd(DIR *dirp); - #endif /* WIN_OPENDIR_H */ #endif /* _WIN32 */