summaryrefslogtreecommitdiff
path: root/tests-clar/clar_libgit2.c
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-08-07 13:22:41 -0700
committerBen Straub <bs@github.com>2013-08-07 13:22:41 -0700
commit9c38f7a6523cdc87a897eccb6d83439987f99a4e (patch)
tree50f451bef9e3c3a869e2f321d585ca929a6a13f6 /tests-clar/clar_libgit2.c
parent75f98a95eee8a0efe8f9649ddc8a81c64d863ced (diff)
downloadlibgit2-9c38f7a6523cdc87a897eccb6d83439987f99a4e.tar.gz
Add typedefs for win32 utf-8 and utf-16 buffers
...and normalize the signatures of the two conversion functions.
Diffstat (limited to 'tests-clar/clar_libgit2.c')
-rw-r--r--tests-clar/clar_libgit2.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests-clar/clar_libgit2.c b/tests-clar/clar_libgit2.c
index 34d54cd94..869acd613 100644
--- a/tests-clar/clar_libgit2.c
+++ b/tests-clar/clar_libgit2.c
@@ -56,12 +56,12 @@ void cl_git_rewritefile(const char *filename, const char *new_content)
char *cl_getenv(const char *name)
{
- wchar_t name_utf16[GIT_WIN_PATH_UTF16];
+ git_win_str_utf16 name_utf16;
DWORD alloc_len;
wchar_t *value_utf16;
char *value_utf8;
- git__utf8_to_16(name_utf16, GIT_WIN_PATH_UTF16, name);
+ git__utf8_to_16(name_utf16, name);
alloc_len = GetEnvironmentVariableW(name_utf16, NULL, 0);
if (alloc_len <= 0)
return NULL;
@@ -81,13 +81,13 @@ char *cl_getenv(const char *name)
int cl_setenv(const char *name, const char *value)
{
- wchar_t name_utf16[GIT_WIN_PATH_UTF16];
- wchar_t value_utf16[GIT_WIN_PATH_UTF16];
+ git_win_str_utf16 name_utf16;
+ git_win_str_utf16 value_utf16;
- git__utf8_to_16(name_utf16, GIT_WIN_PATH_UTF16, name);
+ git__utf8_to_16(name_utf16, name);
if (value) {
- git__utf8_to_16(value_utf16, GIT_WIN_PATH_UTF16, value);
+ git__utf8_to_16(value_utf16, value);
cl_assert(SetEnvironmentVariableW(name_utf16, value_utf16));
} else {
/* Windows XP returns 0 (failed) when passing NULL for lpValue when
@@ -107,12 +107,12 @@ int cl_setenv(const char *name, const char *value)
* the source is a directory, a child of the source). */
int cl_rename(const char *source, const char *dest)
{
- wchar_t source_utf16[GIT_WIN_PATH_UTF16];
- wchar_t dest_utf16[GIT_WIN_PATH_UTF16];
+ git_win_str_utf16 source_utf16;
+ git_win_str_utf16 dest_utf16;
unsigned retries = 1;
- git__utf8_to_16(source_utf16, GIT_WIN_PATH_UTF16, source);
- git__utf8_to_16(dest_utf16, GIT_WIN_PATH_UTF16, dest);
+ git__utf8_to_16(source_utf16, source);
+ git__utf8_to_16(dest_utf16, dest);
while (!MoveFileW(source_utf16, dest_utf16)) {
/* Only retry if the error is ERROR_ACCESS_DENIED;