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