diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2022-11-22 18:05:34 +0400 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2022-11-22 18:05:34 +0400 |
commit | 84a51e4de1790fb3f910e2add72bafd7ce482f4f (patch) | |
tree | b0ea0d0029bed3fbec32b16939ee432cac657f1b /src | |
parent | 36d80a52693904d829d9a4e27361bcd29e41d48d (diff) | |
download | nginx-84a51e4de1790fb3f910e2add72bafd7ce482f4f.tar.gz nginx-84a51e4de1790fb3f910e2add72bafd7ce482f4f.zip |
QUIC: fixed C4706 warnings with MSVC 2010.
The fix is to avoid assignments within conditional expression.
Diffstat (limited to 'src')
-rw-r--r-- | src/event/quic/ngx_event_quic_transport.c | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/src/event/quic/ngx_event_quic_transport.c b/src/event/quic/ngx_event_quic_transport.c index 660038461..3838f6463 100644 --- a/src/event/quic/ngx_event_quic_transport.c +++ b/src/event/quic/ngx_event_quic_transport.c @@ -804,11 +804,23 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end, case NGX_QUIC_FT_ACK: case NGX_QUIC_FT_ACK_ECN: - if (!((p = ngx_quic_parse_int(p, end, &f->u.ack.largest)) - && (p = ngx_quic_parse_int(p, end, &f->u.ack.delay)) - && (p = ngx_quic_parse_int(p, end, &f->u.ack.range_count)) - && (p = ngx_quic_parse_int(p, end, &f->u.ack.first_range)))) - { + p = ngx_quic_parse_int(p, end, &f->u.ack.largest); + if (p == NULL) { + goto error; + } + + p = ngx_quic_parse_int(p, end, &f->u.ack.delay); + if (p == NULL) { + goto error; + } + + p = ngx_quic_parse_int(p, end, &f->u.ack.range_count); + if (p == NULL) { + goto error; + } + + p = ngx_quic_parse_int(p, end, &f->u.ack.first_range); + if (p == NULL) { goto error; } @@ -818,10 +830,11 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end, for (i = 0; i < f->u.ack.range_count; i++) { p = ngx_quic_parse_int(p, end, &varint); - if (p) { - p = ngx_quic_parse_int(p, end, &varint); + if (p == NULL) { + goto error; } + p = ngx_quic_parse_int(p, end, &varint); if (p == NULL) { goto error; } @@ -833,10 +846,18 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end, if (f->type == NGX_QUIC_FT_ACK_ECN) { - if (!((p = ngx_quic_parse_int(p, end, &f->u.ack.ect0)) - && (p = ngx_quic_parse_int(p, end, &f->u.ack.ect1)) - && (p = ngx_quic_parse_int(p, end, &f->u.ack.ce)))) - { + p = ngx_quic_parse_int(p, end, &f->u.ack.ect0); + if (p == NULL) { + goto error; + } + + p = ngx_quic_parse_int(p, end, &f->u.ack.ect1); + if (p == NULL) { + goto error; + } + + p = ngx_quic_parse_int(p, end, &f->u.ack.ce); + if (p == NULL) { goto error; } @@ -989,11 +1010,18 @@ ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end, case NGX_QUIC_FT_RESET_STREAM: - if (!((p = ngx_quic_parse_int(p, end, &f->u.reset_stream.id)) - && (p = ngx_quic_parse_int(p, end, &f->u.reset_stream.error_code)) - && (p = ngx_quic_parse_int(p, end, - &f->u.reset_stream.final_size)))) - { + p = ngx_quic_parse_int(p, end, &f->u.reset_stream.id); + if (p == NULL) { + goto error; + } + + p = ngx_quic_parse_int(p, end, &f->u.reset_stream.error_code); + if (p == NULL) { + goto error; + } + + p = ngx_quic_parse_int(p, end, &f->u.reset_stream.final_size); + if (p == NULL) { goto error; } |