Ticket #3138: wseh.cpp.patch
File wseh.cpp.patch, 1.0 KB (added by , 9 years ago) |
---|
-
source/lib/sysdep/os/win/wseh.cpp
1 /* Copyright (c) 201 0Wildfire Games1 /* Copyright (c) 2015 Wildfire Games 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining 4 4 * a copy of this software and associated documentation files (the … … 365 365 366 366 EXTERN_C int main(int argc, char* argv[]); 367 367 368 // required because main's argv is in a non-UTF8 encoding369 int wmain(int argc, wchar_t* argv[])370 {371 if(argc == 0)372 return EXIT_FAILURE; // ensure &utf8_argv[0] is safe373 std::vector<char*> utf8_argv(argc);374 for(int i = 0; i < argc; i++)375 {376 std::string utf8 = utf8_from_wstring(argv[i]);377 utf8_argv[i] = strdup(utf8.c_str());378 }379 380 const int ret = main(argc, &utf8_argv[0]);381 382 for(int i = 0; i < argc; i++)383 free(utf8_argv[i]);384 return ret;385 }386 387 368 #endif 388 369 389 370 EXTERN_C int MAIN_STARTUP();