Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong advancement of offset #6

Open
ozomer opened this issue Sep 8, 2019 · 0 comments
Open

Wrong advancement of offset #6

ozomer opened this issue Sep 8, 2019 · 0 comments

Comments

@ozomer
Copy link

ozomer commented Sep 8, 2019

In lines https://github.com/ericnorris/node-cdb/blob/master/src/readable-cdb.js#L122-L128
The offset should be reduced only if the payload is the same, i.e.

if (buffer.toString() == key) {
    if (offset === 0) {
        fs.read(self.fd, new Buffer(dataLength), 0, dataLength, recordPosition + 8 + keyLength, returnData);
    } else {
        offset--;
        readSlot(++slot);
    }
} else {
    readSlot(++slot);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant