When comparing char with hex, you have to be careful:
Using the == operator to compare char with 0x80 always results in an error?
I would recommend this syntax introduced in C99 to be sure
if (buffer[i] > '\x3f') { // do something }
It tells the compiler that 0x3f is a char, not an int (security type), otherwise you will probably see a problem with this comparison.
In fact, the clang compiler will warn you about this:
comparing constant 128 with an expression of type 'char' is always false [-Werror, -Wtautological-constant-out-of-range-compare]
source share