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>
This commit is contained in:
parent
b3310426b6
commit
556a7e7318
@ -67,7 +67,7 @@ quintptr Q_CORE_EXPORT qtHookData[] = {
|
|||||||
// The required sizes and offsets are tested in tests/auto/other/toolsupport.
|
// The required sizes and offsets are tested in tests/auto/other/toolsupport.
|
||||||
// When this fails and the change was intentional, adjust the test and
|
// When this fails and the change was intentional, adjust the test and
|
||||||
// adjust this value here.
|
// adjust this value here.
|
||||||
19
|
20
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0]));
|
static_assert(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0]));
|
||||||
|
@ -156,22 +156,6 @@ static void checkWarnMessage(const QIODevice *device, const char *function, cons
|
|||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
QIODevicePrivate::QIODevicePrivate()
|
QIODevicePrivate::QIODevicePrivate()
|
||||||
: openMode(QIODevice::NotOpen),
|
|
||||||
pos(0), devicePos(0),
|
|
||||||
transactionPos(0),
|
|
||||||
readChannelCount(0),
|
|
||||||
writeChannelCount(0),
|
|
||||||
currentReadChannel(0),
|
|
||||||
currentWriteChannel(0),
|
|
||||||
readBufferChunkSize(QIODEVICE_BUFFERSIZE),
|
|
||||||
writeBufferChunkSize(0),
|
|
||||||
currentWriteChunk(nullptr),
|
|
||||||
transactionStarted(false)
|
|
||||||
, baseReadLineDataCalled(false)
|
|
||||||
, accessMode(Unset)
|
|
||||||
#ifdef QT_NO_QOBJECT
|
|
||||||
, q_ptr(nullptr)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +80,14 @@ public:
|
|||||||
QIODevicePrivate();
|
QIODevicePrivate();
|
||||||
virtual ~QIODevicePrivate();
|
virtual ~QIODevicePrivate();
|
||||||
|
|
||||||
QIODevice::OpenMode openMode;
|
// The size of this class is a subject of the library hook data.
|
||||||
QString errorString;
|
// When adding a new member, do not make gaps and be aware
|
||||||
|
// about the padding. Accordingly, adjust offsets in
|
||||||
QList<QRingBuffer> readBuffers;
|
// tests/auto/other/toolsupport and bump the TypeInformationVersion
|
||||||
QList<QRingBuffer> writeBuffers;
|
// field in src/corelib/global/qhooks.cpp, to notify the developers.
|
||||||
|
qint64 pos = 0;
|
||||||
|
qint64 devicePos = 0;
|
||||||
|
qint64 transactionPos = 0;
|
||||||
|
|
||||||
class QRingBufferRef {
|
class QRingBufferRef {
|
||||||
QRingBuffer *m_buf;
|
QRingBuffer *m_buf;
|
||||||
@ -122,27 +125,30 @@ public:
|
|||||||
|
|
||||||
QRingBufferRef buffer;
|
QRingBufferRef buffer;
|
||||||
QRingBufferRef writeBuffer;
|
QRingBufferRef writeBuffer;
|
||||||
qint64 pos;
|
const QByteArray *currentWriteChunk = nullptr;
|
||||||
qint64 devicePos;
|
int readChannelCount = 0;
|
||||||
qint64 transactionPos;
|
int writeChannelCount = 0;
|
||||||
int readChannelCount;
|
int currentReadChannel = 0;
|
||||||
int writeChannelCount;
|
int currentWriteChannel = 0;
|
||||||
int currentReadChannel;
|
int readBufferChunkSize = QIODEVICE_BUFFERSIZE;
|
||||||
int currentWriteChannel;
|
int writeBufferChunkSize = 0;
|
||||||
int readBufferChunkSize;
|
|
||||||
int writeBufferChunkSize;
|
QList<QRingBuffer> readBuffers;
|
||||||
const QByteArray *currentWriteChunk;
|
QList<QRingBuffer> writeBuffers;
|
||||||
bool transactionStarted;
|
QString errorString;
|
||||||
bool baseReadLineDataCalled;
|
QIODevice::OpenMode openMode = QIODevice::NotOpen;
|
||||||
|
|
||||||
|
bool transactionStarted = false;
|
||||||
|
bool baseReadLineDataCalled = false;
|
||||||
|
|
||||||
virtual bool putCharHelper(char c);
|
virtual bool putCharHelper(char c);
|
||||||
|
|
||||||
enum AccessMode {
|
enum AccessMode : quint8 {
|
||||||
Unset,
|
Unset,
|
||||||
Sequential,
|
Sequential,
|
||||||
RandomAccess
|
RandomAccess
|
||||||
};
|
};
|
||||||
mutable AccessMode accessMode;
|
mutable AccessMode accessMode = Unset;
|
||||||
inline bool isSequential() const
|
inline bool isSequential() const
|
||||||
{
|
{
|
||||||
if (accessMode == Unset)
|
if (accessMode == Unset)
|
||||||
@ -179,7 +185,7 @@ public:
|
|||||||
void write(const char *data, qint64 size);
|
void write(const char *data, qint64 size);
|
||||||
|
|
||||||
#ifdef QT_NO_QOBJECT
|
#ifdef QT_NO_QOBJECT
|
||||||
QIODevice *q_ptr;
|
QIODevice *q_ptr = nullptr;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,9 +126,9 @@ void tst_toolsupport::offsets_data()
|
|||||||
#ifdef Q_PROCESSOR_X86
|
#ifdef Q_PROCESSOR_X86
|
||||||
// x86 32-bit has weird alignment rules. Refer to QtPrivate::AlignOf in
|
// x86 32-bit has weird alignment rules. Refer to QtPrivate::AlignOf in
|
||||||
// qglobal.h for more details.
|
// qglobal.h for more details.
|
||||||
data << 188 << 296;
|
data << 180 << 288;
|
||||||
#else
|
#else
|
||||||
data << 192 << 296;
|
data << 184 << 288;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user