Welcome! Log In Create A New Profile

Advanced

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

Valentin V. Bartenev
January 14, 2014 06:06PM
On Tuesday 14 January 2014 17:36:23 itpp2012 wrote:
> You missed 2,
>
> Line +-683:
> if (offset) {
> cl = ngx_http_spdy_filter_get_shadow(stream, in->buf,
> // offset, size);
> (off_t) offset,
> (size_t) size);
> if (cl == NULL) {
> return NGX_CHAIN_ERROR;
> }
>
> and +-Line 760:
> if (offset) {
> // cl = ngx_http_spdy_filter_get_shadow(stream, in->buf, offset,
> size);
> cl = ngx_http_spdy_filter_get_shadow(stream, in->buf, (off_t)
> offset, (size_t) size);
> if (cl == NULL) {
> return NGX_CHAIN_ERROR;
> }
>
>
> Additional warning +-line 684:
> if (offset) {
> cl = ngx_http_spdy_filter_get_shadow(stream, in->buf,
> (off_t) offset, (size_t)
> size);
> if (cl == NULL) {
> return NGX_CHAIN_ERROR;
> }
>
> offset = 0;
>
> src\http\ngx_http_spdy_filter_module.c(685): warning C4701: potentially
> uninitialized local variable 'cl' used
>
> When I add +-line 629:
> ngx_http_spdy_stream_t *stream;
> ngx_http_spdy_loc_conf_t *slcf;
> ngx_http_spdy_out_frame_t *frame;
> + cl = NULL;
>
> The warning is gone.
>
[..]

Thanks! I've just checked these two patches on MSVC 2010,
and it seems all warnings are gone:

# HG changeset patch
# User Valentin Bartenev <vbart@nginx.com>
# Date 1389735892 -14400
# Node ID 439d05a037a344ae8d38b162a98391f92321d03b
# Parent e5fb14e850408b2250f81751b69d2f735bbe8edc
SPDY: fixed build, broken by b7ee1bae0ffa.

False positive warning about the "cl" variable may be uninitialized in
the ngx_http_spdy_filter_get_data_frame() call was suppressed.

It is always initialized either in the "while" cycle or in the following
"if" condition since frame_size cannot be zero.

diff -r e5fb14e85040 -r 439d05a037a3 src/http/ngx_http_spdy_filter_module.c
--- a/src/http/ngx_http_spdy_filter_module.c Tue Jan 14 16:24:45 2014 +0400
+++ b/src/http/ngx_http_spdy_filter_module.c Wed Jan 15 01:44:52 2014 +0400
@@ -665,6 +665,10 @@ ngx_http_spdy_send_chain(ngx_connection_
offset = 0;
}

+#if (NGX_SUPPRESS_WARN)
+ cl = NULL;
+#endif
+
slcf = ngx_http_get_module_loc_conf(r, ngx_http_spdy_module);

frame_size = (limit && limit <= (off_t) slcf->chunk_size)
# HG changeset patch
# User Valentin Bartenev <vbart@nginx.com>
# Date 1389740560 -14400
# Node ID 3d83b3f1354d7d56f1e31849bfa337f75d7b1d30
# Parent 439d05a037a344ae8d38b162a98391f92321d03b
SPDY: fixed off_t/size_t type conversions on 32 bits platforms.

diff -r 439d05a037a3 -r 3d83b3f1354d src/http/ngx_http_spdy_filter_module.c
--- a/src/http/ngx_http_spdy_filter_module.c Wed Jan 15 01:44:52 2014 +0400
+++ b/src/http/ngx_http_spdy_filter_module.c Wed Jan 15 03:02:40 2014 +0400
@@ -35,8 +35,7 @@ static ngx_inline ngx_int_t ngx_http_spd
ngx_connection_t *fc, ngx_http_spdy_stream_t *stream);

static ngx_chain_t *ngx_http_spdy_filter_get_shadow(
- ngx_http_spdy_stream_t *stream, ngx_buf_t *buf, size_t offset,
- size_t size);
+ ngx_http_spdy_stream_t *stream, ngx_buf_t *buf, off_t offset, off_t size);
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_chain_t *last);
@@ -702,7 +701,7 @@ ngx_http_spdy_send_chain(ngx_connection_
*ln = cl;
ln = &cl->next;

- rest -= size;
+ rest -= (size_t) size;
in = in->next;

if (in == NULL) {
@@ -752,7 +751,7 @@ ngx_http_spdy_send_chain(ngx_connection_
}

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_

static ngx_chain_t *
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_chain_t *cl;


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

itpp2012 January 14, 2014 04:26PM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

Valentin V. Bartenev January 14, 2014 04:32PM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

itpp2012 January 14, 2014 04:33PM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

Valentin V. Bartenev January 14, 2014 04:50PM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

itpp2012 January 14, 2014 05:36PM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

Valentin V. Bartenev January 14, 2014 06:06PM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

itpp2012 January 15, 2014 03:53AM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

Valentin V. Bartenev January 15, 2014 05:00AM

Re: src/http/ngx_http_spdy_filter_module.c, latest changesets compiler warnings

itpp2012 January 15, 2014 05:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 257
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready