Skip to content

Commit 35f5299

Browse files
committed
Use Mile::ToString instead of ToMultiByteString.
1 parent aa1ba6d commit 35f5299

File tree

1 file changed

+2
-40
lines changed

1 file changed

+2
-40
lines changed

Mile.Aria2/Mile.Aria2.cpp

+2-40
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,7 @@
1616

1717
extern "C" int aria2_main(int argc, char** argv);
1818

19-
#include <cstdint>
20-
#include <string>
21-
#include <vector>
22-
23-
namespace
24-
{
25-
std::string ToMultiByteString(
26-
std::uint32_t CodePage,
27-
std::wstring_view const& InputString)
28-
{
29-
std::string OutputString;
30-
31-
int OutputStringLength = ::WideCharToMultiByte(
32-
CodePage,
33-
0,
34-
InputString.data(),
35-
static_cast<int>(InputString.size()),
36-
nullptr,
37-
0,
38-
nullptr,
39-
nullptr);
40-
if (OutputStringLength > 0)
41-
{
42-
OutputString.resize(OutputStringLength);
43-
OutputStringLength = ::WideCharToMultiByte(
44-
CodePage,
45-
0,
46-
InputString.data(),
47-
static_cast<int>(InputString.size()),
48-
&OutputString[0],
49-
OutputStringLength,
50-
nullptr,
51-
nullptr);
52-
OutputString.resize(OutputStringLength);
53-
}
54-
55-
return OutputString;
56-
}
57-
}
19+
#include <Mile.Helpers.CppBase.h>
5820

5921
int wmain(int argc, wchar_t** argv)
6022
{
@@ -63,7 +25,7 @@ int wmain(int argc, wchar_t** argv)
6325
for (int i = 0; i < argc; ++i)
6426
{
6527
utf8_argv.push_back(::_strdup(
66-
::ToMultiByteString(CP_UTF8, argv[i]).c_str()));
28+
Mile::ToString(CP_UTF8, argv[i]).c_str()));
6729
}
6830
utf8_argv.push_back(nullptr);
6931

0 commit comments

Comments
 (0)