A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
Diff: sasl_frame_codec.c
- Revision:
- 19:000ab4e6a2c1
- Parent:
- 17:923575db8b2d
- Child:
- 20:206846c14c80
diff -r a922a4a30a82 -r 000ab4e6a2c1 sasl_frame_codec.c --- a/sasl_frame_codec.c Fri Feb 10 17:00:55 2017 -0800 +++ b/sasl_frame_codec.c Fri Feb 24 14:00:58 2017 -0800 @@ -5,6 +5,7 @@ #include <stdint.h> #include <stddef.h> #include <string.h> +#include "azure_c_shared_utility/optimize_size.h" #include "azure_uamqp_c/sasl_frame_codec.h" #include "azure_uamqp_c/frame_codec.h" #include "azure_uamqp_c/amqpalloc.h" @@ -226,7 +227,7 @@ (sasl_frame_value == NULL)) { /* Codes_SRS_SASL_FRAME_CODEC_01_034: [If any error occurs during encoding, sasl_frame_codec_encode_frame shall fail and return a non-zero value.] */ - result = __LINE__; + result = __FAILURE__; } else { @@ -241,7 +242,7 @@ (sasl_frame_descriptor_ulong > SASL_OUTCOME)) { /* Codes_SRS_SASL_FRAME_CODEC_01_034: [If any error occurs during encoding, sasl_frame_codec_encode_frame shall fail and return a non-zero value.] */ - result = __LINE__; + result = __FAILURE__; } /* Codes_SRS_SASL_FRAME_CODEC_01_032: [The payload frame size shall be computed based on the encoded size of the sasl_frame_value and its fields.] */ /* Codes_SRS_SASL_FRAME_CODEC_01_033: [The encoded size of the sasl_frame_value and its fields shall be obtained by calling amqpvalue_get_encoded_size.] */ @@ -250,14 +251,14 @@ (encoded_size > MIX_MAX_FRAME_SIZE - 8)) { /* Codes_SRS_SASL_FRAME_CODEC_01_034: [If any error occurs during encoding, sasl_frame_codec_encode_frame shall fail and return a non-zero value.] */ - result = __LINE__; + result = __FAILURE__; } else { unsigned char* sasl_frame_bytes = (unsigned char*)amqpalloc_malloc(encoded_size); if (sasl_frame_bytes == NULL) { - result = __LINE__; + result = __FAILURE__; } else { @@ -268,7 +269,7 @@ if (amqpvalue_encode(sasl_frame_value, encode_bytes, &payload) != 0) { - result = __LINE__; + result = __FAILURE__; } else { @@ -280,7 +281,7 @@ if (frame_codec_encode_frame(sasl_frame_codec_instance->frame_codec, FRAME_TYPE_SASL, &payload, 1, NULL, 0, on_bytes_encoded, callback_context) != 0) { /* Codes_SRS_SASL_FRAME_CODEC_01_034: [If any error occurs during encoding, sasl_frame_codec_encode_frame shall fail and return a non-zero value.] */ - result = __LINE__; + result = __FAILURE__; } else {