From ac28f25f3a5f915f8f7b7277f4317c2a80196d28 Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:14:54 +0800 Subject: [PATCH] Add module defined prefix char check function (#55) * Module can override the CELLULAR_CHECK_IS_PREFIX_CHAR macro in "cellular_config.h" if allowed prefix char is different. --- source/cellular_at_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/cellular_at_core.c b/source/cellular_at_core.c index 38bb0aa2..4021d909 100644 --- a/source/cellular_at_core.c +++ b/source/cellular_at_core.c @@ -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 /*-----------------------------------------------------------*/ @@ -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;