Commit 03db079f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Minor optimization + exclude code to clang-format

parent f3e1f99f
......@@ -303,8 +303,8 @@ void KCalcDisplay::slotCopy()
break;
}
(QApplication::clipboard())->setText(txt, QClipboard::Clipboard);
(QApplication::clipboard())->setText(txt, QClipboard::Selection);
QApplication::clipboard()->setText(txt, QClipboard::Clipboard);
QApplication::clipboard()->setText(txt, QClipboard::Selection);
}
//------------------------------------------------------------------------------
......@@ -639,7 +639,7 @@ QString KCalcDisplay::formatDecimalNumber(QString string)
// find first digit to not group leading spaces or signs
int firstDigitPos = 0;
for (int i = 0; i < string.length(); ++i) {
for (int i = 0, total = string.length(); i < total; ++i) {
if (string.at(i).isDigit()) {
firstDigitPos = i;
break;
......@@ -660,8 +660,9 @@ QString KCalcDisplay::formatDecimalNumber(QString string)
unsigned short zero = locale.zeroDigit().unicode();
for (int i = 0; i < string.length(); ++i) {
if (string.at(i).isDigit()) {
string[i] = QChar(zero + string.at(i).digitValue());
const auto stringAtI = string.at(i);
if (stringAtI.isDigit()) {
string[i] = QChar(zero + stringAtI.digitValue());
}
}
......
......@@ -15,7 +15,9 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// clang-format off
#include "config-kcalc.h"
// clang-format on
#include "knumber.h"
#include "knumber_base.h"
#include "knumber_error.h"
......@@ -25,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QRegExp>
#include <QStringList>
#include <cmath>
#include <config-kcalc.h>
QString KNumber::GroupSeparator = QStringLiteral(",");
QString KNumber::DecimalSeparator = QStringLiteral(".");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment