summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qiodevice_p.h
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2020-08-21 18:04:19 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2020-08-24 14:50:56 +0300
commit556a7e7318fce42e154439dd7157f44551a7f1ae (patch)
tree4eae631a431e59c5ffc1f014a87931a55ccdbf31 /src/corelib/io/qiodevice_p.h
parentb3310426b6ae09fd9aba4183e60c7b88b837e735 (diff)
QIODevicePrivate: rearrange class members
As this class is a subject of the library hook data, there must be a solid understanding of the member's alignment and padding across different architectures. By reordering the layout, this patch provides a clearer way of adding new members to the class. Bump the TypeInformationVersion field in qtHookData, to notify the Qt Creator developers that the offset of QFilePrivate::fileName was changed and dumpers should be adapted. Change-Id: Ied8b69bdeb9da50ff05aba2107bc75509674b18e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qiodevice_p.h')
-rw-r--r--src/corelib/io/qiodevice_p.h46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index a485ec43b3..8113f08237 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -80,11 +80,14 @@ public:
QIODevicePrivate();
virtual ~QIODevicePrivate();
- QIODevice::OpenMode openMode;
- QString errorString;
-
- QList<QRingBuffer> readBuffers;
- QList<QRingBuffer> writeBuffers;
+ // The size of this class is a subject of the library hook data.
+ // When adding a new member, do not make gaps and be aware
+ // about the padding. Accordingly, adjust offsets in
+ // tests/auto/other/toolsupport and bump the TypeInformationVersion
+ // field in src/corelib/global/qhooks.cpp, to notify the developers.
+ qint64 pos = 0;
+ qint64 devicePos = 0;
+ qint64 transactionPos = 0;
class QRingBufferRef {
QRingBuffer *m_buf;
@@ -122,27 +125,30 @@ public:
QRingBufferRef buffer;
QRingBufferRef writeBuffer;
- qint64 pos;
- qint64 devicePos;
- qint64 transactionPos;
- int readChannelCount;
- int writeChannelCount;
- int currentReadChannel;
- int currentWriteChannel;
- int readBufferChunkSize;
- int writeBufferChunkSize;
- const QByteArray *currentWriteChunk;
- bool transactionStarted;
- bool baseReadLineDataCalled;
+ const QByteArray *currentWriteChunk = nullptr;
+ int readChannelCount = 0;
+ int writeChannelCount = 0;
+ int currentReadChannel = 0;
+ int currentWriteChannel = 0;
+ int readBufferChunkSize = QIODEVICE_BUFFERSIZE;
+ int writeBufferChunkSize = 0;
+
+ QList<QRingBuffer> readBuffers;
+ QList<QRingBuffer> writeBuffers;
+ QString errorString;
+ QIODevice::OpenMode openMode = QIODevice::NotOpen;
+
+ bool transactionStarted = false;
+ bool baseReadLineDataCalled = false;
virtual bool putCharHelper(char c);
- enum AccessMode {
+ enum AccessMode : quint8 {
Unset,
Sequential,
RandomAccess
};
- mutable AccessMode accessMode;
+ mutable AccessMode accessMode = Unset;
inline bool isSequential() const
{
if (accessMode == Unset)
@@ -179,7 +185,7 @@ public:
void write(const char *data, qint64 size);
#ifdef QT_NO_QOBJECT
- QIODevice *q_ptr;
+ QIODevice *q_ptr = nullptr;
#endif
};