From 4b536e162d383b97a8846f85c488b4a4444d1fb6 Mon Sep 17 00:00:00 2001 From: Dennis Oberst Date: Fri, 4 Apr 2025 13:19:49 +0200 Subject: [PATCH] QProtobufSerializer: change fieldIndex to fieldNumber in encodeHeader Pick-to: 6.9 6.8 Change-Id: I465aa746f0467933715091f6c5a1ba536b8313d2 Reviewed-by: Alexey Edelev --- src/protobuf/qprotobufserializer.cpp | 12 ++++++------ src/protobuf/qprotobufserializer_p.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/protobuf/qprotobufserializer.cpp b/src/protobuf/qprotobufserializer.cpp index 66f1d210..432087db 100644 --- a/src/protobuf/qprotobufserializer.cpp +++ b/src/protobuf/qprotobufserializer.cpp @@ -270,21 +270,21 @@ void QProtobufSerializerImpl::serializeMessageFieldEnd(const QProtobufMessage *m m_result = last; } -QByteArray QProtobufSerializerImpl::encodeHeader(int fieldIndex, QtProtobuf::WireTypes wireType) +QByteArray QProtobufSerializerImpl::encodeHeader(int fieldNumber, QtProtobuf::WireTypes wireType) { - // Encodes a property field index and its type into output bytes. + // Encodes a property field number and its type into output bytes. // Header byte - // Meaning | Field index | Type + // Meaning | Field number | Type // ---------- | ------------- | -------- // bit number | 7 6 5 4 3 | 2 1 0 - // fieldIndex: The index of a property in parent object - // wireType: Serialization type used for the property with fieldIndex + // fieldNumber: The index of a property in parent object + // wireType: Serialization type used for the property with fieldNumber // Returns a varint-encoded fieldIndex and wireType - uint32_t header = (fieldIndex << 3) | int(wireType); + uint32_t header = (fieldNumber << 3) | int(wireType); return serializeVarintCommon(header); } diff --git a/src/protobuf/qprotobufserializer_p.h b/src/protobuf/qprotobufserializer_p.h index 3dbe4bbc..f35204a5 100644 --- a/src/protobuf/qprotobufserializer_p.h +++ b/src/protobuf/qprotobufserializer_p.h @@ -58,7 +58,7 @@ private: void serializeMessageFieldEnd(const QProtobufMessage *message, const QtProtobufPrivate::QProtobufFieldInfo &fieldInfo) override; - static QByteArray encodeHeader(int fieldIndex, QtProtobuf::WireTypes wireType); + static QByteArray encodeHeader(int fieldNumber, QtProtobuf::WireTypes wireType); QByteArray m_result; QList m_state;