Skip to content

Commit

Permalink
Avoid variable lengths arrays (#368)
Browse files Browse the repository at this point in the history
* Avoid variable lengths arrays

Despite conforming to C99, variable length arrays are not supported by
MSVC, and maybe some other relevant compilers.  Therefore we hard-code
the maximum required space.

* Properly set custom_properties_table.num_entries
  • Loading branch information
cmb69 committed Apr 5, 2020
1 parent e1c540f commit c3c5156
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion amqp_connection_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ amqp_connection_resource *connection_resource_constructor(amqp_connection_params
}

custom_properties_table.entries = custom_properties_entries;
custom_properties_table.num_entries = sizeof(custom_properties_entries) / sizeof(amqp_table_entry_t);
custom_properties_table.num_entries = params->connection_name ? 2 : 1;

/* We can assume that connection established here but it is not true, real handshake goes during login */

Expand Down

2 comments on commit c3c5156

@cmb69
Copy link
Contributor Author

@cmb69 cmb69 commented on c3c5156 Apr 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lstrojny, this merge missed my first commit (4eb3de3), so it still won't build with MSVC, see https://ci.appveyor.com/project/cmb69/php-amqp#L82

@lstrojny
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, sorry about that. Should be fixed in master now

Please sign in to comment.