]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/DxeHttpLib: Refine some coding style.
authorJiaxin Wu <jiaxin.wu@intel.com>
Tue, 26 Dec 2017 01:31:06 +0000 (09:31 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 27 Dec 2017 08:28:56 +0000 (16:28 +0800)
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
MdeModulePkg/Include/Library/HttpLib.h
MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c

index 285a83122e645c9c34d8f35377fcab584cc2c2a8..9975aea676de09bd7b02b90bd37cd9d698824095 100644 (file)
@@ -434,9 +434,9 @@ HttpFreeHeaderFields (
                                   NULL if any error occured.\r
   @param[out]  RequestMsgSize     Size of the RequestMsg (in bytes).\r
 \r
-  @return EFI_SUCCESS             If HTTP request string was created successfully\r
+  @retval EFI_SUCCESS             If HTTP request string was created successfully.\r
   @retval EFI_OUT_OF_RESOURCES    Failed to allocate resources.\r
-  @retval EFI_INVALID_PARAMETER   The input arguments are invalid\r
+  @retval EFI_INVALID_PARAMETER   The input arguments are invalid.\r
 \r
 **/\r
 EFI_STATUS\r
index edb2acbd069769bf74842be2dd0ec08dd8753fc9..9774670d7c8f2632646586ca2eaf77fc04caa2f9 100644 (file)
@@ -56,7 +56,8 @@ UriPercentDecode (
   HexStr[2] = '\0';\r
   while (Index < BufferLength) {\r
     if (Buffer[Index] == '%') {\r
-      if (Index + 1 >= BufferLength || Index + 2 >= BufferLength || !NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR (Buffer[Index+2])) {\r
+      if (Index + 1 >= BufferLength || Index + 2 >= BufferLength || \r
+          !NET_IS_HEX_CHAR (Buffer[Index+1]) || !NET_IS_HEX_CHAR (Buffer[Index+2])) {\r
         return EFI_INVALID_PARAMETER;\r
       }\r
       HexStr[0] = Buffer[Index+1];\r
@@ -509,7 +510,7 @@ HttpUrlGetHostName (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Parser = (HTTP_URL_PARSER*) UrlParser;\r
+  Parser = (HTTP_URL_PARSER *) UrlParser;\r
 \r
   if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {\r
     return EFI_NOT_FOUND;\r
@@ -569,7 +570,7 @@ HttpUrlGetIp4 (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Parser = (HTTP_URL_PARSER*) UrlParser;\r
+  Parser = (HTTP_URL_PARSER *) UrlParser;\r
 \r
   if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {\r
     return EFI_NOT_FOUND;\r
@@ -632,7 +633,7 @@ HttpUrlGetIp6 (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Parser = (HTTP_URL_PARSER*) UrlParser;\r
+  Parser = (HTTP_URL_PARSER *) UrlParser;\r
 \r
   if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_HOST)) == 0) {\r
     return EFI_NOT_FOUND;\r
@@ -697,11 +698,11 @@ HttpUrlGetPort (
      OUT  UINT16             *Port\r
   )\r
 {\r
-  CHAR8         *PortString;\r
-  EFI_STATUS    Status;\r
-  UINTN         Index;\r
-  UINTN         Data;\r
-  UINT32        ResultLength;\r
+  CHAR8                *PortString;\r
+  EFI_STATUS           Status;\r
+  UINTN                Index;\r
+  UINTN                Data;\r
+  UINT32               ResultLength;\r
   HTTP_URL_PARSER      *Parser;\r
 \r
   if (Url == NULL || UrlParser == NULL || Port == NULL) {\r
@@ -711,7 +712,7 @@ HttpUrlGetPort (
   *Port = 0;\r
   Index = 0;\r
 \r
-  Parser = (HTTP_URL_PARSER*) UrlParser;\r
+  Parser = (HTTP_URL_PARSER *) UrlParser;\r
 \r
   if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_PORT)) == 0) {\r
     return EFI_NOT_FOUND;\r
@@ -789,7 +790,7 @@ HttpUrlGetPath (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Parser = (HTTP_URL_PARSER*) UrlParser;\r
+  Parser = (HTTP_URL_PARSER *) UrlParser;\r
 \r
   if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_PATH)) == 0) {\r
     return EFI_NOT_FOUND;\r
@@ -1159,17 +1160,17 @@ HttpParseMessageBody (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Parser = (HTTP_BODY_PARSER*) MsgParser;\r
+  Parser = (HTTP_BODY_PARSER *) MsgParser;\r
 \r
   if (Parser->IgnoreBody) {\r
     Parser->State = BodyParserComplete;\r
     if (Parser->Callback != NULL) {\r
       Status = Parser->Callback (\r
-                 BodyParseEventOnComplete,\r
-                 Body,\r
-                 0,\r
-                 Parser->Context\r
-                 );\r
+                         BodyParseEventOnComplete,\r
+                         Body,\r
+                         0,\r
+                         Parser->Context\r
+                         );\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
@@ -1201,11 +1202,11 @@ HttpParseMessageBody (
       //\r
       if (Parser->Callback != NULL) {\r
         Status = Parser->Callback (\r
-                   BodyParseEventOnData,\r
-                   Char,\r
-                   MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength),\r
-                   Parser->Context\r
-                   );\r
+                           BodyParseEventOnData,\r
+                           Char,\r
+                           MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength),\r
+                           Parser->Context\r
+                           );\r
         if (EFI_ERROR (Status)) {\r
           return Status;\r
         }\r
@@ -1216,11 +1217,11 @@ HttpParseMessageBody (
         Parser->State = BodyParserComplete;\r
         if (Parser->Callback != NULL) {\r
           Status = Parser->Callback (\r
-                     BodyParseEventOnComplete,\r
-                     Char,\r
-                     0,\r
-                     Parser->Context\r
-                     );\r
+                             BodyParseEventOnComplete,\r
+                             Char,\r
+                             0,\r
+                             Parser->Context\r
+                             );\r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
@@ -1305,11 +1306,11 @@ HttpParseMessageBody (
         Char++;\r
         if (Parser->Callback != NULL) {\r
           Status = Parser->Callback (\r
-                     BodyParseEventOnComplete,\r
-                     Char,\r
-                     0,\r
-                     Parser->Context\r
-                     );\r
+                             BodyParseEventOnComplete,\r
+                             Char,\r
+                             0,\r
+                             Parser->Context\r
+                             );\r
           if (EFI_ERROR (Status)) {\r
             return Status;\r
           }\r
@@ -1335,11 +1336,11 @@ HttpParseMessageBody (
       LengthForCallback = MIN (Parser->CurrentChunkSize - Parser->CurrentChunkParsedSize, RemainderLengthInThis);\r
       if (Parser->Callback != NULL) {\r
         Status = Parser->Callback (\r
-                   BodyParseEventOnData,\r
-                   Char,\r
-                   LengthForCallback,\r
-                   Parser->Context\r
-                   );\r
+                           BodyParseEventOnData,\r
+                           Char,\r
+                           LengthForCallback,\r
+                           Parser->Context\r
+                           );\r
         if (EFI_ERROR (Status)) {\r
           return Status;\r
         }\r
@@ -1404,7 +1405,7 @@ HttpIsMessageComplete (
     return FALSE;\r
   }\r
 \r
-  Parser = (HTTP_BODY_PARSER*) MsgParser;\r
+  Parser = (HTTP_BODY_PARSER *) MsgParser;\r
 \r
   if (Parser->State == BodyParserComplete) {\r
     return TRUE;\r
@@ -1438,7 +1439,7 @@ HttpGetEntityLength (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Parser = (HTTP_BODY_PARSER*) MsgParser;\r
+  Parser = (HTTP_BODY_PARSER *) MsgParser;\r
 \r
   if (!Parser->ContentLengthIsValid) {\r
     return EFI_NOT_READY;\r
@@ -1476,7 +1477,6 @@ HttpFreeMsgParser (
 \r
 **/\r
 CHAR8 *\r
-EFIAPI\r
 AsciiStrGetNextToken (\r
   IN CONST CHAR8 *String,\r
   IN       CHAR8 Separator\r
@@ -1621,7 +1621,7 @@ HttpGetFieldNameAndValue (
       //\r
       // Boundary condition check. \r
       //\r
-      if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 1) {\r
+      if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 1) {\r
         return NULL;  \r
       }\r
       \r
@@ -1630,7 +1630,7 @@ HttpGetFieldNameAndValue (
       //\r
       // Boundary condition check. \r
       //\r
-      if ((UINTN)EndofHeader - (UINTN)(FieldValueStr) < 3) {\r
+      if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 3) {\r
         return NULL;  \r
       }\r
 \r
@@ -1716,9 +1716,9 @@ HttpFreeHeaderFields (
                                   NULL if any error occured.\r
   @param[out]  RequestMsgSize     Size of the RequestMsg (in bytes).\r
 \r
-  @return EFI_SUCCESS             If HTTP request string was created successfully\r
+  @retval EFI_SUCCESS             If HTTP request string was created successfully.\r
   @retval EFI_OUT_OF_RESOURCES    Failed to allocate resources.\r
-  @retval EFI_INVALID_PARAMETER   The input arguments are invalid\r
+  @retval EFI_INVALID_PARAMETER   The input arguments are invalid.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1770,7 +1770,7 @@ HttpGenRequestMessage (
     Status = gBS->LocateProtocol (\r
                     &gEfiHttpUtilitiesProtocolGuid,\r
                     NULL,\r
-                    (VOID **)&HttpUtilitiesProtocol\r
+                    (VOID **) &HttpUtilitiesProtocol\r
                     );\r
 \r
     if (EFI_ERROR (Status)) {\r
@@ -1794,20 +1794,18 @@ HttpGenRequestMessage (
     // Build raw HTTP Headers\r
     //\r
     Status = HttpUtilitiesProtocol->Build (\r
-                HttpUtilitiesProtocol,\r
-                0,\r
-                NULL,\r
-                0,\r
-                NULL,\r
-                Message->HeaderCount,\r
-                AppendList,\r
-                &HttpHdrSize,\r
-                &HttpHdr\r
-                );\r
-\r
-    if (AppendList != NULL) {\r
-      FreePool (AppendList);\r
-    }\r
+                                      HttpUtilitiesProtocol,\r
+                                      0,\r
+                                      NULL,\r
+                                      0,\r
+                                      NULL,\r
+                                      Message->HeaderCount,\r
+                                      AppendList,\r
+                                      &HttpHdrSize,\r
+                                      &HttpHdr\r
+                                      );\r
+\r
+    FreePool (AppendList);\r
 \r
     if (EFI_ERROR (Status) || HttpHdr == NULL){\r
       return Status;\r
@@ -1837,7 +1835,7 @@ HttpGenRequestMessage (
   //\r
   // memory for the string that needs to be sent to TCP\r
   //\r
-  *RequestMsg           = NULL;\r
+  *RequestMsg = NULL;\r
   *RequestMsg = AllocateZeroPool (MsgSize);\r
   if (*RequestMsg == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r