]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: improved HPACK integer parsing code readability.
authorRuslan Ermilov <ru@nginx.com>
Tue, 20 Oct 2015 18:26:38 +0000 (21:26 +0300)
committerRuslan Ermilov <ru@nginx.com>
Tue, 20 Oct 2015 18:26:38 +0000 (21:26 +0300)
No functional changes.

src/http/v2/ngx_http_v2.c

index 54458daeb449fa1211c9c9c50d9cec5c4669f15a..5852c994362573eeb8fb0a89ffa7aa99ebe85c9b 100644 (file)
@@ -2396,8 +2396,8 @@ ngx_http_v2_parse_int(ngx_http_v2_connection_t *h2c, u_char **pos, u_char *end,
         return value;
     }
 
-    if (end - p > NGX_HTTP_V2_INT_OCTETS - 1) {
-        end = p + NGX_HTTP_V2_INT_OCTETS - 1;
+    if (end - start > NGX_HTTP_V2_INT_OCTETS) {
+        end = start + NGX_HTTP_V2_INT_OCTETS;
     }
 
     for (shift = 0; p != end; shift += 7) {
@@ -2417,7 +2417,7 @@ ngx_http_v2_parse_int(ngx_http_v2_connection_t *h2c, u_char **pos, u_char *end,
         }
     }
 
-    if ((size_t) (end - start) >= NGX_HTTP_V2_INT_OCTETS) {
+    if (end == start + NGX_HTTP_V2_INT_OCTETS) {
         return NGX_DECLINED;
     }