diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-05-15 00:37:09 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-05-18 22:39:20 +0300 |
commit | 5c7702a8f9c8cf3722945b643dc3d21303c2482c (patch) | |
tree | eb0345a65998fffec9675df478f72ef40c9f98d3 | |
parent | a2abca317a0bd19056f1cc8ab794cfc3beec01c3 (diff) |
moc/utils.h: fix a narrowing conversion warning
By taking a qsizetype, and using std::all_of.
Pick-to: 6.5
Change-Id: If81465194d92d04af637b0032d9504d6524893aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/tools/moc/utils.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/tools/moc/utils.h b/src/tools/moc/utils.h index 358780a33d..cb118fab38 100644 --- a/src/tools/moc/utils.h +++ b/src/tools/moc/utils.h @@ -6,6 +6,8 @@ #include <QtCore/qglobal.h> +#include <algorithm> + QT_BEGIN_NAMESPACE inline bool is_whitespace(char s) @@ -35,16 +37,11 @@ inline bool is_ident_char(char s) ); } -inline bool is_identifier(const char *s, int len) +inline bool is_identifier(const char *s, qsizetype len) { if (len < 1) return false; - if (!is_ident_start(*s)) - return false; - for (int i = 1; i < len; ++i) - if (!is_ident_char(s[i])) - return false; - return true; + return std::all_of(s, s + len, is_ident_char); } inline bool is_digit_char(char s) |