summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/mqtt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/mqtt.c')
-rw-r--r--libs/libcurl/src/mqtt.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libs/libcurl/src/mqtt.c b/libs/libcurl/src/mqtt.c
index 9cd56781a5..83d49ce707 100644
--- a/libs/libcurl/src/mqtt.c
+++ b/libs/libcurl/src/mqtt.c
@@ -154,15 +154,15 @@ static int mqtt_getsock(struct Curl_easy *data,
static int mqtt_encode_len(char *buf, size_t len)
{
- unsigned char encoded;
int i;
for(i = 0; (len > 0) && (i<4); i++) {
+ unsigned char encoded;
encoded = len % 0x80;
len /= 0x80;
if(len)
encoded |= 0x80;
- buf[i] = encoded;
+ buf[i] = (char)encoded;
}
return i;
@@ -312,7 +312,7 @@ static CURLcode mqtt_connect(struct Curl_easy *data)
start_user = pos + 3 + MQTT_CLIENTID_LEN;
/* position where starts the password payload */
start_pwd = start_user + ulen;
- /* if user name was provided, add it to the packet */
+ /* if username was provided, add it to the packet */
if(ulen) {
start_pwd += 2;
@@ -585,7 +585,7 @@ static size_t mqtt_decode_len(unsigned char *buf,
return len;
}
-#ifdef CURLDEBUG
+#ifdef DEBUGBUILD
static const char *statenames[]={
"MQTT_FIRST",
"MQTT_REMAINING_LENGTH",
@@ -606,7 +606,7 @@ static void mqstate(struct Curl_easy *data,
{
struct connectdata *conn = data->conn;
struct mqtt_conn *mqtt = &conn->proto.mqtt;
-#ifdef CURLDEBUG
+#ifdef DEBUGBUILD
infof(data, "%s (from %s) (next is %s)",
statenames[state],
statenames[mqtt->state],
@@ -743,7 +743,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
struct mqtt_conn *mqtt = &conn->proto.mqtt;
struct MQTT *mq = data->req.p.mqtt;
ssize_t nread;
- unsigned char byte;
+ unsigned char recvbyte;
*done = FALSE;
@@ -776,13 +776,13 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
FALLTHROUGH();
case MQTT_REMAINING_LENGTH:
do {
- result = Curl_xfer_recv(data, (char *)&byte, 1, &nread);
+ result = Curl_xfer_recv(data, (char *)&recvbyte, 1, &nread);
if(result || !nread)
break;
- Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
- mq->pkt_hd[mq->npacket++] = byte;
- } while((byte & 0x80) && (mq->npacket < 4));
- if(!result && nread && (byte & 0x80))
+ Curl_debug(data, CURLINFO_HEADER_IN, (char *)&recvbyte, 1);
+ mq->pkt_hd[mq->npacket++] = recvbyte;
+ } while((recvbyte & 0x80) && (mq->npacket < 4));
+ if(!result && nread && (recvbyte & 0x80))
/* MQTT supports up to 127 * 128^0 + 127 * 128^1 + 127 * 128^2 +
127 * 128^3 bytes. server tried to send more */
result = CURLE_WEIRD_SERVER_REPLY;