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
diff --git a/gui/patternpassword.cpp b/gui/patternpassword.cpp
index 90566e2..ab446b9 100644
--- a/gui/patternpassword.cpp
+++ b/gui/patternpassword.cpp
@@ -232,9 +232,12 @@
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)