Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vp1981 opened this issue May 10, 2024 · 1 comment

Comments

@vp1981
Copy link

vp1981 commented May 10, 2024

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
Copy link
Member

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 ;)

@akallabeth akallabeth added this to the next-3.0 milestone May 11, 2024
akallabeth added a commit to akallabeth/FreeRDP that referenced this issue May 12, 2024
libjpeg API is not const correct, so we need to cast away const
fixes FreeRDP#10175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants