diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-02 15:16:34 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-03 15:15:16 +0100 |
| commit | 65b8514cb5eae5a7055f55fd375da7b2eea487d6 (patch) | |
| tree | a1860cda3959538dd066d658b233f920054548b2 /src/corelib/tools/qarraydata.cpp | |
| parent | 4d8ee1b3493b79a6f1cd5200e6102711c0102c9e (diff) | |
MSVC: Fix integer conversion warnings in containers
Add some casts, fixing warnings like:
src/corelib/text/qbytearray.h(490): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
src/corelib/text/qstring.h(1045): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
src/corelib/tools/qarraydatapointer.h(80): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
src/corelib/tools/qarraydatapointer.h(75): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
src/corelib/text/qbytearray.h(490): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
Change-Id: I221db4d5b660224f0fc1869248802c496db1b91c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qarraydata.cpp')
| -rw-r--r-- | src/corelib/tools/qarraydata.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index 00f6dfe6efb..497eae1f7fd 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -233,7 +233,7 @@ void *QArrayData::allocate(QArrayData **dptr, size_t objectSize, size_t alignmen // find where offset should point to so that data() is aligned to alignment bytes data = (quintptr(header) + sizeof(QArrayData) + alignment - 1) & ~(alignment - 1); - header->alloc = capacity; + header->alloc = uint(capacity); } *dptr = header; @@ -262,7 +262,7 @@ QArrayData::reallocateUnaligned(QArrayData *data, void *dataPointer, options |= AllocatedDataType | MutableData; QArrayData *header = reallocateData(data, allocSize, options); if (header) { - header->alloc = capacity; + header->alloc = uint(capacity); dataPointer = reinterpret_cast<char *>(header) + offset; } return qMakePair(static_cast<QArrayData *>(header), dataPointer); |
