Просмотр исходного кода

【修改】统一 LOG 代码格式

Signed-off-by: chenyong <1521761801@qq.com>
chenyong 7 лет назад
Родитель
Сommit
5bf46f3b60
2 измененных файлов с 17 добавлено и 15 удалено
  1. 15 13
      src/webclient.c
  2. 2 2
      src/webclient_file.c

+ 15 - 13
src/webclient.c

@@ -1406,40 +1406,40 @@ int webclient_request(const char *URI, const char *header, const char *post_data
 
     RT_ASSERT(URI);
 
-    if(post_data && header == RT_NULL)
+    if (post_data && header == RT_NULL)
     {
         LOG_E("request post failed, post input header cannot be empty.");
         return -WEBCLIENT_ERROR;
     }
 
-    if(post_data == RT_NULL && response == RT_NULL)
+    if (post_data == RT_NULL && response == RT_NULL)
     {
         LOG_E("request get failed, get response data cannot be empty.");
         return -WEBCLIENT_ERROR;
     }
 
-    if(post_data == RT_NULL)
+    if (post_data == RT_NULL)
     {
         session = webclient_session_create(WEBCLIENT_HEADER_BUFSZ);
-        if(session == RT_NULL)
+        if (session == RT_NULL)
         {
             rc = -WEBCLIENT_NOMEM;
             goto __exit;
         }
 
-        if(header != RT_NULL)
+        if (header != RT_NULL)
         {
             strncpy(session->header->buffer, header, strlen(header));
         }
 
-        if(webclient_get(session, URI) != 200)
+        if (webclient_get(session, URI) != 200)
         {
             rc = -WEBCLIENT_ERROR;
             goto __exit;
         }
 
         totle_length = webclient_response(session, response);
-        if(totle_length <= 0)
+        if (totle_length <= 0)
         {
             rc = -WEBCLIENT_ERROR;
             goto __exit;
@@ -1448,35 +1448,37 @@ int webclient_request(const char *URI, const char *header, const char *post_data
     else
     {
         session = webclient_session_create(WEBCLIENT_HEADER_BUFSZ);
-        if(session == RT_NULL)
+        if (session == RT_NULL)
         {
             rc = -WEBCLIENT_NOMEM;
             goto __exit;
         }
 
-        if(header != RT_NULL)
+        if (header != RT_NULL)
         {
             strncpy(session->header->buffer, header, strlen(header));
         }
 
-        if(webclient_post(session, URI, post_data) != 200)
+        if (webclient_post(session, URI, post_data) != 200)
         {
             rc = -WEBCLIENT_ERROR;
             goto __exit;
         }
     }
-    if(header != RT_NULL)
+
+    if (header != RT_NULL)
     {
         strncpy(session->header->buffer, header, strlen(header));
     }
+
 __exit:
-    if(session)
+    if (session)
     {
         webclient_close(session);
         session = RT_NULL;
     }
 
-    if(rc < 0)
+    if (rc < 0)
     {
         return rc;
     }

+ 2 - 2
src/webclient_file.c

@@ -87,7 +87,7 @@ int webclient_get_file(const char* URI, const char* filename)
             {
                 write(fd, ptr, length);
                 total_length += length;
-                rt_kprintf(">");
+                LOG_RAW(">");
             }
             else
             {
@@ -107,7 +107,7 @@ int webclient_get_file(const char* URI, const char* filename)
             {
                 write(fd, ptr, length);
                 total_length += length;
-                rt_kprintf(">");
+                LOG_RAW(">");
             }
             else
             {