@@ -271,21 +271,21 @@ bool isDevScript(std::wstring scriptPath)
271
271
return scriptPath.compare (nextToLastSlash + 1 , finalSlash - 1 - nextToLastSlash, L" src" ) == 0 ;
272
272
}
273
273
274
- std::vector<std::string> ConvertToACP (std::vector<std::wstring> commandLine)
274
+ std::vector<std::string> ConvertToUTF8 (std::vector<std::wstring> commandLine)
275
275
{
276
- std::vector<std::string> commandLineACP ;
276
+ std::vector<std::string> commandLineUTF8 ;
277
277
if (commandLine.size () > 0 )
278
278
{
279
- commandLineACP .reserve (commandLine.size ());
279
+ commandLineUTF8 .reserve (commandLine.size ());
280
280
for (const std::wstring ¶m : commandLine)
281
281
{
282
- int dwACPSize = WideCharToMultiByte (CP_ACP , 0 , param.c_str (), (int )param.size (), NULL , 0 , NULL , NULL );
283
- std::string paramACP (dwACPSize , 0 );
284
- WideCharToMultiByte (CP_ACP , 0 , param.c_str (), (int )param.size (), paramACP .data (), dwACPSize , NULL , NULL );
285
- commandLineACP .emplace_back (std::move (paramACP ));
282
+ int dwUTF8Size = WideCharToMultiByte (CP_UTF8 , 0 , param.c_str (), (int )param.size (), NULL , 0 , NULL , NULL );
283
+ std::string paramUTF8 (dwUTF8Size , 0 );
284
+ WideCharToMultiByte (CP_UTF8 , 0 , param.c_str (), (int )param.size (), paramUTF8 .data (), dwUTF8Size , NULL , NULL );
285
+ commandLineUTF8 .emplace_back (std::move (paramUTF8 ));
286
286
}
287
287
}
288
- return commandLineACP ;
288
+ return commandLineUTF8 ;
289
289
}
290
290
291
291
void InitConsole ()
@@ -356,18 +356,18 @@ int CALLBACK wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
356
356
}
357
357
358
358
// Create a utf8 version of the commandline parameters
359
- std::vector<std::string> commandLineACP = ConvertToACP (commandLine);
359
+ std::vector<std::string> commandLineUTF8 = ConvertToUTF8 (commandLine);
360
360
361
361
// Remove the first commandline argument as the scripts don't care about that.
362
- commandLineACP .erase (commandLineACP .begin ());
362
+ commandLineUTF8 .erase (commandLineUTF8 .begin ());
363
363
364
364
// Convert the commandline parameters to a form the DLL can understand
365
365
size_t dwTotalParamSize = 0 ;
366
- for (const std::string ¶m : commandLineACP )
366
+ for (const std::string ¶m : commandLineUTF8 )
367
367
{
368
368
dwTotalParamSize += param.size () + 1 ;
369
369
}
370
- size_t dwNumParams = commandLineACP .size ();
370
+ size_t dwNumParams = commandLineUTF8 .size ();
371
371
std::unique_ptr<char []> pParamBuf = std::make_unique<char []>(dwTotalParamSize);
372
372
char *pCurParamBufLoc = pParamBuf.get ();
373
373
@@ -376,13 +376,13 @@ int CALLBACK wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
376
376
{
377
377
ppParamList[i] = pCurParamBufLoc;
378
378
379
- const std::string ¶m = commandLineACP [i];
379
+ const std::string ¶m = commandLineUTF8 [i];
380
380
memcpy (pCurParamBufLoc, param.c_str (), param.size () + 1 );
381
381
pCurParamBufLoc += param.size () + 1 ;
382
382
}
383
383
384
384
// Call into the DLL
385
- int dwStatus = RunLuaFile (dwNumParams, ppParamList.get ());
385
+ int dwStatus = RunLuaFile (( int ) dwNumParams, ppParamList.get ());
386
386
387
387
// Cleanup the DLL
388
388
FreeLibrary (hDLL);
0 commit comments