make more tests green

This commit is contained in:
Andreas Rumpf 2018-04-29 01:48:21 +02:00
commit b899713832
2 changed files with 3 additions and 3 deletions

View file

@ -74,11 +74,11 @@ proc rawInsert[T](c: var CritBitTree[T], key: string): Node[T] =
var newByte = 0 var newByte = 0
block blockX: block blockX:
while newbyte < key.len: while newbyte < key.len:
if it.key[newbyte] != key[newbyte]: if newbyte >= it.key.len or it.key[newbyte] != key[newbyte]:
newotherbits = it.key[newbyte].ord xor key[newbyte].ord newotherbits = it.key[newbyte].ord xor key[newbyte].ord
break blockX break blockX
inc newbyte inc newbyte
if it.key[newbyte] != '\0': if newbyte < it.key.len:
newotherbits = it.key[newbyte].ord newotherbits = it.key[newbyte].ord
else: else:
return it return it

View file

@ -196,7 +196,7 @@ proc joinPath*(head, tail: string): string {.
else: else:
result = head & tail result = head & tail
else: else:
if tail[0] in {DirSep, AltSep}: if tail.len > 0 and tail[0] in {DirSep, AltSep}:
result = head & tail result = head & tail
else: else:
result = head & DirSep & tail result = head & DirSep & tail