Azure IoT common library

Dependents:   STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more

Revision:
21:b92006c5b9ff
Parent:
19:2e0811512ceb
Child:
45:1119d0f2c4d8
diff -r 95abdea56064 -r b92006c5b9ff socketio_mbed.c
--- a/socketio_mbed.c	Fri Feb 10 17:01:36 2017 -0800
+++ b/socketio_mbed.c	Fri Feb 24 14:01:41 2017 -0800
@@ -8,6 +8,7 @@
 #include "azure_c_shared_utility/socketio.h"
 #include "azure_c_shared_utility/singlylinkedlist.h"
 #include "azure_c_shared_utility/tcpsocketconnection_c.h"
+#include "azure_c_shared_utility/optimize_size.h"
 #include "azure_c_shared_utility/xlogging.h"
 
 #define UNABLE_TO_COMPLETE -2
@@ -99,7 +100,7 @@
     PENDING_SOCKET_IO* pending_socket_io = (PENDING_SOCKET_IO*)malloc(sizeof(PENDING_SOCKET_IO));
     if (pending_socket_io == NULL)
     {
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -107,7 +108,7 @@
         if (pending_socket_io->bytes == NULL)
         {
             free(pending_socket_io);
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -121,7 +122,7 @@
             {
                 free(pending_socket_io->bytes);
                 free(pending_socket_io);
-                result = __LINE__;
+                result = __FAILURE__;
             }
             else
             {
@@ -216,14 +217,14 @@
     SOCKET_IO_INSTANCE* socket_io_instance = (SOCKET_IO_INSTANCE*)socket_io;
     if (socket_io == NULL)
     {
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
         socket_io_instance->tcp_socket_connection = tcpsocketconnection_create();
         if (socket_io_instance->tcp_socket_connection == NULL)
         {
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -231,7 +232,7 @@
             {
                 tcpsocketconnection_destroy(socket_io_instance->tcp_socket_connection);
                 socket_io_instance->tcp_socket_connection = NULL;
-                result = __LINE__;
+                result = __FAILURE__;
             }
             else
             {
@@ -264,7 +265,7 @@
 
     if (socket_io == NULL)
     {
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -273,7 +274,7 @@
         if ((socket_io_instance->io_state == IO_STATE_CLOSED) ||
             (socket_io_instance->io_state == IO_STATE_CLOSING))
         {
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -302,14 +303,14 @@
         (size == 0))
     {
         /* Invalid arguments */
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
         SOCKET_IO_INSTANCE* socket_io_instance = (SOCKET_IO_INSTANCE*)socket_io;
         if (socket_io_instance->io_state != IO_STATE_OPEN)
         {
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -318,7 +319,7 @@
             {
                 if (add_pending_io(socket_io_instance, buffer, size, on_send_complete, callback_context) != 0)
                 {
-                    result = __LINE__;
+                    result = __FAILURE__;
                 }
                 else
                 {
@@ -338,7 +339,7 @@
                     /* queue data */
                     if (add_pending_io(socket_io_instance, (unsigned char*)buffer + send_result, size - send_result, on_send_complete, callback_context) != 0)
                     {
-                        result = __LINE__;
+                        result = __FAILURE__;
                     }
                     else
                     {
@@ -448,7 +449,7 @@
 int socketio_setoption(CONCRETE_IO_HANDLE socket_io, const char* optionName, const void* value)
 {
     /* Not implementing any options */
-    return __LINE__;
+    return __FAILURE__;
 }
 
 const IO_INTERFACE_DESCRIPTION* socketio_get_interface_description(void)