qnanopainter
qnanopainter copied to clipboard
Patch qnanopainter.cpp to fix warning from Clang-Tidy/Clazy: "[bugprone-incorrect-roundings]"
As I mentioned in https://github.com/QUItCoding/qnanopainter/issues/32#issuecomment-462162620 I ran Qt5.12.1's qtcreator "Analyze->Clang-Tidy and Clazy..." and it complained about the rounding in code from https://github.com/QUItCoding/qnanopainter/blob/967d3c28359d679c0c0413ac85e77aa3a767d2bd/libqnanopainter/qnanopainter.cpp#L1453 through https://github.com/QUItCoding/qnanopainter/blob/967d3c28359d679c0c0413ac85e77aa3a767d2bd/libqnanopainter/qnanopainter.cpp#L1464 :
: warning: casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include <cmath>) instead [bugprone-incorrect-roundings]
Enclosed is a patch to fix the warning:
Unlike the "Clang-Tidy and Clazy..." suggestion "<cmath.h>", I used "<qmath.h>" because https://github.com/QUItCoding/qnanopainter/issues/20 indicates cmath.h causes error on MSVC.