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>
This commit is contained in:
parent
c763957503
commit
d48db627f3
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user