Match the length of type for writing data

In MQTT_MAX_TRANSFER_SIZE case, the variable bytesRemaining needs to match the type of data length.
This commit is contained in:
Elsa 2015-10-04 22:16:27 +09:00
parent 2f97e4a558
commit 5cdadf43da

View File

@ -428,7 +428,7 @@ boolean PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length) {
#ifdef MQTT_MAX_TRANSFER_SIZE
uint8_t* writeBuf = buf+(4-llen);
uint8_t bytesRemaining = length+1+llen;
uint16_t bytesRemaining = length+1+llen; //Match the length type
uint8_t bytesToWrite;
boolean result = true;
while((bytesRemaining > 0) && result) {