summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r--src/corelib/tools/qarraydata.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index dcd95924c1..5e21186bbd 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -56,16 +56,16 @@ struct Q_CORE_EXPORT QArrayData
void *data()
{
- Q_ASSERT(size == 0
- || offset < 0 || size_t(offset) >= sizeof(QArrayData));
- return reinterpret_cast<char *>(this) + offset;
+ Q_ASSERT(size == 0 || offset < 0 || size_t(offset) >= sizeof(QArrayData));
+ const quintptr self = reinterpret_cast<qintptr>(this);
+ return reinterpret_cast<void *>(self + offset);
}
const void *data() const
{
- Q_ASSERT(size == 0
- || offset < 0 || size_t(offset) >= sizeof(QArrayData));
- return reinterpret_cast<const char *>(this) + offset;
+ Q_ASSERT(size == 0 || offset < 0 || size_t(offset) >= sizeof(QArrayData));
+ const quintptr self = reinterpret_cast<qintptr>(this);
+ return reinterpret_cast<const void *>(self + offset);
}
// This refers to array data mutability, not "header data" represented by