Skip to content

Commit

Permalink
fix: fix read of single and multi page memos
Browse files Browse the repository at this point in the history
  • Loading branch information
andipaetzold committed Jul 15, 2020
1 parent 82edfcf commit e183790
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ function readMemo(buffer: Buffer, db: Database): string {
);
} else if (bitmask & 0x40) {
// single page
const pageRow = buffer.readUInt32LE(32);
const pageRow = buffer.readUInt32LE(4);
const rowBuffer = db.findPageRow(pageRow);
return uncompressText(
rowBuffer.slice(0, memoLength),
db.constants.format
);
} else if (bitmask === 0) {
// multi page
let pageRow = buffer.readInt32BE(4);
let pageRow = buffer.readInt32LE(4);
let memoDataBuffer = Buffer.alloc(0);
do {
const rowBuffer = db.findPageRow(pageRow);
Expand All @@ -134,7 +134,7 @@ function readMemo(buffer: Buffer, db: Database): string {
rowBuffer.slice(4, buffer.length),
]);

pageRow = rowBuffer.readInt32BE(4);
pageRow = rowBuffer.readInt32LE(0);
} while (pageRow !== 0);

return uncompressText(
Expand Down

0 comments on commit e183790

Please sign in to comment.