File gsoap-03-seqpoint.diff of Package gsoap

From: Jan Engelhardt <jengelh@inai.de>
Date: 2016-01-28 19:19:57.092815111 +0100
References: http://sf.net/p/gsoap2/patches/157/

In file included from stdsoap2_ssl.c:60:0:
stdsoap2_ssl.c: In function ‘soap_getgziphdr’:
stdsoap2.h:2347:128: warning: operation on ‘soap->bufidx’ may be undefined [-Wsequence-point]
 # define soap_get1(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx++])
                                                                                                                                ^
stdsoap2_ssl.c:15576:14: note: in expansion of macro ‘soap_get1’
   { for (i = soap_get1(soap) | (soap_get1(soap) << 8); i; i--)
              ^

---
 gsoap/stdsoap2.cpp |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: gsoap-2.8.28/gsoap/stdsoap2.cpp
===================================================================
--- gsoap-2.8.28.orig/gsoap/stdsoap2.cpp
+++ gsoap-2.8.28/gsoap/stdsoap2.cpp
@@ -16408,7 +16408,10 @@ soap_getgziphdr(struct soap *soap)
       f = c;
   }
   if (f & 0x04) /* FEXTRA */
-  { for (i = soap_get1(soap) | (soap_get1(soap) << 8); i; i--)
+  {
+    int i = soap_get1(soap);
+    i |= soap_get1(soap) << 8;
+    while (i-- > 0)
     { if ((int)soap_get1(soap) == EOF)
         return soap->error = SOAP_ZLIB_ERROR;
     }
openSUSE Build Service is sponsored by