Fix case folding name compare in btree code
Remove folding of 0x0000 char to invalid unicode char 0xFFFF.
Fix false match when name in the btree on disk is the prefix of longer search key.
@@ -1042,20 +1042,20 @@ fsw_hfs_cmpf_catkey (BTreeKey *btkey1, BTreeKey *btkey2)
for (ac = 0; ac == 0 && apos < ckey1nlen; apos++) {
ac = be16_to_cpu (p1[apos]);
- ac = ac ? fsw_to_lower (ac) : 0xFFFF;
+ ac = fsw_to_lower (ac);
}
/* get next valid character from ckey2 */
for (bc = 0; bc == 0 && bpos < ckey2nlen; bpos++) {
bc = p2[bpos];
- bc = bc ? fsw_to_lower (bc) : 0xFFFF;
+ bc = fsw_to_lower (bc);
}
if (ac != bc)
break;
- if (bpos == ckey1nlen)
+ if (ac == 0)
return 0;
}
