Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
hash: fix hash item offset calculating in uhash.dat #255
When a userphrase is going to be removed, HashModify calculates the offset according to its item_index.
However, the item_index will be shifted if there has previously removed item in uhash.dat.
Considering the following example:
chewing_userphrase_remove(ctx, p1, b)
When libchewing restarts, InitUserphrase calls ReadHashItem_bin, it will find that p1' is invalid.
When p2 is going to be removed, the offset of p2 in uhash.dat will be wrong.
In this case, chewing_userphrase_remove returns success, but p2 won't be removed (marked as invalid) in uhash.dat.
This fix tries to find the physical offset in uhash.dat based on the wordSeq.