Standardizing wchar->char in main().

This commit is contained in:
Ben Vanik 2016-01-01 12:46:26 -08:00
parent c8b544ffd4
commit c93b93fe55
2 changed files with 5 additions and 3 deletions

View File

@ -13,6 +13,8 @@
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <io.h> #include <io.h>
#include <cstdlib>
// Autogenerated by `xb premake`. // Autogenerated by `xb premake`.
#include "build/version.h" #include "build/version.h"
@ -72,7 +74,7 @@ int Main() {
for (int n = 0; n < argca; n++) { for (int n = 0; n < argca; n++) {
size_t len = wcslen(argv[n]); size_t len = wcslen(argv[n]);
argva[n] = reinterpret_cast<char*>(alloca(len + 1)); argva[n] = reinterpret_cast<char*>(alloca(len + 1));
wcstombs_s(nullptr, argva[n], len + 1, argv[n], _TRUNCATE); std::wcstombs(argva[n], argv[n], len + 1);
} }
// Parse flags; this may delete some of them. // Parse flags; this may delete some of them.

View File

@ -9,7 +9,7 @@
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <codecvt> #include <cstdlib>
#include <cstring> #include <cstring>
#include <locale> #include <locale>
#include <string> #include <string>
@ -33,7 +33,7 @@ int main(int argc, wchar_t* argv[]) {
for (int n = 0; n < argca; n++) { for (int n = 0; n < argca; n++) {
size_t len = wcslen(argv[n]); size_t len = wcslen(argv[n]);
argva[n] = (char*)alloca(len + 1); argva[n] = (char*)alloca(len + 1);
wcstombs_s(nullptr, argva[n], len + 1, argv[n], _TRUNCATE); std::wcstombs(argva[n], argv[n], len + 1);
} }
// Parse flags; this may delete some of them. // Parse flags; this may delete some of them.