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

Function QStack1

test/cfg/qt.cpp:521–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521void QStack1(QStack<int> intStackArg)
522{
523 for (int i = 0; i <= intStackArg.size(); ++i) {
524 // cppcheck-suppress stlOutOfBounds
525 intStackArg[i] = 1;
526 }
527 // cppcheck-suppress containerOutOfBoundsIndexExpression
528 intStackArg[intStackArg.length()] = 5;
529 // cppcheck-suppress containerOutOfBoundsIndexExpression
530 intStackArg[intStackArg.count()] = 10;
531 // cppcheck-suppress containerOutOfBoundsIndexExpression
532 printf("val: %d\n", intStackArg[intStackArg.size()]);
533
534 QStack<QString> qstringStack1;
535 qstringStack1.push("one");
536 qstringStack1.push("two");
537 (void)qstringStack1[1];
538
539 QStack<QString> qstringStack2;
540 qstringStack2 << "one" << "two";
541 (void)qstringStack2[1];
542 // FIXME: The following should have a containerOutOfBounds suppression #9242
543 (void)qstringStack2[3];
544 // cppcheck-suppress ignoredReturnValue
545 qstringStack2.startsWith("one");
546 // cppcheck-suppress ignoredReturnValue
547 qstringStack2.endsWith("one");
548 // cppcheck-suppress ignoredReturnValue
549 qstringStack2.count();
550 // cppcheck-suppress ignoredReturnValue
551 qstringStack2.length();
552 // cppcheck-suppress ignoredReturnValue
553 qstringStack2.size();
554 // cppcheck-suppress ignoredReturnValue
555 qstringStack2.at(5);
556 // cppcheck-suppress invalidFunctionArg
557 (void)qstringStack2.at(-5);
558}
559
560QStack<int>::iterator QStack2()
561{

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