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
{
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);
char ch = str[i];

View File

@ -182,7 +182,7 @@ class LauncherDialog : public Dialog
ButtonWidget* myOptionsButton{nullptr};
ButtonWidget* myQuitButton{nullptr};
StaticTextWidget* myRomLink{nullptr};
// FIXME - NOT USED StaticTextWidget* myRomLink{nullptr};
RomInfoWidget* myRomInfoWidget{nullptr};
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)
{
size_t start = string::npos;
int len = 0;
const string text = label != EmptyString ? label : url;
size_t start = string::npos, len = 0;
const string& text = label != EmptyString ? label : url;
if(text != EmptyString)
{
// determine position of label
if((start = BSPF::findIgnoreCase(_label, text)) != string::npos)
{
len = int(text.size());
len = text.size();
_url = url;
}
}
@ -546,20 +544,20 @@ bool StaticTextWidget::setUrl(const string& url, const string& label)
if(start != string::npos)
{
// 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];
if(ch == ' ' || ch == ')' || ch == '>')
{
len = i - int(start);
len = i - start;
_url = _label.substr(start, len);
break;
}
}
if(!len)
{
len = int(_label.size() - start);
len = _label.size() - start;
_url = _label.substr(start);
}
}
@ -567,7 +565,7 @@ bool StaticTextWidget::setUrl(const string& url, const string& label)
if(len)
{
setLink(start, len, true);
setLink(start, int(len), true);
setCmd(kOpenUrlCmd);
return true;
}
@ -619,9 +617,9 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, int cmd, bool repeat)
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
_cmd{cmd},
_repeat{repeat}
{
_cmd = cmd;
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG;
_bgcolor = kBtnColor;
_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);
bool setUrl(const string& url = EmptyString, const string& label = EmptyString);
const string& getUrl() const { return _url; };
const string& getUrl() const { return _url; }
protected:
void handleMouseEntered() override;
@ -284,7 +284,6 @@ class ButtonWidget : public StaticTextWidget
void drawWidget(bool hilite) override;
protected:
int _cmd{0};
bool _repeat{false}; // button repeats
bool _useBitmap{false};
const uInt32* _bitmap{nullptr};