aboutsummaryrefslogtreecommitdiff
path: root/compat/win32/dirent.h
diff options
context:
space:
mode:
authorKarsten Blees <blees@dcon.de>2012-01-14 22:01:09 +0100
committerJunio C Hamano <gitster@pobox.com>2014-07-15 11:19:09 -0700
commit0217569bb2db23b8686f67b0f4dda7e517dec6fd (patch)
tree18e8aed19d5bbcc664c565c210477751c2230a67 /compat/win32/dirent.h
parent85faec9d3acd8bb20e26e2d3386f7d3708d02fca (diff)
downloadgit-0217569bb2db23b8686f67b0f4dda7e517dec6fd.tar.gz
git-0217569bb2db23b8686f67b0f4dda7e517dec6fd.tar.xz
Win32: Unicode file name support (dirent)
Changes opendir/readdir to use Windows Unicode APIs and convert between UTF-8/UTF-16. Removes parameter checks that are already covered by xutftowcs_path. This changes detection of ENAMETOOLONG from MAX_PATH - 2 to MAX_PATH (matching is_dir_empty in mingw.c). If name + "/*" or the resulting absolute path is too long, FindFirstFile fails and errno is set through err_win_to_posix. Increases the size of dirent.d_name to accommodate the full WIN32_FIND_DATA.cFileName converted to UTF-8 (UTF-16 to UTF-8 conversion may grow by factor three in the worst case). Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Stepan Kasal <kasal@ucw.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/win32/dirent.h')
-rw-r--r--compat/win32/dirent.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/win32/dirent.h b/compat/win32/dirent.h
index 8838cd61f..058207e4b 100644
--- a/compat/win32/dirent.h
+++ b/compat/win32/dirent.h
@@ -10,7 +10,7 @@ typedef struct DIR DIR;
struct dirent {
unsigned char d_type; /* file type to prevent lstat after readdir */
- char d_name[MAX_PATH]; /* file name */
+ char d_name[MAX_PATH * 3]; /* file name (* 3 for UTF-8 conversion) */
};
DIR *opendir(const char *dirname);