Skip to content

Commit

Permalink
[winpr,utils] fix libjpeg const cast
Browse files Browse the repository at this point in the history
libjpeg API is not const correct, so we need to cast away const
fixes #10175
  • Loading branch information
akallabeth committed May 12, 2024
1 parent 15fc460 commit b6db375
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion winpr/libwinpr/utils/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,10 @@ static void* winpr_convert_to_jpeg(const void* data, size_t size, UINT32 width,
for (size_t x = 0; x < height; x++)
{
const JDIMENSION offset = x * stride;
const JSAMPLE* coffset = &cdata[offset];

/* libjpeg is not const correct, we must cast here to avoid issues
* with newer C compilers type check errors */
JSAMPLE* coffset = (JSAMPLE*)&cdata[offset];
if (jpeg_write_scanlines(&cinfo, &coffset, 1) != 1)
goto fail;
}
Expand Down

0 comments on commit b6db375

Please sign in to comment.