# HG changeset patch # User Teemu Piippo # Date 1455632924 -7200 # Node ID a7f8ce5aa8584c12243c18a66f96b39802b0b242 # Parent f40c792c933483aea3f32ee498435fc67c60626c Use a better gcd algorithm, some style fixes diff -r f40c792c9334 -r a7f8ce5aa858 src/dialogs/ldrawpathdialog.cpp --- a/src/dialogs/ldrawpathdialog.cpp Tue Feb 16 02:11:33 2016 +0200 +++ b/src/dialogs/ldrawpathdialog.cpp Tue Feb 16 16:28:44 2016 +0200 @@ -85,8 +85,10 @@ { okButton()->setEnabled (ok); - if (statusText.isEmpty() && ok == false) + if (statusText.isEmpty() and not ok) + { ui.status->setText ("---"); + } else { ui.status->setText (QString ("%2") diff -r f40c792c9334 -r a7f8ce5aa858 src/miscallenous.cpp --- a/src/miscallenous.cpp Tue Feb 16 02:11:33 2016 +0200 +++ b/src/miscallenous.cpp Tue Feb 16 16:28:44 2016 +0200 @@ -94,26 +94,22 @@ int gcd (int a, int b) { - if (a > 0 and b > 0) + while (b != 0) { - while (a != b) - { - if (a < b) - b -= a; - else - a -= b; - } + int temp = a; + a = b; + b = temp % b; } return a; } -void simplify (int& numer, int& denom) +void simplify (int& numerator, int& denominator) { - int factor = gcd (numer, denom); - numer /= factor; - denom /= factor; + int factor = gcd(numerator, denominator); + numerator /= factor; + denominator /= factor; }