From 9c9308b91b116138ed5cc7753cf59eefd5a86db9 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <qtc-committer@nokia.com> Date: Wed, 10 Dec 2008 10:47:26 +0100 Subject: [PATCH] QByteArray::toLong() does not auto-detect the base and also fixed a typo in the evaluator of bit-or expressions. --- src/libs/cplusplus/pp-engine.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index d2ed3ee73f3..83386e8079c 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -164,7 +164,15 @@ protected: bool process_primary() { if ((*_lex)->is(T_INT_LITERAL)) { - _value.set_long(tokenSpell().toLong()); + int base = 10; + const QByteArray spell = tokenSpell(); + if (spell.at(0) == '0') { + if (spell.size() > 1 && (spell.at(1) == 'x' || spell.at(1) == 'X')) + base = 16; + else + base = 8; + } + _value.set_long(tokenSpell().toLong(0, base)); ++(*_lex); return true; } else if (isTokenDefined()) { @@ -367,7 +375,7 @@ protected: { process_xor(); - while ((*_lex)->is(T_CARET)) { + while ((*_lex)->is(T_PIPE)) { const Token op = *(*_lex); ++(*_lex); -- GitLab