fix compilation warnings

This commit is contained in:
BernardoGiordano 2018-05-25 19:40:22 +02:00
parent ff0f8cc61c
commit b63c82d117
2 changed files with 3 additions and 3 deletions

View file

@ -61,7 +61,7 @@ std::string Account::username(u128 id)
return "";
}
strncpy(username, profilebase.username, sizeof(profilebase.username));
strncpy(username, profilebase.username, sizeof(username) - 1);
std::string user = std::string(username);
mUsernames.insert({id, user});
accountProfileClose(&profile);

View file

@ -40,9 +40,9 @@ void Scrollable::updateSelection(void)
const size_t maxentries = maxVisibleEntries();
const size_t maxpages = (size() % mVisibleEntries == 0) ? size() / mVisibleEntries : size() / mVisibleEntries + 1;
const u32 hu = maxentries * mh / mVisibleEntries;
const int hu = maxentries * mh / mVisibleEntries;
if (hidKeysHeld(CONTROLLER_P1_AUTO) & KEY_TOUCH && touch.py > my && touch.py < my+hu && touch.px > mx && touch.px < mx+mw)
if (hidKeysHeld(CONTROLLER_P1_AUTO) & KEY_TOUCH && (int)touch.py > my && (int)touch.py < my+hu && (int)touch.px > mx && (int)touch.px < mx+mw)
{
mIndex = (size_t)((touch.py - my)*mVisibleEntries/mh);
}