MCPcopy Create free account
hub / github.com/buggins/coolreader / decodeHex

Function decodeHex

crengine/src/lvstring.cpp:872–883  ·  view source on GitHub ↗

decode LEN hex digits, return decoded number, -1 if invalid

Source from the content-addressed store, hash-verified

870
871// decode LEN hex digits, return decoded number, -1 if invalid
872int decodeHex( const lChar16 * str, int len ) {
873 int n = 0;
874 for ( int i=0; i<len; i++ ) {
875 if ( !str[i] )
876 return -1;
877 int d = hexDigit(str[i]);
878 if ( d==-1 )
879 return -1;
880 n = (n<<4) | d;
881 }
882 return n;
883}
884
885// decode LEN decimal digits, return decoded number, -1 if invalid
886int decodeDecimal( const lChar16 * str, int len ) {

Callers 2

processLineMethod · 0.85
decodeHTMLCharFunction · 0.85

Calls 1

hexDigitFunction · 0.70

Tested by

no test coverage detected