Ticket #3225: wseh.cpp.patch
File wseh.cpp.patch, 1.1 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 … … 370 370 { 371 371 if(argc == 0) 372 372 return EXIT_FAILURE; // ensure &utf8_argv[0] is safe 373 373 374 std::vector<char*> utf8_argv(argc); 375 std::string buffer; 376 377 char* p = (char*) 1; 374 378 for(int i = 0; i < argc; i++) 375 379 { 376 std::string utf8 = utf8_from_wstring(argv[i]); 377 utf8_argv[i] = strdup(utf8.c_str()); 380 buffer += "_" + utf8_from_wstring(argv[i]); 381 *(&buffer.at(0) + (int)p - 1) = '\x0'; 382 utf8_argv[i] = p; 383 p = (char*)buffer.length() + 1; 378 384 } 379 385 386 p = &buffer.at(0); 387 for (int i = 0; i < argc; i++) 388 utf8_argv[i] = p + (int)utf8_argv[i]; 389 380 390 const int ret = main(argc, &utf8_argv[0]); 381 391 382 for(int i = 0; i < argc; i++)383 free(utf8_argv[i]);384 392 return ret; 385 393 } 386 394