Image: Codestyle changes

This commit is contained in:
Peter Keresztes Schmidt 2021-09-12 11:38:44 +02:00 committed by Isaac Connor
parent 93c5ad0939
commit a4ebf533a9
1 changed files with 151 additions and 153 deletions

View File

@ -958,7 +958,7 @@ bool Image::ReadJpeg(const std::string &filename, unsigned int p_colours, unsign
jpeg_stdio_src(readjpg_dcinfo, infile); jpeg_stdio_src(readjpg_dcinfo, infile);
jpeg_read_header(readjpg_dcinfo, TRUE); jpeg_read_header(readjpg_dcinfo, true);
if ((readjpg_dcinfo->num_components != 1) && (readjpg_dcinfo->num_components != 3)) { if ((readjpg_dcinfo->num_components != 1) && (readjpg_dcinfo->num_components != 3)) {
Error("Unexpected colours when reading jpeg image: %d", colours); Error("Unexpected colours when reading jpeg image: %d", colours);
@ -1050,7 +1050,6 @@ cinfo->out_color_space = JCS_RGB;
} }
jpeg_finish_decompress(readjpg_dcinfo); jpeg_finish_decompress(readjpg_dcinfo);
fclose(infile); fclose(infile);
return true; return true;
@ -1087,7 +1086,7 @@ bool Image::WriteJpeg(const std::string &filename,
} }
int quality = quality_override ? quality_override : config.jpeg_file_quality; int quality = quality_override ? quality_override : config.jpeg_file_quality;
struct jpeg_compress_struct *cinfo = writejpg_ccinfo[quality]; jpeg_compress_struct *cinfo = writejpg_ccinfo[quality];
FILE *outfile = nullptr; FILE *outfile = nullptr;
int raw_fd = 0; int raw_fd = 0;
@ -1104,7 +1103,10 @@ bool Image::WriteJpeg(const std::string &filename,
jpg_err.pub.emit_message = zm_jpeg_emit_silence; jpg_err.pub.emit_message = zm_jpeg_emit_silence;
if (setjmp(jpg_err.setjmp_buffer)) { if (setjmp(jpg_err.setjmp_buffer)) {
jpeg_abort_compress(cinfo); jpeg_abort_compress(cinfo);
Debug(1, "Aborted a write mid-stream and %s and %d", (outfile == nullptr) ? "closing file" : "file not opened", raw_fd); Debug(1,
"Aborted a write mid-stream and %s and %d",
(outfile == nullptr) ? "closing file" : "file not opened",
raw_fd);
if (raw_fd) if (raw_fd)
close(raw_fd); close(raw_fd);
if (outfile) if (outfile)
@ -1239,11 +1241,7 @@ cinfo->out_color_space = JCS_RGB;
return true; return true;
} }
bool Image::DecodeJpeg( bool Image::DecodeJpeg(const JOCTET *inbuffer, int inbuffer_size, unsigned int p_colours, unsigned int p_subpixelorder)
const JOCTET *inbuffer,
int inbuffer_size,
unsigned int p_colours,
unsigned int p_subpixelorder)
{ {
unsigned int new_width, new_height, new_colours, new_subpixelorder; unsigned int new_width, new_height, new_colours, new_subpixelorder;