diff --git a/compress.cpp b/compress.cpp index db8340dd..f71e693d 100644 --- a/compress.cpp +++ b/compress.cpp @@ -338,13 +338,11 @@ void encodeRaw(char *rawData, int length, int samplerate, const char *outname, C result = vorbis_encode_setup_managed(&vi, numChannels, samplerate, (oggparms.maxBitr > 0 ? 1000 * oggparms.maxBitr : -1), (1000 * oggparms.nominalBitr), (oggparms.minBitr > 0 ? 1000 * oggparms.minBitr : -1)); if (result == OV_EFAULT) { - printf("Error: Internal Logic Fault.\n\n"); vorbis_info_clear(&vi); - exit(-1); + error("Error: Internal Logic Fault"); } else if ((result == OV_EINVAL) || (result == OV_EIMPL)) { - printf("Error: Invalid bitrate parameters.\n\n"); vorbis_info_clear(&vi); - exit(-1); + error("Error: Invalid bitrate parameters"); } if (!oggparms.silent) { @@ -369,13 +367,11 @@ void encodeRaw(char *rawData, int length, int samplerate, const char *outname, C result = vorbis_encode_setup_vbr(&vi, numChannels, samplerate, oggparms.quality * 0.1f); if (result == OV_EFAULT) { - printf("Error: Internal Logic Fault.\n\n"); vorbis_info_clear(&vi); - exit(-1); + error("Internal Logic Fault"); } else if ((result == OV_EINVAL) || (result == OV_EIMPL)) { - printf("Error: Invalid bitrate parameters.\n\n"); vorbis_info_clear(&vi); - exit(-1); + error("Invalid bitrate parameters"); } if (!oggparms.silent) { diff --git a/compress_agos.cpp b/compress_agos.cpp index 7b669c03..67330f56 100644 --- a/compress_agos.cpp +++ b/compress_agos.cpp @@ -136,26 +136,22 @@ static void convert_pc(Filename* inputPath) { input = fopen(inputPath->getFullPath(), "rb"); if (!input) { - printf("Cannot open file: %s\n", inputPath->getFullPath()); - exit(-1); + error("Cannot open file: %s", inputPath->getFullPath()); } output_idx = fopen(TEMP_IDX, "wb"); if (!output_idx) { - printf("Can't open file " TEMP_IDX " for write!\n" ); - exit(-1); + error("Cannot open file " TEMP_IDX " for write"); } output_snd = fopen(TEMP_DAT, "wb"); if (!output_snd) { - printf("Can't open file " TEMP_DAT " for write!\n" ); - exit(-1); + error("Cannot open file " TEMP_DAT " for write"); } num = get_offsets(filenums, offsets); if (!num) { - printf("This does not seem to be a valid file\n"); - exit(-1); + error("This does not seem to be a valid file"); } size = num * 4; @@ -183,26 +179,22 @@ static void convert_mac(Filename *inputPath) { inputPath->setFullName("voices.idx"); input = fopen(inputPath->getFullPath(), "rb"); if (!input) { - printf("Cannot open file: %s\n", "voices.idx"); - exit(-1); + error("Cannot open file: %s", "voices.idx"); } output_idx = fopen(TEMP_IDX, "wb"); if (!output_idx) { - printf("Can't open file " TEMP_IDX " for write!\n" ); - exit(-1); + error("Cannot open file " TEMP_IDX " for write"); } output_snd = fopen(TEMP_DAT, "wb"); if (!output_snd) { - printf("Can't open file " TEMP_DAT " for write!\n" ); - exit(-1); + error("Cannot open file " TEMP_DAT " for write"); } num = get_offsets_mac(filenums, offsets); if (!num) { - printf("This does not seem to be a valid file\n"); - exit(-1); + error("This does not seem to be a valid file"); } size = num * 4; @@ -226,8 +218,7 @@ static void convert_mac(Filename *inputPath) { input = fopen(inputPath->getFullPath(), "rb"); if (!input) { - printf("Cannot open file: %s\n", inputPath->getFullPath()); - exit(-1); + error("Cannot open file: %s", inputPath->getFullPath()); } } diff --git a/compress_scumm_bun.cpp b/compress_scumm_bun.cpp index 079626ca..4a6eb39b 100644 --- a/compress_scumm_bun.cpp +++ b/compress_scumm_bun.cpp @@ -695,8 +695,7 @@ void writeWaveHeader(int s_size, int rate, int chan) { fseek(_waveTmpFile, 0, SEEK_SET); if (fwrite(wav, 1, 44, _waveTmpFile) != 44) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } fclose(_waveTmpFile); _waveTmpFile = NULL; @@ -706,14 +705,12 @@ void writeToTempWave(char *fileName, byte *output_data, unsigned int size) { if (!_waveTmpFile) { _waveTmpFile = fopen(fileName, "wb"); if (!_waveTmpFile) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } byte wav[44]; memset(wav, 0, 44); if (fwrite(output_data, 1, 44, _waveTmpFile) != 44) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } _waveDataSize = 0; } @@ -723,8 +720,7 @@ void writeToTempWave(char *fileName, byte *output_data, unsigned int size) { output_data[j + 1] = tmp; } if (fwrite(output_data, 1, size, _waveTmpFile) != size) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } _waveDataSize += size; } @@ -1123,8 +1119,7 @@ int main(int argc, char *argv[]) { FILE *input = fopen(inpath.getFullPath(), "rb"); if (!input) { - printf("Cannot open file: %s\n", inpath.getFullPath()); - exit(-1); + error("Cannot open file: %s", inpath.getFullPath()); } if(outpath.empty()) { @@ -1135,8 +1130,7 @@ int main(int argc, char *argv[]) { FILE *output = fopen(outpath.getFullPath(), "wb"); if (!output) { - printf("Cannot open file: %s\n", outpath.getFullPath()); - exit(-1); + error("Cannot open file: %s", outpath.getFullPath()); } writeUint32BE(output, 'LB23'); diff --git a/compress_scumm_san.cpp b/compress_scumm_san.cpp index 03c00569..e48dd41f 100644 --- a/compress_scumm_san.cpp +++ b/compress_scumm_san.cpp @@ -123,8 +123,7 @@ void writeWaveHeader(int s_size) { fseek(_waveTmpFile, 0, SEEK_SET); if (fwrite(wav, 1, 44, _waveTmpFile) != 44) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } fclose(_waveTmpFile); _waveTmpFile = NULL; @@ -133,14 +132,12 @@ void writeToTempWave(char *fileName, byte *output_data, unsigned int size) { if (!_waveTmpFile) { _waveTmpFile = fopen(fileName, "wb"); if (!_waveTmpFile) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } byte wav[44]; memset(wav, 0, 44); if (fwrite(output_data, 1, 44, _waveTmpFile) != 44) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } _waveDataSize = 0; } @@ -151,8 +148,7 @@ void writeToTempWave(char *fileName, byte *output_data, unsigned int size) { } if (fwrite(output_data, 1, size, _waveTmpFile) != size) { - printf("error write temp wave file"); - exit(1); + error("error writing temp wave file"); } _waveDataSize += size; } @@ -551,8 +547,7 @@ void handleAudioTrack(int index, int trackId, int frame, int nbframes, FILE *inp sprintf(tmpPath, "%s/%s_%04d_%03d.tmp", outputDir, inputFilename, frame, trackId); audioTrack->file = fopen(tmpPath, "wb"); if (!audioTrack->file) { - printf("error write temp file"); - exit(1); + error("error writing temp file"); } } else { if (!iact) @@ -614,8 +609,7 @@ void handleDigIACT(FILE *input, int size, const char *outputDir, const char *inp trackId = track + 600; volume = track_flags * 2 - 600; } else { - printf("handleDigIACT() Bad track_flags: %d\n", track_flags); - exit(1); + error("handleDigIACT() Bad track_flags: %d", track_flags); } handleAudioTrack(index, trackId, frame, nbframes, input, outputDir, inputFilename, size, volume, pan, true); @@ -685,14 +679,12 @@ int main(int argc, char *argv[]) { FILE *input = fopen(inpath.getFullPath(), "rb"); if (!input) { - printf("Cannot open file: %s\n", inpath.getFullPath()); - exit(-1); + error("Cannot open file: %s", inpath.getFullPath()); } FILE *output = fopen(outpath.getFullPath(), "wb"); if (!output) { - printf("Cannot open file: %s\n", outpath.getFullPath()); - exit(-1); + error("Cannot open file: %s", outpath.getFullPath()); } Filename flupath(inpath); @@ -707,8 +699,7 @@ int main(int argc, char *argv[]) { flupath.setExtension(".flu"); flu_out = fopen(flupath.getFullPath(), "wb"); if (!flu_out) { - printf("Cannot open ancillary file: %s\n", flupath.getFullPath()); - exit(-1); + error("Cannot open ancillary file: %s", flupath.getFullPath()); } } diff --git a/compress_scumm_sou.cpp b/compress_scumm_sou.cpp index b75aa048..9b1970f0 100644 --- a/compress_scumm_sou.cpp +++ b/compress_scumm_sou.cpp @@ -189,26 +189,22 @@ int main(int argc, char *argv[]) { input = fopen(inpath.getFullPath(), "rb"); if (!input) { - printf("Cannot open file: %s\n", inpath.getFullPath()); - exit(-1); + error("Cannot open file: %s", inpath.getFullPath()); } output_idx = fopen(TEMP_IDX, "wb"); if (!output_idx) { - printf("Can't open file " TEMP_IDX " for write!\n" ); - exit(-1); + error("Cannot open file " TEMP_IDX " for write" ); } output_snd = fopen(TEMP_DAT, "wb"); if (!output_snd) { - printf("Can't open file " TEMP_DAT " for write!\n"); - exit(-1); + error("Cannot open file " TEMP_DAT " for write"); } /* Get the 'SOU ....' header */ fread(buf, 1, 8, input); if (strncmp(buf, f_hdr, 8)) { - printf("Bad SOU\n"); - exit(-1); + error("Bad SOU"); } while (1) diff --git a/compress_sword2.cpp b/compress_sword2.cpp index 3a86700c..43b3e944 100644 --- a/compress_sword2.cpp +++ b/compress_sword2.cpp @@ -37,8 +37,7 @@ uint32 append_to_file(FILE *f1, const char *filename) { f2 = fopen(filename, "rb"); if (!f2) { - printf("Can't open file %s for reading!\n", filename); - exit(-1); + error("Cannot open file %s for reading", filename); } orig_length = length = fileSize(f2); @@ -110,28 +109,24 @@ int main(int argc, char *argv[]) { input = fopen(inpath.getFullPath(), "rb"); if (!input) { - printf("Cannot open file: %s\n", inpath.getFullPath()); - return EXIT_FAILURE; + error("Cannot open file: %s", inpath.getFullPath()); } indexSize = readUint32LE(input); totalSize = 12 * (indexSize + 1); if (readUint32BE(input) != 0xfff0fff0) { - printf("This doesn't look like a cluster file\n"); - return EXIT_FAILURE; + error("This doesn't look like a cluster file"); } output_idx = fopen(TEMP_IDX, "wb"); if (!output_idx) { - printf("Can't open file " TEMP_IDX " for writing!\n"); - return EXIT_FAILURE; + error("Cannot open file " TEMP_IDX " for writing"); } output_snd = fopen(TEMP_DAT, "wb"); if (!output_snd) { - printf("Can't open file " TEMP_DAT " for writing!\n"); - return EXIT_FAILURE; + error("Cannot open file " TEMP_DAT " for writing"); } writeUint32LE(output_idx, indexSize); @@ -152,8 +147,7 @@ int main(int argc, char *argv[]) { f = fopen(TEMP_WAV, "wb"); if (!f) { - printf("Can't open file %s for writing!\n", TEMP_WAV); - return EXIT_FAILURE; + error("Cannot open file %s for writing", TEMP_WAV); } /* @@ -228,8 +222,7 @@ int main(int argc, char *argv[]) { output = fopen(outpath.getFullPath(), "wb"); if (!output) { - printf("Can't open file %s for writing!\n", outpath.getFullPath()); - return EXIT_FAILURE; + error("Cannot open file %s for writing", outpath.getFullPath()); } append_to_file(output, TEMP_IDX); diff --git a/compress_tucker.cpp b/compress_tucker.cpp index a515f56a..d54c375c 100644 --- a/compress_tucker.cpp +++ b/compress_tucker.cpp @@ -415,7 +415,7 @@ static uint32 compress_audio_directory(const Filename *inpath, const Filename *o sprintf(filepath, "%s/audio/%s", inputDir, audio_wav_fileslist[i]); input = fopen(filepath, "rb"); if (!input) { - error("Can't open file '%s'", filepath); + error("Cannot open file '%s'", filepath); } temp_table[i].size = compress_file_wav(input, output); fclose(input); diff --git a/encode_dxa.cpp b/encode_dxa.cpp index 179c60db..82d439f1 100644 --- a/encode_dxa.cpp +++ b/encode_dxa.cpp @@ -554,8 +554,7 @@ int read_png_file(const char* filename, unsigned char *&image, unsigned char *&p FILE *fp = fopen(filename, "rb"); if (!fp) { - printf("read_png_file: Can't open file: %s\n", filename); - exit(-1); + error("read_png_file: Cannot open file: %s", filename); } fread(header, 1, 8, fp); if (png_sig_cmp(header, 0, 8)) @@ -628,8 +627,7 @@ void readVideoInfo(Filename *filename, int &width, int &height, int &framerate, FILE *smk = fopen(filename->getFullPath(), "rb"); if (!smk) { - printf("readVideoInfo: Can't open file: %s\n", filename->getFullPath()); - exit(-1); + error("readVideoInfo: Cannot open file: %s", filename->getFullPath()); } scaleMode = S_NONE; diff --git a/kyra_pak.cpp b/kyra_pak.cpp index 3482c860..f8d16c89 100644 --- a/kyra_pak.cpp +++ b/kyra_pak.cpp @@ -250,9 +250,9 @@ bool PAKFile::addFile(const char *name, uint8 *data, uint32 size) { bool PAKFile::linkFiles(const char *name, const char *linkTo) { if (!_fileList) - error("Can't find file '%s' in file list", linkTo); + error("Cannot find file '%s' in file list", linkTo); if (!_fileList->findEntry(linkTo)) - error("Can't find file '%s' in file list", linkTo); + error("Cannot find file '%s' in file list", linkTo); if ((_fileList && _fileList->findEntry(name)) || (_links && _links->findSrcEntry(name))) error("entry '%s' already exists"); diff --git a/utils/wave.cpp b/utils/wave.cpp index d5a5f386..bc22f943 100644 --- a/utils/wave.cpp +++ b/utils/wave.cpp @@ -160,7 +160,7 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, do { stream.seek(offset, SEEK_CUR); if (stream.pos() >= initialPos + wavLength + 8) { - warning("getWavInfo: Can't find 'data' chunk"); + warning("getWavInfo: Cannot find 'data' chunk"); return false; } stream.read(buf, 4);