dcb3b7
From 1f3ac68dac93b7b85f09427d188386aaff0d3f80 Mon Sep 17 00:00:00 2001
dcb3b7
From: Reini Urban <reini.urban@gmail.com>
dcb3b7
Date: Fri, 17 Feb 2017 12:06:27 +0100
dcb3b7
Subject: [PATCH] Conform to C90
dcb3b7
MIME-Version: 1.0
dcb3b7
Content-Type: text/plain; charset=UTF-8
dcb3b7
Content-Transfer-Encoding: 8bit
dcb3b7
dcb3b7
The code failed to compile when building perl because perl adds -Werror=declaration-after-statement:
dcb3b7
dcb3b7
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
dcb3b7
Zlib.xs: In function 'flushParams':
dcb3b7
Zlib.xs:702:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
dcb3b7
     Bytef* output = s->deflateParams_out_buffer ;
dcb3b7
     ^~~~~
dcb3b7
dcb3b7
CPAN RT#120272
dcb3b7
dcb3b7
Signed-off-by: Petr Písař <ppisar@redhat.com>
dcb3b7
---
dcb3b7
 Zlib.xs | 22 +++++++++++-----------
dcb3b7
 1 file changed, 11 insertions(+), 11 deletions(-)
dcb3b7
dcb3b7
diff --git a/Zlib.xs b/Zlib.xs
dcb3b7
index 83d1423..7f4396a 100644
dcb3b7
--- a/Zlib.xs
dcb3b7
+++ b/Zlib.xs
dcb3b7
@@ -696,14 +696,14 @@ flushParams(di_stream* s)
dcb3b7
     int ret ;
dcb3b7
     z_stream * strm = &s->stream;
dcb3b7
 
dcb3b7
-    strm->next_in = NULL;
dcb3b7
-    strm->avail_in = 0;
dcb3b7
-    
dcb3b7
     Bytef* output = s->deflateParams_out_buffer ;
dcb3b7
     uLong total_output = s->deflateParams_out_length;
dcb3b7
 
dcb3b7
     uLong have = 0;
dcb3b7
 
dcb3b7
+    strm->next_in = NULL;
dcb3b7
+    strm->avail_in = 0;
dcb3b7
+    
dcb3b7
     do 
dcb3b7
     {
dcb3b7
         if (output)
dcb3b7
@@ -1133,12 +1133,12 @@ deflate (s, buf, output)
dcb3b7
         }
dcb3b7
 
dcb3b7
         RETVAL = deflate(&(s->stream), Z_NO_FLUSH);
dcb3b7
-        if (RETVAL != Z_STREAM_ERROR) {
dcb3b7
+        /* if (RETVAL != Z_STREAM_ERROR) {
dcb3b7
             int done = increment -  s->stream.avail_out ;
dcb3b7
-            /* printf("std DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
dcb3b7
+            printf("std DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
dcb3b7
             GetErrorString(RETVAL), s->stream.avail_in,
dcb3b7
-s->stream.avail_out, done); */
dcb3b7
-        }
dcb3b7
+s->stream.avail_out, done);
dcb3b7
+        } */
dcb3b7
     
dcb3b7
         if (trace) {
dcb3b7
             printf("DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
dcb3b7
@@ -1260,12 +1260,12 @@ flush(s, output, f=Z_FINISH)
dcb3b7
         }
dcb3b7
 
dcb3b7
         RETVAL = deflate(&(s->stream), f);
dcb3b7
-        if (RETVAL != Z_STREAM_ERROR) {
dcb3b7
+        /* if (RETVAL != Z_STREAM_ERROR) {
dcb3b7
             int done = availableout -  s->stream.avail_out ;
dcb3b7
-            /* printf("flush DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
dcb3b7
+            printf("flush DEFLATEr returned %d '%s'  avail in %d, out %d wrote %d\n", RETVAL,
dcb3b7
             GetErrorString(RETVAL), s->stream.avail_in,
dcb3b7
-s->stream.avail_out, done); */
dcb3b7
-        }
dcb3b7
+s->stream.avail_out, done);
dcb3b7
+        } */
dcb3b7
     
dcb3b7
         if (trace) {
dcb3b7
             printf("flush DEFLATE returned %d '%s', avail in %d, out %d\n", RETVAL,
dcb3b7
-- 
dcb3b7
2.7.4
dcb3b7