Lossless: Fix innocuous UBSan warnings

This commit is contained in:
DRC
2022-11-17 11:31:29 -06:00
parent 07129256e0
commit db9dd93da4
3 changed files with 8 additions and 4 deletions

View File

@@ -256,8 +256,9 @@ METHODDEF(void)
simple_downscale(j_compress_ptr cinfo, simple_downscale(j_compress_ptr cinfo,
_JSAMPROW input_buf, _JSAMPROW output_buf, JDIMENSION width) _JSAMPROW input_buf, _JSAMPROW output_buf, JDIMENSION width)
{ {
while (width--) do {
*output_buf++ = (_JSAMPLE)RIGHT_SHIFT(*input_buf++, cinfo->Al); *output_buf++ = (_JSAMPLE)RIGHT_SHIFT(*input_buf++, cinfo->Al);
} while (--width);
} }

View File

@@ -196,7 +196,8 @@ decompress_data(j_decompress_ptr cinfo, _JSAMPIMAGE output_buf)
} }
/* Account for restart interval (no-op if not using restarts) */ /* Account for restart interval (no-op if not using restarts) */
diff->restart_rows_to_go--; if (cinfo->restart_interval)
diff->restart_rows_to_go--;
/* Completed an MCU row, but perhaps not an iMCU row */ /* Completed an MCU row, but perhaps not an iMCU row */
diff->MCU_ctr = 0; diff->MCU_ctr = 0;

View File

@@ -216,16 +216,18 @@ METHODDEF(void)
simple_upscale(j_decompress_ptr cinfo, simple_upscale(j_decompress_ptr cinfo,
JDIFFROW diff_buf, _JSAMPROW output_buf, JDIMENSION width) JDIFFROW diff_buf, _JSAMPROW output_buf, JDIMENSION width)
{ {
while (width--) do {
*output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al); *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
} while (--width);
} }
METHODDEF(void) METHODDEF(void)
noscale(j_decompress_ptr cinfo, noscale(j_decompress_ptr cinfo,
JDIFFROW diff_buf, _JSAMPROW output_buf, JDIMENSION width) JDIFFROW diff_buf, _JSAMPROW output_buf, JDIMENSION width)
{ {
while (width--) do {
*output_buf++ = (_JSAMPLE)(*diff_buf++); *output_buf++ = (_JSAMPLE)(*diff_buf++);
} while (--width);
} }