Skip to content

Commit

Permalink
fix lzss padding mistake when file ends on a block boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
bri3d committed Jun 24, 2022
1 parent 91c222a commit 64a1632
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/lzss/lzss.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,14 @@ void EncodeLZSS(FILE *inFile, FILE *outFile, int dontPad, int exactPad)
putc(padding_block[i % 0x11], outFile);
compressedSize++;
}
} else {
if (dontPad == 0)
{
while ((compressedSize % 0x10) != 0)
{
putc(0x00, outFile);
compressedSize++;
}
}
}
}
if (dontPad == 0)
{
while ((compressedSize % 0x10) != 0)
{
putc(0x00, outFile);
compressedSize++;
}
}
fprintf(stderr, "compressedSize %lx\n", compressedSize);
Expand Down

0 comments on commit 64a1632

Please sign in to comment.