Skip to content

Commit

Permalink
Fix C++ One Definition Rules (ODR) Violations (#399)
Browse files Browse the repository at this point in the history
**Issue:**
aws/aws-sdk-cpp#2137

**Description of Changes:**
Rename `decoder_state` -> `h2_decoder_state` to avoid collision with same-named struct in aws-c-compression.
  • Loading branch information
graebm committed Nov 8, 2022
1 parent 390114b commit 2c5a2a7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/h2_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static enum pseudoheader_name s_header_to_pseudoheader_name(enum aws_http_header
**********************************************************************************************************************/

typedef struct aws_h2err(state_fn)(struct aws_h2_decoder *decoder, struct aws_byte_cursor *input);
struct decoder_state {
struct h2_decoder_state {
state_fn *fn;
uint32_t bytes_required;
const char *name;
Expand All @@ -135,7 +135,7 @@ struct decoder_state {
#define DEFINE_STATE(_name, _bytes_required) \
static state_fn s_state_fn_##_name; \
enum { s_state_##_name##_requires_##_bytes_required##_bytes = _bytes_required }; \
static const struct decoder_state s_state_##_name = { \
static const struct h2_decoder_state s_state_##_name = { \
.fn = s_state_fn_##_name, \
.bytes_required = s_state_##_name##_requires_##_bytes_required##_bytes, \
.name = #_name, \
Expand Down Expand Up @@ -171,7 +171,7 @@ DEFINE_STATE(frame_unknown, 0);
DEFINE_STATE(connection_preface_string, 1); /* requires 1 byte but may consume more */

/* Helper for states that need to transition to frame-type states */
static const struct decoder_state *s_state_frames[AWS_H2_FRAME_TYPE_COUNT] = {
static const struct h2_decoder_state *s_state_frames[AWS_H2_FRAME_TYPE_COUNT] = {
[AWS_H2_FRAME_T_DATA] = &s_state_frame_data,
[AWS_H2_FRAME_T_HEADERS] = &s_state_frame_headers,
[AWS_H2_FRAME_T_PRIORITY] = &s_state_frame_priority,
Expand All @@ -196,7 +196,7 @@ struct aws_h2_decoder {
struct aws_hpack_decoder hpack;
bool is_server;
struct aws_byte_buf scratch;
const struct decoder_state *state;
const struct h2_decoder_state *state;
bool state_changed;

/* HTTP/2 connection preface must be first thing received (RFC-7540 3.5):
Expand Down Expand Up @@ -454,7 +454,7 @@ struct aws_h2err aws_h2_decode(struct aws_h2_decoder *decoder, struct aws_byte_c
* State functions
**********************************************************************************************************************/

static struct aws_h2err s_decoder_switch_state(struct aws_h2_decoder *decoder, const struct decoder_state *state) {
static struct aws_h2err s_decoder_switch_state(struct aws_h2_decoder *decoder, const struct h2_decoder_state *state) {
/* Ensure payload is big enough to enter next state.
* If this fails, then the payload length we received is too small for this frame type.
* (ex: a RST_STREAM frame with < 4 bytes) */
Expand Down

0 comments on commit 2c5a2a7

Please sign in to comment.