in source/sigv4.c [1374:1408]
static bool isTrimmableSpace( const char * value,
size_t index,
size_t valLen,
size_t trimmedLength )
{
bool ret = false;
assert( ( value != NULL ) && ( index < valLen ) );
/* Only trim spaces. */
if( isWhitespace( value[ index ] ) )
{
/* The last character is a trailing space. */
if( ( index + 1U ) == valLen )
{
ret = true;
}
/* Trim if the next character is also a space. */
else if( isWhitespace( value[ index + 1U ] ) )
{
ret = true;
}
/* It is a leading space if no characters have been written yet. */
else if( trimmedLength == 0U )
{
ret = true;
}
else
{
/* Empty else. */
}
}
return ret;
}