Remove type truncation warnings (#4770)

warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
warning C4805: '!=': unsafe mix of type 'int' and type 'bool' in operation
warning C4305: 'argument': truncation from 'double' to 'float'
This commit is contained in:
Paul Johnson
2025-12-23 13:21:11 +00:00
committed by GitHub
parent 1a0cd74c19
commit 4eaec533aa
12 changed files with 20 additions and 21 deletions

View File

@@ -98,7 +98,7 @@ public:
bool getFieldBool(string name); ///< get value of bool field of VALUE OBJECT (objValue)
inline MVJSONValue* at(unsigned int i){ return arrayValue.at(i); }
inline int size() { if (valueType == MVJSON_TYPE_ARRAY) return arrayValue.size(); else return 1; }
inline size_t size() { if (valueType == MVJSON_TYPE_ARRAY) return arrayValue.size(); else return 1; }
private:
void init(MVJSON_TYPE valueType);
};

View File

@@ -28,12 +28,11 @@ void QwtPlotGappedCurve::drawSeries(QPainter *painter, const QwtScaleMap &xMap,
if ( !painter || dataSize() <= 0 )
return;
if (to < 0)
to = dataSize();
size_t samples = (to < 0) ? dataSize() : to;
int i = from;
double last = 0;
while (i < to)
while (i < samples)
{
// First non-missed point will be the start of curve section.
double x = sample(i).x();

View File

@@ -514,7 +514,7 @@ void ZipReaderPrivate::scanFiles()
int num_dir_entries = 0;
EndOfDirectory eod;
while (start_of_directory == -1) {
size_t pos = device->size() - sizeof(EndOfDirectory) - i;
qint64 pos = device->size() - sizeof(EndOfDirectory) - i;
if (pos < 0 || i > 65535) {
qWarning() << "QZip: EndOfDirectory not found";
return;