Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Oct 6, 2023
1 parent 853f240 commit c514121
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/libs/antares/args/args_to_utf8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
#include <shellapi.h>
#endif // YUNI_OS_WINDOWS

IntoUTF8ArgsTranslator::IntoUTF8ArgsTranslator(int argc, char** argv)
IntoUTF8ArgsTranslator::IntoUTF8ArgsTranslator(int& argc, char** argv)
: argc_(argc), argv_(argv)
{
}

char** IntoUTF8ArgsTranslator::convert()
{
#ifdef YUNI_OS_WINDOWS
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
argv_ = (char**)malloc(argc * sizeof(char*));
for (int i = 0; i != argc; ++i)
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &argc_);
argv_ = (char**)malloc(argc_ * sizeof(char*));
for (int i = 0; i != argc_; ++i)
{
const uint len = (uint)wcslen(wargv[i]);
const uint newLen = WideCharToMultiByte(CP_UTF8, 0, wargv[i], len, NULL, 0, NULL, NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/args/include/antares/args/args_to_utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class IntoUTF8ArgsTranslator
char** convert();
~IntoUTF8ArgsTranslator();
private:
int argc_ = 0;
int& argc_;
char** argv_;
};

0 comments on commit c514121

Please sign in to comment.