MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / QVector1

Function QVector1

test/cfg/qt.cpp:453–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451}
452
453void QVector1(QVector<int> intVectorArg)
454{
455 for (int i = 0; i <= intVectorArg.size(); ++i) {
456 // cppcheck-suppress stlOutOfBounds
457 intVectorArg[i] = 1;
458 }
459 // cppcheck-suppress containerOutOfBoundsIndexExpression
460 intVectorArg[intVectorArg.length()] = 5;
461 // cppcheck-suppress containerOutOfBoundsIndexExpression
462 intVectorArg[intVectorArg.count()] = 10;
463 // cppcheck-suppress containerOutOfBoundsIndexExpression
464 printf("val: %d\n", intVectorArg[intVectorArg.size()]);
465
466 QVector<QString> qstringVector1{"one", "two"};
467 (void)qstringVector1[1];
468
469 QVector<QString> qstringVector2 = {"one", "two"};
470 (void)qstringVector2[1];
471
472 QVector<QString> qstringVector3;
473 qstringVector3 << "one" << "two";
474 (void)qstringVector3[1];
475 // FIXME: The following should have a containerOutOfBounds suppression #9242
476 (void)qstringVector3[3];
477 // cppcheck-suppress ignoredReturnValue
478 qstringVector3.startsWith("one");
479 // cppcheck-suppress ignoredReturnValue
480 qstringVector3.endsWith("one");
481 // cppcheck-suppress ignoredReturnValue
482 qstringVector3.count();
483 // cppcheck-suppress ignoredReturnValue
484 qstringVector3.length();
485 // cppcheck-suppress ignoredReturnValue
486 qstringVector3.size();
487 // cppcheck-suppress ignoredReturnValue
488 qstringVector3.at(5);
489 // cppcheck-suppress invalidFunctionArg
490 (void)qstringVector3.at(-5);
491}
492
493QVector<int>::iterator QVector2()
494{

Callers

nothing calls this directly

Calls 4

startsWithMethod · 0.80
endsWithMethod · 0.80
atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected