Commit 87943ca6 authored by Leandro Melo's avatar Leandro Melo Committed by Leandro T. C. Melo
Browse files

C++: Fix hexadecimals in quick fix



Task-number: QTCREATORBUG-6240
Change-Id: Id3dc48d47f88017b3bc9e026c8e5552d2e9f4d48
Reviewed-by: default avatarChristian Kamm <christian.d.kamm@nokia.com>
parent c436e63b
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <cpptools/cpptoolsconstants.h> #include <cpptools/cpptoolsconstants.h>
#include <cpptools/cpprefactoringchanges.h> #include <cpptools/cpprefactoringchanges.h>
#include <cpptools/insertionpointlocator.h> #include <cpptools/insertionpointlocator.h>
#include <cpptools/cpptoolsreuse.h>
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
...@@ -1282,7 +1283,7 @@ public: ...@@ -1282,7 +1283,7 @@ public:
// remove trailing L or U and stuff // remove trailing L or U and stuff
const char * const spell = numeric->chars(); const char * const spell = numeric->chars();
int numberLength = numeric->size(); int numberLength = numeric->size();
while (numberLength > 0 && (spell[numberLength-1] < '0' || spell[numberLength-1] > 'F')) while (numberLength > 0 && !isHexadecimal(spell[numberLength - 1]))
--numberLength; --numberLength;
if (numberLength < 1) if (numberLength < 1)
return result; return result;
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <QtGui/QTextDocument> #include <QtGui/QTextDocument>
#include <QtGui/QTextCursor> #include <QtGui/QTextCursor>
#include <cctype>
namespace CppTools { namespace CppTools {
void moveCursorToEndOfIdentifier(QTextCursor *tc) { void moveCursorToEndOfIdentifier(QTextCursor *tc) {
...@@ -49,4 +51,11 @@ void moveCursorToEndOfIdentifier(QTextCursor *tc) { ...@@ -49,4 +51,11 @@ void moveCursorToEndOfIdentifier(QTextCursor *tc) {
} }
} }
bool isHexadecimal(char c)
{
return std::isdigit(c)
|| (c >= 'a' && c <= 'f')
|| (c >= 'A' && c <= 'F');
}
} // CppTools } // CppTools
...@@ -8,6 +8,7 @@ QT_FORWARD_DECLARE_CLASS(QTextCursor) ...@@ -8,6 +8,7 @@ QT_FORWARD_DECLARE_CLASS(QTextCursor)
namespace CppTools { namespace CppTools {
void CPPTOOLS_EXPORT moveCursorToEndOfIdentifier(QTextCursor *tc); void CPPTOOLS_EXPORT moveCursorToEndOfIdentifier(QTextCursor *tc);
bool CPPTOOLS_EXPORT isHexadecimal(char c);
} // CppTools } // CppTools
......
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