Ticket #3138: wseh.cpp.patch

File wseh.cpp.patch, 1.0 KB (added by historic_bruno, 9 years ago)
  • source/lib/sysdep/os/win/wseh.cpp

     
    1 /* Copyright (c) 2010 Wildfire Games
     1/* Copyright (c) 2015 Wildfire Games
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    365365
    366366EXTERN_C int main(int argc, char* argv[]);
    367367
    368 // required because main's argv is in a non-UTF8 encoding
    369 int wmain(int argc, wchar_t* argv[])
    370 {
    371     if(argc == 0)
    372         return EXIT_FAILURE;    // ensure &utf8_argv[0] is safe
    373     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 
    387368#endif
    388369
    389370EXTERN_C int MAIN_STARTUP();