diff options
author | Ahmad Samir <[email protected]> | 2025-10-02 21:18:24 +0300 |
---|---|---|
committer | Ahmad Samir <[email protected]> | 2025-10-16 23:30:17 +0300 |
commit | ca725e1465fcc6d71b25c414aa9a0f0c3faad1d5 (patch) | |
tree | 4d918ee4b7eeb20281e78f615103c231595f784b /src | |
parent | 2a35107c12d154ae148caca291377fdd0545e60f (diff) |
QJsonParseError: fix clang -Wshorten-64-to-32 warnings
Change it to qint64 in Qt7, as requested in code review, so as to make
it easier to extend it in the future.
Pick-to: 6.10 6.8 6.5
Change-Id: If893d719dd0457fac46fdd37ff95ce95222b1858
Reviewed-by: Thiago Macieira <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/serialization/qjsonparseerror.h | 4 | ||||
-rw-r--r-- | src/corelib/serialization/qjsonparser.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/serialization/qjsonparseerror.h b/src/corelib/serialization/qjsonparseerror.h index 803b04c53b6..d8fc94448e6 100644 --- a/src/corelib/serialization/qjsonparseerror.h +++ b/src/corelib/serialization/qjsonparseerror.h @@ -7,6 +7,7 @@ #include <QtCore/qtconfigmacros.h> #include <QtCore/qtcoreexports.h> +#include <QtCore/qtypes.h> QT_BEGIN_NAMESPACE @@ -34,7 +35,8 @@ struct Q_CORE_EXPORT QJsonParseError QString errorString() const; - int offset = -1; + std::conditional_t<QT_VERSION_MAJOR < 7, int, qint64> + offset = -1; ParseError error = NoError; }; diff --git a/src/corelib/serialization/qjsonparser.cpp b/src/corelib/serialization/qjsonparser.cpp index df266a76c79..779287adb1d 100644 --- a/src/corelib/serialization/qjsonparser.cpp +++ b/src/corelib/serialization/qjsonparser.cpp @@ -321,7 +321,9 @@ QCborValue Parser::parse(QJsonParseError *error) error: container.reset(); if (error) { - error->offset = json - head; + using OffType = decltype(error->offset); + error->offset = OffType(json - head); + Q_ASSERT(error->offset == json - head); error->error = lastError; } return QCborValue(); |