| | |
| | | memset(topics_buf, 0x00, sizeof(topics_buf)); |
| | | memcpy(topics_buf, buf, size); |
| | | rr.data = topics_buf; |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgRequestTopicReply mrt; |
| | | mrt.mutable_errmsg()->set_errcode(::bhome_msg::ErrorCode(rv)); |
| | | mrt.mutable_errmsg()->set_errstring(errString); |
| | | mrt.set_data(rr.data.data()); |
| | | *reply_len = mrt.ByteSizeLong(); |
| | | *reply = malloc(*reply_len); |
| | | mrt.SerializePartialToArray(*reply, *reply_len); |
| | | #endif |
| | | } |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgRequestTopicReply mrt; |
| | | mrt.mutable_errmsg()->set_errcode(::bhome_msg::ErrorCode(rv)); |
| | | mrt.mutable_errmsg()->set_errstring(errString); |
| | | mrt.set_data(rr.data.data()); |
| | | *reply_len = mrt.ByteSizeLong(); |
| | | *reply = malloc(*reply_len); |
| | | mrt.SerializePartialToArray(*reply, *reply_len); |
| | | #else |
| | | if (rv > 0) { |
| | | min = strlen(errString) + 1; |
| | | buf = malloc(min); |
| | | memcpy(buf, errString, strlen(errString)); |
| | | *((char *)buf + min - 1) = '\0'; |
| | | |
| | | *reply = buf; |
| | | *reply_len = min; |
| | | } |
| | | #endif |
| | | |
| | | if (rv == 0) |
| | | return true; |
| | | |