From babcabfbc899d5a72b282f8cf0b510840e91ba0e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 16 Apr 2020 12:56:58 +0200 Subject: Clean up state handling for ICU and iconv based codecs Get rid of the hack for the FreeFunction and instead add a proper function pointer to clear the data to the ConverterState struct. Change-Id: I104aae1a4381c69f1a254713ec76e1aeaa862cdc Reviewed-by: Lars Knoll --- src/corelib/serialization/qtextstream.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib/serialization/qtextstream.cpp') diff --git a/src/corelib/serialization/qtextstream.cpp b/src/corelib/serialization/qtextstream.cpp index 9325cd9163..cb72b28511 100644 --- a/src/corelib/serialization/qtextstream.cpp +++ b/src/corelib/serialization/qtextstream.cpp @@ -364,12 +364,14 @@ static void copyConverterStateHelper(QTextCodec::ConverterState *dest, { // ### QTextCodec::ConverterState's copy constructors and assignments are // private. This function copies the structure manually. - Q_ASSERT(!src->d); + Q_ASSERT(!src->clearFn); dest->flags = src->flags; + dest->remainingChars = src->remainingChars; dest->invalidChars = src->invalidChars; dest->state_data[0] = src->state_data[0]; dest->state_data[1] = src->state_data[1]; dest->state_data[2] = src->state_data[2]; + dest->state_data[3] = src->state_data[3]; } #endif @@ -787,7 +789,7 @@ inline void QTextStreamPrivate::consume(int size) inline void QTextStreamPrivate::saveConverterState(qint64 newPos) { #if QT_CONFIG(textcodec) - if (readConverterState.d) { + if (readConverterState.clearFn) { // converter cannot be copied, so don't save anything // don't update readBufferStartDevicePos either return; -- cgit v1.2.3