mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 18:22:40 +08:00
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.
This commit is contained in:
parent
70c010167f
commit
d143119e3c
@ -35,8 +35,7 @@ static ngx_inline ngx_int_t ngx_http_spdy_filter_send(
|
|||||||
ngx_connection_t *fc, ngx_http_spdy_stream_t *stream);
|
ngx_connection_t *fc, ngx_http_spdy_stream_t *stream);
|
||||||
|
|
||||||
static ngx_chain_t *ngx_http_spdy_filter_get_shadow(
|
static ngx_chain_t *ngx_http_spdy_filter_get_shadow(
|
||||||
ngx_http_spdy_stream_t *stream, ngx_buf_t *buf, size_t offset,
|
ngx_http_spdy_stream_t *stream, ngx_buf_t *buf, off_t offset, off_t size);
|
||||||
size_t size);
|
|
||||||
static ngx_http_spdy_out_frame_t *ngx_http_spdy_filter_get_data_frame(
|
static ngx_http_spdy_out_frame_t *ngx_http_spdy_filter_get_data_frame(
|
||||||
ngx_http_spdy_stream_t *stream, size_t len, ngx_chain_t *first,
|
ngx_http_spdy_stream_t *stream, size_t len, ngx_chain_t *first,
|
||||||
ngx_chain_t *last);
|
ngx_chain_t *last);
|
||||||
@ -702,7 +701,7 @@ ngx_http_spdy_send_chain(ngx_connection_t *fc, ngx_chain_t *in, off_t limit)
|
|||||||
*ln = cl;
|
*ln = cl;
|
||||||
ln = &cl->next;
|
ln = &cl->next;
|
||||||
|
|
||||||
rest -= size;
|
rest -= (size_t) size;
|
||||||
in = in->next;
|
in = in->next;
|
||||||
|
|
||||||
if (in == NULL) {
|
if (in == NULL) {
|
||||||
@ -752,7 +751,7 @@ ngx_http_spdy_send_chain(ngx_connection_t *fc, ngx_chain_t *in, off_t limit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (limit < (off_t) slcf->chunk_size) {
|
if (limit < (off_t) slcf->chunk_size) {
|
||||||
frame_size = limit;
|
frame_size = (size_t) limit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -777,7 +776,7 @@ ngx_http_spdy_send_chain(ngx_connection_t *fc, ngx_chain_t *in, off_t limit)
|
|||||||
|
|
||||||
static ngx_chain_t *
|
static ngx_chain_t *
|
||||||
ngx_http_spdy_filter_get_shadow(ngx_http_spdy_stream_t *stream, ngx_buf_t *buf,
|
ngx_http_spdy_filter_get_shadow(ngx_http_spdy_stream_t *stream, ngx_buf_t *buf,
|
||||||
size_t offset, size_t size)
|
off_t offset, off_t size)
|
||||||
{
|
{
|
||||||
ngx_buf_t *chunk;
|
ngx_buf_t *chunk;
|
||||||
ngx_chain_t *cl;
|
ngx_chain_t *cl;
|
||||||
|
Loading…
Reference in New Issue
Block a user