mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
refactor: convert final 7 getRemainingSize() comparisons to hasRemaining()
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Fix extra-paren variants in world_packets and packet_parsers_tbc. getRemainingSize() is now exclusively arithmetic across the entire codebase — all bounds checks use hasRemaining().
This commit is contained in:
parent
d50bca21c4
commit
a491202f93
2 changed files with 6 additions and 6 deletions
|
|
@ -912,7 +912,7 @@ bool TbcPacketParsers::parseNameQueryResponse(network::Packet& packet, NameQuery
|
|||
data.guid = packet.readUInt64();
|
||||
data.found = 0;
|
||||
data.name = packet.readString();
|
||||
if (!data.name.empty() && (packet.getRemainingSize()) >= 12) {
|
||||
if (!data.name.empty() && packet.hasRemaining(12)) {
|
||||
uint32_t race = packet.readUInt32();
|
||||
uint32_t gender = packet.readUInt32();
|
||||
uint32_t cls = packet.readUInt32();
|
||||
|
|
@ -938,7 +938,7 @@ bool TbcPacketParsers::parseNameQueryResponse(network::Packet& packet, NameQuery
|
|||
data.found = found;
|
||||
if (data.found != 0) return true;
|
||||
data.name = packet.readString();
|
||||
if (!data.name.empty() && (packet.getRemainingSize()) >= 12) {
|
||||
if (!data.name.empty() && packet.hasRemaining(12)) {
|
||||
uint32_t race = packet.readUInt32();
|
||||
uint32_t gender = packet.readUInt32();
|
||||
uint32_t cls = packet.readUInt32();
|
||||
|
|
|
|||
|
|
@ -1504,7 +1504,7 @@ bool MessageChatParser::parse(network::Packet& packet, MessageChatData& data) {
|
|||
packet.setReadPos(start);
|
||||
return false;
|
||||
}
|
||||
if ((packet.getRemainingSize()) < (static_cast<size_t>(len) + minTrailingBytes)) {
|
||||
if (!packet.hasRemaining(static_cast<size_t>(len) + minTrailingBytes)) {
|
||||
packet.setReadPos(start);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2209,7 +2209,7 @@ bool PetitionShowlistParser::parse(network::Packet& packet, PetitionShowlistData
|
|||
data.displayId = packet.readUInt32();
|
||||
data.cost = packet.readUInt32();
|
||||
// Skip unused fields if present
|
||||
if ((packet.getRemainingSize()) >= 8) {
|
||||
if (packet.hasRemaining(8)) {
|
||||
data.charterType = packet.readUInt32();
|
||||
data.requiredSigs = packet.readUInt32();
|
||||
}
|
||||
|
|
@ -2270,7 +2270,7 @@ bool GuildQueryResponseParser::parse(network::Packet& packet, GuildQueryResponse
|
|||
data.borderColor = packet.readUInt32();
|
||||
data.backgroundColor = packet.readUInt32();
|
||||
|
||||
if ((packet.getRemainingSize()) >= 4) {
|
||||
if (packet.hasRemaining(4)) {
|
||||
data.rankCount = packet.readUInt32();
|
||||
}
|
||||
LOG_INFO("Parsed SMSG_GUILD_QUERY_RESPONSE: guild=", data.guildName, " id=", data.guildId);
|
||||
|
|
@ -2425,7 +2425,7 @@ bool GuildEventParser::parse(network::Packet& packet, GuildEventData& data) {
|
|||
for (uint8_t i = 0; i < data.numStrings && i < 3; ++i) {
|
||||
data.strings[i] = packet.readString();
|
||||
}
|
||||
if ((packet.getRemainingSize()) >= 8) {
|
||||
if (packet.hasRemaining(8)) {
|
||||
data.guid = packet.readUInt64();
|
||||
}
|
||||
LOG_INFO("Parsed SMSG_GUILD_EVENT: type=", static_cast<int>(data.eventType), " strings=", static_cast<int>(data.numStrings));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue