mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
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:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -134,7 +134,7 @@ GenericLegendItem::paintEvent(QPaintEvent *)
|
||||
// under mouse show
|
||||
if (clickable && underMouse()) {
|
||||
QColor color = GColor(CPLOTMARKER);
|
||||
color.setAlphaF(0.2); // same as plotarea
|
||||
color.setAlphaF(0.2f); // same as plotarea
|
||||
painter.setBrush(color);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.drawRect(hoverrect);
|
||||
|
||||
@@ -61,7 +61,7 @@ void GenericSelectTool::paint(QPainter*painter, const QStyleOptionGraphicsItem *
|
||||
QRectF fr = host->axisRect.value(hoveraxis, QRectF());
|
||||
if (fr != QRectF()) {
|
||||
QColor color = GColor(CPLOTMARKER);
|
||||
color.setAlphaF(0.2); // almost hidden if not moving/sizing
|
||||
color.setAlphaF(0.2f); // almost hidden if not moving/sizing
|
||||
painter->fillRect(mapRectFromScene(fr),QBrush(color));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class HrPwPlot : public QwtPlot
|
||||
QwtPlotMarker *r_mrk1;
|
||||
QwtPlotMarker *r_mrk2;
|
||||
bool joinLine = false;
|
||||
int shadeZones = 0;
|
||||
bool shadeZones = false;
|
||||
|
||||
void setShadeZones(int);
|
||||
int isShadeZones() const;
|
||||
|
||||
@@ -40,7 +40,7 @@ class HrPwWindow : public GcChartWindow
|
||||
Q_OBJECT
|
||||
G_OBJECT
|
||||
|
||||
Q_PROPERTY(int shadeZones READ isShadeZones WRITE setShadeZones USER true)
|
||||
Q_PROPERTY(bool shadeZones READ isShadeZones WRITE setShadeZones USER true)
|
||||
Q_PROPERTY(int joinLine READ isJoinLine WRITE setJoinLine USER true)
|
||||
Q_PROPERTY(int fullplot READ showFullplot WRITE setFullplot USER true)
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ SmallPlotPicker::trackerText(const QPoint &point) const
|
||||
QwtPlotItemList plotItems = plot()->itemList(QwtPlotItem::Rtti_PlotCurve);
|
||||
foreach (QwtPlotItem *plotItem, plotItems) {
|
||||
QwtPlotCurve *plotCurve = static_cast<QwtPlotCurve *>(plotItem);
|
||||
int idx = 0;
|
||||
size_t idx = 0;
|
||||
size_t size = plotCurve->data()->size();
|
||||
double dist = 100000;
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
|
||||
@@ -4895,7 +4895,7 @@ void write_float32(QByteArray* array, float f, bool is_big_endian) {
|
||||
|
||||
// Zero pad string to length of field (len)
|
||||
void write_string(QByteArray* array, const char* str, int len) {
|
||||
int slen = strlen(str);
|
||||
size_t slen = strlen(str);
|
||||
array->append(str, slen);
|
||||
array->append(len - slen, 0);
|
||||
}
|
||||
|
||||
@@ -301,11 +301,11 @@ AgendaTree::drawRow
|
||||
if (! isTopLevel && type == 0 && hover) {
|
||||
painter->save();
|
||||
QColor bgColor = option.palette.color(QPalette::Active, QPalette::Highlight);
|
||||
bgColor.setAlphaF(0.2);
|
||||
bgColor.setAlphaF(0.2f);
|
||||
QRect hoverRect(option.rect);
|
||||
hoverRect.setX(hoverRect.x() + 4 * dpiXFactor);
|
||||
painter->fillRect(hoverRect, bgColor);
|
||||
bgColor.setAlphaF(0.6);
|
||||
bgColor.setAlphaF(0.6f);
|
||||
QRect markerRect(option.rect);
|
||||
markerRect.setWidth(4 * dpiXFactor);
|
||||
painter->fillRect(markerRect, bgColor);
|
||||
|
||||
@@ -1302,9 +1302,9 @@ AgendaEntryDelegate::paint
|
||||
|
||||
if (hover) {
|
||||
QColor bgColor = opt.palette.color(QPalette::Active, QPalette::Highlight);
|
||||
bgColor.setAlphaF(0.2);
|
||||
bgColor.setAlphaF(0.2f);
|
||||
QColor bgBorder = bgColor;
|
||||
bgBorder.setAlphaF(0.6);
|
||||
bgBorder.setAlphaF(0.6f);
|
||||
iconColor = GCColor::invertColor(GCColor::blendedColor(bgColor, opt.palette.color(QPalette::Active, QPalette::AlternateBase)));
|
||||
textColor = iconColor;
|
||||
}
|
||||
|
||||
@@ -124,37 +124,37 @@ duration: DURATION minuteValue { $$ = new ModelNumberEq
|
||||
| DURATION minuteValue RANGESYMBOL { $$ = new ModelNumberRangeFilter(TdbWorkoutModelIdx::duration, $2 * 60000); }
|
||||
;
|
||||
|
||||
intensity: INTENSITY mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::intensity, $2, 0.05); }
|
||||
intensity: INTENSITY mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::intensity, $2, 0.05f); }
|
||||
| INTENSITY mixedNumValue RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::intensity, $2, $4); }
|
||||
| INTENSITY RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::intensity, 0, $3); }
|
||||
| INTENSITY mixedNumValue RANGESYMBOL { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::intensity, $2); }
|
||||
;
|
||||
|
||||
vi: VI mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::vi, $2, 0.05); }
|
||||
vi: VI mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::vi, $2, 0.05f); }
|
||||
| VI mixedNumValue RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::vi, $2, $4); }
|
||||
| VI RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::vi, 0, $3); }
|
||||
| VI mixedNumValue RANGESYMBOL { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::vi, $2); }
|
||||
;
|
||||
|
||||
xpower: XPOWER mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::xp, $2, 0.05); }
|
||||
xpower: XPOWER mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::xp, $2, 0.05f); }
|
||||
| XPOWER mixedNumValue RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::xp, $2, $4); }
|
||||
| XPOWER RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::xp, 0, $3); }
|
||||
| XPOWER mixedNumValue RANGESYMBOL { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::xp, $2); }
|
||||
;
|
||||
|
||||
ri: RI mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::ri, $2, 0.05); }
|
||||
ri: RI mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::ri, $2, 0.05f); }
|
||||
| RI mixedNumValue RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::ri, $2, $4); }
|
||||
| RI RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::ri, 0, $3); }
|
||||
| RI mixedNumValue RANGESYMBOL { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::ri, $2); }
|
||||
;
|
||||
|
||||
bikescore: BIKESCORE mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::bs, $2, 0.05); }
|
||||
bikescore: BIKESCORE mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::bs, $2, 0.05f); }
|
||||
| BIKESCORE mixedNumValue RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::bs, $2, $4); }
|
||||
| BIKESCORE RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::bs, 0, $3); }
|
||||
| BIKESCORE mixedNumValue RANGESYMBOL { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::bs, $2); }
|
||||
;
|
||||
|
||||
svi: SVI mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::svi, $2, 0.05); }
|
||||
svi: SVI mixedNumValue { $$ = new ModelFloatEqualFilter(TdbWorkoutModelIdx::svi, $2, 0.05f); }
|
||||
| SVI mixedNumValue RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::svi, $2, $4); }
|
||||
| SVI RANGESYMBOL mixedNumValue { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::svi, 0, $3); }
|
||||
| SVI mixedNumValue RANGESYMBOL { $$ = new ModelFloatRangeFilter(TdbWorkoutModelIdx::svi, $2); }
|
||||
|
||||
Reference in New Issue
Block a user