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
b85d0afd
Commit
b85d0afd
authored
Feb 18, 2016
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3606 from ethomson/drop_xp
win32: drop xp support in WideCharToMultiByte
parents
5663d4f6
494e61b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
18 deletions
+3
-18
src/win32/utf-conv.c
+3
-18
No files found.
src/win32/utf-conv.c
View file @
b85d0afd
...
@@ -8,20 +8,6 @@
...
@@ -8,20 +8,6 @@
#include "common.h"
#include "common.h"
#include "utf-conv.h"
#include "utf-conv.h"
GIT_INLINE
(
DWORD
)
get_wc_flags
(
void
)
{
static
char
inited
=
0
;
static
DWORD
flags
;
/* Invalid code point check supported on Vista+ only */
if
(
!
inited
)
{
flags
=
git_has_win32_version
(
6
,
0
,
0
)
?
WC_ERR_INVALID_CHARS
:
0
;
inited
=
1
;
}
return
flags
;
}
GIT_INLINE
(
void
)
git__set_errno
(
void
)
GIT_INLINE
(
void
)
git__set_errno
(
void
)
{
{
if
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
if
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
...
@@ -66,7 +52,7 @@ int git__utf16_to_8(char *dest, size_t dest_size, const wchar_t *src)
...
@@ -66,7 +52,7 @@ int git__utf16_to_8(char *dest, size_t dest_size, const wchar_t *src)
/* Length of -1 indicates NULL termination of the input string. Subtract 1 from the result to
/* Length of -1 indicates NULL termination of the input string. Subtract 1 from the result to
* turn 0 into -1 (an error code) and to not count the NULL terminator as part of the string's
* turn 0 into -1 (an error code) and to not count the NULL terminator as part of the string's
* length. WideCharToMultiByte never returns int's minvalue, so underflow is not possible */
* length. WideCharToMultiByte never returns int's minvalue, so underflow is not possible */
if
((
len
=
WideCharToMultiByte
(
CP_UTF8
,
get_wc_flags
()
,
src
,
-
1
,
dest
,
(
int
)
dest_size
,
NULL
,
NULL
)
-
1
)
<
0
)
if
((
len
=
WideCharToMultiByte
(
CP_UTF8
,
WC_ERR_INVALID_CHARS
,
src
,
-
1
,
dest
,
(
int
)
dest_size
,
NULL
,
NULL
)
-
1
)
<
0
)
git__set_errno
();
git__set_errno
();
return
len
;
return
len
;
...
@@ -127,12 +113,11 @@ int git__utf8_to_16_alloc(wchar_t **dest, const char *src)
...
@@ -127,12 +113,11 @@ int git__utf8_to_16_alloc(wchar_t **dest, const char *src)
int
git__utf16_to_8_alloc
(
char
**
dest
,
const
wchar_t
*
src
)
int
git__utf16_to_8_alloc
(
char
**
dest
,
const
wchar_t
*
src
)
{
{
int
utf8_size
;
int
utf8_size
;
DWORD
dwFlags
=
get_wc_flags
();
*
dest
=
NULL
;
*
dest
=
NULL
;
/* Length of -1 indicates NULL termination of the input string */
/* Length of -1 indicates NULL termination of the input string */
utf8_size
=
WideCharToMultiByte
(
CP_UTF8
,
dwFlags
,
src
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
utf8_size
=
WideCharToMultiByte
(
CP_UTF8
,
WC_ERR_INVALID_CHARS
,
src
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
utf8_size
)
{
if
(
!
utf8_size
)
{
git__set_errno
();
git__set_errno
();
...
@@ -146,7 +131,7 @@ int git__utf16_to_8_alloc(char **dest, const wchar_t *src)
...
@@ -146,7 +131,7 @@ int git__utf16_to_8_alloc(char **dest, const wchar_t *src)
return
-
1
;
return
-
1
;
}
}
utf8_size
=
WideCharToMultiByte
(
CP_UTF8
,
dwFlags
,
src
,
-
1
,
*
dest
,
utf8_size
,
NULL
,
NULL
);
utf8_size
=
WideCharToMultiByte
(
CP_UTF8
,
WC_ERR_INVALID_CHARS
,
src
,
-
1
,
*
dest
,
utf8_size
,
NULL
,
NULL
);
if
(
!
utf8_size
)
{
if
(
!
utf8_size
)
{
git__set_errno
();
git__set_errno
();
...
...
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