summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-09-16 14:20:26 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-09-17 17:29:24 +0000
commitd48db627f3fee4a21364bf0f8de9f9ea56809f3d (patch)
tree39faa9aa42e92a99d3a487f05ec15853b757967d
parentc763957503453ca954224c24a6d1ce493fccc318 (diff)
QVersionNumber: fix iterator/pointer mistake
The dataFitsInline and setInlineData functions take a pointer/size pair, not an iterator/size pair. The code was working because QList iterators implicitly convert to pointers -- but that's sloppy, just use the list's data() function instead. Do a similar change for the constructor taking an initializer_list, for symmetry. Change-Id: I2cec191620185b3b08169c4051296eb610f14ecf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r--src/corelib/tools/qversionnumber.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h
index 7f530b4b98..65f0952cd9 100644
--- a/src/corelib/tools/qversionnumber.h
+++ b/src/corelib/tools/qversionnumber.h
@@ -93,8 +93,8 @@ class QVersionNumber
SegmentStorage(const QList<int> &seg)
{
- if (dataFitsInline(seg.begin(), seg.size()))
- setInlineData(seg.begin(), seg.size());
+ if (dataFitsInline(seg.data(), seg.size()))
+ setInlineData(seg.data(), seg.size());
else
pointer_segments = new QList<int>(seg);
}
@@ -136,15 +136,15 @@ class QVersionNumber
explicit SegmentStorage(QList<int> &&seg)
{
- if (dataFitsInline(seg.begin(), seg.size()))
- setInlineData(seg.begin(), seg.size());
+ if (dataFitsInline(seg.data(), seg.size()))
+ setInlineData(seg.data(), seg.size());
else
pointer_segments = new QList<int>(std::move(seg));
}
SegmentStorage(std::initializer_list<int> args)
{
- if (dataFitsInline(args.begin(), int(args.size()))) {
- setInlineData(args.begin(), int(args.size()));
+ if (dataFitsInline(std::data(args), int(args.size()))) {
+ setInlineData(std::data(args), int(args.size()));
} else {
pointer_segments = new QList<int>(args);
}