summaryrefslogtreecommitdiff
path: root/src/win32/utf-conv.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-12-01 13:09:58 -0500
committerEdward Thomson <ethomson@microsoft.com>2014-12-16 10:08:43 -0600
commitcceae9a25d0bed8b00f4981e051d5f380ef54401 (patch)
tree37fc849d60ba24f6c6ac896322d6e8ac5f7d902c /src/win32/utf-conv.h
parent09debe1213b9c979e21106ccbe9d420f8511f4eb (diff)
downloadlibgit2-cceae9a25d0bed8b00f4981e051d5f380ef54401.tar.gz
win32: use NT-prefixed "\\?\" paths
When turning UTF-8 paths into UCS-2 paths for Windows, always use the \\?\-prefixed paths. Because this bypasses the system's path canonicalization, handle the canonicalization functions ourselves. We must: 1. always use a backslash as a directory separator 2. only use a single backslash between directories 3. not rely on the system to translate "." and ".." in paths 4. remove trailing backslashes, except at the drive root (C:\)
Diffstat (limited to 'src/win32/utf-conv.h')
-rw-r--r--src/win32/utf-conv.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/win32/utf-conv.h b/src/win32/utf-conv.h
index a480cd93e..89cdb96da 100644
--- a/src/win32/utf-conv.h
+++ b/src/win32/utf-conv.h
@@ -10,21 +10,6 @@
#include <wchar.h>
#include "common.h"
-/* Equal to the Win32 MAX_PATH constant. The maximum path length is 259
- * characters plus a NULL terminator. */
-#define GIT_WIN_PATH_UTF16 260
-
-/* Maximum size of a UTF-8 Win32 path. UTF-8 does have 4-byte sequences,
- * but they are encoded in UTF-16 using surrogate pairs, which takes up
- * the space of two characters. Two characters in the range U+0800 ->
- * U+FFFF take up more space in UTF-8 (6 bytes) than one surrogate pair
- * (4 bytes). */
-#define GIT_WIN_PATH_UTF8 (259 * 3 + 1)
-
-/* Win32 path types */
-typedef wchar_t git_win32_path[GIT_WIN_PATH_UTF16];
-typedef char git_win32_utf8_path[GIT_WIN_PATH_UTF8];
-
/**
* Converts a UTF-8 string to wide characters.
*
@@ -67,28 +52,4 @@ int git__utf8_to_16_alloc(wchar_t **dest, const char *src);
*/
int git__utf16_to_8_alloc(char **dest, const wchar_t *src);
-/**
- * Converts a UTF-8 Win32 path to wide characters.
- *
- * @param dest The buffer to receive the wide string.
- * @param src The UTF-8 string to convert.
- * @return The length of the wide string, in characters (not counting the NULL terminator), or < 0 for failure
- */
-GIT_INLINE(int) git_win32_path_from_utf8(git_win32_path dest, const char *src)
-{
- return git__utf8_to_16(dest, GIT_WIN_PATH_UTF16, src);
-}
-
-/**
- * Converts a wide Win32 path to UTF-8.
- *
- * @param dest The buffer to receive the UTF-8 string.
- * @param src The wide string to convert.
- * @return The length of the UTF-8 string, in bytes (not counting the NULL terminator), or < 0 for failure
- */
-GIT_INLINE(int) git_win32_path_to_utf8(git_win32_utf8_path dest, const wchar_t *src)
-{
- return git__utf16_to_8(dest, GIT_WIN_PATH_UTF8, src);
-}
-
#endif