MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / injectPlatformArg

Function injectPlatformArg

app/src/Platform/AppPlatform.cpp:409–425  ·  view source on GitHub ↗

code-verify off (cold argv setup before QApplication exists; C malloc is intentional) * @brief Injects "-platform " into argv before Qt parses it. */

Source from the content-addressed store, hash-verified

407 * @brief Injects "-platform <platform>" into argv before Qt parses it.
408 */
409char** injectPlatformArg(int& argc, char** argv, const char* platform)
410{
411 char** newArgv = static_cast<char**>(malloc(sizeof(char*) * (argc + 3)));
412 if (!newArgv)
413 return argv;
414
415 newArgv[0] = argv[0];
416 newArgv[1] = const_cast<char*>("-platform");
417 newArgv[2] = const_cast<char*>(platform);
418
419 for (int i = 1; i < argc; ++i)
420 newArgv[i + 2] = argv[i];
421
422 newArgv[argc + 2] = nullptr;
423 argc += 2;
424 return newArgv;
425}
426
427// code-verify on
428

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected