Skip to content

Commit

Permalink
Add module defined prefix char check function (#55)
Browse files Browse the repository at this point in the history
* Module can override the CELLULAR_CHECK_IS_PREFIX_CHAR macro in "cellular_config.h" if allowed prefix char is different.
  • Loading branch information
chinglee-iot authored Nov 11, 2021
1 parent 477bd62 commit ac28f25
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/cellular_at_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@

/*-----------------------------------------------------------*/

#define CHECK_IS_PREFIX_CHAR( inputChar ) \
#ifndef CELLULAR_CHECK_IS_PREFIX_CHAR
#define CELLULAR_CHECK_IS_PREFIX_CHAR( inputChar ) \
( ( ( ( int32_t ) isalpha( ( ( int8_t ) ( inputChar ) ) ) ) == 0 ) && \
( ( ( int32_t ) isdigit( ( ( int8_t ) ( inputChar ) ) ) ) == 0 ) && \
( ( inputChar ) != '+' ) && ( ( inputChar ) != '_' ) )
#endif

/*-----------------------------------------------------------*/

Expand Down Expand Up @@ -141,7 +143,7 @@ CellularATError_t Cellular_ATIsPrefixPresent( const char * pString,
/* It's caused by stanard api isalpha and isdigit. */
/* coverity[misra_c_2012_directive_4_6_violation] */
/* coverity[misra_c_2012_rule_10_8_violation] */
if( CHECK_IS_PREFIX_CHAR( ( char ) ( *ptrChar ) ) )
if( CELLULAR_CHECK_IS_PREFIX_CHAR( ( char ) ( *ptrChar ) ) )
{
*pResult = false;
break;
Expand Down

0 comments on commit ac28f25

Please sign in to comment.