Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
841034a3
Commit
841034a3
authored
Aug 13, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reintroduce type for UTF8 win32 path conversions
parent
d4cff0cb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
10 deletions
+11
-10
src/win32/dir.c
+1
-1
src/win32/dir.h
+1
-1
src/win32/posix_w32.c
+4
-4
src/win32/utf-conv.h
+5
-4
No files found.
src/win32/dir.c
View file @
841034a3
...
...
@@ -24,7 +24,7 @@ static int init_filter(char *filter, size_t n, const char *dir)
git__DIR
*
git__opendir
(
const
char
*
dir
)
{
char
filter
[
GIT_WIN_PATH_UTF8
]
;
git_win32_path_as_utf8
filter
;
git_win32_path
filter_w
;
git__DIR
*
new
=
NULL
;
...
...
src/win32/dir.h
View file @
841034a3
...
...
@@ -11,7 +11,7 @@
struct
git__dirent
{
int
d_ino
;
char
d_name
[
GIT_WIN_PATH_UTF8
]
;
git_win32_path_as_utf8
d_name
;
};
typedef
struct
{
...
...
src/win32/posix_w32.c
View file @
841034a3
...
...
@@ -109,10 +109,10 @@ static int do_lstat(
* the length of the path pointed to, which we expect everywhere else
*/
if
(
S_ISLNK
(
fMode
))
{
char
target
[
GIT_WIN_PATH_UTF8
]
;
git_win32_path_as_utf8
target
;
int
readlink_result
;
readlink_result
=
p_readlink
(
file_name
,
target
,
GIT_WIN_PATH_UTF8
);
readlink_result
=
p_readlink
(
file_name
,
target
,
sizeof
(
target
)
);
if
(
readlink_result
==
-
1
)
return
-
1
;
...
...
@@ -300,7 +300,7 @@ int p_getcwd(char *buffer_out, size_t size)
int
p_stat
(
const
char
*
path
,
struct
stat
*
buf
)
{
char
target
[
GIT_WIN_PATH_UTF8
]
;
git_win32_path_as_utf8
target
;
int
error
=
0
;
error
=
do_lstat
(
path
,
buf
,
0
);
...
...
@@ -308,7 +308,7 @@ int p_stat(const char* path, struct stat* buf)
/* We need not do this in a loop to unwind chains of symlinks since
* p_readlink calls GetFinalPathNameByHandle which does it for us. */
if
(
error
>=
0
&&
S_ISLNK
(
buf
->
st_mode
)
&&
(
error
=
p_readlink
(
path
,
target
,
GIT_WIN_PATH_UTF8
))
>=
0
)
(
error
=
p_readlink
(
path
,
target
,
sizeof
(
target
)
))
>=
0
)
error
=
do_lstat
(
target
,
buf
,
0
);
return
error
;
...
...
src/win32/utf-conv.h
View file @
841034a3
...
...
@@ -4,13 +4,12 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_git_utfconv_h__
#define INCLUDE_git_utfconv_h__
#include <wchar.h>
#include "common.h"
#ifndef INCLUDE_git_utfconv_h__
#define INCLUDE_git_utfconv_h__
/* Maximum characters in a Windows path plus one for NUL byte */
#define GIT_WIN_PATH_UTF16 (260 + 1)
...
...
@@ -19,6 +18,8 @@
typedef
wchar_t
git_win32_path
[
GIT_WIN_PATH_UTF16
];
typedef
char
git_win32_path_as_utf8
[
GIT_WIN_PATH_UTF8
];
/* dest_size is the size of dest in wchar_t's */
int
git__utf8_to_16
(
wchar_t
*
dest
,
size_t
dest_size
,
const
char
*
src
);
/* dest_size is the size of dest in char's */
...
...
@@ -29,7 +30,7 @@ GIT_INLINE(int) git_win32_path_from_c(git_win32_path dest, const char *src)
return
git__utf8_to_16
(
dest
,
GIT_WIN_PATH_UTF16
,
src
);
}
GIT_INLINE
(
int
)
git_win32_path_to_c
(
char
*
dest
,
const
git_win32_path
src
)
GIT_INLINE
(
int
)
git_win32_path_to_c
(
git_win32_path_as_utf8
dest
,
const
wchar_t
*
src
)
{
return
git__utf16_to_8
(
dest
,
GIT_WIN_PATH_UTF8
,
src
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment