QCustomPlot Discussion and Comments

QCPColorMapData::fill broken (fix included)Return to overview
April 10, 2024, 15:31
by Tim Angus

QCPColorMapData ::fill uses memset to fill a data will the fill value, but this doesn't work as memset takes an int parameter. The implicit cast of double -> int will only rarely be correct.

--- a/source/thirdparty/qcustomplot/qcustomplot.cpp
+++ b/source/thirdparty/qcustomplot/qcustomplot.cpp
@@ -26230,7 +26230,8 @@ void QCPColorMapData::clearAlpha()
 void QCPColorMapData::fill(double z)
 {
 const int dataCount = mValueSize*mKeySize;
- memset(mData, z, dataCount*sizeof(*mData));
+ for(size_t i = 0; i < dataCount; i++)
+ mData[i] = z;
 mDataBounds = QCPRange(z, z);
 mDataModified = true;
 }

April 10, 2024, 19:46
by Tim Angus

*a data array with

AltStyle によって変換されたページ (->オリジナル) /