Browse Source

Null-terminate argvU8 array in wmain() wrapper.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
64c86251ef
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      adapters/standalone.cpp

+ 2
- 1
adapters/standalone.cpp View File

@@ -264,11 +264,12 @@ int main(int argc, char* argv[]) {
int wmain(int argc, wchar_t* argvU16[]) { int wmain(int argc, wchar_t* argvU16[]) {
// Initialize char* array with string-owned buffers // Initialize char* array with string-owned buffers
std::string argvStr[argc]; std::string argvStr[argc];
const char* argvU8[argc];
const char* argvU8[argc + 1];
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
argvStr[i] = string::UTF16toUTF8(argvU16[i]); argvStr[i] = string::UTF16toUTF8(argvU16[i]);
argvU8[i] = argvStr[i].c_str(); argvU8[i] = argvStr[i].c_str();
} }
argvU8[argc] = NULL;
return main(argc, (char**) argvU8); return main(argc, (char**) argvU8);
} }
#endif #endif

Loading…
Cancel
Save