FreeRDP / FreeRDP

FreeRDP is a free remote desktop protocol library and clients
http://www.freerdp.com/
Apache License 2.0
10.4k stars 14.53k forks source link

Compilation with jpeg-turbo and GCC14 requires changing in winpr/libwinpr/utils/image.c #10175

Closed vp1981 closed 2 weeks ago

vp1981 commented 3 weeks ago

Hello.

I'm on Archlinux x86_64 with gcc14 and libjpeg (libjpeg-turbo 3.0.2). To compile freerdp from git I have to apply the following patch:

diff --git a/winpr/libwinpr/utils/image.c b/winpr/libwinpr/utils/image.c
index c60982571..8cf95df6c 100644
--- a/winpr/libwinpr/utils/image.c
+++ b/winpr/libwinpr/utils/image.c
@@ -626,7 +626,7 @@ void* winpr_convert_to_jpeg(const void* data, size_t size, UINT32 width, UINT32
    for (size_t x = 0; x < height; x++)
    {
        const JDIMENSION offset = x * stride;
-       const JSAMPLE* coffset = &cdata[offset];
+       JSAMPLE* coffset = &cdata[offset];
        if (jpeg_write_scanlines(&cinfo, &coffset, 1) != 1)
            goto fail;
    }

According to jpeglib.h the second argument of jpeg_write_scanlines shouldn't have const.

Previously I built freerdp with GCC13 and all was fine, I presume it is related to new GCC14.

akallabeth commented 2 weeks ago

yes, API bug of lilbjpeg(aka not const correct), requires explicit casts with newer gcc. pull requests welcome, will be back next week, but no idea when I got time ;)