Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
antevir committed Mar 26, 2024
1 parent 56ae4e0 commit 186086c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions examples/http_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,24 @@ static void signalEvent(uint32_t evtFlag)

static void networkUpUrc(struct uCxHandle *puCxHandle)
{
(void)puCxHandle;
U_CX_LOG_LINE(U_CX_LOG_CH_DBG, "networkUpUrc");
signalEvent(URC_FLAG_NETWORK_UP);
}

static void sockConnected(struct uCxHandle *puCxHandle, int32_t socket_handle)
{
(void)puCxHandle;
(void)socket_handle;
U_CX_LOG_LINE(U_CX_LOG_CH_DBG, "sockConnected");
signalEvent(URC_FLAG_SOCK_CONNECTED);
}

static void socketData(struct uCxHandle *puCxHandle, int32_t socket_handle, int32_t number_bytes)
{
(void)puCxHandle;
(void)socket_handle;
(void)number_bytes;
signalEvent(URC_FLAG_SOCK_DATA);
}

Expand Down
8 changes: 7 additions & 1 deletion examples/http_example_no_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,24 @@ static void signalEvent(uint32_t evtFlag)

static void networkUpUrc(struct uCxHandle *puCxHandle)
{
(void)puCxHandle;
U_CX_LOG_LINE(U_CX_LOG_CH_DBG, "networkUpUrc");
signalEvent(URC_FLAG_NETWORK_UP);
}

static void sockConnected(struct uCxHandle *puCxHandle, int32_t socket_handle)
{
(void)puCxHandle;
(void)socket_handle;
U_CX_LOG_LINE(U_CX_LOG_CH_DBG, "sockConnected");
signalEvent(URC_FLAG_SOCK_CONNECTED);
}

static void socketData(struct uCxHandle *puCxHandle, int32_t socket_handle, int32_t number_bytes)
{
(void)puCxHandle;
(void)socket_handle;
(void)number_bytes;
signalEvent(URC_FLAG_SOCK_DATA);
}

Expand All @@ -118,7 +124,7 @@ static void sleepMs(int32_t timeMs)
* PUBLIC FUNCTIONS
* -------------------------------------------------------------- */

int main(int argc, char **argv)
int main(void)
{
uCxAtClient_t client;
uCxHandle_t ucxHandle;
Expand Down
2 changes: 1 addition & 1 deletion src/u_cx_at_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int32_t handleBinaryRx(uCxAtClient_t *pClient)
} else {
// The two length bytes have now been received
int32_t parse_code;
uint16_t length = (lengthBuf[0] << 8) | lengthBuf[1];
uint16_t length = (uint16_t)(lengthBuf[0] << 8) | lengthBuf[1];
char *pRxBuffer = (char *)pClient->pConfig->pRxBuffer;
parse_code = parseLine(pClient, pRxBuffer, pClient->rxBufferPos);
setupBinaryTransfer(pClient, parse_code, length);
Expand Down
1 change: 1 addition & 0 deletions src/u_cx_at_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ int32_t uCxIpAddressToString(const uSockIpAddress_t *pIpAddress,
pWritePtr[0] = ']';
pWritePtr[1] = 0;
pWritePtr += 2;
(void)pWritePtr; // Keep clang-analyzer happy
break;
default:
// Invalid address type
Expand Down
2 changes: 1 addition & 1 deletion src/u_cx_at_urc_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool uCxAtUrcQueueEnqueueBegin(uCxAtUrcQueue_t *pUrcQueue, const char *pUrcLine,
uUrcEntry_t *pEntry = (uUrcEntry_t *)&pUrcQueue->pBuffer[pUrcQueue->bufferPos];
memcpy(&pEntry->data[0], pUrcLine, urcLineLen);
pEntry->data[urcLineLen] = 0; // Add null term
pEntry->strLineLen = urcLineLen;
pEntry->strLineLen = (uint16_t)urcLineLen;
pEntry->payloadSize = 0;
pUrcQueue->bufferPos += sizeof(uUrcEntry_t) + urcLineLen + 1;
pUrcQueue->pEnqueueEntry = pEntry;
Expand Down
2 changes: 1 addition & 1 deletion src/u_cx_at_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int32_t uCxAtUtilHexToByte(const char *pHex, uint8_t *pOutByte)
if ((highNibble < 0) || (lowNibble < 0)) {
return -1;
}
*pOutByte = (highNibble << 4) | lowNibble;
*pOutByte = (uint8_t)((highNibble << 4) | lowNibble);
return 0;
}

Expand Down
4 changes: 4 additions & 0 deletions ucx_api/u_cx.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
static void urcCallback(struct uCxAtClient *pClient, void *pTag, char *pLine, size_t lineLength,
uint8_t *pBinaryData, size_t binaryDataLen)
{
(void)pClient;
(void)pTag;
(void)pBinaryData;
(void)binaryDataLen;
uCxHandle_t *puCxHandle = (uCxHandle_t *)pTag;
char *pParams = pLine;
size_t paramLen = lineLength;
Expand Down

0 comments on commit 186086c

Please sign in to comment.