Blob Blame History Raw
From 1f3ac68dac93b7b85f09427d188386aaff0d3f80 Mon Sep 17 00:00:00 2001
From: Reini Urban <reini.urban@gmail.com>
Date: Fri, 17 Feb 2017 12:06:27 +0100
Subject: [PATCH] Conform to C90
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The code failed to compile when building perl because perl adds -Werror=declaration-after-statement:

gcc -c  -I/usr/include -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings -g   -DVERSION=\"2.069\" -DXS_VERSION=\"2.069\" -fPIC "-I../.."  -DNO_VIZ -DZ_SOLO   -DGZIP_OS_CODE=3  Zlib.c
Zlib.xs: In function 'flushParams':
Zlib.xs:702:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     Bytef* output = s->deflateParams_out_buffer ;
     ^~~~~

CPAN RT#120272

Signed-off-by: Petr Písař <ppisar@redhat.com>
---
 Zlib.xs | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/Zlib.xs b/Zlib.xs
index 83d1423..7f4396a 100644
--- a/Zlib.xs
+++ b/Zlib.xs
@@ -696,14 +696,14 @@ flushParams(di_stream* s)
     int ret ;
     z_stream * strm = &s->stream;
 
-    strm->next_in = NULL;
-    strm->avail_in = 0;
-    
     Bytef* output = s->deflateParams_out_buffer ;
     uLong total_output = s->deflateParams_out_length;
 
     uLong have = 0;
 
+    strm->next_in = NULL;
+    strm->avail_in = 0;
+    
     do 
     {
         if (output)
@@ -1133,12 +1133,12 @@ deflate (s, buf, output)
         }
 
         RETVAL = deflate(&(s->stream), Z_NO_FLUSH);
-        if (RETVAL != Z_STREAM_ERROR) {
+        /* if (RETVAL != Z_STREAM_ERROR) {
             int done = increment -  s->stream.avail_out ;
-            /* printf("std DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
+            printf("std DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
             GetErrorString(RETVAL), s->stream.avail_in,
-s->stream.avail_out, done); */
-        }
+s->stream.avail_out, done);
+        } */
     
         if (trace) {
             printf("DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
@@ -1260,12 +1260,12 @@ flush(s, output, f=Z_FINISH)
         }
 
         RETVAL = deflate(&(s->stream), f);
-        if (RETVAL != Z_STREAM_ERROR) {
+        /* if (RETVAL != Z_STREAM_ERROR) {
             int done = availableout -  s->stream.avail_out ;
-            /* printf("flush DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
+            printf("flush DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
             GetErrorString(RETVAL), s->stream.avail_in,
-s->stream.avail_out, done); */
-        }
+s->stream.avail_out, done);
+        } */
     
         if (trace) {
             printf("flush DEFLATE returned %d '%s', avail in %d, out %d\n", RETVAL,
-- 
2.7.4