Closed ColinIanKing closed 7 years ago
I think it will fix all except potential memory leak, which I don't think is a valid one.
Please try the attached file, if it is fine, I will apply.
Apologies for taking so long to reply, for some reason I missed the notification on your message.
Using the source from the zip I get:
/usr/share/clang/scan-build-3.8/bin/../libexec/c++-analyzer -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtDBus -I/usr/include/qt4 -I. -I. -o qcustomplot.o qcustomplot/qcustomplot.cpp qcustomplot/qcustomplot.cpp:2837:31: warning: Division by zero return mElements.at(index / columnCount()).at(index % columnCount());
qcustomplot/qcustomplot.cpp:2837:57: warning: Division by zero
return mElements.at(index / columnCount()).at(index % columnCount());
~~~~~~^~~~~~~~~~~~~~~
qcustomplot/qcustomplot.cpp:2849:24: warning: Division by zero
mElements[index / columnCount()][index % columnCount()] = 0;
~~~~~~^~~~~~~~~~~~~~~
qcustomplot/qcustomplot.cpp:2849:47: warning: Division by zero
mElements[index / columnCount()][index % columnCount()] = 0;
~~~~~~^~~~~~~~~~~~~~~
qcustomplot/qcustomplot.cpp:7141:5: warning: Potential memory leak
return true;
^~~~~~~~~~~
qcustomplot/qcustomplot.cpp:19077:59: warning: The right operand of '+' is a garbage value
keyPixel = mKeyAxis.data()->coordToPixel(range.upper) + upperPixelWidth;
^ ~~~~~~~~~~~~~~~
6 warnings generated.
However, some of these have been fixed by my latest commits, 1f1b6f4f1ed406c4652253ba3819cc22ae2e18ac, baaee2d0b1196c4e5dd780f7f4c41a083ebd3511
Building/static analysis with clang's scan build has found some potential issues with ThermalMonitor:
built using clang 3.8.0-2ubuntu3 (tags/RELEASE_380/final):
scan-build make
qcustomplot/qcustomplot.cpp:2837:31: warning: Division by zero return mElements.at(index / columnCount()).at(index % columnCount());