Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings #1486

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/MQTTAsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,8 @@ int MQTTAsync_isComplete(MQTTAsync handle, MQTTAsync_token dt)
current = NULL;
while (ListNextElement(m->c->outboundMsgs, &current))
{
Messages* m = (Messages*)(current->content);
if (m->msgid == dt)
Messages* m2 = (Messages*)(current->content);
if (m2->msgid == dt)
goto exit;
}
}
Expand Down Expand Up @@ -1493,8 +1493,8 @@ int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens)
current = NULL;
while (ListNextElement(m->c->outboundMsgs, &current))
{
Messages* m = (Messages*)(current->content);
(*tokens)[count++] = m->msgid;
Messages* m2 = (Messages*)(current->content);
(*tokens)[count++] = m2->msgid;
}
}
(*tokens)[count] = -1; /* indicate end of list */
Expand Down
2 changes: 1 addition & 1 deletion src/MQTTAsyncUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size)
; /* don't persist QoS0 if that create option is set to 0 */
else
{
int rc = MQTTAsync_persistCommand(command);
rc = MQTTAsync_persistCommand(command);
if (command->command.type == PUBLISH && rc == 0)
{
char key[PERSISTENCE_MAX_KEY_LENGTH + 1];
Expand Down
8 changes: 4 additions & 4 deletions src/MQTTClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -1439,8 +1439,8 @@ static MQTTResponse MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_c

while (ListNextElement(m->c->outboundMsgs, &outcurrent))
{
Messages* m = (Messages*)(outcurrent->content);
memset(&m->lastTouch, '\0', sizeof(m->lastTouch));
Messages* m2 = (Messages*)(outcurrent->content);
memset(&m2->lastTouch, '\0', sizeof(m2->lastTouch));
}
MQTTProtocol_retry(zero, 1, 1);
if (m->c->connected != 1)
Expand Down Expand Up @@ -2933,8 +2933,8 @@ int MQTTClient_getPendingDeliveryTokens(MQTTClient handle, MQTTClient_deliveryTo
}
while (ListNextElement(m->c->outboundMsgs, &current))
{
Messages* m = (Messages*)(current->content);
(*tokens)[count++] = m->msgid;
Messages* m2 = (Messages*)(current->content);
(*tokens)[count++] = m2->msgid;
}
(*tokens)[count] = -1;
}
Expand Down
3 changes: 1 addition & 2 deletions src/MQTTPersistence.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int MQTTPersistence_restorePackets(Clients *c)
int rc = 0;
char **msgkeys = NULL,
*buffer = NULL;
int nkeys, buflen;
int nkeys = 0, buflen;
int i = 0;
int msgs_sent = 0;
int msgs_rcvd = 0;
Expand Down Expand Up @@ -353,7 +353,6 @@ int MQTTPersistence_restorePackets(Clients *c)
exit:
if (msgkeys)
{
int i = 0;
for (i = 0; i < nkeys; ++i)
{
if (msgkeys[i])
Expand Down
1 change: 0 additions & 1 deletion src/SSLSocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,6 @@ int SSLSocket_putdatas(SSL* ssl, SOCKET socket, char* buf0, size_t buf0len, Pack
free(iovec.iov_base);
else
{
int i;
free(buf0);
for (i = 0; i < bufs.count; ++i)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ int Socket_new(const char* addr, size_t addr_len, int port, SOCKET* sock)
#endif
int rc = SOCKET_ERROR;
#if defined(_WIN32) || defined(_WIN64)
short family;
short family = AF_INET;
#else
sa_family_t family = AF_INET;
#endif
Expand Down Expand Up @@ -1198,7 +1198,7 @@ int Socket_new(const char* addr, size_t addr_len, int port, SOCKET* sock)
if (rc == EINPROGRESS || rc == EWOULDBLOCK)
{
SOCKET* pnewSd = (SOCKET*)malloc(sizeof(SOCKET));
ListElement* result = NULL;
ListElement* listResult = NULL;

if (!pnewSd)
{
Expand All @@ -1207,9 +1207,9 @@ int Socket_new(const char* addr, size_t addr_len, int port, SOCKET* sock)
}
*pnewSd = *sock;
Paho_thread_lock_mutex(socket_mutex);
result = ListAppend(mod_s.connect_pending, pnewSd, sizeof(SOCKET));
listResult = ListAppend(mod_s.connect_pending, pnewSd, sizeof(SOCKET));
Paho_thread_unlock_mutex(socket_mutex);
if (!result)
if (!listResult)
{
free(pnewSd);
rc = PAHO_MEMORY_ERROR;
Expand Down
5 changes: 2 additions & 3 deletions src/WebSocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,7 @@ char *WebSocket_getdata(networkHandles *net, size_t bytes, size_t* actual_len)
/* no current frame, so let's go receive one for the network */
if ( !frame )
{
const int rc =
WebSocket_receiveFrame( net, actual_len );
rc = WebSocket_receiveFrame( net, actual_len );

if ( rc == TCPSOCKET_COMPLETE && in_frames && in_frames->first)
frame = in_frames->first->content;
Expand All @@ -715,7 +714,7 @@ char *WebSocket_getdata(networkHandles *net, size_t bytes, size_t* actual_len)


while (*actual_len < bytes) {
const int rc = WebSocket_receiveFrame(net, actual_len);
rc = WebSocket_receiveFrame(net, actual_len);

if (rc != TCPSOCKET_COMPLETE) {
goto exit;
Expand Down