# Src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings

**URL:** <https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510>\
**Category:** NGINX\
**Created:** [January 14, 2014, 10:56pm UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510 "2014-01-14T22:56:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [January 14, 2014, 10:56pm UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/1 "2014-01-14T22:56:05Z")

</div>

src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler  
warnings

In ngx\_http\_spdy\_send\_chain(ngx\_connection\_t \*fc, ngx\_chain\_t \*in, off\_t  
limit):

src/http/ngx\_http\_spdy\_filter\_module.c(682) : warning C4244: ‘function’  
:  
conversion from ‘off\_t’ to ‘size\_t’, possible loss of data

src/http/ngx\_http\_spdy\_filter\_module.c(701) : warning C4244: ‘-=’ :  
conversion from ‘off\_t’ to ‘size\_t’, possible loss of data

src/http/ngx\_http\_spdy\_filter\_module.c(715) : warning C4244: ‘function’  
:  
conversion from ‘off\_t’ to ‘size\_t’, possible loss of data

src/http/ngx\_http\_spdy\_filter\_module.c(751) : warning C4244: ‘=’ :  
conversion from ‘off\_t’ to ‘size\_t’, possible loss of data

src/http/ngx\_http\_spdy\_filter\_module.c(757) : warning C4244: ‘function’  
:  
conversion from ‘off\_t’ to ‘size\_t’, possible loss of data

Posted at Nginx Forum:

> **[src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings](https://forum.nginx.org/read.php?2,246444,246444#msg-246444)**
>
> src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings In ngx\_http\_spdy\_send\_chain(ngx\_connection\_t \*fc, ngx\_chain\_t \*in, off\_t limit): src/http/ngx\_http\_spdy\_filter\_module.c(682) : warning C4244: 'function' : conversion from...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 14, 2014, 10:56pm UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/2 "2014-01-14T22:56:05Z")

</div>

On Tuesday 14 January 2014 16:26:41 itpp2012 wrote:

> src/http/ngx\_http\_spdy\_filter\_module.c(715) : warning C4244: ‘function’ :  
> conversion from ‘off\_t’ to ‘size\_t’, possible loss of data
> 
> src/http/ngx\_http\_spdy\_filter\_module.c(751) : warning C4244: ‘=’ :  
> conversion from ‘off\_t’ to ‘size\_t’, possible loss of data
> 
> src/http/ngx\_http\_spdy\_filter\_module.c(757) : warning C4244: ‘function’ :  
> conversion from ‘off\_t’ to ‘size\_t’, possible loss of data

What compiler are you using?

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 14, 2014, 11:00pm UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/3 "2014-01-14T23:00:11Z")

</div>

VC 2010, 32bit mode.

Posted at Nginx Forum:

> **[Re: src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings](https://forum.nginx.org/read.php?2,246444,246446#msg-246446)**
>
> src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings In ngx\_http\_spdy\_send\_chain(ngx\_connection\_t \*fc, ngx\_chain\_t \*in, off\_t limit): src/http/ngx\_http\_spdy\_filter\_module.c(682) : warning C4244: 'function' : conversion from...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 14, 2014, 11:00pm UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/4 "2014-01-14T23:00:12Z")

</div>

On Tuesday 14 January 2014 16:33:39 itpp2012 wrote:

> VC 2010, 32bit mode.

Ok. Please, try a patch below:

diff -r 439d05a037a3 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 01:44:57 2014  
+0400  
@@ -35,7 +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,

- ngx\_http\_spdy\_stream\_t \*stream, ngx\_buf\_t \*buf, off\_t offset,  
size\_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,  
@@ -702,7 +702,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 +752,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 +777,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, size\_t size)  
{  
ngx\_buf\_t \*chunk;  
ngx\_chain\_t \*cl;

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 14, 2014, 11:38pm UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/5 "2014-01-14T23:38:04Z")

</div>

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.

Posted at Nginx Forum:

> **[Re: src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings](https://forum.nginx.org/read.php?2,246444,246449#msg-246449)**
>
> src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings In ngx\_http\_spdy\_send\_chain(ngx\_connection\_t \*fc, ngx\_chain\_t \*in, off\_t limit): src/http/ngx\_http\_spdy\_filter\_module.c(682) : warning C4244: 'function' : conversion from...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 15, 2014, 9:54am UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/6 "2014-01-15T09:54:11Z")

</div>

I see only the ‘#if (NGX\_SUPPRESS\_WARN)’ commit on hg, where are the  
others?  
can’t attach anything here, after changeset 5516:439d05a037a3 additional  
changes are embedded here:  
[http://nginx-win.ecsds.eu/ngx\_http\_spdy\_filter\_module.c](http://nginx-win.ecsds.eu/ngx_http_spdy_filter_module.c)

Posted at Nginx Forum:

> **[Re: src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings](https://forum.nginx.org/read.php?2,246444,246470#msg-246470)**
>
> src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings In ngx\_http\_spdy\_send\_chain(ngx\_connection\_t \*fc, ngx\_chain\_t \*in, off\_t limit): src/http/ngx\_http\_spdy\_filter\_module.c(682) : warning C4244: 'function' : conversion from...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 15, 2014, 9:42am UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/7 "2014-01-15T09:42:42Z")

</div>

On Tuesday 14 January 2014 17:36:23 itpp2012 wrote:

> ```
> }
> 
> offset = 0;
> 
> ```
> 
> 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 B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

# 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);

# HG changeset patch

# User Valentin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

# 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;

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 15, 2014, 10:58am UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/8 "2014-01-15T10:58:54Z")

</div>

On Wednesday 15 January 2014 03:53:23 itpp2012 wrote:

> I see only the ‘#if (NGX\_SUPPRESS\_WARN)’ commit on hg, where are the others?  
> can’t attach anything here, after changeset 5516:439d05a037a3 additional  
> changes are embedded here:  
> [http://nginx-win.ecsds.eu/ngx\_http\_spdy\_filter\_module.c](http://nginx-win.ecsds.eu/ngx_http_spdy_filter_module.c)

It was delayed for internal review. The first patch was posted for  
review  
even before you have complained about the problem.

Now the second patch is committed too with expanded commit log:  
[http://hg.nginx.org/nginx/rev/9d1479234f3c](http://hg.nginx.org/nginx/rev/9d1479234f3c)

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [January 15, 2014, 11:09am UTC](https://www.ruby-forum.com/t/src-http-ngx-http-spdy-filter-module-c-latest-changesets-compiler-warnings/238510/9 "2014-01-15T11:09:07Z")

</div>

Aha, I need more patience 🙂

Posted at Nginx Forum:

> **[Re: src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings](https://forum.nginx.org/read.php?2,246444,246478#msg-246478)**
>
> src/http/ngx\_http\_spdy\_filter\_module.c, latest changesets compiler warnings In ngx\_http\_spdy\_send\_chain(ngx\_connection\_t \*fc, ngx\_chain\_t \*in, off\_t limit): src/http/ngx\_http\_spdy\_filter\_module.c(682) : warning C4244: 'function' : conversion from...
