serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1712065 - /serf/trunk/protocols/http2_protocol.c
Date Mon, 02 Nov 2015 16:16:10 GMT
Author: rhuijben
Date: Mon Nov  2 16:16:10 2015
New Revision: 1712065

URL: http://svn.apache.org/viewvc?rev=1712065&view=rev
Log:
Remove some

* protocols/http2_protocol.c
  (serf_bucket_create_numberv): Increase code compatibility by
    not calling va_arg() with a second argument smaller than int.
    Remove unused int64 support

Modified:
    serf/trunk/protocols/http2_protocol.c

Modified: serf/trunk/protocols/http2_protocol.c
URL: http://svn.apache.org/viewvc/serf/trunk/protocols/http2_protocol.c?rev=1712065&r1=1712064&r2=1712065&view=diff
==============================================================================
--- serf/trunk/protocols/http2_protocol.c (original)
+++ serf/trunk/protocols/http2_protocol.c Mon Nov  2 16:16:10 2015
@@ -59,26 +59,10 @@ serf_bucket_create_numberv(serf_bucket_a
 
   for (c = format; *c; c++)
     {
-      switch (*c)
-      {
-        case '1': /* char */
-          sz += 1;
-          break;
-        case '2': /* apr_int16_t / apr_uint16_t */
-          sz += 2;
-          break;
-        case '3': /* apr_int32_t / apr_uint32_t */
-          sz += 3;
-          break;
-        case '4': /* apr_int32_t / apr_uint32_t */
-          sz += 4;
-          break;
-        case '8': /* apr_int64_t / apr_uint64_t */
-          sz += 8;
-          break;
-        default:
-          abort(); /* Invalid format */
-      }
+      if (*c >= '1' && *c <= '4')
+        sz += (*c - '0');
+      else
+        abort(); /* Invalid format */
     }
 
   buffer = serf_bucket_mem_alloc(allocator, sz);
@@ -91,10 +75,10 @@ serf_bucket_create_numberv(serf_bucket_a
        switch (*c)
         {
           case '1':
-            *r++ = va_arg(argp, char);
+            *r++ = va_arg(argp, int);
             break;
           case '2':
-            tmp = va_arg(argp, apr_uint16_t);
+            tmp = va_arg(argp, int);
             *r++ = (tmp >> 8) & 0xFF;
             *r++ = tmp & 0xFF;
             break;
@@ -111,17 +95,6 @@ serf_bucket_create_numberv(serf_bucket_a
             *r++ = (tmp >> 8) & 0xFF;
             *r++ = tmp & 0xFF;
             break;
-          case '8':
-            tmp_64 = va_arg(argp, apr_uint64_t);
-            *r++ = (tmp_64 >> 56) & 0xFF;
-            *r++ = (tmp_64 >> 48) & 0xFF;
-            *r++ = (tmp_64 >> 40) & 0xFF;
-            *r++ = (tmp_64 >> 32) & 0xFF;
-            *r++ = (tmp_64 >> 24) & 0xFF;
-            *r++ = (tmp_64 >> 16) & 0xFF;
-            *r++ = (tmp_64 >> 8) & 0xFF;
-            *r++ = tmp_64 & 0xFF;
-            break;
        }
     }
 



Mime
View raw message