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
89ad1c57
Commit
89ad1c57
authored
Feb 01, 2013
by
Sven Strickroth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get utf8_size from WideCharToMultiByte instead of guessing it
Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent
b0dc81f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/errors.c
+3
-3
src/netops.c
+3
-3
No files found.
src/errors.c
View file @
89ad1c57
...
...
@@ -61,11 +61,11 @@ void giterr_set(int error_class, const char *string, ...)
(
LPWSTR
)
&
lpMsgBuf
,
0
,
NULL
);
if
(
size
)
{
int
utf8_size
=
size
*
4
+
1
;
int
utf8_size
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
lpMsgBuf
,
-
1
,
NULL
,
0
,
NULL
,
NULL
)
;
char
*
lpMsgBuf_utf8
=
git__
calloc
(
utf8_size
,
sizeof
(
char
));
char
*
lpMsgBuf_utf8
=
git__
malloc
(
utf8_size
*
sizeof
(
char
));
GITERR_CHECK_ALLOC
(
lpMsgBuf_utf8
);
WideCharToMultiByte
(
CP_UTF8
,
0
,
lpMsgBuf
,
size
,
lpMsgBuf_utf8
,
utf8_size
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_UTF8
,
0
,
lpMsgBuf
,
-
1
,
lpMsgBuf_utf8
,
utf8_size
,
NULL
,
NULL
);
git_buf_PUTS
(
&
buf
,
": "
);
git_buf_puts
(
&
buf
,
lpMsgBuf_utf8
);
...
...
src/netops.c
View file @
89ad1c57
...
...
@@ -46,10 +46,10 @@ static void net_set_error(const char *str)
int
size
=
FormatMessageW
(
FORMAT_MESSAGE_ALLOCATE_BUFFER
|
FORMAT_MESSAGE_FROM_SYSTEM
,
0
,
error
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
(
LPWSTR
)
&
err_str
,
0
,
0
);
int
utf8_size
=
size
*
4
+
1
;
char
*
err_str_utf8
=
git__
calloc
(
utf8_size
,
sizeof
(
char
));
int
utf8_size
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
err_str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
)
;
char
*
err_str_utf8
=
git__
malloc
(
utf8_size
*
sizeof
(
char
));
GITERR_CHECK_ALLOC
(
err_str_utf8
);
WideCharToMultiByte
(
CP_UTF8
,
0
,
err_str
,
size
,
err_str_utf8
,
utf8_size
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_UTF8
,
0
,
err_str
,
-
1
,
err_str_utf8
,
utf8_size
,
NULL
,
NULL
);
giterr_set
(
GITERR_NET
,
"%s: %s"
,
str
,
err_str_utf8
);
LocalFree
(
err_str
);
...
...
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