gbaconv

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

commit 559969e2d4d42dc0b88e74f320ebfe1a9a0376a3
parent bcef1aa3d9b5c77273851f3be24851322b377e1c
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 22 Feb 2019 10:26:04 +0100

Return 1 instead of -1 when encountering errors in main().

Diffstat:
Mpcx2gba.c | 10+++++-----
Mwav2gba.c | 12++++++------
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/pcx2gba.c b/pcx2gba.c @@ -73,13 +73,13 @@ int main(int argc, char *argv[]) { if (input_file_buffer == NULL) { printf("ERROR: Cannot allocate memory\n\n"); - return -1; + return 1; } input_file = fopen(argv[1], "rb"); if (input_file == NULL) { printf("ERROR: Cannot open file %s\n\n", argv[1]); - return -1; + return 1; } fread(input_file_buffer, input_file_size, 1, input_file); @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) { if (input_file_size < PCX_HEADER_LENGTH + PCX_PALETTE_LENGTH) { printf("ERROR: Input File is not a PCX file\n\n"); - return -1; + return 1; } /* Check that the file is a valid 8-bpp PCX */ @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) { if (pcx_header.bits_per_pixel != 8) { printf("ERROR: Input File is not 8-bpp\n\n"); - return -1; + return 1; } /* Uncompress RLE encoded PCX Input File */ @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) { output_file = fopen(argv[2], "w"); if (output_file == NULL) { printf("ERROR: Cannot create file %s\n\n", argv[2]); - return -1; + return 1; } printf("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); diff --git a/wav2gba.c b/wav2gba.c @@ -56,13 +56,13 @@ int main(int argc, char *argv[]) { if (input_file_buffer == NULL) { printf("ERROR: Cannot allocate memory\n\n"); - return -1; + return 1; } input_file = fopen(argv[1], "rb"); if (input_file == NULL) { printf("ERROR: Cannot open file %s\n\n", argv[1]); - return -1; + return 1; } fread(input_file_buffer, input_file_size, 1, input_file); @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { if (input_file_size < WAVE_HEADER_LENGTH) { printf("ERROR: Input File is not a WAV file\n\n"); - return -1; + return 1; } /* Check that the file is a valid 8-bit MONO WAV */ @@ -78,19 +78,19 @@ int main(int argc, char *argv[]) { if (wave_header.channels != 1) { printf("ERROR: Input File is not MONO\n\n"); - return -1; + return 1; } if (wave_header.bits_per_sample != 8) { printf("ERROR: Input File is not 8-bit\n\n"); - return -1; + return 1; } /* Create Output File */ output_file = fopen(argv[2], "w"); if (output_file == NULL) { printf("ERROR: Cannot create file %s\n\n", argv[2]); - return -1; + return 1; } printf("INPUT FILE: %s (8-bit, MONO, %i Hz)\n", argv[1], wave_header.sample_rate);