Fix assertion condition.

This commit is contained in:
Sönke Ludwig 2017-06-22 16:22:11 +02:00
parent ed9efd9f44
commit f123e55fa9

View file

@ -1249,7 +1249,7 @@ struct InetPathFormat {
for (size_t i = idx; i < s.length; i++) {
if (s[i] == '%') {
assert(i+3 < s.length, "segment string not validated!?");
assert(i+2 < s.length, "segment string not validated!?");
ret.put(cast(char)(hexDigit(s[i+1]) << 4 | hexDigit(s[i+2])));
i += 2;
} else ret.put(s[i]);
@ -1270,5 +1270,6 @@ struct InetPathFormat {
assert(decodeSegment!Segment("foo").equal([Segment("foo")]));
assert(decodeSegment!Segment("foo/").equal([Segment("foo", '/')]));
assert(decodeSegment!Segment("fo%20o\\").equal([Segment("fo o\\")]));
assert(decodeSegment!Segment("foo%20").equal([Segment("foo ")]));
}
}