gbaconv

A set of tools aimed at GameBoy Advance developers
Log | Files | Refs | README | LICENSE

commit e581bd7f4a8e38dcccfb0f1e5e1490c3df09a43b
parent c6ce294aa496ccbf53ece8ee54210940ff680a96
Author: Frederic Cambus <fred@statdns.com>
Date:   Sun, 28 Jul 2019 20:38:30 +0200

Increment pcx_header.x_max and pcx_header.y_max once and for all.

Diffstat:
Mpcx2gba.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pcx2gba.c b/pcx2gba.c @@ -102,8 +102,11 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + pcx_header.x_max++; + pcx_header.y_max++; + /* Uncompress RLE encoded PCX Input File */ - pcx_buffer_size = (pcx_header.x_max+1)*(pcx_header.y_max+1); + pcx_buffer_size = pcx_header.x_max * pcx_header.y_max; pcx_buffer = malloc(pcx_buffer_size); loop = PCX_HEADER_LENGTH; @@ -131,7 +134,7 @@ int main(int argc, char *argv[]) { pcx_image_palette[loop] = input_file_buffer[st.st_size - PCX_PALETTE_LENGTH + loop] / 8; } - fprintf(stderr, "INPUT FILE: %s (%ix%ix%i-bpp)\n", argv[1], pcx_header.x_max+1, pcx_header.y_max+1, pcx_header.bits_per_pixel); + fprintf(stderr, "INPUT FILE: %s (%ix%ix%i-bpp)\n", argv[1], pcx_header.x_max, pcx_header.y_max, pcx_header.bits_per_pixel); fprintf(stdout, "const u16 %s_palette[] = {\n", argv[2]);