Fix type conversion warnings in VS 2017 64-bit

PR-URL: https://github.com/nodejs/http-parser/pull/461
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
master
Sergey Zolotarev 6 years ago committed by Ben Noordhuis
parent 3502589659
commit 73f4442aae

@ -153,7 +153,7 @@ do { \
*/ */
#define COUNT_HEADER_SIZE(V) \ #define COUNT_HEADER_SIZE(V) \
do { \ do { \
nread += (V); \ nread += (uint32_t)(V); \
if (UNLIKELY(nread > max_header_size)) { \ if (UNLIKELY(nread > max_header_size)) { \
SET_ERRNO(HPE_HEADER_OVERFLOW); \ SET_ERRNO(HPE_HEADER_OVERFLOW); \
goto error; \ goto error; \
@ -2281,14 +2281,14 @@ http_parse_host(const char * buf, struct http_parser_url *u, int found_at) {
switch(new_s) { switch(new_s) {
case s_http_host: case s_http_host:
if (s != s_http_host) { if (s != s_http_host) {
u->field_data[UF_HOST].off = p - buf; u->field_data[UF_HOST].off = (uint16_t)(p - buf);
} }
u->field_data[UF_HOST].len++; u->field_data[UF_HOST].len++;
break; break;
case s_http_host_v6: case s_http_host_v6:
if (s != s_http_host_v6) { if (s != s_http_host_v6) {
u->field_data[UF_HOST].off = p - buf; u->field_data[UF_HOST].off = (uint16_t)(p - buf);
} }
u->field_data[UF_HOST].len++; u->field_data[UF_HOST].len++;
break; break;
@ -2300,7 +2300,7 @@ http_parse_host(const char * buf, struct http_parser_url *u, int found_at) {
case s_http_host_port: case s_http_host_port:
if (s != s_http_host_port) { if (s != s_http_host_port) {
u->field_data[UF_PORT].off = p - buf; u->field_data[UF_PORT].off = (uint16_t)(p - buf);
u->field_data[UF_PORT].len = 0; u->field_data[UF_PORT].len = 0;
u->field_set |= (1 << UF_PORT); u->field_set |= (1 << UF_PORT);
} }
@ -2309,7 +2309,7 @@ http_parse_host(const char * buf, struct http_parser_url *u, int found_at) {
case s_http_userinfo: case s_http_userinfo:
if (s != s_http_userinfo) { if (s != s_http_userinfo) {
u->field_data[UF_USERINFO].off = p - buf ; u->field_data[UF_USERINFO].off = (uint16_t)(p - buf);
u->field_data[UF_USERINFO].len = 0; u->field_data[UF_USERINFO].len = 0;
u->field_set |= (1 << UF_USERINFO); u->field_set |= (1 << UF_USERINFO);
} }
@ -2413,7 +2413,7 @@ http_parser_parse_url(const char *buf, size_t buflen, int is_connect,
continue; continue;
} }
u->field_data[uf].off = p - buf; u->field_data[uf].off = (uint16_t)(p - buf);
u->field_data[uf].len = 1; u->field_data[uf].len = 1;
u->field_set |= (1 << uf); u->field_set |= (1 << uf);

Loading…
Cancel
Save