Skip to content

Commit

Permalink
Trying a self written toupper() to see if this passes tests and satis…
Browse files Browse the repository at this point in the history
…fies MISRA
  • Loading branch information
Soren Ptak committed Aug 25, 2022
1 parent 342ed61 commit e789424
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions source/core_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,24 @@ static int8_t caseInsensitiveStringCmp( const char * str1,
{
size_t i = 0U;
/* Inclusion of inbetween variables for MISRA rule 13.2 compliance */
int32_t firstChar;
int32_t secondChar;
int8_t firstChar;
int8_t secondChar;

for( i = 0U; i < n; i++ )
{
firstChar = toupper( ( int32_t ) ( ( unsigned char ) str1[ i ] ) );
secondChar = toupper( ( int32_t ) ( ( unsigned char ) str2[ i ] ) );
firstChar = ( int8_t ) str1[ i ];
secondChar = ( int8_t ) str2[ i ];

/* Add 32 to go from uppercase to lowercase ASCII character */
if( ( firstChar >= 65 ) && ( firstChar <= 90 ) )
{
firstChar = firstChar + 32;
}

if( ( secondChar >= 65 ) && ( secondChar <= 90 ) )
{
secondChar = secondChar + 32;
}

if( ( firstChar ) != ( secondChar ) )
{
Expand Down

0 comments on commit e789424

Please sign in to comment.