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 log print format warning for GNU ARM compiler #154

Merged
Merged
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
2 changes: 1 addition & 1 deletion source/cellular_3gpp_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static CellularPktStatus_t _parseTimeZoneInfo( char * pTimeZoneResp,

if( pktStatus == CELLULAR_PKT_STATUS_OK )
{
LogDebug( ( "TimeZoneInfo: Timezone %d Year %d Month %d day %d,", pTimeInfo->timeZone,
LogDebug( ( "TimeZoneInfo: Timezone %d Year %d Month %d day %d,", ( int ) pTimeInfo->timeZone,
pTimeInfo->year,
pTimeInfo->month,
pTimeInfo->day ) );
Expand Down
2 changes: 1 addition & 1 deletion source/cellular_at_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ CellularATError_t Cellular_ATHexStrToHex( const char * pString,
}
else
{
firstNibble = firstNibble << 4;
firstNibble = ( uint8_t ) ( firstNibble << 4 );
( pHexData )[ i ] = firstNibble | secondNibble;
}

Expand Down
8 changes: 4 additions & 4 deletions source/cellular_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ CellularError_t _Cellular_RemoveSocketData( CellularContext_t * pContext,

if( socketHandle->socketState == SOCKETSTATE_CONNECTING )
{
LogWarn( ( "_Cellular_RemoveSocket, socket is connecting state [%u]", socketHandle->socketId ) );
LogWarn( ( "_Cellular_RemoveSocket, socket is connecting state [%u]", ( unsigned int ) socketHandle->socketId ) );
}

taskENTER_CRITICAL();
Expand Down Expand Up @@ -652,7 +652,7 @@ CellularError_t _Cellular_IsValidSocket( const CellularContext_t * pContext,
{
if( ( sockIndex >= CELLULAR_NUM_SOCKET_MAX ) || ( pContext->pSocketData[ sockIndex ] == NULL ) )
{
LogError( ( "_Cellular_IsValidSocket, invalid socket handle %u", sockIndex ) );
LogError( ( "_Cellular_IsValidSocket, invalid socket handle %u", ( unsigned int ) sockIndex ) );
cellularStatus = CELLULAR_BAD_PARAMETER;
}
}
Expand Down Expand Up @@ -701,7 +701,7 @@ CellularError_t _Cellular_ConvertCsqSignalRssi( int16_t csqRssi,
}
else
{
rssiValue = SIGNAL_QUALITY_CSQ_RSSI_BASE + ( csqRssi * SIGNAL_QUALITY_CSQ_RSSI_STEP );
rssiValue = ( int16_t ) ( SIGNAL_QUALITY_CSQ_RSSI_BASE + ( csqRssi * SIGNAL_QUALITY_CSQ_RSSI_STEP ) );
}
}

Expand Down Expand Up @@ -916,7 +916,7 @@ CellularSocketContext_t * _Cellular_GetSocketData( const CellularContext_t * pCo
{
if( ( sockIndex >= CELLULAR_NUM_SOCKET_MAX ) || ( pContext->pSocketData[ sockIndex ] == NULL ) )
{
LogError( ( "_Cellular_GetSocketData, invalid socket handle %u", sockIndex ) );
LogError( ( "_Cellular_GetSocketData, invalid socket handle %u", ( unsigned int ) sockIndex ) );
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions source/cellular_common_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ static CellularError_t _socketSetSockOptLevelTransport( CellularSocketOption_t o
}
else
{
LogError( ( "Cellular_SocketSetSockOpt: Cannot change the contextID in this state %d or length %d is invalid.",
socketHandle->socketState, optionValueLength ) );
LogError( ( "Cellular_SocketSetSockOpt: Cannot change the contextID in this state %d or length %u is invalid.",
socketHandle->socketState, ( unsigned int ) optionValueLength ) );
cellularStatus = CELLULAR_INTERNAL_FAILURE;
}
}
Expand All @@ -123,8 +123,8 @@ static CellularError_t _socketSetSockOptLevelTransport( CellularSocketOption_t o
}
else
{
LogError( ( "Cellular_SocketSetSockOpt: Cannot change the localPort in this state %d or length %d is invalid.",
socketHandle->socketState, optionValueLength ) );
LogError( ( "Cellular_SocketSetSockOpt: Cannot change the localPort in this state %d or length %u is invalid.",
socketHandle->socketState, ( unsigned int ) optionValueLength ) );
cellularStatus = CELLULAR_INTERNAL_FAILURE;
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/cellular_pkthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ CellularPktStatus_t _Cellular_AtParseInit( const CellularContext_t * pContext )

if( result >= 0 )
{
LogError( ( "AtParseFail for %u: %d %s %s", i, result,
LogError( ( "AtParseFail for %u: %d %s %s", ( unsigned int ) i, ( int ) result,
pTokenMap[ i ].pStrValue, pTokenMap[ i + 1U ].pStrValue ) );
finit = false;
}
Expand All @@ -836,7 +836,7 @@ CellularPktStatus_t _Cellular_AtParseInit( const CellularContext_t * pContext )

for( i = 0; i < tokenMapSize; i++ )
{
LogDebug( ( "Callbacks setup for %u : %s", i, pTokenMap[ i ].pStrValue ) );
LogDebug( ( "Callbacks setup for %u : %s", ( unsigned int ) i, pTokenMap[ i ].pStrValue ) );
}
}
else
Expand Down
28 changes: 14 additions & 14 deletions source/cellular_pktio.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static void _saveData( char * pLine,

( void ) dataLen;

LogDebug( ( "_saveData : Save data %p with length %d", pLine, dataLen ) );
LogDebug( ( "_saveData : Save data %p with length %u", pLine, ( unsigned int ) dataLen ) );

pNew = ( CellularATCommandLine_t * ) Platform_Malloc( sizeof( CellularATCommandLine_t ) );
configASSERT( ( pNew != NULL ) );
Expand Down Expand Up @@ -174,7 +174,7 @@ static void _saveRawData( char * pLine,
CellularATCommandResponse_t * pResp,
uint32_t dataLen )
{
LogDebug( ( "Save [%p] %d data to pResp", pLine, dataLen ) );
LogDebug( ( "Save [%p] %u data to pResp", pLine, ( unsigned int ) dataLen ) );
_saveData( pLine, pResp, dataLen );
}

Expand All @@ -183,7 +183,7 @@ static void _saveRawData( char * pLine,
static void _saveATData( char * pLine,
CellularATCommandResponse_t * pResp )
{
LogDebug( ( "Save [%s] %lu AT data to pResp", pLine, strlen( pLine ) ) );
LogDebug( ( "Save [%s] %u AT data to pResp", pLine, ( unsigned int ) strlen( pLine ) ) );
_saveData( pLine, pResp, ( uint32_t ) ( strlen( pLine ) + 1U ) );
}

Expand Down Expand Up @@ -546,8 +546,8 @@ static char * _handleLeftoverBuffer( CellularContext_t * pContext )
/* Move the leftover data or AT command response to the start of buffer.
* Set the pRead pointer to the empty buffer space. */

LogDebug( ( "moved the partial line/data from %p to %p %d",
pContext->pPktioReadPtr, pContext->pktioReadBuf, pContext->partialDataRcvdLen ) );
LogDebug( ( "moved the partial line/data from %p to %p %u",
pContext->pPktioReadPtr, pContext->pktioReadBuf, ( unsigned int ) pContext->partialDataRcvdLen ) );

( void ) memmove( pContext->pktioReadBuf, pContext->pPktioReadPtr, pContext->partialDataRcvdLen );
pContext->pktioReadBuf[ pContext->partialDataRcvdLen ] = '\0';
Expand Down Expand Up @@ -609,15 +609,15 @@ static char * _Cellular_ReadLine( CellularContext_t * pContext,
if( bufferEmptyLength > 0 )
{
( void ) pContext->pCommIntf->recv( pContext->hPktioCommIntf, ( uint8_t * ) pRead,
bufferEmptyLength,
( uint32_t ) bufferEmptyLength,
CELLULAR_COMM_IF_RECV_TIMEOUT_MS, &bytesRead );

if( bytesRead > 0U )
{
/* Add a NULL after the bytesRead. This is required for further processing. */
pRead[ bytesRead ] = '\0';

LogDebug( ( "AT Read %d bytes, data[%p]", bytesRead, pRead ) );
LogDebug( ( "AT Read %u bytes, data[%p]", ( unsigned int ) bytesRead, pRead ) );
/* Set the pBytesRead only when actual bytes read from comm interface. */
*pBytesRead = bytesRead + partialDataRead;

Expand Down Expand Up @@ -670,12 +670,12 @@ static CellularPktStatus_t _handleData( char * pStartOfData,
/* There are more bytes after the data. */
*pBytesLeft = ( bytesDataAndLeft - pContext->dataLength );

LogDebug( ( "_handleData : read buffer buffer %p start %p prefix %d left %d, read total %d",
LogDebug( ( "_handleData : read buffer buffer %p start %p prefix %d left %d, read total %u",
pContext->pktioReadBuf,
pStartOfData,
bytesBeforeData,
*pBytesLeft,
bytesRead ) );
( unsigned int ) bytesBeforeData,
( unsigned int ) *pBytesLeft,
( unsigned int ) bytesRead ) );

/* reset the data related variables. */
pContext->dataLength = 0U;
Expand Down Expand Up @@ -886,7 +886,7 @@ static bool _preprocessInputBuffer( CellularContext_t * pContext,
{
/* The input buffer callback returns incorrect buffer length. */
LogError( ( "Input buffer callback returns bufferLength %u. Modem returns length %u. Clean the read buffer.",
bufferLength, *pBytesRead ) );
( unsigned int ) bufferLength, ( unsigned int ) *pBytesRead ) );

/* Clean the read buffer and read pointer. */
( void ) memset( pContext->pktioReadBuf, 0, PKTIO_READ_BUFFER_SIZE + 1U );
Expand Down Expand Up @@ -1026,7 +1026,7 @@ static bool _handleDataResult( CellularContext_t * pContext,
else
{
*pBytesRead = bytesLeft;
LogDebug( ( "_handleData okay, keep processing %u bytes %p", bytesLeft, *ppLine ) );
LogDebug( ( "_handleData okay, keep processing %u bytes %p", ( unsigned int ) bytesLeft, *ppLine ) );
}

return keepProcess;
Expand Down Expand Up @@ -1427,7 +1427,7 @@ uint32_t _Cellular_PktioSendData( CellularContext_t * pContext,
dataLen, CELLULAR_COMM_IF_SEND_TIMEOUT_MS, &sentLen );
}

LogDebug( ( "PktioSendData sent %d bytes", sentLen ) );
LogDebug( ( "PktioSendData sent %u bytes", ( unsigned int ) sentLen ) );
return sentLen;
}

Expand Down