From 40d9b5c5fcc29d58248f00b6c6437af252881e17 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 27 Jun 2019 14:11:02 +0200 Subject: Fix santizize=undefined warning (overflow) --- src/Utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Utils.cpp') 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(qAbs(hash % 360)); // start with moderate saturation and lightness values. auto sat = 220; auto lightness = 125; -- cgit 1.5.1