aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-11-29 08:32:43 -0500
committerKen Moore <ken@ixsystems.com>2016-11-29 08:32:43 -0500
commit37c099c421884041c9e50837708639a95328e31b (patch)
tree1f8b8f45379ffb1ddb1deaa8a556d991af7eb51d /src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
parentAdd a small 1/5 second delay between the zoom slider changing and the actual ... (diff)
downloadlumina-37c099c421884041c9e50837708639a95328e31b.tar.gz
lumina-37c099c421884041c9e50837708639a95328e31b.tar.bz2
lumina-37c099c421884041c9e50837708639a95328e31b.zip
Fix a recursive bug in the parenthesis matching/replacing routine within lumina-calculator.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-calculator/mainUI.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
index fcc39fd2..057e4ddd 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
@@ -255,14 +255,16 @@ double mainUI::strToNumber(QString str){
if(need==0){ end = i; }
}
if(end<start){ return BADVALUE; }
- //qDebug() << "Replace value:" << str << start << end << str.mid(start+1,end-start);
+ //qDebug() << "Replace value:" << str << start << end << str.mid(start+1,end-start-1);
double tmp = strToNumber( str.mid(start+1, end-start-1));
if(tmp!=tmp){ return BADVALUE; } //not a number
//Now check really quick if this was an argument to a scientific operation
+ //qDebug() << "Got Number:" << tmp;
for(int i=start-1; i>=0; i-- ){
+ //qDebug() << "Check for function:" << start << i << str[i];
if( !str[i].isLower() || i==0 ){
if(!str[i].isLower()){ i++; }//don't need the invalid character
- if(start-i<2){ continue; } //not long enough - 2+ chars for sci functions
+ if(start-i<2){ break; } //not long enough - 2+ chars for sci functions
//Got a scientific operation - run it through the routine
tmp = performSciOperation( str.mid(i, start-i), tmp);
if(tmp!=tmp){ return BADVALUE; } //got a bad value
bgstack15