While npos means "largest unsigned value" and adding 1 to it yields 0, it may be clearer to just assign 0 to it and only increment otherwise.
This also allows to remove a file-wide suppression for unsigned-integer-overflow.
While npos means "largest unsigned value" and adding 1 to it yields 0, it may be clearer to just assign 0 to it and only increment otherwise.
This also allows to remove a file-wide suppression for unsigned-integer-overflow.
432 | @@ -433,13 +433,16 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn 433 | if (pos==0) 434 | throw std::runtime_error("TX output value not specified"); 435 | 436 | - if (pos != std::string::npos) { 437 | + if (pos == std::string::npos) {
nit: Preserving the original condition, i.e., switching branches if and else, makes diff smaller.
Double negation makes code harder to read
Since npos is already a negation, in this case the else would be triple-negated
ACK faa75fa19335e3e826efa4f2280609a2db34425d, I have reviewed the code and it looks OK, I agree it can be merged.
Code-review ACK faa75fa19335e3e826efa4f2280609a2db34425d