V2 of integrating uAMQP vixes into vendored copy (#5931)
This commit is contained in:
Родитель
40fa516d87
Коммит
ef538101f2
|
@ -275,11 +275,11 @@ int amqp_frame_codec_encode_frame(AMQP_FRAME_CODEC_HANDLE amqp_frame_codec, uint
|
|||
}
|
||||
else
|
||||
{
|
||||
PAYLOAD* new_payloads = NULL;
|
||||
size_t calloc_size = safe_add_size_t(payload_count, 1);
|
||||
calloc_size = safe_multiply_size_t(calloc_size, sizeof(PAYLOAD));
|
||||
if (calloc_size == SIZE_MAX ||
|
||||
(new_payloads = (PAYLOAD*)calloc(1, calloc_size)) == NULL)
|
||||
PAYLOAD* new_payloads = NULL;
|
||||
size_t calloc_size = safe_add_size_t(payload_count, 1);
|
||||
calloc_size = safe_multiply_size_t(calloc_size, sizeof(PAYLOAD));
|
||||
if (calloc_size == SIZE_MAX ||
|
||||
(new_payloads = (PAYLOAD*)calloc(1, calloc_size)) == NULL)
|
||||
{
|
||||
LogError("Could not allocate frame payloads, size:%zu", calloc_size);
|
||||
result = MU_FAILURE;
|
||||
|
|
|
@ -5485,6 +5485,7 @@ static int internal_decoder_decode_bytes(INTERNAL_DECODER_DATA* internal_decoder
|
|||
{
|
||||
AMQP_VALUE described_value;
|
||||
internal_decoder_destroy(inner_decoder);
|
||||
internal_decoder_data->inner_decoder = NULL;
|
||||
|
||||
described_value = REFCOUNT_TYPE_CREATE(AMQP_VALUE_DATA);
|
||||
if (described_value == NULL)
|
||||
|
|
|
@ -1595,9 +1595,7 @@ CONNECTION_HANDLE connection_create2(XIO_HANDLE xio, const char* hostname, const
|
|||
{
|
||||
connection->last_frame_sent_time = connection->last_frame_received_time;
|
||||
|
||||
/* Codes_S_R_S_CONNECTION_01_072: [When connection_create
|
||||
* succeeds, the state of the connection shall be
|
||||
* CONNECTION_STATE_START.] */
|
||||
/* Codes_S_R_S_CONNECTION_01_072: [When connection_create succeeds, the state of the connection shall be CONNECTION_STATE_START.] */
|
||||
connection_set_state(connection, CONNECTION_STATE_START);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ static void link_frame_received(void* context, AMQP_VALUE performative, uint32_t
|
|||
}
|
||||
else if (is_flow_type_by_descriptor(descriptor))
|
||||
{
|
||||
FLOW_HANDLE flow_handle=NULL;
|
||||
FLOW_HANDLE flow_handle;
|
||||
if (amqpvalue_get_flow(performative, &flow_handle) != 0)
|
||||
{
|
||||
LogError("Cannot get flow performative");
|
||||
|
@ -425,6 +425,7 @@ static void link_frame_received(void* context, AMQP_VALUE performative, uint32_t
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
flow_destroy(flow_handle);
|
||||
}
|
||||
}
|
||||
|
@ -470,7 +471,6 @@ static void link_frame_received(void* context, AMQP_VALUE performative, uint32_t
|
|||
if ((link_instance->received_payload_size > 0) || more)
|
||||
{
|
||||
unsigned char* new_received_payload;;
|
||||
|
||||
size_t realloc_size = safe_add_size_t((size_t)link_instance->received_payload_size, payload_size);
|
||||
if (realloc_size == SIZE_MAX ||
|
||||
(new_received_payload = (unsigned char*)realloc(link_instance->received_payload, realloc_size)) == NULL)
|
||||
|
|
|
@ -246,114 +246,107 @@ MESSAGE_HANDLE message_clone(MESSAGE_HANDLE source_message)
|
|||
|
||||
if ((result != NULL) && (source_message->body_amqp_data_count > 0))
|
||||
{
|
||||
size_t calloc_size = safe_multiply_size_t(source_message->body_amqp_data_count, sizeof(BODY_AMQP_DATA));
|
||||
size_t calloc_size = safe_multiply_size_t(source_message->body_amqp_data_count, sizeof(BODY_AMQP_DATA));
|
||||
#if defined(_MSC_VER)
|
||||
__analysis_assume(calloc_size == (source_message->body_amqp_data_count+1)*sizeof(BODY_AMQP_DATA));
|
||||
__analysis_assume(calloc_size == (source_message->body_amqp_data_count+1)*sizeof(BODY_AMQP_DATA));
|
||||
#endif
|
||||
|
||||
if (calloc_size == SIZE_MAX)
|
||||
{
|
||||
LogError("Invalid size for body_amqp_data_items");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result->body_amqp_data_items = (BODY_AMQP_DATA*)calloc(1, calloc_size);
|
||||
|
||||
if (result->body_amqp_data_items == NULL)
|
||||
if (calloc_size == SIZE_MAX)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the
|
||||
* source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
LogError("Cannot allocate memory for body data sections");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
LogError("Invalid size for body_amqp_data_items");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
result->body_amqp_data_items = (BODY_AMQP_DATA*)calloc(1, calloc_size);
|
||||
|
||||
for (i = 0; i < source_message->body_amqp_data_count; i++)
|
||||
{
|
||||
result->body_amqp_data_items[i].body_data_section_length = source_message->body_amqp_data_items[i].body_data_section_length;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_011: [If an AMQP data has been set as message body on
|
||||
* the source message it shall be cloned by allocating memory for the binary
|
||||
* payload.] */
|
||||
result->body_amqp_data_items[i].body_data_section_bytes = (unsigned char*)malloc(source_message->body_amqp_data_items[i].body_data_section_length);
|
||||
if (result->body_amqp_data_items[i].body_data_section_bytes == NULL)
|
||||
if (result->body_amqp_data_items == NULL)
|
||||
{
|
||||
LogError("Cannot allocate memory for body data section %u", (unsigned int)i);
|
||||
break;
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
LogError("Cannot allocate memory for body data sections");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)memcpy(result->body_amqp_data_items[i].body_data_section_bytes, source_message->body_amqp_data_items[i].body_data_section_bytes, source_message->body_amqp_data_items[i].body_data_section_length);
|
||||
}
|
||||
}
|
||||
size_t i;
|
||||
|
||||
result->body_amqp_data_count = i;
|
||||
if (i < source_message->body_amqp_data_count)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the
|
||||
* source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
for (i = 0; i < source_message->body_amqp_data_count; i++)
|
||||
{
|
||||
result->body_amqp_data_items[i].body_data_section_length = source_message->body_amqp_data_items[i].body_data_section_length;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_011: [If an AMQP data has been set as message body on the source message it shall be cloned by allocating memory for the binary payload.] */
|
||||
result->body_amqp_data_items[i].body_data_section_bytes = (unsigned char*)malloc(source_message->body_amqp_data_items[i].body_data_section_length);
|
||||
if (result->body_amqp_data_items[i].body_data_section_bytes == NULL)
|
||||
{
|
||||
LogError("Cannot allocate memory for body data section %u", (unsigned int)i);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)memcpy(result->body_amqp_data_items[i].body_data_section_bytes, source_message->body_amqp_data_items[i].body_data_section_bytes, source_message->body_amqp_data_items[i].body_data_section_length);
|
||||
}
|
||||
}
|
||||
|
||||
result->body_amqp_data_count = i;
|
||||
if (i < source_message->body_amqp_data_count)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((result != NULL) && (source_message->body_amqp_sequence_count > 0))
|
||||
{
|
||||
size_t calloc_size = safe_multiply_size_t(source_message->body_amqp_sequence_count, sizeof(AMQP_VALUE));
|
||||
size_t calloc_size = safe_multiply_size_t(source_message->body_amqp_sequence_count, sizeof(AMQP_VALUE));
|
||||
#if defined(_MSC_VER)
|
||||
__analysis_assume(calloc_size == (source_message->body_amqp_sequence_count+1) * sizeof(AMQP_VALUE));
|
||||
__analysis_assume(calloc_size == (source_message->body_amqp_sequence_count+1) * sizeof(AMQP_VALUE));
|
||||
#endif
|
||||
|
||||
if (calloc_size == SIZE_MAX)
|
||||
{
|
||||
LogError("Invalid size for body_amqp_sequence_items");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result->body_amqp_sequence_items = (AMQP_VALUE*)calloc(1, calloc_size);
|
||||
if (result->body_amqp_sequence_items == NULL)
|
||||
if (calloc_size == SIZE_MAX)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the
|
||||
* source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
LogError("Cannot allocate memory for body AMQP sequences");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
LogError("Invalid size for body_amqp_sequence_items");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < source_message->body_amqp_sequence_count; i++)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_160: [ If AMQP sequences are set as AMQP body they shall
|
||||
* be cloned by calling `amqpvalue_clone`. ] */
|
||||
result->body_amqp_sequence_items[i] = amqpvalue_clone(source_message->body_amqp_sequence_items[i]);
|
||||
if (result->body_amqp_sequence_items[i] == NULL)
|
||||
result->body_amqp_sequence_items = (AMQP_VALUE*)calloc(1, calloc_size);
|
||||
if (result->body_amqp_sequence_items == NULL)
|
||||
{
|
||||
LogError("Cannot clone AMQP sequence %u", (unsigned int)i);
|
||||
break;
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
LogError("Cannot allocate memory for body AMQP sequences");
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
|
||||
result->body_amqp_sequence_count = i;
|
||||
if (i < source_message->body_amqp_sequence_count)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the
|
||||
* source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
for (i = 0; i < source_message->body_amqp_sequence_count; i++)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_160: [ If AMQP sequences are set as AMQP body they shall be cloned by calling `amqpvalue_clone`. ] */
|
||||
result->body_amqp_sequence_items[i] = amqpvalue_clone(source_message->body_amqp_sequence_items[i]);
|
||||
if (result->body_amqp_sequence_items[i] == NULL)
|
||||
{
|
||||
LogError("Cannot clone AMQP sequence %u", (unsigned int)i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result->body_amqp_sequence_count = i;
|
||||
if (i < source_message->body_amqp_sequence_count)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_012: [ If any cloning operation for the members of the source message fails, then `message_clone` shall fail and return NULL. ]*/
|
||||
message_destroy(result);
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((result != NULL) && (source_message->body_amqp_value != NULL))
|
||||
|
@ -1072,71 +1065,66 @@ int message_add_body_amqp_data(MESSAGE_HANDLE message, BINARY_DATA amqp_data)
|
|||
}
|
||||
else
|
||||
{
|
||||
size_t realloc_size = safe_add_size_t(message->body_amqp_data_count, 1);
|
||||
realloc_size = safe_multiply_size_t(sizeof(BODY_AMQP_DATA), realloc_size);
|
||||
size_t realloc_size = safe_add_size_t(message->body_amqp_data_count, 1);
|
||||
realloc_size = safe_multiply_size_t(sizeof(BODY_AMQP_DATA), realloc_size);
|
||||
#if defined(_MSC_VER)
|
||||
__analysis_assume(realloc_size == (message->body_amqp_data_count+1) * sizeof(BODY_AMQP_DATA));
|
||||
__analysis_assume(realloc_size / sizeof(BODY_AMQP_DATA) > message->body_amqp_data_count);
|
||||
__analysis_assume(message->body_amqp_data_count < realloc_size / sizeof(BODY_AMQP_DATA));
|
||||
__analysis_assume(realloc_size == (message->body_amqp_data_count+1) * sizeof(BODY_AMQP_DATA));
|
||||
__analysis_assume(realloc_size / sizeof(BODY_AMQP_DATA) > message->body_amqp_data_count);
|
||||
__analysis_assume(message->body_amqp_data_count < realloc_size / sizeof(BODY_AMQP_DATA));
|
||||
#endif
|
||||
|
||||
|
||||
if (realloc_size == SIZE_MAX)
|
||||
{
|
||||
LogError("Invalid size for new_body_amqp_data_items");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_086: [ `message_add_body_amqp_data` shall add the contents of
|
||||
* `amqp_data` to the list of AMQP data values for the body of the message identified by
|
||||
* `message`. ]*/
|
||||
BODY_AMQP_DATA* new_body_amqp_data_items = (BODY_AMQP_DATA*)realloc(message->body_amqp_data_items, realloc_size);
|
||||
if (new_body_amqp_data_items == NULL)
|
||||
if (realloc_size == SIZE_MAX)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_153: [ If allocating memory to store the added AMQP data
|
||||
* fails, `message_add_body_amqp_data` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cannot allocate memory for body AMQP data items");
|
||||
result = MU_FAILURE;
|
||||
LogError("Invalid size for new_body_amqp_data_items");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
message->body_amqp_data_items = new_body_amqp_data_items;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
__analysis_assume(realloc_size > message->body_amqp_data_count * sizeof(BODY_AMQP_DATA));
|
||||
#endif
|
||||
if (amqp_data.length == 0)
|
||||
{
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes = NULL;
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_length = 0;
|
||||
message->body_amqp_data_count++;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_087: [ On success it shall return 0. ]*/
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes
|
||||
= (unsigned char*)malloc(amqp_data.length);
|
||||
if (message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes == NULL)
|
||||
/* Codes_SRS_MESSAGE_01_086: [ `message_add_body_amqp_data` shall add the contents of `amqp_data` to the list of AMQP data values for the body of the message identified by `message`. ]*/
|
||||
BODY_AMQP_DATA* new_body_amqp_data_items = (BODY_AMQP_DATA*)realloc(message->body_amqp_data_items, realloc_size);
|
||||
if (new_body_amqp_data_items == NULL)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_153: [ If allocating memory to store the added AMQP data
|
||||
* fails, `message_add_body_amqp_data` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cannot allocate memory for body AMQP data to be added");
|
||||
result = MU_FAILURE;
|
||||
/* Codes_SRS_MESSAGE_01_153: [ If allocating memory to store the added AMQP data fails, `message_add_body_amqp_data` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cannot allocate memory for body AMQP data items");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_length = amqp_data.length;
|
||||
(void)memcpy(message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes, amqp_data.bytes, amqp_data.length);
|
||||
message->body_amqp_data_count++;
|
||||
message->body_amqp_data_items = new_body_amqp_data_items;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_087: [ On success it shall return 0. ]*/
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(_MSC_VER)
|
||||
__analysis_assume(realloc_size > message->body_amqp_data_count * sizeof(BODY_AMQP_DATA));
|
||||
#endif
|
||||
if (amqp_data.length == 0)
|
||||
{
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes = NULL;
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_length = 0;
|
||||
message->body_amqp_data_count++;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_087: [ On success it shall return 0. ]*/
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes = (unsigned char*)malloc(amqp_data.length);
|
||||
if (message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes == NULL)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_153: [ If allocating memory to store the added AMQP data fails, `message_add_body_amqp_data` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cannot allocate memory for body AMQP data to be added");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_length = amqp_data.length;
|
||||
(void)memcpy(message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes, amqp_data.bytes, amqp_data.length);
|
||||
message->body_amqp_data_count++;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_087: [ On success it shall return 0. ]*/
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1330,58 +1318,53 @@ int message_add_body_amqp_sequence(MESSAGE_HANDLE message, AMQP_VALUE sequence_l
|
|||
}
|
||||
else
|
||||
{
|
||||
size_t realloc_size = safe_add_size_t(message->body_amqp_sequence_count, 1);
|
||||
realloc_size = safe_multiply_size_t(sizeof(AMQP_VALUE), realloc_size);
|
||||
size_t realloc_size = safe_add_size_t(message->body_amqp_sequence_count, 1);
|
||||
realloc_size = safe_multiply_size_t(sizeof(AMQP_VALUE), realloc_size);
|
||||
#if defined(_MSC_VER)
|
||||
__analysis_assume(realloc_size == (message->body_amqp_sequence_count+1) * sizeof(AMQP_VALUE));
|
||||
__analysis_assume(message->body_amqp_sequence_count < realloc_size / sizeof(AMQP_VALUE));
|
||||
__analysis_assume(realloc_size == (message->body_amqp_sequence_count+1) * sizeof(AMQP_VALUE));
|
||||
__analysis_assume(message->body_amqp_sequence_count < realloc_size / sizeof(AMQP_VALUE));
|
||||
#endif
|
||||
|
||||
if (realloc_size == SIZE_MAX)
|
||||
{
|
||||
LogError("Invalid size for new_body_amqp_sequence_items");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
AMQP_VALUE* new_body_amqp_sequence_items = (AMQP_VALUE*)realloc(message->body_amqp_sequence_items, realloc_size);
|
||||
if (new_body_amqp_sequence_items == NULL)
|
||||
if (realloc_size == SIZE_MAX)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_158: [ If allocating memory in order to store the sequence fails, `message_add_body_amqp_sequence` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cannot allocate enough memory for sequence items");
|
||||
LogError("Invalid size for new_body_amqp_sequence_items");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
message->body_amqp_sequence_items = new_body_amqp_sequence_items;
|
||||
AMQP_VALUE* new_body_amqp_sequence_items = (AMQP_VALUE*)realloc(message->body_amqp_sequence_items, realloc_size);
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_110: [ `message_add_body_amqp_sequence` shall add the contents
|
||||
* of `sequence` to the list of AMQP sequences for the body of the message identified
|
||||
* by `message`. ]*/
|
||||
/* Codes_SRS_MESSAGE_01_156: [ The AMQP sequence shall be cloned by calling
|
||||
* `amqpvalue_clone`. ]*/
|
||||
if (new_body_amqp_sequence_items == NULL)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_158: [ If allocating memory in order to store the sequence fails, `message_add_body_amqp_sequence` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cannot allocate enough memory for sequence items");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
message->body_amqp_sequence_items = new_body_amqp_sequence_items;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_110: [ `message_add_body_amqp_sequence` shall add the contents of `sequence` to the list of AMQP sequences for the body of the message identified by `message`. ]*/
|
||||
/* Codes_SRS_MESSAGE_01_156: [ The AMQP sequence shall be cloned by calling `amqpvalue_clone`. ]*/
|
||||
#if defined(_MSC_VER)
|
||||
__analysis_assume(realloc_size > message->body_amqp_sequence_count * sizeof(AMQP_VALUE));
|
||||
__analysis_assume(realloc_size > message->body_amqp_sequence_count * sizeof(AMQP_VALUE));
|
||||
#endif
|
||||
message->body_amqp_sequence_items[message->body_amqp_sequence_count]
|
||||
= amqpvalue_clone(sequence_list);
|
||||
if (message->body_amqp_sequence_items[message->body_amqp_sequence_count] == NULL)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_157: [ If `amqpvalue_clone` fails,
|
||||
* `message_add_body_amqp_sequence` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cloning sequence failed");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_114: [ If adding the AMQP sequence fails, the previous value
|
||||
* shall be preserved. ]*/
|
||||
message->body_amqp_sequence_count++;
|
||||
message->body_amqp_sequence_items[message->body_amqp_sequence_count] = amqpvalue_clone(sequence_list);
|
||||
if (message->body_amqp_sequence_items[message->body_amqp_sequence_count] == NULL)
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_157: [ If `amqpvalue_clone` fails, `message_add_body_amqp_sequence` shall fail and return a non-zero value. ]*/
|
||||
LogError("Cloning sequence failed");
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Codes_SRS_MESSAGE_01_114: [ If adding the AMQP sequence fails, the previous value shall be preserved. ]*/
|
||||
message->body_amqp_sequence_count++;
|
||||
|
||||
/* Codes_SRS_MESSAGE_01_111: [ On success it shall return 0. ]*/
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
/* Codes_SRS_MESSAGE_01_111: [ On success it shall return 0. ]*/
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче