summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qxbmhandler.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-01-17 20:54:52 +0200
committerAhmad Samir <a.samirh78@gmail.com>2023-02-07 20:04:11 +0200
commit498f3452285aa44580e1d03baeec126d475f8401 (patch)
tree6307934b58045f6b6761023f769844d87cdc63ca /src/gui/image/qxbmhandler.cpp
parent9a8b9473d5f0fd4639193481ba9b344d91f3f00a (diff)
QtMiscUtils: add some more character helpers
isHexDigit, isOctalDigit, isAsciiDigit, isAsciiLower, isAsciiUpper, isAsciiLetterOrNumber. This de-duplicates some code through out. Rename two local lambdas that were called "isAsciiLetterOrNumber" to not conflict with the method in QtMiscUtils. Change-Id: I5b631f95b9f109136d19515f7e20b8e2fbca3d43 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/image/qxbmhandler.cpp')
-rw-r--r--src/gui/image/qxbmhandler.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index 5e81370887..8206fe3b29 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -16,6 +16,8 @@
QT_BEGIN_NAMESPACE
+using namespace QtMiscUtils;
+
Q_DECLARE_LOGGING_CATEGORY(lcImageIo)
/*****************************************************************************
@@ -54,11 +56,9 @@ static bool read_xbm_header(QIODevice *device, int& w, int& h)
}
auto parseDefine = [] (const char *buf, int len) -> int {
- auto isAsciiLetterOrNumber = [] (char ch) -> bool {
- return (ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= 'a' && ch <= 'z') ||
- ch == '_' || ch == '.';
+ auto checkChar = [] (char ch) -> bool {
+ return isAsciiLetterOrNumber(ch)
+ || ch == '_' || ch == '.';
};
auto isAsciiSpace = [] (char ch) -> bool {
return ch == ' ' || ch == '\t';
@@ -70,7 +70,7 @@ static bool read_xbm_header(QIODevice *device, int& w, int& h)
int index = defineLen;
while (buf[index] && isAsciiSpace(buf[index]))
++index;
- while (buf[index] && isAsciiLetterOrNumber(buf[index]))
+ while (buf[index] && checkChar(buf[index]))
++index;
while (buf[index] && isAsciiSpace(buf[index]))
++index;