Skip to content

Commit 2c5a2a7

Browse files
authored
Fix C++ One Definition Rules (ODR) Violations (#399)
**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.
1 parent 390114b commit 2c5a2a7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/h2_decoder.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static enum pseudoheader_name s_header_to_pseudoheader_name(enum aws_http_header
126126
**********************************************************************************************************************/
127127

128128
typedef struct aws_h2err(state_fn)(struct aws_h2_decoder *decoder, struct aws_byte_cursor *input);
129-
struct decoder_state {
129+
struct h2_decoder_state {
130130
state_fn *fn;
131131
uint32_t bytes_required;
132132
const char *name;
@@ -135,7 +135,7 @@ struct decoder_state {
135135
#define DEFINE_STATE(_name, _bytes_required) \
136136
static state_fn s_state_fn_##_name; \
137137
enum { s_state_##_name##_requires_##_bytes_required##_bytes = _bytes_required }; \
138-
static const struct decoder_state s_state_##_name = { \
138+
static const struct h2_decoder_state s_state_##_name = { \
139139
.fn = s_state_fn_##_name, \
140140
.bytes_required = s_state_##_name##_requires_##_bytes_required##_bytes, \
141141
.name = #_name, \
@@ -171,7 +171,7 @@ DEFINE_STATE(frame_unknown, 0);
171171
DEFINE_STATE(connection_preface_string, 1); /* requires 1 byte but may consume more */
172172

173173
/* Helper for states that need to transition to frame-type states */
174-
static const struct decoder_state *s_state_frames[AWS_H2_FRAME_TYPE_COUNT] = {
174+
static const struct h2_decoder_state *s_state_frames[AWS_H2_FRAME_TYPE_COUNT] = {
175175
[AWS_H2_FRAME_T_DATA] = &s_state_frame_data,
176176
[AWS_H2_FRAME_T_HEADERS] = &s_state_frame_headers,
177177
[AWS_H2_FRAME_T_PRIORITY] = &s_state_frame_priority,
@@ -196,7 +196,7 @@ struct aws_h2_decoder {
196196
struct aws_hpack_decoder hpack;
197197
bool is_server;
198198
struct aws_byte_buf scratch;
199-
const struct decoder_state *state;
199+
const struct h2_decoder_state *state;
200200
bool state_changed;
201201

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

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

0 commit comments

Comments
 (0)