[...] switch(cptr[3]) { case 0xC0 ... 0xDF: [...]
I'm sorry to say, but this is not C. §6.6.4.2:1 of C99 (the current C standard says):
| The controlling expression of a switch statement shall have integer | type, and shall not cause a block to be entered by a jump from outside | the block to a statement that follows a case or default label in the | block (or an enclosed block) if that block contains the declaration of | a variably modified object or variably modified typedef name. The ^^^ | expression of each case label shall be an integer constant ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | expression. No two of the case constant expressions in the same switch ^^^^^^^^^^ | statement shall have the same value after conversion. There may be at | most one default label in a switch statement. (Any enclosed switch | statement may have a default label or case constant expressions with | values that duplicate case constant expressions in the enclosing | switch statement.)
"0xC0 ... 0xDF" is not an integer constant expression, so this is not legal C.