--- libaitmqtt/src/sub.c 2012/06/20 15:02:24 1.2 +++ libaitmqtt/src/sub.c 2012/06/21 13:47:30 1.2.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: sub.c,v 1.2 2012/06/20 15:02:24 misho Exp $ +* $Id: sub.c,v 1.2.2.1 2012/06/21 13:47:30 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -61,7 +61,7 @@ mqtt_msgSUBSCRIBE(mqtt_msg_t * __restrict buf, mqtt_su u_short msgID, u_char Dup, u_char QOS) { int len, siz = 0; - u_int n; + u_int n, *l; struct mqtthdr *hdr; mqtthdr_var_t *topic; mqtt_len_t *mid; @@ -103,7 +103,8 @@ mqtt_msgSUBSCRIBE(mqtt_msg_t * __restrict buf, mqtt_su hdr->mqtt_msg.qos = QOS; hdr->mqtt_msg.dup = Dup ? 1 : 0; hdr->mqtt_msg.retain = 0; - *(u_int*) hdr->mqtt_len = n; + l = (u_int*) hdr->mqtt_len; + *l = n; data += siz; /* variable header */ @@ -186,7 +187,7 @@ mqtt_msgUNSUBSCRIBE(mqtt_msg_t * __restrict buf, mqtt_ u_short msgID, u_char Dup, u_char QOS) { int len, siz = 0; - u_int n; + u_int n, *l; struct mqtthdr *hdr; mqtthdr_var_t *topic; mqtt_len_t *mid; @@ -227,7 +228,8 @@ mqtt_msgUNSUBSCRIBE(mqtt_msg_t * __restrict buf, mqtt_ hdr->mqtt_msg.qos = QOS; hdr->mqtt_msg.dup = Dup ? 1 : 0; hdr->mqtt_msg.retain = 0; - *(u_int*) hdr->mqtt_len = n; + l = (u_int*) hdr->mqtt_len; + *l = n; data += siz; /* variable header */