Move escape character processing into library

And expand to include all 8-bit values.
This commit is contained in:
Robin Stuart 2017-10-21 12:45:50 +01:00
parent 1fb99fff8c
commit 0314ca65a8
5 changed files with 142 additions and 89 deletions

View file

@ -43,7 +43,11 @@ size_t ustrlen(const unsigned char data[]) {
int ctoi(const char source) {
if ((source >= '0') && (source <= '9'))
return (source - '0');
return (source - 'A' + 10);
if ((source >= 'A') && (source <= 'F'))
return (source - 'A' + 10);
if ((source >= 'a') && (source <= 'f'))
return (source - 'a' + 10);
return -1;
}