| 415 | } |
| 416 | |
| 417 | void CheckTypeImpl::longCastAssignError(const Token *tok, const ValueType* src, const ValueType* tgt) |
| 418 | { |
| 419 | std::string srcStr = src ? src->str() : "int"; |
| 420 | makeBaseTypeString(srcStr); |
| 421 | std::string tgtStr = tgt ? tgt->str() : "long"; |
| 422 | makeBaseTypeString(tgtStr); |
| 423 | reportError(tok, |
| 424 | Severity::style, |
| 425 | "truncLongCastAssignment", |
| 426 | srcStr + " result is assigned to " + tgtStr + " variable. If the variable is " + tgtStr + " to avoid loss of information, then you have loss of information.\n" + |
| 427 | srcStr + " result is assigned to " + tgtStr + " variable. If the variable is " + tgtStr + " to avoid loss of information, then there is loss of information. To avoid loss of information you must cast a calculation operand to " + tgtStr + ", for example 'l = a * b;' => 'l = (" + tgtStr + ")a * b;'.", CWE197, Certainty::normal); |
| 428 | } |
| 429 | |
| 430 | void CheckTypeImpl::longCastReturnError(const Token *tok, const ValueType* src, const ValueType* tgt) |
| 431 | { |
no test coverage detected