Fix minor compiler warnings.

This commit is contained in:
Stephen Anthony 2021-04-22 11:18:45 -02:30
parent ab005bd0c7
commit 8371fbe98a
4 changed files with 12 additions and 15 deletions

View File

@ -302,9 +302,9 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id
const string AboutDialog::getUrl(const string& str) const const string AboutDialog::getUrl(const string& str) const
{ {
bool isUrl = false; bool isUrl = false;
int start = 0, len = 0; size_t start = 0, len = 0;
for(int i = 0; i < str.size(); ++i) for(size_t i = 0; i < str.size(); ++i)
{ {
string remainder = str.substr(i); string remainder = str.substr(i);
char ch = str[i]; char ch = str[i];

View File

@ -182,7 +182,7 @@ class LauncherDialog : public Dialog
ButtonWidget* myOptionsButton{nullptr}; ButtonWidget* myOptionsButton{nullptr};
ButtonWidget* myQuitButton{nullptr}; ButtonWidget* myQuitButton{nullptr};
StaticTextWidget* myRomLink{nullptr}; // FIXME - NOT USED StaticTextWidget* myRomLink{nullptr};
RomInfoWidget* myRomInfoWidget{nullptr}; RomInfoWidget* myRomInfoWidget{nullptr};
std::unordered_map<string,string> myMD5List; std::unordered_map<string,string> myMD5List;

View File

@ -518,17 +518,15 @@ void StaticTextWidget::setLink(size_t start, int len, bool underline)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StaticTextWidget::setUrl(const string& url, const string& label) bool StaticTextWidget::setUrl(const string& url, const string& label)
{ {
size_t start = string::npos; size_t start = string::npos, len = 0;
int len = 0; const string& text = label != EmptyString ? label : url;
const string text = label != EmptyString ? label : url;
if(text != EmptyString) if(text != EmptyString)
{ {
// determine position of label // determine position of label
if((start = BSPF::findIgnoreCase(_label, text)) != string::npos) if((start = BSPF::findIgnoreCase(_label, text)) != string::npos)
{ {
len = int(text.size()); len = text.size();
_url = url; _url = url;
} }
} }
@ -546,20 +544,20 @@ bool StaticTextWidget::setUrl(const string& url, const string& label)
if(start != string::npos) if(start != string::npos)
{ {
// find end of URL // find end of URL
for(int i = int(start); i < _label.size(); ++i) for(size_t i = start; i < _label.size(); ++i)
{ {
char ch = _label[i]; char ch = _label[i];
if(ch == ' ' || ch == ')' || ch == '>') if(ch == ' ' || ch == ')' || ch == '>')
{ {
len = i - int(start); len = i - start;
_url = _label.substr(start, len); _url = _label.substr(start, len);
break; break;
} }
} }
if(!len) if(!len)
{ {
len = int(_label.size() - start); len = _label.size() - start;
_url = _label.substr(start); _url = _label.substr(start);
} }
} }
@ -567,7 +565,7 @@ bool StaticTextWidget::setUrl(const string& url, const string& label)
if(len) if(len)
{ {
setLink(start, len, true); setLink(start, int(len), true);
setCmd(kOpenUrlCmd); setCmd(kOpenUrlCmd);
return true; return true;
} }
@ -619,9 +617,9 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int x, int y, int w, int h,
const string& label, int cmd, bool repeat) const string& label, int cmd, bool repeat)
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center), : StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
_cmd{cmd},
_repeat{repeat} _repeat{repeat}
{ {
_cmd = cmd;
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG; _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG;
_bgcolor = kBtnColor; _bgcolor = kBtnColor;
_bgcolorhi = kBtnColorHi; _bgcolorhi = kBtnColorHi;

View File

@ -220,7 +220,7 @@ class StaticTextWidget : public Widget, public CommandSender
void setLink(size_t start = string::npos, int len = 0, bool underline = false); void setLink(size_t start = string::npos, int len = 0, bool underline = false);
bool setUrl(const string& url = EmptyString, const string& label = EmptyString); bool setUrl(const string& url = EmptyString, const string& label = EmptyString);
const string& getUrl() const { return _url; }; const string& getUrl() const { return _url; }
protected: protected:
void handleMouseEntered() override; void handleMouseEntered() override;
@ -284,7 +284,6 @@ class ButtonWidget : public StaticTextWidget
void drawWidget(bool hilite) override; void drawWidget(bool hilite) override;
protected: protected:
int _cmd{0};
bool _repeat{false}; // button repeats bool _repeat{false}; // button repeats
bool _useBitmap{false}; bool _useBitmap{false};
const uInt32* _bitmap{nullptr}; const uInt32* _bitmap{nullptr};