Fixed minor clang warnings, and implemented clang-tidy suggestions.

This commit is contained in:
Stephen Anthony 2020-11-17 18:37:10 -03:30
parent bd52de99b0
commit a7d83e352e
5 changed files with 19 additions and 22 deletions

View File

@ -465,14 +465,14 @@ string RomListWidget::getToolTip(Common::Point pos) const
const string bytes = myDisasm->list[idx.y].bytes;
if(bytes.length() < idx.x + 1)
if(bytes.length() < size_t(idx.x + 1))
return EmptyString;
Int32 val;
if(bytes.length() == 8 && bytes[2] != ' ')
{
// Binary value
val = stol(bytes, 0, 2);
val = static_cast<Int32>(stol(bytes, 0, 2));
}
else
{
@ -484,7 +484,7 @@ string RomListWidget::getToolTip(Common::Point pos) const
// Get one hex byte
const string valStr = bytes.substr((idx.x / 3) * 3, 2);
val = stol(valStr, 0, 16);
val = static_cast<Int32>(stol(valStr, 0, 16));
}
ostringstream buf;

View File

@ -28,13 +28,7 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
CommandSender(boss),
_rows(rows),
_cols(cols),
_currentRow(0),
_currentCol(0),
_rowHeight(0),
_colWidth(0),
_selectedItem(0),
_shiftBits(shiftBits),
_editable(true)
_shiftBits(shiftBits)
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS |
Widget::FLAG_WANTS_RAWDATA;

View File

@ -53,14 +53,14 @@ class ToggleWidget : public Widget, public CommandSender
bool hasToolTip() const override { return true; }
protected:
int _rows;
int _cols;
int _currentRow;
int _currentCol;
int _rowHeight; // explicitly set in child classes
int _colWidth; // explicitly set in child classes
int _selectedItem;
bool _editable;
int _rows{0};
int _cols{0};
int _currentRow{0};
int _currentCol{0};
int _rowHeight{0}; // explicitly set in child classes
int _colWidth{0}; // explicitly set in child classes
int _selectedItem{0};
bool _editable{true};
bool _swapBits{false};
int _shiftBits{0}; // shift bits for tooltip display

View File

@ -62,7 +62,7 @@ void ToolTip::setFont(const GUI::Font& font)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToolTip::update(const Widget* widget, Common::Point pos)
void ToolTip::update(const Widget* widget, const Common::Point& pos)
{
if(myTipWidget != widget)
{
@ -70,7 +70,10 @@ void ToolTip::update(const Widget* widget, Common::Point pos)
release();
}
if(myTipShown && myTipWidget->changedToolTip(myPos, pos))
myPos = pos, show();
{
myPos = pos;
show();
}
else
myPos = pos;
}

View File

@ -59,9 +59,9 @@ class ToolTip
void release();
/**
Update focussed widget and current mouse position.
Update focused widget and current mouse position.
*/
void update(const Widget* widget, Common::Point pos);
void update(const Widget* widget, const Common::Point& pos);
/*
Render the tooltip