Skip to content

Commit

Permalink
* FIX [exchange] Fix some code warning
Browse files Browse the repository at this point in the history
Signed-off-by: Moi Ran <maoyi.ran@emqx.io>
  • Loading branch information
RanMaoyi committed Nov 28, 2023
1 parent 32dbb1d commit 3023082
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/mqtt/protocol/exchange/exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exchange_init(exchange_t **ex, char *name, char *topic,
return -1;
}
for (unsigned int i = 0; i < rbsCount; i++) {
if (rbsCaps[i] == NULL || rbsCaps[i] >= RINGBUFFER_MAX_SIZE) {
if (rbsCaps[i] >= RINGBUFFER_MAX_SIZE) {
return -1;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/mqtt/protocol/exchange/exchange_client_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ client_publish(nng_socket sock, const char *topic, uint8_t *payload,
{
int rv;

UNUSED(verbose);
// create a PUBLISH message
nng_msg *pubmsg;
nng_mqtt_msg_alloc(&pubmsg, 0);
Expand Down
10 changes: 5 additions & 5 deletions src/mqtt/protocol/exchange/exchange_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void test_exchange_init(void)
{
exchange_t *ex = NULL;
char **ringBufferName;
int caps = 10000;
unsigned int caps = 10000;

ringBufferName = nng_alloc(1 * sizeof(char *));
for (int i = 0; i < 1; i++) {
Expand All @@ -41,9 +41,9 @@ void test_exchange_init(void)
NUTS_TRUE(exchange_release(ex) == 0);

for (int i = 0; i < 1; i++) {
nng_free(ringBufferName[i], *ringBufferName[i]);
nng_free(ringBufferName[i], sizeof(*ringBufferName[i]));
}
nng_free(ringBufferName, strlen(ringBufferName));
nng_free(ringBufferName, sizeof(*ringBufferName));

return;
}
Expand All @@ -59,7 +59,7 @@ void test_exchange_ringBuffer(void)
{
exchange_t *ex = NULL;
char **ringBufferName;
int caps = 1;
unsigned int caps = 1;

ringBufferName = nng_alloc(1 * sizeof(char *));
for (int i = 0; i < 1; i++) {
Expand All @@ -78,7 +78,7 @@ void test_exchange_ringBuffer(void)
nng_free(ringBufferName, sizeof(ringBufferName));

nng_msg *msg = NULL;
msg = alloc_pub_msg(&topic);
msg = alloc_pub_msg((char *)&topic);
NUTS_TRUE(msg != NULL);

NUTS_TRUE(exchange_handle_msg(ex, (void *)msg) == 0);
Expand Down

0 comments on commit 3023082

Please sign in to comment.