diff --git a/source/tanya/conv.d b/source/tanya/conv.d index 561ccce..bce5401 100644 --- a/source/tanya/conv.d +++ b/source/tanya/conv.d @@ -308,11 +308,11 @@ do { digit = range.front - 'W'; } - else if (range.front >= 'A') + else if (range.front >= 'A' && range.front <= 'Z') { digit = range.front - '7'; } - else if (range.front >= '0') + else if (range.front >= '0' && range.front <= '9') { digit = range.front - '0'; } @@ -360,6 +360,15 @@ do return n; } +// ':' is not a hex value +@nogc nothrow pure @safe unittest +{ + string colon = ":"; + auto actual = readIntegral!ubyte(colon, 16); + assert(actual == 0); + assert(colon.length == 1); +} + // reads ubyte.max @nogc nothrow pure @safe unittest {