comparison src/event/quic/ngx_event_quic_transport.c @ 9038:a26897674420 quic

QUIC: fixed C4706 warnings with MSVC 2010. The fix is to avoid assignments within conditional expression.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 22 Nov 2022 18:05:34 +0400
parents a2fbae359828
children def8e398d7c5
comparison
equal deleted inserted replaced
9037:0f5fc7a320db 9038:a26897674420
802 break; 802 break;
803 803
804 case NGX_QUIC_FT_ACK: 804 case NGX_QUIC_FT_ACK:
805 case NGX_QUIC_FT_ACK_ECN: 805 case NGX_QUIC_FT_ACK_ECN:
806 806
807 if (!((p = ngx_quic_parse_int(p, end, &f->u.ack.largest)) 807 p = ngx_quic_parse_int(p, end, &f->u.ack.largest);
808 && (p = ngx_quic_parse_int(p, end, &f->u.ack.delay)) 808 if (p == NULL) {
809 && (p = ngx_quic_parse_int(p, end, &f->u.ack.range_count)) 809 goto error;
810 && (p = ngx_quic_parse_int(p, end, &f->u.ack.first_range)))) 810 }
811 { 811
812 p = ngx_quic_parse_int(p, end, &f->u.ack.delay);
813 if (p == NULL) {
814 goto error;
815 }
816
817 p = ngx_quic_parse_int(p, end, &f->u.ack.range_count);
818 if (p == NULL) {
819 goto error;
820 }
821
822 p = ngx_quic_parse_int(p, end, &f->u.ack.first_range);
823 if (p == NULL) {
812 goto error; 824 goto error;
813 } 825 }
814 826
815 b->pos = p; 827 b->pos = p;
816 828
817 /* process all ranges to get bounds, values are ignored */ 829 /* process all ranges to get bounds, values are ignored */
818 for (i = 0; i < f->u.ack.range_count; i++) { 830 for (i = 0; i < f->u.ack.range_count; i++) {
819 831
820 p = ngx_quic_parse_int(p, end, &varint); 832 p = ngx_quic_parse_int(p, end, &varint);
821 if (p) {
822 p = ngx_quic_parse_int(p, end, &varint);
823 }
824
825 if (p == NULL) { 833 if (p == NULL) {
826 goto error; 834 goto error;
827 } 835 }
836
837 p = ngx_quic_parse_int(p, end, &varint);
838 if (p == NULL) {
839 goto error;
840 }
828 } 841 }
829 842
830 b->last = p; 843 b->last = p;
831 844
832 f->u.ack.ranges_length = b->last - b->pos; 845 f->u.ack.ranges_length = b->last - b->pos;
833 846
834 if (f->type == NGX_QUIC_FT_ACK_ECN) { 847 if (f->type == NGX_QUIC_FT_ACK_ECN) {
835 848
836 if (!((p = ngx_quic_parse_int(p, end, &f->u.ack.ect0)) 849 p = ngx_quic_parse_int(p, end, &f->u.ack.ect0);
837 && (p = ngx_quic_parse_int(p, end, &f->u.ack.ect1)) 850 if (p == NULL) {
838 && (p = ngx_quic_parse_int(p, end, &f->u.ack.ce)))) 851 goto error;
839 { 852 }
853
854 p = ngx_quic_parse_int(p, end, &f->u.ack.ect1);
855 if (p == NULL) {
856 goto error;
857 }
858
859 p = ngx_quic_parse_int(p, end, &f->u.ack.ce);
860 if (p == NULL) {
840 goto error; 861 goto error;
841 } 862 }
842 863
843 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 864 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
844 "quic ACK ECN counters ect0:%uL ect1:%uL ce:%uL", 865 "quic ACK ECN counters ect0:%uL ect1:%uL ce:%uL",
987 1008
988 break; 1009 break;
989 1010
990 case NGX_QUIC_FT_RESET_STREAM: 1011 case NGX_QUIC_FT_RESET_STREAM:
991 1012
992 if (!((p = ngx_quic_parse_int(p, end, &f->u.reset_stream.id)) 1013 p = ngx_quic_parse_int(p, end, &f->u.reset_stream.id);
993 && (p = ngx_quic_parse_int(p, end, &f->u.reset_stream.error_code)) 1014 if (p == NULL) {
994 && (p = ngx_quic_parse_int(p, end, 1015 goto error;
995 &f->u.reset_stream.final_size)))) 1016 }
996 { 1017
1018 p = ngx_quic_parse_int(p, end, &f->u.reset_stream.error_code);
1019 if (p == NULL) {
1020 goto error;
1021 }
1022
1023 p = ngx_quic_parse_int(p, end, &f->u.reset_stream.final_size);
1024 if (p == NULL) {
997 goto error; 1025 goto error;
998 } 1026 }
999 1027
1000 break; 1028 break;
1001 1029