From b4ada5122c93789800e9ae7ff4dc671db4c4d2c3 Mon Sep 17 00:00:00 2001
From: Michael Adams <mdadams@ece.uvic.ca>
Date: Sat, 19 Feb 2022 08:09:46 -0800
Subject: [PATCH 5/6] Added the following patch from OpenSUSE:    
 xv-3.10a-jpeg8.dif

---
 src/xvjpeg.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/xvjpeg.c b/src/xvjpeg.c
index 2594db4..65063e3 100644
--- a/src/xvjpeg.c
+++ b/src/xvjpeg.c
@@ -511,7 +511,7 @@ int LoadJFIF(fname, pinfo, quick)
   JSAMPROW                         rowptr[1];
   FILE                            *fp;
   const char                      *colorspace_name = "Color";
-  byte                            *pic, *pic_end;
+  byte                            *pic;
   long                             filesize;
   int                              i,w,h,bperpix,bperline,count;
 
@@ -625,6 +625,7 @@ L2:
          *   if CONV24_BEST, or other, ask for 24-bit image and hand it to XV
          */
         cinfo.desired_number_of_colors = 256;
+        cinfo.colormap = NULL;
 
         if (conv24 == CONV24_FAST || conv24 == CONV24_SLOW) {
           cinfo.quantize_colors = TRUE;
@@ -662,7 +663,6 @@ L2:
 	    fbasename);
     goto L1;
   }
-  pic_end = pic + count;
 
   jpeg_start_decompress(&cinfo);
 
@@ -679,7 +679,8 @@ L2:
 
   /* Convert CMYK to RGB color space */
 
-  if (bperpix > 3) {
+  if (cinfo.out_color_components > 3) {
+    const byte *pic_end = pic + count;
     register byte *p = pic;
 
     /* According to documentation accompanying the IJG JPEG Library, it appears
@@ -732,7 +733,7 @@ L2:
     pinfo->colType = F_FULLCOLOR;
 
     if (cinfo.quantize_colors) {
-      switch (bperpix) {
+      switch (cinfo.out_color_components) {
         case 3:
           for (i = 0; i < cinfo.actual_number_of_colors; i++) {
             pinfo->r[i] = cinfo.colormap[0][i];
-- 
2.35.1