commit c7410d9b5fff425d858283a91542cbd88130d242
Author: Paul Howarth <paul(a)city-fan.org>
Date: Wed Feb 16 18:48:57 2022 +0000
Fix some C99-isms
This supports building xv with older compilers.
xv-3.10a-c99isms.patch | 105 +++++++++++++++++++++++++++++++++++++++++++++++++
xv.spec | 4 ++
2 files changed, 109 insertions(+)
---
diff --git a/xv-3.10a-c99isms.patch b/xv-3.10a-c99isms.patch
new file mode 100644
index 0000000..b2107b0
--- /dev/null
+++ b/xv-3.10a-c99isms.patch
@@ -0,0 +1,105 @@
+commit db38c617bcd546aa13ade20eb141cf46b751cbd3
+Author: Paul Howarth <paul(a)city-fan.org>
+Date: Mon Jan 31 20:36:23 2022 +0000
+
+ Fix some C99-isms
+
+ This supports building xv with older compilers.
+
+diff --git a/src/xvjp2k.c b/src/xvjp2k.c
+index dbbeee1..931c9aa 100644
+--- a/src/xvjp2k.c
++++ b/src/xvjp2k.c
+@@ -108,7 +108,8 @@ static int print_log(jas_logtype_t type, const char *format, va_list
ap) {
+ if (get_debug_level() >= 1) {
+ jas_eprintf("%s", buffer);
+ } else {
+- for (int i = 0; i < count; ++i) {
++ int i;
++ for (i = 0; i < count; ++i) {
+ if (buffer[i] == '\n') {
+ buffer[i] = ' ';
+ }
+@@ -343,9 +344,10 @@ static int LoadJP2K(char *fname, register PICINFO *pinfo, int
quick,
+ int num_comps = vstride;
+ int width = w;
+ int height = h;
++ int comp_ind;
+ data = jas_matrix_create(height, width);
+ assert(data);
+- for (int comp_ind = 0; comp_ind < num_comps; ++comp_ind) {
++ for (comp_ind = 0; comp_ind < num_comps; ++comp_ind) {
+ if (jas_image_readcmpt(img, comp_ind, 0, 0, width, height, data)) {
+ ret = 0;
+ goto done;
+@@ -353,10 +355,11 @@ static int LoadJP2K(char *fname, register PICINFO *pinfo, int
quick,
+ unsigned char *buffer;
+ jas_seqent_t *src;
+ unsigned char *dst;
++ int xx, yy;
+ dst = pinfo->pic + comp_ind;
+- for (int yy = 0; yy < height; ++yy) {
++ for (yy = 0; yy < height; ++yy) {
+ src = jas_matrix_getvref(data, yy);
+- for (int xx = 0; xx < width; ++xx) {
++ for (xx = 0; xx < width; ++xx) {
+ *dst = *src;
+ ++src;
+ dst += num_comps;
+@@ -714,12 +717,13 @@ static void StoreJP2K(char *options) {
+ fp2 = 0;
+
+ int num_comps = (colorType == F_GREYSCALE) ? 1 : 3;
++ int comp_ind;
+ if (num_comps == 3) {
+ color_space = JAS_CLRSPC_SRGB;
+ } else {
+ color_space = JAS_CLRSPC_SGRAY;
+ }
+- for (int comp_ind = 0; comp_ind < num_comps; ++comp_ind) {
++ for (comp_ind = 0; comp_ind < num_comps; ++comp_ind) {
+ parm[comp_ind].tlx = 0;
+ parm[comp_ind].tly = 0;
+ parm[comp_ind].hstep = 1;
+@@ -739,11 +743,12 @@ static void StoreJP2K(char *options) {
+ }
+
+ {
++ int comp_ind;
+ if (!(data = jas_matrix_create(h, w))) {
+ goto done;
+ }
+ if (num_comps == 3) {
+- for (int comp_ind = 0; comp_ind < num_comps; ++comp_ind) {
++ for (comp_ind = 0; comp_ind < num_comps; ++comp_ind) {
+ int comp_type;
+ switch (comp_ind) {
+ case 0:
+@@ -760,10 +765,11 @@ static void StoreJP2K(char *options) {
+ unsigned char *buffer;
+ unsigned char *src;
+ jas_seqent_t *dst;
++ int x, y;
+ src = pic + comp_ind;
+- for (int y = 0; y < h; ++y) {
++ for (y = 0; y < h; ++y) {
+ dst = jas_matrix_getvref(data, y);
+- for (int x = 0; x < w; ++x) {
++ for (x = 0; x < w; ++x) {
+ *dst = *src;
+ ++dst;
+ src += num_comps;
+@@ -780,10 +786,11 @@ static void StoreJP2K(char *options) {
+ unsigned char *buffer;
+ unsigned char *src;
+ jas_seqent_t *dst;
++ int x, y;
+ src = pic;
+- for (int y = 0; y < h; ++y) {
++ for (y = 0; y < h; ++y) {
+ dst = jas_matrix_getvref(data, y);
+- for (int x = 0; x < w; ++x) {
++ for (x = 0; x < w; ++x) {
+ int v;
+ if (mode == 0) {
+ v = *src;
diff --git a/xv.spec b/xv.spec
index 332ba79..6b436f2 100644
--- a/xv.spec
+++ b/xv.spec
@@ -36,6 +36,7 @@ Patch10: xv-3.10a-smooth-fix2.patch
Patch11: xv-3.10a-signal.patch
Patch12: xv-3.10a-gcc10.patch
Patch13: xv-3.10a-20220127-jasper.patch
+Patch14: xv-3.10a-c99isms.patch
BuildRequires: gcc
BuildRequires: libtiff-devel
@@ -165,6 +166,9 @@ rm ../%{name}-%{vprog}-jumbo-fix-enh-patch-%{vjumbo}.txt
# Fix Jasper support to use proper library APIs (patch from Jasper upstream maintainer)
%patch13 -p0
+# Fix some C99-isms introduced in previous patch, breaks build with older compilers
+%patch14 -p2
+
# Fix compiler options, install directories; enable JPEG 2000 support
%patch0 -p1