mirror of https://github.com/qt/qtgrpc.git
QProtobufSerializer: change fieldIndex to fieldNumber in encodeHeader
Pick-to: 6.9 6.8 Change-Id: I465aa746f0467933715091f6c5a1ba536b8313d2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
9508b383f2
commit
4b536e162d
|
@ -270,21 +270,21 @@ void QProtobufSerializerImpl::serializeMessageFieldEnd(const QProtobufMessage *m
|
||||||
m_result = last;
|
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
|
// Header byte
|
||||||
// Meaning | Field index | Type
|
// Meaning | Field number | Type
|
||||||
// ---------- | ------------- | --------
|
// ---------- | ------------- | --------
|
||||||
// bit number | 7 6 5 4 3 | 2 1 0
|
// bit number | 7 6 5 4 3 | 2 1 0
|
||||||
|
|
||||||
// fieldIndex: The index of a property in parent object
|
// fieldNumber: The index of a property in parent object
|
||||||
// wireType: Serialization type used for the property with fieldIndex
|
// wireType: Serialization type used for the property with fieldNumber
|
||||||
|
|
||||||
// Returns a varint-encoded fieldIndex and wireType
|
// Returns a varint-encoded fieldIndex and wireType
|
||||||
|
|
||||||
uint32_t header = (fieldIndex << 3) | int(wireType);
|
uint32_t header = (fieldNumber << 3) | int(wireType);
|
||||||
return serializeVarintCommon<uint32_t>(header);
|
return serializeVarintCommon<uint32_t>(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ private:
|
||||||
void serializeMessageFieldEnd(const QProtobufMessage *message,
|
void serializeMessageFieldEnd(const QProtobufMessage *message,
|
||||||
const QtProtobufPrivate::QProtobufFieldInfo &fieldInfo) override;
|
const QtProtobufPrivate::QProtobufFieldInfo &fieldInfo) override;
|
||||||
|
|
||||||
static QByteArray encodeHeader(int fieldIndex, QtProtobuf::WireTypes wireType);
|
static QByteArray encodeHeader(int fieldNumber, QtProtobuf::WireTypes wireType);
|
||||||
|
|
||||||
QByteArray m_result;
|
QByteArray m_result;
|
||||||
QList<QByteArray> m_state;
|
QList<QByteArray> m_state;
|
||||||
|
|
Loading…
Reference in New Issue