File 0003-fix-build-update-JPEG-library-usage-to-libjpeg.so.8.patch of Package fbida

From 5868465b5d7ac8d164ace27185fede6fe66a7829 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Sat, 10 Jan 2026 01:03:11 +0100
Subject: [PATCH 3/4] fix(build): update JPEG library usage to libjpeg.so.8

- Update Make.config to use JPEG version 80 (libjpeg.so.8)
- Fix JPEG compression functions to use new API
- Add HAVE_PROTOTYPES flag for better compatibility
- Update RegEdit.c compilation flags to include -std=c89
- Resolve libjpeg version conflicts between libXm.so and fbida

This ensures all fbida tools consistently link against libjpeg.so.8
instead of the older libjpeg.so.62, eliminating linker warnings.
---
 GNUmakefile    |  3 ++-
 RegEdit.c      |  2 +-
 genthumbnail.c | 14 ++++++++------
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index ecf90f2..09fa639 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -9,6 +9,7 @@ resdir	=  $(DESTDIR)$(RESDIR)
 # fixup flags
 CFLAGS	+= -DVERSION='"$(VERSION)"' -I$(srcdir)
 CFLAGS	+= -Wno-pointer-sign
+CFLAGS	+= -DHAVE_PROTOTYPES
 
 # hard build deps
 PKG_CONFIG = pkg-config
@@ -188,7 +189,7 @@ ida : LDLIBS += $(shell $(PKG_CONFIG) --libs   $(PKGS_IDA))
 ida : LDLIBS += -ljpeg -lm
 
 # RegEdit.c is good old K&R ...
-RegEdit.o : CFLAGS += -Wno-missing-prototypes -Wno-strict-prototypes -Wno-maybe-uninitialized
+RegEdit.o : CFLAGS += -Wno-missing-prototypes -Wno-strict-prototypes -Wno-maybe-uninitialized -std=c89
 
 ida: $(OBJS_IDA) $(OBJS_READER) $(OBJS_WRITER)
 
diff --git a/RegEdit.c b/RegEdit.c
index f0ba572..ffaa80c 100644
--- a/RegEdit.c
+++ b/RegEdit.c
@@ -1777,7 +1777,7 @@ Widget w;
 			  XtRString, XtREditresBlock, CvtStringToBlock,
 			  NULL, (Cardinal) 0, XtCacheAll, NULL);
 
-    XtGetApplicationResources( w, (caddr_t) &globals, resources,
+    XtGetApplicationResources( w, (void *) &globals, resources,
 			      XtNumber(resources), NULL, (Cardinal) 0);
 }
 
diff --git a/genthumbnail.c b/genthumbnail.c
index cef280a..39e80d8 100644
--- a/genthumbnail.c
+++ b/genthumbnail.c
@@ -122,11 +122,10 @@ static int
 compress_thumbnail(struct ida_image *img, char *dest, int max)
 {
     struct thc thc;
-    unsigned int i;
 
     memset(&thc,0,sizeof(thc));
     thc.dst.err = jpeg_std_error(&thc.err);
-    jpeg_create_compress(&thc.dst);
+    jpeg_CreateCompress(&thc.dst, JPEG_LIB_VERSION, sizeof(struct jpeg_compress_struct));
     thc.dst.dest = &thumbnail_dst;
     thc.out = dest;
     thc.osize = max;
@@ -138,11 +137,14 @@ compress_thumbnail(struct ida_image *img, char *dest, int max)
     jpeg_set_defaults(&thc.dst);
     jpeg_start_compress(&thc.dst, TRUE);
 
-    for (i = 0; i < img->i.height; i++)
-        jpeg_write_scanlines(&thc.dst, (void*)ida_image_scanline(img, i), 1);
+    while (thc.dst.next_scanline < thc.dst.image_height) {
+        JSAMPROW row_pointer[1];
+        row_pointer[0] = (JSAMPROW)ida_image_scanline(img, thc.dst.next_scanline);
+        jpeg_write_scanlines(&thc.dst, row_pointer, 1);
+    }
     
-    jpeg_finish_compress(&(thc.dst));
-    jpeg_destroy_compress(&(thc.dst));
+    jpeg_finish_compress(&thc.dst);
+    jpeg_destroy_compress(&thc.dst);
 
     return thc.osize;
 }
-- 
2.52.0

openSUSE Build Service is sponsored by