@@ -2714,13 +2714,13 @@ void CheckOther::checkSignOfUnsignedVariable()
27142714 for (const Token *tok = scope->bodyStart ->next (); tok != scope->bodyEnd ; tok = tok->next ()) {
27152715 const ValueFlow::Value *zeroValue = nullptr ;
27162716 const Token *nonZeroExpr = nullptr ;
2717- if (comparisonNonZeroExpressionLessThanZero (tok, & zeroValue, & nonZeroExpr)) {
2717+ if (comparisonNonZeroExpressionLessThanZero (tok, zeroValue, nonZeroExpr)) {
27182718 const ValueType* vt = nonZeroExpr->valueType ();
27192719 if (vt->pointer )
27202720 pointerLessThanZeroError (tok, zeroValue);
27212721 else
27222722 unsignedLessThanZeroError (tok, zeroValue, nonZeroExpr->expressionString ());
2723- } else if (testIfNonZeroExpressionIsPositive (tok, & zeroValue, & nonZeroExpr)) {
2723+ } else if (testIfNonZeroExpressionIsPositive (tok, zeroValue, nonZeroExpr)) {
27242724 const ValueType* vt = nonZeroExpr->valueType ();
27252725 if (vt->pointer )
27262726 pointerPositiveError (tok, zeroValue);
@@ -2731,7 +2731,7 @@ void CheckOther::checkSignOfUnsignedVariable()
27312731 }
27322732}
27332733
2734- bool CheckOther::comparisonNonZeroExpressionLessThanZero (const Token *tok, const ValueFlow::Value ** zeroValue, const Token ** nonZeroExpr, bool suppress)
2734+ bool CheckOther::comparisonNonZeroExpressionLessThanZero (const Token *tok, const ValueFlow::Value *& zeroValue, const Token *& nonZeroExpr, bool suppress)
27352735{
27362736 if (!tok->isComparisonOp () || !tok->astOperand1 () || !tok->astOperand2 ())
27372737 return false ;
@@ -2740,24 +2740,24 @@ bool CheckOther::comparisonNonZeroExpressionLessThanZero(const Token *tok, const
27402740 const ValueFlow::Value *v2 = tok->astOperand2 ()->getValue (0 );
27412741
27422742 if (Token::Match (tok, " <|<=" ) && v2 && v2->isKnown ()) {
2743- * zeroValue = v2;
2744- * nonZeroExpr = tok->astOperand1 ();
2743+ zeroValue = v2;
2744+ nonZeroExpr = tok->astOperand1 ();
27452745 } else if (Token::Match (tok, " >|>=" ) && v1 && v1->isKnown ()) {
2746- * zeroValue = v1;
2747- * nonZeroExpr = tok->astOperand2 ();
2746+ zeroValue = v1;
2747+ nonZeroExpr = tok->astOperand2 ();
27482748 } else {
27492749 return false ;
27502750 }
27512751
2752- if (const Variable* var = (* nonZeroExpr) ->variable ())
2752+ if (const Variable* var = nonZeroExpr->variable ())
27532753 if (var->typeStartToken ()->isTemplateArg ())
27542754 return suppress;
27552755
2756- const ValueType* vt = (* nonZeroExpr) ->valueType ();
2756+ const ValueType* vt = nonZeroExpr->valueType ();
27572757 return vt && (vt->pointer || vt->sign == ValueType::UNSIGNED);
27582758}
27592759
2760- bool CheckOther::testIfNonZeroExpressionIsPositive (const Token *tok, const ValueFlow::Value ** zeroValue, const Token ** nonZeroExpr)
2760+ bool CheckOther::testIfNonZeroExpressionIsPositive (const Token *tok, const ValueFlow::Value *& zeroValue, const Token *& nonZeroExpr)
27612761{
27622762 if (!tok->isComparisonOp () || !tok->astOperand1 () || !tok->astOperand2 ())
27632763 return false ;
@@ -2766,16 +2766,16 @@ bool CheckOther::testIfNonZeroExpressionIsPositive(const Token *tok, const Value
27662766 const ValueFlow::Value *v2 = tok->astOperand2 ()->getValue (0 );
27672767
27682768 if (Token::simpleMatch (tok, " >=" ) && v2 && v2->isKnown ()) {
2769- * zeroValue = v2;
2770- * nonZeroExpr = tok->astOperand1 ();
2769+ zeroValue = v2;
2770+ nonZeroExpr = tok->astOperand1 ();
27712771 } else if (Token::simpleMatch (tok, " <=" ) && v1 && v1->isKnown ()) {
2772- * zeroValue = v1;
2773- * nonZeroExpr = tok->astOperand2 ();
2772+ zeroValue = v1;
2773+ nonZeroExpr = tok->astOperand2 ();
27742774 } else {
27752775 return false ;
27762776 }
27772777
2778- const ValueType* vt = (* nonZeroExpr) ->valueType ();
2778+ const ValueType* vt = nonZeroExpr->valueType ();
27792779 return vt && (vt->pointer || vt->sign == ValueType::UNSIGNED);
27802780}
27812781
@@ -3864,7 +3864,7 @@ void CheckOther::checkModuloOfOneError(const Token *tok)
38643864// -----------------------------------------------------------------------------
38653865// Overlapping write (undefined behavior)
38663866// -----------------------------------------------------------------------------
3867- static bool getBufAndOffset (const Token *expr, const Token ** buf, MathLib::bigint *offset)
3867+ static bool getBufAndOffset (const Token *expr, const Token *& buf, MathLib::bigint *offset)
38683868{
38693869 if (!expr)
38703870 return false ;
@@ -3885,7 +3885,7 @@ static bool getBufAndOffset(const Token *expr, const Token **buf, MathLib::bigin
38853885 return false ;
38863886 }
38873887 } else if (expr->valueType () && expr->valueType ()->pointer > 0 ) {
3888- * buf = expr;
3888+ buf = expr;
38893889 *offset = 0 ;
38903890 return true ;
38913891 } else {
@@ -3895,7 +3895,7 @@ static bool getBufAndOffset(const Token *expr, const Token **buf, MathLib::bigin
38953895 return false ;
38963896 if (!offsetToken->hasKnownIntValue ())
38973897 return false ;
3898- * buf = bufToken;
3898+ buf = bufToken;
38993899 *offset = offsetToken->getKnownIntValue ();
39003900 return true ;
39013901}
@@ -3974,9 +3974,9 @@ void CheckOther::checkOverlappingWrite()
39743974 const MathLib::bigint sizeValue = args[nonOverlappingData->sizeArg -1 ]->getKnownIntValue ();
39753975 const Token *buf1, *buf2;
39763976 MathLib::bigint offset1, offset2;
3977- if (!getBufAndOffset (ptr1, & buf1, &offset1))
3977+ if (!getBufAndOffset (ptr1, buf1, &offset1))
39783978 continue ;
3979- if (!getBufAndOffset (ptr2, & buf2, &offset2))
3979+ if (!getBufAndOffset (ptr2, buf2, &offset2))
39803980 continue ;
39813981
39823982 if (offset1 < offset2 && offset1 + sizeValue <= offset2)
0 commit comments