You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* 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. ]*/
253
-
LogError("Cannot allocate memory for body data sections");
252
+
LogError("Invalid size for body_amqp_data_items");
254
253
message_destroy(result);
255
254
result=NULL;
256
255
}
257
256
else
258
257
{
259
-
for (i=0; i<source_message->body_amqp_data_count; i++)
/* 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. ]*/
263
+
LogError("Cannot allocate memory for body data sections");
264
+
message_destroy(result);
265
+
result=NULL;
266
+
}
267
+
else
268
+
{
269
+
size_ti;
262
270
263
-
/* 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.] */
/* 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.] */
/* 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. ]*/
292
+
message_destroy(result);
293
+
result=NULL;
273
294
}
274
295
}
275
-
276
-
result->body_amqp_data_count=i;
277
-
if (i<source_message->body_amqp_data_count)
278
-
{
279
-
/* 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. ]*/
280
-
message_destroy(result);
281
-
result=NULL;
282
-
}
283
296
}
284
297
}
285
298
286
299
if ((result!=NULL) && (source_message->body_amqp_sequence_count>0))
/* 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. ]*/
294
-
LogError("Cannot allocate memory for body AMQP sequences");
305
+
LogError("Invalid size for body_amqp_sequence_items");
295
306
message_destroy(result);
296
307
result=NULL;
297
308
}
298
309
else
299
310
{
300
-
for (i=0; i<source_message->body_amqp_sequence_count; i++)
301
-
{
302
-
/* Codes_SRS_MESSAGE_01_160: [ If AMQP sequences are set as AMQP body they shall be cloned by calling `amqpvalue_clone`. ] */
/* 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. ]*/
315
+
LogError("Cannot allocate memory for body AMQP sequences");
315
316
message_destroy(result);
316
317
result=NULL;
317
318
}
318
-
}
319
+
else
320
+
{
321
+
size_ti;
322
+
323
+
for (i=0; i<source_message->body_amqp_sequence_count; i++)
324
+
{
325
+
/* Codes_SRS_MESSAGE_01_160: [ If AMQP sequences are set as AMQP body they shall be cloned by calling `amqpvalue_clone`. ] */
/* 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. ]*/
338
+
message_destroy(result);
339
+
result=NULL;
340
+
}
341
+
}
342
+
}
319
343
}
320
344
321
345
if ((result!=NULL) && (source_message->body_amqp_value!=NULL))
@@ -1016,7 +1040,7 @@ int message_add_body_amqp_data(MESSAGE_HANDLE message, BINARY_DATA amqp_data)
1016
1040
if ((message==NULL) ||
1017
1041
/* Tests_SRS_MESSAGE_01_089: [ If the `bytes` member of `amqp_data` is NULL and the `size` member is non-zero, `message_add_body_amqp_data` shall fail and return a non-zero value. ]*/
@@ -1034,45 +1058,56 @@ int message_add_body_amqp_data(MESSAGE_HANDLE message, BINARY_DATA amqp_data)
1034
1058
}
1035
1059
else
1036
1060
{
1037
-
/* 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`. ]*/
/* 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. ]*/
1042
-
LogError("Cannot allocate memory for body AMQP data items");
1066
+
LogError("Invalid size for new_body_amqp_data_items");
/* 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`. ]*/
/* Codes_SRS_MESSAGE_01_087: [ On success it shall return 0. ]*/
1056
-
result=0;
1075
+
/* 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. ]*/
1076
+
LogError("Cannot allocate memory for body AMQP data items");
if (message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes==NULL)
1062
-
{
1063
-
/* 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. ]*/
1064
-
LogError("Cannot allocate memory for body AMQP data to be added");
if (message->body_amqp_data_items[message->body_amqp_data_count].body_data_section_bytes==NULL)
1096
+
{
1097
+
/* 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. ]*/
1098
+
LogError("Cannot allocate memory for body AMQP data to be added");
/* 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. ]*/
1274
-
LogError("Cannot allocate enough memory for sequence items");
1310
+
LogError("Invalid size for 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`. ]*/
1282
-
/* Codes_SRS_MESSAGE_01_156: [ The AMQP sequence shall be cloned by calling `amqpvalue_clone`. ]*/
if (message->body_amqp_sequence_items[message->body_amqp_sequence_count] ==NULL)
1317
+
if (new_body_amqp_sequence_items==NULL)
1285
1318
{
1286
-
/* Codes_SRS_MESSAGE_01_157: [ If `amqpvalue_clone` fails, `message_add_body_amqp_sequence` shall fail and return a non-zero value. ]*/
1287
-
LogError("Cloning sequence failed");
1319
+
/* 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. ]*/
1320
+
LogError("Cannot allocate enough memory for sequence items");
1288
1321
result=MU_FAILURE;
1289
1322
}
1290
1323
else
1291
1324
{
1292
-
/* Codes_SRS_MESSAGE_01_114: [ If adding the AMQP sequence fails, the previous value shall be preserved. ]*/
/* Codes_SRS_MESSAGE_01_111: [ On success it shall return 0. ]*/
1296
-
result=0;
1327
+
/* 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`. ]*/
1328
+
/* Codes_SRS_MESSAGE_01_156: [ The AMQP sequence shall be cloned by calling `amqpvalue_clone`. ]*/
0 commit comments