mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Fix santizize=undefined warning (overflow)
This commit is contained in:
parent
da01f1713f
commit
40d9b5c5fc
2 changed files with 4 additions and 4 deletions
|
@ -342,10 +342,10 @@ utils::linkColor()
|
||||||
return QPalette().color(QPalette::Link).name();
|
return QPalette().color(QPalette::Link).name();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
uint32_t
|
||||||
utils::hashQString(const QString &input)
|
utils::hashQString(const QString &input)
|
||||||
{
|
{
|
||||||
auto hash = 0;
|
uint32_t hash = 0;
|
||||||
|
|
||||||
for (int i = 0; i < input.length(); i++) {
|
for (int i = 0; i < input.length(); i++) {
|
||||||
hash = input.at(i).digitValue() + ((hash << 5) - hash);
|
hash = input.at(i).digitValue() + ((hash << 5) - hash);
|
||||||
|
@ -363,7 +363,7 @@ utils::generateContrastingHexColor(const QString &input, const QString &backgrou
|
||||||
// Create a color for the input
|
// Create a color for the input
|
||||||
auto hash = hashQString(input);
|
auto hash = hashQString(input);
|
||||||
// create a hue value based on the hash of the input.
|
// create a hue value based on the hash of the input.
|
||||||
auto userHue = qAbs(hash % 360);
|
auto userHue = static_cast<int>(qAbs(hash % 360));
|
||||||
// start with moderate saturation and lightness values.
|
// start with moderate saturation and lightness values.
|
||||||
auto sat = 220;
|
auto sat = 220;
|
||||||
auto lightness = 125;
|
auto lightness = 125;
|
||||||
|
|
|
@ -243,7 +243,7 @@ QString
|
||||||
linkColor();
|
linkColor();
|
||||||
|
|
||||||
//! Returns the hash code of the input QString
|
//! Returns the hash code of the input QString
|
||||||
int
|
uint32_t
|
||||||
hashQString(const QString &input);
|
hashQString(const QString &input);
|
||||||
|
|
||||||
//! Generate a color (matching #RRGGBB) that has an acceptable contrast to background that is based
|
//! Generate a color (matching #RRGGBB) that has an acceptable contrast to background that is based
|
||||||
|
|
Loading…
Reference in a new issue