mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
Remove const_cast
This commit is contained in:
parent
3a9aedea68
commit
e8ffe96232
4 changed files with 8 additions and 10 deletions
|
@ -150,11 +150,9 @@ QDataStream& operator<<(QDataStream &out, const Assignment& assignment) {
|
|||
|
||||
QDataStream& operator>>(QDataStream &in, Assignment& assignment) {
|
||||
quint8 packedType;
|
||||
in >> packedType;
|
||||
in >> packedType >> assignment._uuid >> assignment._pool >> assignment._payload;
|
||||
assignment._type = (Assignment::Type) packedType;
|
||||
|
||||
in >> assignment._uuid >> assignment._pool >> assignment._payload;
|
||||
|
||||
if (assignment._command == Assignment::RequestCommand) {
|
||||
in >> assignment._walletUUID;
|
||||
}
|
||||
|
|
|
@ -247,13 +247,13 @@ void LimitedNodeList::collectPacketStats(const NLPacket& packet) {
|
|||
|
||||
void LimitedNodeList::fillPacketHeader(const NLPacket& packet, const QUuid& connectionSecret) {
|
||||
if (!NON_SOURCED_PACKETS.contains(packet.getType())) {
|
||||
const_cast<NLPacket&>(packet).writeSourceID(getSessionUUID());
|
||||
packet.writeSourceID(getSessionUUID());
|
||||
}
|
||||
|
||||
if (!connectionSecret.isNull()
|
||||
&& !NON_SOURCED_PACKETS.contains(packet.getType())
|
||||
&& !NON_VERIFIED_PACKETS.contains(packet.getType())) {
|
||||
const_cast<NLPacket&>(packet).writeVerificationHashGivenSecret(connectionSecret);
|
||||
packet.writeVerificationHashGivenSecret(connectionSecret);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ void NLPacket::readSourceID() {
|
|||
}
|
||||
}
|
||||
|
||||
void NLPacket::writeSourceID(const QUuid& sourceID) {
|
||||
void NLPacket::writeSourceID(const QUuid& sourceID) const {
|
||||
Q_ASSERT(!NON_SOURCED_PACKETS.contains(_type));
|
||||
|
||||
auto offset = Packet::totalHeaderSize(isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion);
|
||||
|
@ -207,7 +207,7 @@ void NLPacket::writeSourceID(const QUuid& sourceID) {
|
|||
_sourceID = sourceID;
|
||||
}
|
||||
|
||||
void NLPacket::writeVerificationHashGivenSecret(const QUuid& connectionSecret) {
|
||||
void NLPacket::writeVerificationHashGivenSecret(const QUuid& connectionSecret) const {
|
||||
Q_ASSERT(!NON_SOURCED_PACKETS.contains(_type) && !NON_VERIFIED_PACKETS.contains(_type));
|
||||
|
||||
auto offset = Packet::totalHeaderSize(isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion)
|
||||
|
|
|
@ -56,8 +56,8 @@ public:
|
|||
|
||||
const QUuid& getSourceID() const { return _sourceID; }
|
||||
|
||||
void writeSourceID(const QUuid& sourceID);
|
||||
void writeVerificationHashGivenSecret(const QUuid& connectionSecret);
|
||||
void writeSourceID(const QUuid& sourceID) const;
|
||||
void writeVerificationHashGivenSecret(const QUuid& connectionSecret) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -80,7 +80,7 @@ protected:
|
|||
|
||||
PacketType _type;
|
||||
PacketVersion _version;
|
||||
QUuid _sourceID;
|
||||
mutable QUuid _sourceID;
|
||||
};
|
||||
|
||||
#endif // hifi_NLPacket_h
|
||||
|
|
Loading…
Reference in a new issue