@@ -2713,13 +2713,13 @@ void CheckOther::checkSignOfUnsignedVariable()
27132713 for (const Token *tok = scope->bodyStart ->next (); tok != scope->bodyEnd ; tok = tok->next ()) {
27142714 const ValueFlow::Value *zeroValue = nullptr ;
27152715 const Token *nonZeroExpr = nullptr ;
2716- if (comparisonNonZeroExpressionLessThanZero (tok, & zeroValue, & nonZeroExpr)) {
2716+ if (comparisonNonZeroExpressionLessThanZero (tok, zeroValue, nonZeroExpr)) {
27172717 const ValueType* vt = nonZeroExpr->valueType ();
27182718 if (vt->pointer )
27192719 pointerLessThanZeroError (tok, zeroValue);
27202720 else
27212721 unsignedLessThanZeroError (tok, zeroValue, nonZeroExpr->expressionString ());
2722- } else if (testIfNonZeroExpressionIsPositive (tok, & zeroValue, & nonZeroExpr)) {
2722+ } else if (testIfNonZeroExpressionIsPositive (tok, zeroValue, nonZeroExpr)) {
27232723 const ValueType* vt = nonZeroExpr->valueType ();
27242724 if (vt->pointer )
27252725 pointerPositiveError (tok, zeroValue);
@@ -2730,7 +2730,7 @@ void CheckOther::checkSignOfUnsignedVariable()
27302730 }
27312731}
27322732
2733- bool CheckOther::comparisonNonZeroExpressionLessThanZero (const Token *tok, const ValueFlow::Value ** zeroValue, const Token ** nonZeroExpr, bool suppress)
2733+ bool CheckOther::comparisonNonZeroExpressionLessThanZero (const Token *tok, const ValueFlow::Value *& zeroValue, const Token *& nonZeroExpr, bool suppress)
27342734{
27352735 if (!tok->isComparisonOp () || !tok->astOperand1 () || !tok->astOperand2 ())
27362736 return false ;
@@ -2739,24 +2739,24 @@ bool CheckOther::comparisonNonZeroExpressionLessThanZero(const Token *tok, const
27392739 const ValueFlow::Value *v2 = tok->astOperand2 ()->getValue (0 );
27402740
27412741 if (Token::Match (tok, " <|<=" ) && v2 && v2->isKnown ()) {
2742- * zeroValue = v2;
2743- * nonZeroExpr = tok->astOperand1 ();
2742+ zeroValue = v2;
2743+ nonZeroExpr = tok->astOperand1 ();
27442744 } else if (Token::Match (tok, " >|>=" ) && v1 && v1->isKnown ()) {
2745- * zeroValue = v1;
2746- * nonZeroExpr = tok->astOperand2 ();
2745+ zeroValue = v1;
2746+ nonZeroExpr = tok->astOperand2 ();
27472747 } else {
27482748 return false ;
27492749 }
27502750
2751- if (const Variable* var = (* nonZeroExpr) ->variable ())
2751+ if (const Variable* var = nonZeroExpr->variable ())
27522752 if (var->typeStartToken ()->isTemplateArg ())
27532753 return suppress;
27542754
2755- const ValueType* vt = (* nonZeroExpr) ->valueType ();
2755+ const ValueType* vt = nonZeroExpr->valueType ();
27562756 return vt && (vt->pointer || vt->sign == ValueType::UNSIGNED);
27572757}
27582758
2759- bool CheckOther::testIfNonZeroExpressionIsPositive (const Token *tok, const ValueFlow::Value ** zeroValue, const Token ** nonZeroExpr)
2759+ bool CheckOther::testIfNonZeroExpressionIsPositive (const Token *tok, const ValueFlow::Value *& zeroValue, const Token *& nonZeroExpr)
27602760{
27612761 if (!tok->isComparisonOp () || !tok->astOperand1 () || !tok->astOperand2 ())
27622762 return false ;
@@ -2765,16 +2765,16 @@ bool CheckOther::testIfNonZeroExpressionIsPositive(const Token *tok, const Value
27652765 const ValueFlow::Value *v2 = tok->astOperand2 ()->getValue (0 );
27662766
27672767 if (Token::simpleMatch (tok, " >=" ) && v2 && v2->isKnown ()) {
2768- * zeroValue = v2;
2769- * nonZeroExpr = tok->astOperand1 ();
2768+ zeroValue = v2;
2769+ nonZeroExpr = tok->astOperand1 ();
27702770 } else if (Token::simpleMatch (tok, " <=" ) && v1 && v1->isKnown ()) {
2771- * zeroValue = v1;
2772- * nonZeroExpr = tok->astOperand2 ();
2771+ zeroValue = v1;
2772+ nonZeroExpr = tok->astOperand2 ();
27732773 } else {
27742774 return false ;
27752775 }
27762776
2777- const ValueType* vt = (* nonZeroExpr) ->valueType ();
2777+ const ValueType* vt = nonZeroExpr->valueType ();
27782778 return vt && (vt->pointer || vt->sign == ValueType::UNSIGNED);
27792779}
27802780
@@ -3863,7 +3863,7 @@ void CheckOther::checkModuloOfOneError(const Token *tok)
38633863// -----------------------------------------------------------------------------
38643864// Overlapping write (undefined behavior)
38653865// -----------------------------------------------------------------------------
3866- static bool getBufAndOffset (const Token *expr, const Token ** buf, MathLib::bigint *offset)
3866+ static bool getBufAndOffset (const Token *expr, const Token *& buf, MathLib::bigint *offset)
38673867{
38683868 if (!expr)
38693869 return false ;
@@ -3884,7 +3884,7 @@ static bool getBufAndOffset(const Token *expr, const Token **buf, MathLib::bigin
38843884 return false ;
38853885 }
38863886 } else if (expr->valueType () && expr->valueType ()->pointer > 0 ) {
3887- * buf = expr;
3887+ buf = expr;
38883888 *offset = 0 ;
38893889 return true ;
38903890 } else {
@@ -3894,7 +3894,7 @@ static bool getBufAndOffset(const Token *expr, const Token **buf, MathLib::bigin
38943894 return false ;
38953895 if (!offsetToken->hasKnownIntValue ())
38963896 return false ;
3897- * buf = bufToken;
3897+ buf = bufToken;
38983898 *offset = offsetToken->getKnownIntValue ();
38993899 return true ;
39003900}
@@ -3973,9 +3973,9 @@ void CheckOther::checkOverlappingWrite()
39733973 const MathLib::bigint sizeValue = args[nonOverlappingData->sizeArg -1 ]->getKnownIntValue ();
39743974 const Token *buf1, *buf2;
39753975 MathLib::bigint offset1, offset2;
3976- if (!getBufAndOffset (ptr1, & buf1, &offset1))
3976+ if (!getBufAndOffset (ptr1, buf1, &offset1))
39773977 continue ;
3978- if (!getBufAndOffset (ptr2, & buf2, &offset2))
3978+ if (!getBufAndOffset (ptr2, buf2, &offset2))
39793979 continue ;
39803980
39813981 if (offset1 < offset2 && offset1 + sizeValue <= offset2)
0 commit comments