nginx

changeset 5517:9d1479234f3c

SPDY: fixed off_t/size_t type conversions on 32 bits platforms. Parameters of ngx_http_spdy_filter_get_shadow() are changed from size_t to off_t since the last call of the function may get size and offset from the rest of a file buffer. This fixes possible data loss rightfully complained by MSVC on 32 bits systems where off_t is 8 bytes long while size_t is only 4 bytes. The other two type casts are needed just to suppress warnings about possible data loss also complained by MSVC but false positive in these cases.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 15 Jan 2014 13:23:31 +0400
parents 439d05a037a3
children ec9e9da4c1fb
files src/http/ngx_http_spdy_filter_module.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/src/http/ngx_http_spdy_filter_module.c	Wed Jan 15 01:44:52 2014 +0400
     1.2 +++ b/src/http/ngx_http_spdy_filter_module.c	Wed Jan 15 13:23:31 2014 +0400
     1.3 @@ -35,8 +35,7 @@
     1.4      ngx_connection_t *fc, ngx_http_spdy_stream_t *stream);
     1.5  
     1.6  static ngx_chain_t *ngx_http_spdy_filter_get_shadow(
     1.7 -    ngx_http_spdy_stream_t *stream, ngx_buf_t *buf, size_t offset,
     1.8 -    size_t size);
     1.9 +    ngx_http_spdy_stream_t *stream, ngx_buf_t *buf, off_t offset, off_t size);
    1.10  static ngx_http_spdy_out_frame_t *ngx_http_spdy_filter_get_data_frame(
    1.11      ngx_http_spdy_stream_t *stream, size_t len, ngx_chain_t *first,
    1.12      ngx_chain_t *last);
    1.13 @@ -702,7 +701,7 @@
    1.14              *ln = cl;
    1.15              ln = &cl->next;
    1.16  
    1.17 -            rest -= size;
    1.18 +            rest -= (size_t) size;
    1.19              in = in->next;
    1.20  
    1.21              if (in == NULL) {
    1.22 @@ -752,7 +751,7 @@
    1.23              }
    1.24  
    1.25              if (limit < (off_t) slcf->chunk_size) {
    1.26 -                frame_size = limit;
    1.27 +                frame_size = (size_t) limit;
    1.28              }
    1.29          }
    1.30      }
    1.31 @@ -777,7 +776,7 @@
    1.32  
    1.33  static ngx_chain_t *
    1.34  ngx_http_spdy_filter_get_shadow(ngx_http_spdy_stream_t *stream, ngx_buf_t *buf,
    1.35 -    size_t offset, size_t size)
    1.36 +    off_t offset, off_t size)
    1.37  {
    1.38      ngx_buf_t    *chunk;
    1.39      ngx_chain_t  *cl;