From 61c7c5c67e5dde7eb3ec288247cceb9be29a47a2 Mon Sep 17 00:00:00 2001 From: nailyk Date: Fri, 19 Aug 2016 13:36:07 +0200 Subject: Gui: replace pow() function The old pow function doesn't work for other power than 2 - replace pow function by a squared one Solve the TeamWin/Team-Win-Recovery-Project#646 issue. Change-Id: Id177300d45a7b49ff983795288434d910eb35c2a --- gui/patternpassword.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gui/patternpassword.cpp b/gui/patternpassword.cpp index 90566e219..ab446b9f0 100644 --- a/gui/patternpassword.cpp +++ b/gui/patternpassword.cpp @@ -232,9 +232,12 @@ void GUIPatternPassword::Resize(size_t n) { static int pow(int x, int i) { - while(i-- > 1) - x *= x; - return x; + int result = 1; + if (i<0) + return 0; + while(i-- > 0) + result *= x; + return result; } static bool IsInCircle(int x, int y, int ox, int oy, int r) -- cgit v1.2.3