Commit 576c0f9c authored by nanahira's avatar nanahira

Merge branch 'master' of https://github.com/Fluorohydride/ygopro

parents 3f122605 8ddb05c5
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "game.h" #include "game.h"
#include "data_manager.h" #include "data_manager.h"
#include <event2/thread.h> #include <event2/thread.h>
#include <memory>
#ifdef __APPLE__ #ifdef __APPLE__
#import <CoreFoundation/CoreFoundation.h> #import <CoreFoundation/CoreFoundation.h>
#endif #endif
...@@ -62,10 +63,12 @@ int main(int argc, char* argv[]) { ...@@ -62,10 +63,12 @@ int main(int argc, char* argv[]) {
#ifdef _WIN32 #ifdef _WIN32
int wargc; int wargc;
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &wargc); std::unique_ptr<wchar_t*[], void(*)(wchar_t**)> wargv(CommandLineToArgvW(GetCommandLineW(), &wargc), [](wchar_t** wargv) {
LocalFree(wargv);
});
#else #else
int wargc = argc; int wargc = argc;
wchar_t (*wargv)[256] = new wchar_t[wargc][256]; auto wargv = std::make_unique<wchar_t[][256]>(wargc);
for(int i = 0; i < argc; ++i) { for(int i = 0; i < argc; ++i) {
BufferIO::DecodeUTF8(argv[i], wargv[i]); BufferIO::DecodeUTF8(argv[i], wargv[i]);
} }
...@@ -175,11 +178,6 @@ int main(int argc, char* argv[]) { ...@@ -175,11 +178,6 @@ int main(int argc, char* argv[]) {
} }
} }
} }
#ifdef _WIN32
LocalFree(wargv);
#else
delete[] wargv;
#endif
ygo::mainGame->MainLoop(); ygo::mainGame->MainLoop();
#ifdef _WIN32 #ifdef _WIN32
WSACleanup(); WSACleanup();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment