summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-06-27 14:11:02 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2019-06-27 14:57:32 +0200
commit40d9b5c5fcc29d58248f00b6c6437af252881e17 (patch)
tree7d9b2a404ab0736c4c821644c6889f12e655ca41 /src
parentMerge pull request #76 from xvitaly/0.7.0-dev (diff)
downloadnheko-40d9b5c5fcc29d58248f00b6c6437af252881e17.tar.xz
Fix santizize=undefined warning (overflow)
Diffstat (limited to 'src')
-rw-r--r--src/Utils.cpp6
-rw-r--r--src/Utils.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp

index 690a9a9a..3d304e7d 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp
@@ -342,10 +342,10 @@ utils::linkColor() return QPalette().color(QPalette::Link).name(); } -int +uint32_t utils::hashQString(const QString &input) { - auto hash = 0; + uint32_t hash = 0; for (int i = 0; i < input.length(); i++) { 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 auto hash = hashQString(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. auto sat = 220; auto lightness = 125; diff --git a/src/Utils.h b/src/Utils.h
index bf941c4c..0f022770 100644 --- a/src/Utils.h +++ b/src/Utils.h
@@ -243,7 +243,7 @@ QString linkColor(); //! Returns the hash code of the input QString -int +uint32_t hashQString(const QString &input); //! Generate a color (matching #RRGGBB) that has an acceptable contrast to background that is based