MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / CheckArgumentsSize

Function CheckArgumentsSize

CppCoverage/OptionsParser.cpp:302–323  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

300 }
301 //---------------------------------------------------------------------------
302 void CheckArgumentsSize(int argc,
303 const char** argv,
304 Tools::WarningManager& warningManager)
305 {
306 size_t estimatedSize = 0;
307 for (int i = 0; i < argc; ++i)
308 {
309 auto argument = argv[i];
310 if (argument)
311 estimatedSize += strlen(argument);
312 }
313
314 estimatedSize += argc - 1; // separators for arguments.
315 if (estimatedSize >=
316 static_cast<size_t>(OptionsParser::DosCommandLineMaxSize * 3 /
317 4))
318 {
319 auto tooLongCmd = OptionsParser::GetTooLongCommandLineMessage();
320 LOG_WARNING << tooLongCmd;
321 warningManager.AddWarning(tooLongCmd);
322 }
323 }
324 }
325
326 //-------------------------------------------------------------------------

Callers 1

ParseMethod · 0.85

Calls 1

AddWarningMethod · 0.80

Tested by

no test coverage detected