[packages/xv] - added jasper patch (don't use internal functions or hacks) - use default libpng instead of 1.2.x -

qboosh qboosh at pld-linux.org
Sat Mar 25 19:00:12 CET 2023


commit d74c2284becc874528e033c79fc9bd5177b59ff0
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Mar 25 19:01:52 2023 +0100

    - added jasper patch (don't use internal functions or hacks)
    - use default libpng instead of 1.2.x
    - release 43

 xv-jasper.patch | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 xv.spec         |  8 +++--
 2 files changed, 101 insertions(+), 3 deletions(-)
---
diff --git a/xv.spec b/xv.spec
index d03357a..c2bb97c 100644
--- a/xv.spec
+++ b/xv.spec
@@ -9,7 +9,7 @@ Summary(tr.UTF-8):	X tabanlı resim görüntüleyici
 Summary(uk.UTF-8):	Програма для перегляду та перетворення файлів зображень для X
 Name:		xv
 Version:	3.10a
-Release:	42
+Release:	43
 License:	Shareware
 Group:		X11/Applications/Graphics
 Source0:	ftp://ftp.cis.upenn.edu/pub/xv/%{name}-%{version}.tar.gz
@@ -30,10 +30,11 @@ Patch1:		%{name}-3.10a-enhancements.20070520-20081216.diff
 Patch2:		%{name}-libpng-1.5.patch
 Patch3:		%{name}-buffer_overflows.patch
 Patch4:		%{name}-format.patch
+Patch5:		%{name}-jasper.patch
 URL:		http://www.trilon.com/xv/xv.html
 BuildRequires:	jasper-devel
 BuildRequires:	libjpeg-devel
-BuildRequires:	libpng-devel
+BuildRequires:	libpng-devel >= 2:1.2
 BuildRequires:	libtiff-devel
 BuildRequires:	xorg-lib-libX11-devel
 BuildRequires:	xorg-lib-libXt-devel
@@ -111,11 +112,12 @@ patch -p1 < ./xv-3.10a-jumbo-fix-enh-patch-20070520.txt || exit 1
 %patch2 -p0
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %build
 %{__make} \
 	CC="%{__cc}" \
-	CCOPTS="%{rpmcppflags} %{rpmcflags} `pkg-config --cflags libpng12 2>/dev/null`" \
+	CCOPTS="%{rpmcppflags} %{rpmcflags} `pkg-config --cflags libpng 2>/dev/null`" \
 	LDFLAGS="%{rpmldflags}"
 
 %install
diff --git a/xv-jasper.patch b/xv-jasper.patch
new file mode 100644
index 0000000..7e6ba3f
--- /dev/null
+++ b/xv-jasper.patch
@@ -0,0 +1,96 @@
+--- xv-3.10a/xvjp2k.c.orig	2007-05-14 03:04:37.000000000 +0200
++++ xv-3.10a/xvjp2k.c	2023-03-25 17:00:59.872321637 +0100
+@@ -68,53 +68,29 @@ static const char *fbasename,  /* File's
+     read_err[]   = "%s:  I/O error reading %s file",
+     bad_dims[]   = "%s:  error in JPEG-2000 header (bad image size)";
+ 
+-/* We only want to override the JasPer Library's "jas_eprintf()" subroutine in
+-   order to make it a "wrapper" around XV's own error-reporting subroutine, but
+-   because of the way the former is currently packaged in JasPer Library Version
+-   1.701, we must override everything else packaged in the "jas_debug.o" module
+-   with it, otherwise we get "duplicate definition" messages from the linker.
+-*/
+-int jas_getdbglevel(void) {return 0;}
+-int jas_setdbglevel(int n) {return 0;}
+-int jas_memdump(FILE *fp,void *data,size_t len) {return 0;}
+-
+-int jas_eprintf(const char *fmt,...)         /* Handle JasPer Library message */
++int jasper_vlogmsgf(jas_logtype_t logtype, const char *fmt,...)         /* Handle JasPer Library message */
+ {
+-    static char error[] = "error: ", warning[]= "warning: ";
+     va_list ap;
+     int kind = ISTR_WARNING;
+     char buffer[512];
+     register char *p;
+ 
+- /* Unlike the IJG JPEG Library, the JasPer Library current has no graceful way
+-    for an application (= us!) to intercept its diagnostic messages and output
+-    them using our own subroutines, so this ugly replacement for its output
+-    subroutine will have to suffice.  At Version 1.701, lthough the library's
+-    own "jas_eprintf()" is a varargs subroutine, all calls currently pass just
+-    1 string with a Line Feed at the end and no "printf(3C)" arguments.  Most
+-    strings begin with "error: " or "warning: ", although a few have neither.
+-    We try to translate these into the format preferred by XV, trimming any
+-    trailing Line Feed character (ugh!).
+- */
+     va_start(ap, fmt);
+     vsnprintf(p = buffer,512,fmt,ap);
+     va_end(ap);
+     while (*p++);
+     if (p[-2] == '\n') p[-2] = '\0';
+     p = buffer;
+-    if (strncmp(p,error,sizeof error) == 0) /* "error: ... " */
++    if (jas_logtype_getclass(logtype) == JAS_LOGTYPE_CLASS_ERROR)
+       {
+         kind = ISTR_WARNING;
+-        p += sizeof error;
+       }
+-    else /* "warning: ... " */
+-      if (strncmp(p,warning,sizeof warning) == 0)
++    else
+         {
+           kind = ISTR_INFO;
+-          p += sizeof warning;
+         };
+     SetISTR(kind,"%s:  %s",fbasename,p);
+-    return strlen(fmt);
++    return 0;
+ }
+ 
+ static char *SetBuf(FILE *f)
+@@ -185,7 +185,7 @@ int LoadJPC(char *fname,register PICINFO
+     So, mark the stream buffer proactively:
+  */
+     str->bufmode_ |= JAS_STREAM_RDBUF; /* We will only read the stream buffer */
+-    if (!(img = jpc_decode(str,0))) goto L2;
++    if (!(img = jas_image_decode(str,jas_image_strtofmt("jpc"), 0))) goto L2;
+     if ((vstride = jas_image_numcmpts(img))) /* num. color planes */
+       {
+ 
+@@ -375,7 +375,7 @@ int LoadJP2(char *fname,register PICINFO
+     So, mark the stream buffer proactively:
+  */
+     str->bufmode_ |= JAS_STREAM_RDBUF; /* We will only read the stream buffer */
+-    if (!(img = jp2_decode(str,0))) goto L2;
++    if (!(img = jas_image_decode(str,jas_image_strtofmt("jp2"), 0))) goto L2;
+     if ((vstride = jas_image_numcmpts(img))) /* num. color planes */
+       {
+ 
+@@ -674,6 +650,8 @@ void CreateJP2KW(void)
+       };
+     static const char hstr[]={"Height"}, wstr[]={"Width"};
+ 
++    jas_conf_set_vlogmsgf(jasper_vlogmsgf);
++
+     if (!(jp2kW = CreateWindow( "xvjp2k"
+                               , "XVjp2k"
+                               , 0
+@@ -948,7 +948,7 @@ static void StoreJP2K(char *options)
+           }
+         while (++i <= 2);
+       };
+-    if (   (*(format == F_JPC ? jpc_encode : jp2_encode))(img,str,options) >= 0
++    if (jas_image_encode(img,str,(format == F_JPC) ? "jpc" : "jp2",options) >= 0
+         && jas_stream_flush(str) >= 0
+        ) error = 0; /* Success! */
+ L1: jas_image_destroy(img);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/xv.git/commitdiff/d74c2284becc874528e033c79fc9bd5177b59ff0



More information about the pld-cvs-commit mailing list