CLEANUP: quic: replace "choosen" with "chosen" all over the code

Some variables were set as "choosen" instead of "chosen", this is dedicated
spelling fix
This commit is contained in:
Ilya Shipitsin 2022-11-01 15:46:39 +05:00 committed by Amaury Denoyelle
parent 74b5f7b31b
commit ace3da8dd4
3 changed files with 16 additions and 16 deletions

View File

@ -27,7 +27,7 @@ struct tp_preferred_address {
}; };
struct tp_version_information { struct tp_version_information {
uint32_t choosen; uint32_t chosen;
const uint32_t *others; const uint32_t *others;
size_t nb_others; size_t nb_others;
const struct quic_version *negotiated_version; const struct quic_version *negotiated_version;

View File

@ -13,7 +13,7 @@ void quic_transport_params_init(struct quic_transport_params *p, int server);
int quic_transport_params_encode(unsigned char *buf, int quic_transport_params_encode(unsigned char *buf,
const unsigned char *end, const unsigned char *end,
struct quic_transport_params *p, struct quic_transport_params *p,
const struct quic_version *choosen_version, const struct quic_version *chosen_version,
int server); int server);
int quic_transport_params_store(struct quic_conn *conn, int server, int quic_transport_params_store(struct quic_conn *conn, int server,
@ -46,10 +46,10 @@ static inline void quic_tp_cid_dump(struct buffer *buf,
static inline void quic_tp_version_info_dump(struct buffer *b, static inline void quic_tp_version_info_dump(struct buffer *b,
const struct tp_version_information *tp, int local) const struct tp_version_information *tp, int local)
{ {
if (!tp->choosen) if (!tp->chosen)
return; return;
chunk_appendf(b, "\n\tversion_information:(choosen=0x%08x", tp->choosen); chunk_appendf(b, "\n\tversion_information:(chosen=0x%08x", tp->chosen);
if (tp->nb_others) { if (tp->nb_others) {
int i = 0; int i = 0;
const uint32_t *ver; const uint32_t *ver;

View File

@ -173,15 +173,15 @@ static int quic_transport_param_dec_version_info(struct tp_version_information *
const uint32_t *ver; const uint32_t *ver;
/* <tp_len> must be a multiple of sizeof(uint32_t) */ /* <tp_len> must be a multiple of sizeof(uint32_t) */
if (tp_len < sizeof tp->choosen || (tp_len & 0x3)) if (tp_len < sizeof tp->chosen || (tp_len & 0x3))
return 0; return 0;
tp->choosen = ntohl(*(uint32_t *)*buf); tp->chosen = ntohl(*(uint32_t *)*buf);
/* Must not be null */ /* Must not be null */
if (!tp->choosen) if (!tp->chosen)
return 0; return 0;
*buf += sizeof tp->choosen; *buf += sizeof tp->chosen;
tp->others = (const uint32_t *)*buf; tp->others = (const uint32_t *)*buf;
/* Others versions must not be null */ /* Others versions must not be null */
@ -418,20 +418,20 @@ static int quic_transport_param_enc_pref_addr(unsigned char **buf,
return 1; return 1;
} }
/* Encode version information transport parameters with <choosen_version> as choosen /* Encode version information transport parameters with <chosen_version> as chosen
* version. * version.
* Return 1 if succeeded, 0 if not. * Return 1 if succeeded, 0 if not.
*/ */
static int quic_transport_param_enc_version_info(unsigned char **buf, static int quic_transport_param_enc_version_info(unsigned char **buf,
const unsigned char *end, const unsigned char *end,
const struct quic_version *choosen_version, const struct quic_version *chosen_version,
int server) int server)
{ {
int i; int i;
uint64_t tp_len; uint64_t tp_len;
uint32_t ver; uint32_t ver;
tp_len = sizeof choosen_version->num + quic_versions_nb * sizeof(uint32_t); tp_len = sizeof chosen_version->num + quic_versions_nb * sizeof(uint32_t);
if (!quic_transport_param_encode_type_len(buf, end, if (!quic_transport_param_encode_type_len(buf, end,
QUIC_TP_DRAFT_VERSION_INFORMATION, QUIC_TP_DRAFT_VERSION_INFORMATION,
tp_len)) tp_len))
@ -440,11 +440,11 @@ static int quic_transport_param_enc_version_info(unsigned char **buf,
if (end - *buf < tp_len) if (end - *buf < tp_len)
return 0; return 0;
/* First: choosen version */ /* First: chosen version */
ver = htonl(choosen_version->num); ver = htonl(chosen_version->num);
memcpy(*buf, &ver, sizeof ver); memcpy(*buf, &ver, sizeof ver);
*buf += sizeof ver; *buf += sizeof ver;
/* For servers: all supported version, choosen included */ /* For servers: all supported version, chosen included */
for (i = 0; i < quic_versions_nb; i++) { for (i = 0; i < quic_versions_nb; i++) {
ver = htonl(quic_versions[i].num); ver = htonl(quic_versions[i].num);
memcpy(*buf, &ver, sizeof ver); memcpy(*buf, &ver, sizeof ver);
@ -462,7 +462,7 @@ static int quic_transport_param_enc_version_info(unsigned char **buf,
int quic_transport_params_encode(unsigned char *buf, int quic_transport_params_encode(unsigned char *buf,
const unsigned char *end, const unsigned char *end,
struct quic_transport_params *p, struct quic_transport_params *p,
const struct quic_version *choosen_version, const struct quic_version *chosen_version,
int server) int server)
{ {
unsigned char *head; unsigned char *head;
@ -568,7 +568,7 @@ int quic_transport_params_encode(unsigned char *buf,
p->active_connection_id_limit)) p->active_connection_id_limit))
return 0; return 0;
if (!quic_transport_param_enc_version_info(&pos, end, choosen_version, server)) if (!quic_transport_param_enc_version_info(&pos, end, chosen_version, server))
return 0; return 0;
return pos - head; return pos - head;