--- mqtt/src/Attic/sub.c 2011/11/22 14:00:09 1.1.2.7 +++ mqtt/src/Attic/sub.c 2011/11/28 10:17:12 1.1.2.8 @@ -48,13 +48,13 @@ mqtt_msgSUBSCRIBE(mqtt_msg_t * __restrict buf, mqtt_su siz += sizeof(mqtt_v_t); /* payload with subscriptions */ - for (t = Topics; t && t->sub_data; t++) { + for (t = Topics; t && t->sub_topic._base; t++) { topic = (mqtthdr_var_t*) (buf->msg_base + siz); - topic->var_sb.val = t->sub_sb.val; - memcpy(topic->var_data, t->sub_data, ntohs(topic->var_sb.val)); + topic->var_sb.val = htons(t->sub_topic._size); + memcpy(topic->var_data, t->sub_topic._base, ntohs(topic->var_sb.val)); siz += MQTTHDR_VAR_SIZEOF(topic); qos = (buf->msg_base + siz); - *qos = t->sub_qos; + *qos = t->sub_ret; siz++; } @@ -103,9 +103,9 @@ mqtt_msgSUBACK(mqtt_msg_t * __restrict buf, mqtt_subsc v->val = htons(msgID); /* QoS payload from subscriptions */ - for (t = Topics; t && t->sub_data; t++) { + for (t = Topics; t && t->sub_topic._base; t++) { qos = (buf->msg_base + siz); - *qos = t->sub_qos; + *qos = t->sub_ret; siz++; } @@ -162,10 +162,10 @@ mqtt_msgUNSUBSCRIBE(mqtt_msg_t * __restrict buf, mqtt_ siz += sizeof(mqtt_v_t); /* payload with subscriptions */ - for (t = Topics; t && t->sub_data; t++) { + for (t = Topics; t && t->sub_topic._base; t++) { topic = (mqtthdr_var_t*) (buf->msg_base + siz); - topic->var_sb.val = t->sub_sb.val; - memcpy(topic->var_data, t->sub_data, ntohs(topic->var_sb.val)); + topic->var_sb.val = htons(t->sub_topic._size); + memcpy(topic->var_data, t->sub_topic._base, ntohs(topic->var_sb.val)); siz += MQTTHDR_VAR_SIZEOF(topic); }