nodejs / http-parser

http request/response parser for c
MIT License
6.33k stars 1.53k forks source link

Fix type conversion warnings in Visual Studio 2017 64-bit #461

Closed sryze closed 5 years ago

sryze commented 5 years ago

This PR fixes a bunch of warnings in Visual Studio 64-bit builds:

http_parser.c(1368): warning C4244: '+=': conversion from '__int64' to 'uint32_t', possible loss of data
http_parser.c(1372): warning C4244: '+=': conversion from '__int64' to 'uint32_t', possible loss of data
http_parser.c(1484): warning C4244: '+=': conversion from '__int64' to 'uint32_t', possible loss of data
http_parser.c(1669): warning C4244: '+=': conversion from '__int64' to 'uint32_t', possible loss of data
http_parser.c(2284): warning C4244: '=': conversion from '__int64' to 'uint16_t', possible loss of data
http_parser.c(2291): warning C4244: '=': conversion from '__int64' to 'uint16_t', possible loss of data
http_parser.c(2303): warning C4244: '=': conversion from '__int64' to 'uint16_t', possible loss of data
http_parser.c(2312): warning C4244: '=': conversion from '__int64' to 'uint16_t', possible loss of data
http_parser.c(2416): warning C4244: '=': conversion from '__int64' to 'uint16_t', possible loss of data

(as of commit 350258965909f249f9c59823aac240313e0d0120)

bnoordhuis commented 5 years ago

Thanks for the PR. The fields are all unsigned. Would you agree it's more appropriate to cast to uint32_t and uint16_t?

sryze commented 5 years ago

Yes, I agree, I missed that somehow. Updated the commit.

bnoordhuis commented 5 years ago

Thanks Sergey, merged in 73f4442 and released in v2.9.0.