Commit ce14d16374cb58052afdf87f7b3932f33503a87c
1 parent
5f683b9c
Fix all casts from char to enum class
This went wrong when the char was negative.
Showing
1 changed file
with
10 additions
and
10 deletions
mqttpacket.cpp
| @@ -495,7 +495,7 @@ ConnectData MqttPacket::parseConnectData() | @@ -495,7 +495,7 @@ ConnectData MqttPacket::parseConnectData() | ||
| 495 | 495 | ||
| 496 | while (pos < prop_end_at) | 496 | while (pos < prop_end_at) |
| 497 | { | 497 | { |
| 498 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 498 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 499 | 499 | ||
| 500 | switch (prop) | 500 | switch (prop) |
| 501 | { | 501 | { |
| @@ -557,7 +557,7 @@ ConnectData MqttPacket::parseConnectData() | @@ -557,7 +557,7 @@ ConnectData MqttPacket::parseConnectData() | ||
| 557 | 557 | ||
| 558 | while (pos < prop_end_at) | 558 | while (pos < prop_end_at) |
| 559 | { | 559 | { |
| 560 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 560 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 561 | 561 | ||
| 562 | switch (prop) | 562 | switch (prop) |
| 563 | { | 563 | { |
| @@ -662,7 +662,7 @@ ConnAckData MqttPacket::parseConnAckData() | @@ -662,7 +662,7 @@ ConnAckData MqttPacket::parseConnAckData() | ||
| 662 | 662 | ||
| 663 | while (pos < prop_end_at) | 663 | while (pos < prop_end_at) |
| 664 | { | 664 | { |
| 665 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 665 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 666 | 666 | ||
| 667 | switch (prop) | 667 | switch (prop) |
| 668 | { | 668 | { |
| @@ -866,7 +866,7 @@ AuthPacketData MqttPacket::parseAuthData() | @@ -866,7 +866,7 @@ AuthPacketData MqttPacket::parseAuthData() | ||
| 866 | 866 | ||
| 867 | while (pos < prop_end_at) | 867 | while (pos < prop_end_at) |
| 868 | { | 868 | { |
| 869 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 869 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 870 | 870 | ||
| 871 | switch (prop) | 871 | switch (prop) |
| 872 | { | 872 | { |
| @@ -991,7 +991,7 @@ DisconnectData MqttPacket::parseDisconnectData() | @@ -991,7 +991,7 @@ DisconnectData MqttPacket::parseDisconnectData() | ||
| 991 | 991 | ||
| 992 | while (pos < prop_end_at) | 992 | while (pos < prop_end_at) |
| 993 | { | 993 | { |
| 994 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 994 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 995 | 995 | ||
| 996 | switch (prop) | 996 | switch (prop) |
| 997 | { | 997 | { |
| @@ -1067,7 +1067,7 @@ void MqttPacket::handleSubscribe() | @@ -1067,7 +1067,7 @@ void MqttPacket::handleSubscribe() | ||
| 1067 | 1067 | ||
| 1068 | while (pos < prop_end_at) | 1068 | while (pos < prop_end_at) |
| 1069 | { | 1069 | { |
| 1070 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 1070 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 1071 | 1071 | ||
| 1072 | switch (prop) | 1072 | switch (prop) |
| 1073 | { | 1073 | { |
| @@ -1158,7 +1158,7 @@ void MqttPacket::handleUnsubscribe() | @@ -1158,7 +1158,7 @@ void MqttPacket::handleUnsubscribe() | ||
| 1158 | 1158 | ||
| 1159 | while (pos < prop_end_at) | 1159 | while (pos < prop_end_at) |
| 1160 | { | 1160 | { |
| 1161 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 1161 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 1162 | 1162 | ||
| 1163 | switch (prop) | 1163 | switch (prop) |
| 1164 | { | 1164 | { |
| @@ -1236,7 +1236,7 @@ void MqttPacket::parsePublishData() | @@ -1236,7 +1236,7 @@ void MqttPacket::parsePublishData() | ||
| 1236 | 1236 | ||
| 1237 | while (pos < prop_end_at) | 1237 | while (pos < prop_end_at) |
| 1238 | { | 1238 | { |
| 1239 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 1239 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 1240 | 1240 | ||
| 1241 | switch (prop) | 1241 | switch (prop) |
| 1242 | { | 1242 | { |
| @@ -1403,7 +1403,7 @@ PubRecData MqttPacket::parsePubRecData() | @@ -1403,7 +1403,7 @@ PubRecData MqttPacket::parsePubRecData() | ||
| 1403 | 1403 | ||
| 1404 | if (!atEnd()) | 1404 | if (!atEnd()) |
| 1405 | { | 1405 | { |
| 1406 | - result.reasonCode = static_cast<ReasonCodes>(readByte()); | 1406 | + result.reasonCode = static_cast<ReasonCodes>(readUint8()); |
| 1407 | } | 1407 | } |
| 1408 | 1408 | ||
| 1409 | return result; | 1409 | return result; |
| @@ -1494,7 +1494,7 @@ SubAckData MqttPacket::parseSubAckData() | @@ -1494,7 +1494,7 @@ SubAckData MqttPacket::parseSubAckData() | ||
| 1494 | 1494 | ||
| 1495 | while (pos < prop_end_at) | 1495 | while (pos < prop_end_at) |
| 1496 | { | 1496 | { |
| 1497 | - const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readByte()); | 1497 | + const Mqtt5Properties prop = static_cast<Mqtt5Properties>(readUint8()); |
| 1498 | 1498 | ||
| 1499 | switch (prop) | 1499 | switch (prop) |
| 1500 | { | 1500 | { |