#6 seek fails with negative value

open
nobody
None
5
2005-11-03
2005-11-03
Anonymous
No

I've been testing a number of disk-based caches, etc
and came across sdbm... the only problem I found is
when I've tested with millions of items :)

The 'seek' calls would raise an exception for negative
value (sorry, can't remember the exact exception). I
traced it back to the OFF_xxx methods returning a
negative number -- since seek requires a long, I change
the methods to look like:

private static final long OFF_PAG(int off) {
long offset = (long) off * (long) PBLKSIZ;
return offset;
}

seems to be working fine ATM.

Discussion