Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
169810e8
Unverified
Commit
169810e8
authored
May 30, 2020
by
Shen-Ta Hsieh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/icu: add null terminate in win32 string and wstring
parent
9f5c6d29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
Win32.cxx
src/lib/icu/Win32.cxx
+6
-4
No files found.
src/lib/icu/Win32.cxx
View file @
169810e8
...
...
@@ -34,9 +34,10 @@ WideCharToMultiByte(unsigned code_page, std::wstring_view src)
if
(
length
<=
0
)
throw
MakeLastError
(
"Failed to convert from Unicode"
);
std
::
unique_ptr
<
char
[]
>
buffer
(
new
char
[
length
]);
auto
buffer
=
std
::
make_unique
<
char
[]
>
(
length
+
1
);
buffer
[
length
]
=
'\0'
;
length
=
WideCharToMultiByte
(
code_page
,
0
,
src
.
data
(),
src
.
size
(),
buffer
.
get
(),
length
,
buffer
.
get
(),
length
+
1
,
nullptr
,
nullptr
);
if
(
length
<=
0
)
throw
MakeLastError
(
"Failed to convert from Unicode"
);
...
...
@@ -52,9 +53,10 @@ MultiByteToWideChar(unsigned code_page, std::string_view src)
if
(
length
<=
0
)
throw
MakeLastError
(
"Failed to convert to Unicode"
);
std
::
unique_ptr
<
wchar_t
[]
>
buffer
(
new
wchar_t
[
length
]);
auto
buffer
=
std
::
make_unique
<
wchar_t
[]
>
(
length
+
1
);
buffer
[
length
]
=
L'\0'
;
length
=
MultiByteToWideChar
(
code_page
,
0
,
src
.
data
(),
src
.
size
(),
buffer
.
get
(),
length
);
buffer
.
get
(),
length
+
1
);
if
(
length
<=
0
)
throw
MakeLastError
(
"Failed to convert to Unicode"
);
...
...
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