mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-23 05:38:41 +00:00
Rename git_win_str_utf* to git_win32_path_utf*
This commit is contained in:
parent
9c38f7a652
commit
2c0128ee79
@ -58,7 +58,7 @@ int git_futils_creat_locked(const char *path, const mode_t mode)
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
#ifdef GIT_WIN32
|
#ifdef GIT_WIN32
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
|
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
fd = _wopen(buf, O_WRONLY | O_CREAT | O_TRUNC |
|
fd = _wopen(buf, O_WRONLY | O_CREAT | O_TRUNC |
|
||||||
|
@ -486,7 +486,7 @@ bool git_path_is_empty_dir(const char *path)
|
|||||||
{
|
{
|
||||||
git_buf pathbuf = GIT_BUF_INIT;
|
git_buf pathbuf = GIT_BUF_INIT;
|
||||||
HANDLE hFind = INVALID_HANDLE_VALUE;
|
HANDLE hFind = INVALID_HANDLE_VALUE;
|
||||||
git_win_str_utf16 wbuf;
|
git_win32_path_utf16 wbuf;
|
||||||
WIN32_FIND_DATAW ffd;
|
WIN32_FIND_DATAW ffd;
|
||||||
bool retval = true;
|
bool retval = true;
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ static int winhttp_connect(
|
|||||||
const char *url)
|
const char *url)
|
||||||
{
|
{
|
||||||
wchar_t *ua = L"git/1.0 (libgit2 " WIDEN(LIBGIT2_VERSION) L")";
|
wchar_t *ua = L"git/1.0 (libgit2 " WIDEN(LIBGIT2_VERSION) L")";
|
||||||
git_win_str_utf16 host;
|
git_win32_path_utf16 host;
|
||||||
int32_t port;
|
int32_t port;
|
||||||
const char *default_port = "80";
|
const char *default_port = "80";
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -26,7 +26,7 @@ static int init_filter(char *filter, size_t n, const char *dir)
|
|||||||
git__DIR *git__opendir(const char *dir)
|
git__DIR *git__opendir(const char *dir)
|
||||||
{
|
{
|
||||||
char filter[GIT_WIN_PATH_UTF8];
|
char filter[GIT_WIN_PATH_UTF8];
|
||||||
git_win_str_utf16 filter_w;
|
git_win32_path_utf16 filter_w;
|
||||||
git__DIR *new = NULL;
|
git__DIR *new = NULL;
|
||||||
|
|
||||||
if (!dir || !init_filter(filter, sizeof(filter), dir))
|
if (!dir || !init_filter(filter, sizeof(filter), dir))
|
||||||
@ -102,7 +102,7 @@ struct git__dirent *git__readdir(git__DIR *d)
|
|||||||
void git__rewinddir(git__DIR *d)
|
void git__rewinddir(git__DIR *d)
|
||||||
{
|
{
|
||||||
char filter[GIT_WIN_PATH_UTF8];
|
char filter[GIT_WIN_PATH_UTF8];
|
||||||
git_win_str_utf16 filter_w;
|
git_win32_path_utf16 filter_w;
|
||||||
|
|
||||||
if (!d)
|
if (!d)
|
||||||
return;
|
return;
|
||||||
|
@ -20,7 +20,7 @@ GIT_INLINE(int) p_link(const char *old, const char *new)
|
|||||||
|
|
||||||
GIT_INLINE(int) p_mkdir(const char *path, mode_t mode)
|
GIT_INLINE(int) p_mkdir(const char *path, mode_t mode)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
GIT_UNUSED(mode);
|
GIT_UNUSED(mode);
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
return _wmkdir(buf);
|
return _wmkdir(buf);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
int p_unlink(const char *path)
|
int p_unlink(const char *path)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
_wchmod(buf, 0666);
|
_wchmod(buf, 0666);
|
||||||
return _wunlink(buf);
|
return _wunlink(buf);
|
||||||
@ -59,7 +59,7 @@ static int do_lstat(
|
|||||||
const char *file_name, struct stat *buf, int posix_enotdir)
|
const char *file_name, struct stat *buf, int posix_enotdir)
|
||||||
{
|
{
|
||||||
WIN32_FILE_ATTRIBUTE_DATA fdata;
|
WIN32_FILE_ATTRIBUTE_DATA fdata;
|
||||||
git_win_str_utf16 fbuf;
|
git_win32_path_utf16 fbuf;
|
||||||
wchar_t lastch;
|
wchar_t lastch;
|
||||||
int flen;
|
int flen;
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ int p_readlink(const char *link, char *target, size_t target_len)
|
|||||||
static fpath_func pGetFinalPath = NULL;
|
static fpath_func pGetFinalPath = NULL;
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
DWORD dwRet;
|
DWORD dwRet;
|
||||||
git_win_str_utf16 link_w;
|
git_win32_path_utf16 link_w;
|
||||||
wchar_t* target_w;
|
wchar_t* target_w;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ int p_symlink(const char *old, const char *new)
|
|||||||
|
|
||||||
int p_open(const char *path, int flags, ...)
|
int p_open(const char *path, int flags, ...)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
|
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
@ -273,7 +273,7 @@ int p_open(const char *path, int flags, ...)
|
|||||||
|
|
||||||
int p_creat(const char *path, mode_t mode)
|
int p_creat(const char *path, mode_t mode)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
return _wopen(buf, _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY, mode);
|
return _wopen(buf, _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY, mode);
|
||||||
}
|
}
|
||||||
@ -316,14 +316,14 @@ int p_stat(const char* path, struct stat* buf)
|
|||||||
|
|
||||||
int p_chdir(const char* path)
|
int p_chdir(const char* path)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
return _wchdir(buf);
|
return _wchdir(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int p_chmod(const char* path, mode_t mode)
|
int p_chmod(const char* path, mode_t mode)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
return _wchmod(buf, mode);
|
return _wchmod(buf, mode);
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ int p_chmod(const char* path, mode_t mode)
|
|||||||
int p_rmdir(const char* path)
|
int p_rmdir(const char* path)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
|
|
||||||
error = _wrmdir(buf);
|
error = _wrmdir(buf);
|
||||||
@ -348,7 +348,7 @@ int p_rmdir(const char* path)
|
|||||||
|
|
||||||
int p_hide_directory__w32(const char *path)
|
int p_hide_directory__w32(const char *path)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
return (SetFileAttributesW(buf, FILE_ATTRIBUTE_HIDDEN) != 0) ? 0 : -1;
|
return (SetFileAttributesW(buf, FILE_ATTRIBUTE_HIDDEN) != 0) ? 0 : -1;
|
||||||
}
|
}
|
||||||
@ -356,8 +356,8 @@ int p_hide_directory__w32(const char *path)
|
|||||||
char *p_realpath(const char *orig_path, char *buffer)
|
char *p_realpath(const char *orig_path, char *buffer)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
git_win_str_utf16 orig_path_w;
|
git_win32_path_utf16 orig_path_w;
|
||||||
git_win_str_utf16 buffer_w;
|
git_win32_path_utf16 buffer_w;
|
||||||
|
|
||||||
git__utf8_to_16(orig_path_w, orig_path);
|
git__utf8_to_16(orig_path_w, orig_path);
|
||||||
|
|
||||||
@ -449,15 +449,15 @@ int p_setenv(const char* name, const char* value, int overwrite)
|
|||||||
|
|
||||||
int p_access(const char* path, mode_t mode)
|
int p_access(const char* path, mode_t mode)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 buf;
|
git_win32_path_utf16 buf;
|
||||||
git__utf8_to_16(buf, path);
|
git__utf8_to_16(buf, path);
|
||||||
return _waccess(buf, mode);
|
return _waccess(buf, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int p_rename(const char *from, const char *to)
|
int p_rename(const char *from, const char *to)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 wfrom;
|
git_win32_path_utf16 wfrom;
|
||||||
git_win_str_utf16 wto;
|
git_win32_path_utf16 wto;
|
||||||
|
|
||||||
git__utf8_to_16(wfrom, from);
|
git__utf8_to_16(wfrom, from);
|
||||||
git__utf8_to_16(wto, to);
|
git__utf8_to_16(wto, to);
|
||||||
|
@ -70,12 +70,12 @@ void git__utf8_to_16(wchar_t *dest, size_t length, const char *src)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int git__utf8_to_16(git_win_str_utf16 dest, const git_win_str_utf8 src)
|
int git__utf8_to_16(git_win32_path_utf16 dest, const git_win32_path_utf8 src)
|
||||||
{
|
{
|
||||||
return MultiByteToWideChar(CP_UTF8, 0, src, -1, dest, GIT_WIN_PATH_UTF16);
|
return MultiByteToWideChar(CP_UTF8, 0, src, -1, dest, GIT_WIN_PATH_UTF16);
|
||||||
}
|
}
|
||||||
|
|
||||||
int git__utf16_to_8(git_win_str_utf8 dest, const git_win_str_utf16 src)
|
int git__utf16_to_8(git_win32_path_utf8 dest, const git_win32_path_utf16 src)
|
||||||
{
|
{
|
||||||
return WideCharToMultiByte(CP_UTF8, 0, src, -1, dest, GIT_WIN_PATH_UTF8, NULL, NULL);
|
return WideCharToMultiByte(CP_UTF8, 0, src, -1, dest, GIT_WIN_PATH_UTF8, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
#define GIT_WIN_PATH_UTF16 (260 + 1)
|
#define GIT_WIN_PATH_UTF16 (260 + 1)
|
||||||
#define GIT_WIN_PATH_UTF8 (260 * 4 + 1)
|
#define GIT_WIN_PATH_UTF8 (260 * 4 + 1)
|
||||||
|
|
||||||
typedef wchar_t git_win_str_utf16[GIT_WIN_PATH_UTF16];
|
typedef wchar_t git_win32_path_utf16[GIT_WIN_PATH_UTF16];
|
||||||
typedef char git_win_str_utf8[GIT_WIN_PATH_UTF8];
|
typedef char git_win32_path_utf8[GIT_WIN_PATH_UTF8];
|
||||||
|
|
||||||
int git__utf8_to_16(git_win_str_utf16 dest, const git_win_str_utf8 src);
|
int git__utf8_to_16(git_win32_path_utf16 dest, const git_win32_path_utf8 src);
|
||||||
int git__utf16_to_8(git_win_str_utf8 dest, const git_win_str_utf16 src);
|
int git__utf16_to_8(git_win32_path_utf8 dest, const git_win32_path_utf16 src);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void cl_git_rewritefile(const char *filename, const char *new_content)
|
|||||||
|
|
||||||
char *cl_getenv(const char *name)
|
char *cl_getenv(const char *name)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 name_utf16;
|
git_win32_path_utf16 name_utf16;
|
||||||
DWORD alloc_len;
|
DWORD alloc_len;
|
||||||
wchar_t *value_utf16;
|
wchar_t *value_utf16;
|
||||||
char *value_utf8;
|
char *value_utf8;
|
||||||
@ -81,8 +81,8 @@ char *cl_getenv(const char *name)
|
|||||||
|
|
||||||
int cl_setenv(const char *name, const char *value)
|
int cl_setenv(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 name_utf16;
|
git_win32_path_utf16 name_utf16;
|
||||||
git_win_str_utf16 value_utf16;
|
git_win32_path_utf16 value_utf16;
|
||||||
|
|
||||||
git__utf8_to_16(name_utf16, name);
|
git__utf8_to_16(name_utf16, name);
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ int cl_setenv(const char *name, const char *value)
|
|||||||
* the source is a directory, a child of the source). */
|
* the source is a directory, a child of the source). */
|
||||||
int cl_rename(const char *source, const char *dest)
|
int cl_rename(const char *source, const char *dest)
|
||||||
{
|
{
|
||||||
git_win_str_utf16 source_utf16;
|
git_win32_path_utf16 source_utf16;
|
||||||
git_win_str_utf16 dest_utf16;
|
git_win32_path_utf16 dest_utf16;
|
||||||
unsigned retries = 1;
|
unsigned retries = 1;
|
||||||
|
|
||||||
git__utf8_to_16(source_utf16, source);
|
git__utf8_to_16(source_utf16, source);
|
||||||
|
Loading…
Reference in New Issue
Block a user