0002-libv4lconvert-fix-jpeg-v9x-gcc-14.x-compile-jpeg_mem.patch 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. From 9f0da8467183f9f647bddc4a5b4f01aad930846a Mon Sep 17 00:00:00 2001
  2. From: Peter Seiderer <ps.report@gmx.net>
  3. Date: Mon, 2 Sep 2024 15:59:53 +0200
  4. Subject: [PATCH] libv4lconvert: fix jpeg-v9x/gcc-14.x compile (jpeg_mem_dest
  5. argument mismatch)
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. - fix jpeg_mem_dest pointer arument mismatch (long unsigned int vs. size_t)
  10. with jpeg-v9x/gcc-14.x 32-bit arm compile
  11. Fixes:
  12. ../lib/libv4lconvert/jl2005bcd.c: In function ‘v4lconvert_decode_jl2005bcd’:
  13. ../lib/libv4lconvert/jl2005bcd.c:94:46: error: passing argument 3 of ‘jpeg_mem_dest’ from incompatible pointer type [-Wincompatible-pointer-types]
  14. 94 | jpeg_mem_dest (&cinfo, &jpeg_header, &jpeg_header_size);
  15. | ^~~~~~~~~~~~~~~~~
  16. | |
  17. | long unsigned int *
  18. In file included from ../lib/libv4lconvert/libv4lconvert-priv.h:26,
  19. from ../lib/libv4lconvert/jl2005bcd.c:30:
  20. .../host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/jpeglib.h:979:28: note: expected ‘size_t *’ {aka ‘unsigned int *’} but argument is of type ‘long unsigned int *’
  21. 979 | EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
  22. | ^~~
  23. ../lib/libv4lconvert/jpeg.c: In function ‘init_libjpeg_cinfo’:
  24. ../lib/libv4lconvert/jpeg.c:157:45: error: passing argument 3 of ‘jpeg_mem_dest’ from incompatible pointer type [-Wincompatible-pointer-types]
  25. 157 | jpeg_mem_dest(&cinfo, &jpeg_header, &jpeg_header_size);
  26. | ^~~~~~~~~~~~~~~~~
  27. | |
  28. | long unsigned int *
  29. In file included from ../lib/libv4lconvert/libv4lconvert-priv.h:26,
  30. from ../lib/libv4lconvert/jpeg.c:21:
  31. .../host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/jpeglib.h:979:28: note: expected ‘size_t *’ {aka ‘unsigned int *’} but argument is of type ‘long unsigned int *’
  32. 979 | EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
  33. | ^~~
  34. Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  35. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
  36. Upstream: https://git.linuxtv.org/v4l-utils.git/commit/?id=e11e10ff7c8a4ef69526edd275c0ed92a450fbf3
  37. [Romain: backport to 1.28.1]
  38. Signed-off-by: Romain Naour <romain.naour@smile.fr>
  39. ---
  40. lib/libv4lconvert/jl2005bcd.c | 4 ++++
  41. lib/libv4lconvert/jpeg.c | 4 ++++
  42. 2 files changed, 8 insertions(+)
  43. diff --git a/lib/libv4lconvert/jl2005bcd.c b/lib/libv4lconvert/jl2005bcd.c
  44. index 707c3205..14b040f3 100644
  45. --- a/lib/libv4lconvert/jl2005bcd.c
  46. +++ b/lib/libv4lconvert/jl2005bcd.c
  47. @@ -63,7 +63,11 @@ int v4lconvert_decode_jl2005bcd(struct v4lconvert_data *data,
  48. struct jpeg_decompress_struct dinfo;
  49. struct jpeg_error_mgr jcerr, jderr;
  50. JOCTET *jpeg_header = NULL;
  51. +#if JPEG_LIB_VERSION >= 90
  52. + size_t jpeg_header_size = 0;
  53. +#else
  54. unsigned long jpeg_header_size = 0;
  55. +#endif
  56. int i, x, y, x1, y1, jpeg_data_size, jpeg_data_idx, eoi, size;
  57. /* src_size had better be bigger than 16 */
  58. diff --git a/lib/libv4lconvert/jpeg.c b/lib/libv4lconvert/jpeg.c
  59. index ebfc8149..450d0967 100644
  60. --- a/lib/libv4lconvert/jpeg.c
  61. +++ b/lib/libv4lconvert/jpeg.c
  62. @@ -136,7 +136,11 @@ static void init_libjpeg_cinfo(struct v4lconvert_data *data)
  63. {
  64. struct jpeg_compress_struct cinfo;
  65. unsigned char *jpeg_header = NULL;
  66. +#if JPEG_LIB_VERSION >= 90
  67. + size_t jpeg_header_size = 0;
  68. +#else
  69. unsigned long jpeg_header_size = 0;
  70. +#endif
  71. if (data->cinfo_initialized)
  72. return;
  73. --
  74. 2.50.1