]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootSupport.c
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootSupport.c
index 99d7fb39c7936ea579fb0b859791bbbdbb5d987e..236ef259318b4877cf18a8897bc88af1f745eade 100644 (file)
@@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 #include "HttpBootDxe.h"\r
 \r
-\r
 /**\r
   Get the Nic handle using any child handle in the IPv4 stack.\r
 \r
@@ -21,10 +20,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/\r
 EFI_HANDLE\r
 HttpBootGetNicByIp4Children (\r
-  IN EFI_HANDLE                 ControllerHandle\r
+  IN EFI_HANDLE  ControllerHandle\r
   )\r
 {\r
-  EFI_HANDLE                    NicHandle;\r
+  EFI_HANDLE  NicHandle;\r
 \r
   NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiHttpProtocolGuid);\r
   if (NicHandle == NULL) {\r
@@ -48,10 +47,11 @@ HttpBootGetNicByIp4Children (
 **/\r
 EFI_HANDLE\r
 HttpBootGetNicByIp6Children (\r
-  IN EFI_HANDLE                 ControllerHandle\r
+  IN EFI_HANDLE  ControllerHandle\r
   )\r
 {\r
-  EFI_HANDLE                    NicHandle;\r
+  EFI_HANDLE  NicHandle;\r
+\r
   NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiHttpProtocolGuid);\r
   if (NicHandle == NULL) {\r
     NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid);\r
@@ -73,17 +73,17 @@ HttpBootGetNicByIp6Children (
 **/\r
 VOID\r
 HttpBootUintnToAscDecWithFormat (\r
-  IN UINTN                       Number,\r
-  IN UINT8                       *Buffer,\r
-  IN INTN                        Length\r
+  IN UINTN  Number,\r
+  IN UINT8  *Buffer,\r
+  IN INTN   Length\r
   )\r
 {\r
-  UINTN                          Remainder;\r
+  UINTN  Remainder;\r
 \r
-  for (; Length > 0; Length--) {\r
-    Remainder      = Number % 10;\r
-    Number        /= 10;\r
-    Buffer[Length - 1] = (UINT8) ('0' + Remainder);\r
+  for ( ; Length > 0; Length--) {\r
+    Remainder          = Number % 10;\r
+    Number            /= 10;\r
+    Buffer[Length - 1] = (UINT8)('0' + Remainder);\r
   }\r
 }\r
 \r
@@ -95,10 +95,10 @@ HttpBootUintnToAscDecWithFormat (
 **/\r
 VOID\r
 HttpBootShowIp4Addr (\r
-  IN EFI_IPv4_ADDRESS   *Ip\r
+  IN EFI_IPv4_ADDRESS  *Ip\r
   )\r
 {\r
-  UINTN                 Index;\r
+  UINTN  Index;\r
 \r
   for (Index = 0; Index < 4; Index++) {\r
     AsciiPrint ("%d", Ip->Addr[Index]);\r
@@ -116,23 +116,25 @@ HttpBootShowIp4Addr (
 **/\r
 VOID\r
 HttpBootShowIp6Addr (\r
-  IN EFI_IPv6_ADDRESS   *Ip\r
+  IN EFI_IPv6_ADDRESS  *Ip\r
   )\r
 {\r
-  UINTN                 Index;\r
+  UINTN  Index;\r
 \r
   for (Index = 0; Index < 16; Index++) {\r
-\r
     if (Ip->Addr[Index] != 0) {\r
       AsciiPrint ("%x", Ip->Addr[Index]);\r
     }\r
+\r
     Index++;\r
     if (Index > 15) {\r
       return;\r
     }\r
+\r
     if (((Ip->Addr[Index] & 0xf0) == 0) && (Ip->Addr[Index - 1] != 0)) {\r
       AsciiPrint ("0");\r
     }\r
+\r
     AsciiPrint ("%x", Ip->Addr[Index]);\r
     if (Index < 15) {\r
       AsciiPrint (":");\r
@@ -148,142 +150,141 @@ HttpBootShowIp6Addr (
 **/\r
 VOID\r
 HttpBootPrintErrorMessage (\r
-  EFI_HTTP_STATUS_CODE            StatusCode\r
+  EFI_HTTP_STATUS_CODE  StatusCode\r
   )\r
 {\r
   AsciiPrint ("\n");\r
 \r
   switch (StatusCode) {\r
-  case HTTP_STATUS_300_MULTIPLE_CHOICES:\r
-    AsciiPrint ("\n  Redirection: 300 Multiple Choices");\r
-    break;\r
-\r
-  case HTTP_STATUS_301_MOVED_PERMANENTLY:\r
-    AsciiPrint ("\n  Redirection: 301 Moved Permanently");\r
-    break;\r
+    case HTTP_STATUS_300_MULTIPLE_CHOICES:\r
+      AsciiPrint ("\n  Redirection: 300 Multiple Choices");\r
+      break;\r
 \r
-  case HTTP_STATUS_302_FOUND:\r
-    AsciiPrint ("\n  Redirection: 302 Found");\r
-    break;\r
+    case HTTP_STATUS_301_MOVED_PERMANENTLY:\r
+      AsciiPrint ("\n  Redirection: 301 Moved Permanently");\r
+      break;\r
 \r
-  case HTTP_STATUS_303_SEE_OTHER:\r
-    AsciiPrint ("\n  Redirection: 303 See Other");\r
-    break;\r
+    case HTTP_STATUS_302_FOUND:\r
+      AsciiPrint ("\n  Redirection: 302 Found");\r
+      break;\r
 \r
-  case HTTP_STATUS_304_NOT_MODIFIED:\r
-    AsciiPrint ("\n  Redirection: 304 Not Modified");\r
-    break;\r
+    case HTTP_STATUS_303_SEE_OTHER:\r
+      AsciiPrint ("\n  Redirection: 303 See Other");\r
+      break;\r
 \r
-  case HTTP_STATUS_305_USE_PROXY:\r
-    AsciiPrint ("\n  Redirection: 305 Use Proxy");\r
-    break;\r
+    case HTTP_STATUS_304_NOT_MODIFIED:\r
+      AsciiPrint ("\n  Redirection: 304 Not Modified");\r
+      break;\r
 \r
-  case HTTP_STATUS_307_TEMPORARY_REDIRECT:\r
-    AsciiPrint ("\n  Redirection: 307 Temporary Redirect");\r
-    break;\r
+    case HTTP_STATUS_305_USE_PROXY:\r
+      AsciiPrint ("\n  Redirection: 305 Use Proxy");\r
+      break;\r
 \r
-  case HTTP_STATUS_308_PERMANENT_REDIRECT:\r
-    AsciiPrint ("\n  Redirection: 308 Permanent Redirect");\r
-    break;\r
+    case HTTP_STATUS_307_TEMPORARY_REDIRECT:\r
+      AsciiPrint ("\n  Redirection: 307 Temporary Redirect");\r
+      break;\r
 \r
-  case HTTP_STATUS_400_BAD_REQUEST:\r
-    AsciiPrint ("\n  Client Error: 400 Bad Request");\r
-    break;\r
+    case HTTP_STATUS_308_PERMANENT_REDIRECT:\r
+      AsciiPrint ("\n  Redirection: 308 Permanent Redirect");\r
+      break;\r
 \r
-  case HTTP_STATUS_401_UNAUTHORIZED:\r
-    AsciiPrint ("\n  Client Error: 401 Unauthorized");\r
-    break;\r
+    case HTTP_STATUS_400_BAD_REQUEST:\r
+      AsciiPrint ("\n  Client Error: 400 Bad Request");\r
+      break;\r
 \r
-  case HTTP_STATUS_402_PAYMENT_REQUIRED:\r
-    AsciiPrint ("\n  Client Error: 402 Payment Required");\r
-    break;\r
+    case HTTP_STATUS_401_UNAUTHORIZED:\r
+      AsciiPrint ("\n  Client Error: 401 Unauthorized");\r
+      break;\r
 \r
-  case HTTP_STATUS_403_FORBIDDEN:\r
-    AsciiPrint ("\n  Client Error: 403 Forbidden");\r
-    break;\r
+    case HTTP_STATUS_402_PAYMENT_REQUIRED:\r
+      AsciiPrint ("\n  Client Error: 402 Payment Required");\r
+      break;\r
 \r
-  case HTTP_STATUS_404_NOT_FOUND:\r
-    AsciiPrint ("\n  Client Error: 404 Not Found");\r
-    break;\r
+    case HTTP_STATUS_403_FORBIDDEN:\r
+      AsciiPrint ("\n  Client Error: 403 Forbidden");\r
+      break;\r
 \r
-  case HTTP_STATUS_405_METHOD_NOT_ALLOWED:\r
-    AsciiPrint ("\n  Client Error: 405 Method Not Allowed");\r
-    break;\r
+    case HTTP_STATUS_404_NOT_FOUND:\r
+      AsciiPrint ("\n  Client Error: 404 Not Found");\r
+      break;\r
 \r
-  case HTTP_STATUS_406_NOT_ACCEPTABLE:\r
-    AsciiPrint ("\n  Client Error: 406 Not Acceptable");\r
-    break;\r
+    case HTTP_STATUS_405_METHOD_NOT_ALLOWED:\r
+      AsciiPrint ("\n  Client Error: 405 Method Not Allowed");\r
+      break;\r
 \r
-  case HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED:\r
-    AsciiPrint ("\n  Client Error: 407 Proxy Authentication Required");\r
-    break;\r
+    case HTTP_STATUS_406_NOT_ACCEPTABLE:\r
+      AsciiPrint ("\n  Client Error: 406 Not Acceptable");\r
+      break;\r
 \r
-  case HTTP_STATUS_408_REQUEST_TIME_OUT:\r
-    AsciiPrint ("\n  Client Error: 408 Request Timeout");\r
-    break;\r
+    case HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED:\r
+      AsciiPrint ("\n  Client Error: 407 Proxy Authentication Required");\r
+      break;\r
 \r
-  case HTTP_STATUS_409_CONFLICT:\r
-    AsciiPrint ("\n  Client Error: 409 Conflict");\r
-    break;\r
+    case HTTP_STATUS_408_REQUEST_TIME_OUT:\r
+      AsciiPrint ("\n  Client Error: 408 Request Timeout");\r
+      break;\r
 \r
-  case HTTP_STATUS_410_GONE:\r
-    AsciiPrint ("\n  Client Error: 410 Gone");\r
-    break;\r
+    case HTTP_STATUS_409_CONFLICT:\r
+      AsciiPrint ("\n  Client Error: 409 Conflict");\r
+      break;\r
 \r
-  case HTTP_STATUS_411_LENGTH_REQUIRED:\r
-    AsciiPrint ("\n  Client Error: 411 Length Required");\r
-    break;\r
+    case HTTP_STATUS_410_GONE:\r
+      AsciiPrint ("\n  Client Error: 410 Gone");\r
+      break;\r
 \r
-  case HTTP_STATUS_412_PRECONDITION_FAILED:\r
-    AsciiPrint ("\n  Client Error: 412 Precondition Failed");\r
-    break;\r
+    case HTTP_STATUS_411_LENGTH_REQUIRED:\r
+      AsciiPrint ("\n  Client Error: 411 Length Required");\r
+      break;\r
 \r
-  case HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE:\r
-    AsciiPrint ("\n  Client Error: 413 Request Entity Too Large");\r
-    break;\r
+    case HTTP_STATUS_412_PRECONDITION_FAILED:\r
+      AsciiPrint ("\n  Client Error: 412 Precondition Failed");\r
+      break;\r
 \r
-  case HTTP_STATUS_414_REQUEST_URI_TOO_LARGE:\r
-    AsciiPrint ("\n  Client Error: 414 Request URI Too Long");\r
-    break;\r
+    case HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE:\r
+      AsciiPrint ("\n  Client Error: 413 Request Entity Too Large");\r
+      break;\r
 \r
-  case HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE:\r
-    AsciiPrint ("\n  Client Error: 415 Unsupported Media Type");\r
-    break;\r
+    case HTTP_STATUS_414_REQUEST_URI_TOO_LARGE:\r
+      AsciiPrint ("\n  Client Error: 414 Request URI Too Long");\r
+      break;\r
 \r
-  case HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED:\r
-    AsciiPrint ("\n  Client Error: 416 Requested Range Not Satisfiable");\r
-    break;\r
+    case HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE:\r
+      AsciiPrint ("\n  Client Error: 415 Unsupported Media Type");\r
+      break;\r
 \r
-  case HTTP_STATUS_417_EXPECTATION_FAILED:\r
-    AsciiPrint ("\n  Client Error: 417 Expectation Failed");\r
-    break;\r
+    case HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED:\r
+      AsciiPrint ("\n  Client Error: 416 Requested Range Not Satisfiable");\r
+      break;\r
 \r
-  case HTTP_STATUS_500_INTERNAL_SERVER_ERROR:\r
-    AsciiPrint ("\n  Server Error: 500 Internal Server Error");\r
-    break;\r
+    case HTTP_STATUS_417_EXPECTATION_FAILED:\r
+      AsciiPrint ("\n  Client Error: 417 Expectation Failed");\r
+      break;\r
 \r
-  case HTTP_STATUS_501_NOT_IMPLEMENTED:\r
-    AsciiPrint ("\n  Server Error: 501 Not Implemented");\r
-    break;\r
+    case HTTP_STATUS_500_INTERNAL_SERVER_ERROR:\r
+      AsciiPrint ("\n  Server Error: 500 Internal Server Error");\r
+      break;\r
 \r
-  case HTTP_STATUS_502_BAD_GATEWAY:\r
-    AsciiPrint ("\n  Server Error: 502 Bad Gateway");\r
-    break;\r
+    case HTTP_STATUS_501_NOT_IMPLEMENTED:\r
+      AsciiPrint ("\n  Server Error: 501 Not Implemented");\r
+      break;\r
 \r
-  case HTTP_STATUS_503_SERVICE_UNAVAILABLE:\r
-    AsciiPrint ("\n  Server Error: 503 Service Unavailable");\r
-    break;\r
+    case HTTP_STATUS_502_BAD_GATEWAY:\r
+      AsciiPrint ("\n  Server Error: 502 Bad Gateway");\r
+      break;\r
 \r
-  case HTTP_STATUS_504_GATEWAY_TIME_OUT:\r
-    AsciiPrint ("\n  Server Error: 504 Gateway Timeout");\r
-    break;\r
+    case HTTP_STATUS_503_SERVICE_UNAVAILABLE:\r
+      AsciiPrint ("\n  Server Error: 503 Service Unavailable");\r
+      break;\r
 \r
-  case HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED:\r
-    AsciiPrint ("\n  Server Error: 505 HTTP Version Not Supported");\r
-    break;\r
+    case HTTP_STATUS_504_GATEWAY_TIME_OUT:\r
+      AsciiPrint ("\n  Server Error: 504 Gateway Timeout");\r
+      break;\r
 \r
-  default: ;\r
+    case HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED:\r
+      AsciiPrint ("\n  Server Error: 505 HTTP Version Not Supported");\r
+      break;\r
 \r
+    default:;\r
   }\r
 }\r
 \r
@@ -297,11 +298,11 @@ HttpBootPrintErrorMessage (
 VOID\r
 EFIAPI\r
 HttpBootCommonNotify (\r
-  IN EFI_EVENT           Event,\r
-  IN VOID                *Context\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
   )\r
 {\r
-  *((BOOLEAN *) Context) = TRUE;\r
+  *((BOOLEAN *)Context) = TRUE;\r
 }\r
 \r
 /**\r
@@ -317,38 +318,38 @@ HttpBootCommonNotify (
 **/\r
 EFI_STATUS\r
 HttpBootDns (\r
-  IN     HTTP_BOOT_PRIVATE_DATA   *Private,\r
-  IN     CHAR16                   *HostName,\r
-     OUT EFI_IPv6_ADDRESS         *IpAddress\r
+  IN     HTTP_BOOT_PRIVATE_DATA  *Private,\r
+  IN     CHAR16                  *HostName,\r
+  OUT EFI_IPv6_ADDRESS           *IpAddress\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
-  EFI_DNS6_PROTOCOL               *Dns6;\r
-  EFI_DNS6_CONFIG_DATA            Dns6ConfigData;\r
-  EFI_DNS6_COMPLETION_TOKEN       Token;\r
-  EFI_HANDLE                      Dns6Handle;\r
-  EFI_IP6_CONFIG_PROTOCOL         *Ip6Config;\r
-  EFI_IPv6_ADDRESS                *DnsServerList;\r
-  UINTN                           DnsServerListCount;\r
-  UINTN                           DataSize;\r
-  BOOLEAN                         IsDone;\r
-\r
-  DnsServerList       = NULL;\r
-  DnsServerListCount  = 0;\r
-  Dns6                = NULL;\r
-  Dns6Handle          = NULL;\r
+  EFI_STATUS                 Status;\r
+  EFI_DNS6_PROTOCOL          *Dns6;\r
+  EFI_DNS6_CONFIG_DATA       Dns6ConfigData;\r
+  EFI_DNS6_COMPLETION_TOKEN  Token;\r
+  EFI_HANDLE                 Dns6Handle;\r
+  EFI_IP6_CONFIG_PROTOCOL    *Ip6Config;\r
+  EFI_IPv6_ADDRESS           *DnsServerList;\r
+  UINTN                      DnsServerListCount;\r
+  UINTN                      DataSize;\r
+  BOOLEAN                    IsDone;\r
+\r
+  DnsServerList      = NULL;\r
+  DnsServerListCount = 0;\r
+  Dns6               = NULL;\r
+  Dns6Handle         = NULL;\r
   ZeroMem (&Token, sizeof (EFI_DNS6_COMPLETION_TOKEN));\r
 \r
   //\r
   // Get DNS server list from EFI IPv6 Configuration protocol.\r
   //\r
-  Status = gBS->HandleProtocol (Private->Controller, &gEfiIp6ConfigProtocolGuid, (VOID **) &Ip6Config);\r
+  Status = gBS->HandleProtocol (Private->Controller, &gEfiIp6ConfigProtocolGuid, (VOID **)&Ip6Config);\r
   if (!EFI_ERROR (Status)) {\r
     //\r
     // Get the required size.\r
     //\r
     DataSize = 0;\r
-    Status = Ip6Config->GetData (Ip6Config, Ip6ConfigDataTypeDnsServer, &DataSize, NULL);\r
+    Status   = Ip6Config->GetData (Ip6Config, Ip6ConfigDataTypeDnsServer, &DataSize, NULL);\r
     if (Status == EFI_BUFFER_TOO_SMALL) {\r
       DnsServerList = AllocatePool (DataSize);\r
       if (DnsServerList == NULL) {\r
@@ -364,6 +365,7 @@ HttpBootDns (
       }\r
     }\r
   }\r
+\r
   //\r
   // Create a DNSv6 child instance and get the protocol.\r
   //\r
@@ -380,7 +382,7 @@ HttpBootDns (
   Status = gBS->OpenProtocol (\r
                   Dns6Handle,\r
                   &gEfiDns6ProtocolGuid,\r
-                  (VOID **) &Dns6,\r
+                  (VOID **)&Dns6,\r
                   Private->Ip6Nic->ImageHandle,\r
                   Private->Controller,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -397,11 +399,11 @@ HttpBootDns (
   Dns6ConfigData.DnsServerList  = DnsServerList;\r
   Dns6ConfigData.EnableDnsCache = TRUE;\r
   Dns6ConfigData.Protocol       = EFI_IP_PROTO_UDP;\r
-  IP6_COPY_ADDRESS (&Dns6ConfigData.StationIp,&Private->StationIp.v6);\r
+  IP6_COPY_ADDRESS (&Dns6ConfigData.StationIp, &Private->StationIp.v6);\r
   Status = Dns6->Configure (\r
-                    Dns6,\r
-                    &Dns6ConfigData\r
-                    );\r
+                   Dns6,\r
+                   &Dns6ConfigData\r
+                   );\r
   if (EFI_ERROR (Status)) {\r
     goto Exit;\r
   }\r
@@ -443,25 +445,30 @@ HttpBootDns (
       Status = EFI_DEVICE_ERROR;\r
       goto Exit;\r
     }\r
-    if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {\r
+\r
+    if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {\r
       Status = EFI_DEVICE_ERROR;\r
       goto Exit;\r
     }\r
+\r
     //\r
     // We just return the first IPv6 address from DNS protocol.\r
     //\r
     IP6_COPY_ADDRESS (IpAddress, Token.RspData.H2AData->IpList);\r
     Status = EFI_SUCCESS;\r
   }\r
+\r
 Exit:\r
 \r
   if (Token.Event != NULL) {\r
     gBS->CloseEvent (Token.Event);\r
   }\r
+\r
   if (Token.RspData.H2AData != NULL) {\r
     if (Token.RspData.H2AData->IpList != NULL) {\r
       FreePool (Token.RspData.H2AData->IpList);\r
     }\r
+\r
     FreePool (Token.RspData.H2AData);\r
   }\r
 \r
@@ -504,11 +511,11 @@ Exit:
 **/\r
 EFI_STATUS\r
 HttpBootCheckUriScheme (\r
-  IN      CHAR8                  *Uri\r
+  IN      CHAR8  *Uri\r
   )\r
 {\r
-  UINTN                Index;\r
-  EFI_STATUS           Status;\r
+  UINTN       Index;\r
+  EFI_STATUS  Status;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
@@ -519,7 +526,8 @@ HttpBootCheckUriScheme (
     if (Uri[Index] == ':') {\r
       break;\r
     }\r
-    if (Uri[Index] >= 'A' && Uri[Index] <= 'Z') {\r
+\r
+    if ((Uri[Index] >= 'A') && (Uri[Index] <= 'Z')) {\r
       Uri[Index] -= (CHAR8)('A' - 'a');\r
     }\r
   }\r
@@ -557,8 +565,8 @@ HttpBootCheckUriScheme (
 **/\r
 EFI_STATUS\r
 HttpBootParseFilePath (\r
-  IN     EFI_DEVICE_PATH_PROTOCOL     *FilePath,\r
-     OUT CHAR8                        **UriAddress\r
+  IN     EFI_DEVICE_PATH_PROTOCOL  *FilePath,\r
+  OUT CHAR8                        **UriAddress\r
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;\r
@@ -578,28 +586,32 @@ HttpBootParseFilePath (
   TempDevicePath = FilePath;\r
   while (!IsDevicePathEnd (TempDevicePath)) {\r
     if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH) &&\r
-        (DevicePathSubType (TempDevicePath) == MSG_URI_DP)) {\r
-      UriDevicePath = (URI_DEVICE_PATH*) TempDevicePath;\r
+        (DevicePathSubType (TempDevicePath) == MSG_URI_DP))\r
+    {\r
+      UriDevicePath = (URI_DEVICE_PATH *)TempDevicePath;\r
       //\r
       // UEFI Spec doesn't require the URI to be a NULL-terminated string\r
       // So we allocate a new buffer and always append a '\0' to it.\r
       //\r
-      UriStrLength = DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);\r
+      UriStrLength = DevicePathNodeLength (UriDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL);\r
       if (UriStrLength == 0) {\r
         //\r
         // return a NULL UriAddress if it's a empty URI device path node.\r
         //\r
         break;\r
       }\r
+\r
       Uri = AllocatePool (UriStrLength + 1);\r
       if (Uri == NULL) {\r
         return EFI_OUT_OF_RESOURCES;\r
       }\r
-      CopyMem (Uri, UriDevicePath->Uri, DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL));\r
-      Uri[DevicePathNodeLength (UriDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL)] = '\0';\r
+\r
+      CopyMem (Uri, UriDevicePath->Uri, DevicePathNodeLength (UriDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL));\r
+      Uri[DevicePathNodeLength (UriDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL)] = '\0';\r
 \r
       *UriAddress = Uri;\r
     }\r
+\r
     TempDevicePath = NextDevicePathNode (TempDevicePath);\r
   }\r
 \r
@@ -625,23 +637,23 @@ HttpBootParseFilePath (
 **/\r
 EFI_STATUS\r
 HttpBootCheckImageType (\r
-  IN      CHAR8                  *Uri,\r
-  IN      VOID                   *UriParser,\r
-  IN      UINTN                  HeaderCount,\r
-  IN      EFI_HTTP_HEADER        *Headers,\r
-     OUT  HTTP_BOOT_IMAGE_TYPE   *ImageType\r
+  IN      CHAR8              *Uri,\r
+  IN      VOID               *UriParser,\r
+  IN      UINTN              HeaderCount,\r
+  IN      EFI_HTTP_HEADER    *Headers,\r
+  OUT  HTTP_BOOT_IMAGE_TYPE  *ImageType\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  EFI_HTTP_HEADER       *Header;\r
-  CHAR8                 *FilePath;\r
-  CHAR8                 *FilePost;\r
+  EFI_STATUS       Status;\r
+  EFI_HTTP_HEADER  *Header;\r
+  CHAR8            *FilePath;\r
+  CHAR8            *FilePost;\r
 \r
-  if (Uri == NULL || UriParser == NULL || ImageType == NULL) {\r
+  if ((Uri == NULL) || (UriParser == NULL) || (ImageType == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (HeaderCount != 0 && Headers == NULL) {\r
+  if ((HeaderCount != 0) && (Headers == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -712,22 +724,22 @@ HttpBootCheckImageType (
 **/\r
 EFI_STATUS\r
 HttpBootRegisterRamDisk (\r
-  IN  HTTP_BOOT_PRIVATE_DATA       *Private,\r
-  IN  UINTN                        BufferSize,\r
-  IN  VOID                         *Buffer,\r
-  IN  HTTP_BOOT_IMAGE_TYPE         ImageType\r
+  IN  HTTP_BOOT_PRIVATE_DATA  *Private,\r
+  IN  UINTN                   BufferSize,\r
+  IN  VOID                    *Buffer,\r
+  IN  HTTP_BOOT_IMAGE_TYPE    ImageType\r
   )\r
 {\r
-  EFI_RAM_DISK_PROTOCOL      *RamDisk;\r
-  EFI_STATUS                 Status;\r
-  EFI_DEVICE_PATH_PROTOCOL   *DevicePath;\r
-  EFI_GUID                   *RamDiskType;\r
+  EFI_RAM_DISK_PROTOCOL     *RamDisk;\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_GUID                  *RamDiskType;\r
 \r
   ASSERT (Private != NULL);\r
   ASSERT (Buffer != NULL);\r
   ASSERT (BufferSize != 0);\r
 \r
-  Status = gBS->LocateProtocol (&gEfiRamDiskProtocolGuid, NULL, (VOID**) &RamDisk);\r
+  Status = gBS->LocateProtocol (&gEfiRamDiskProtocolGuid, NULL, (VOID **)&RamDisk);\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((DEBUG_ERROR, "HTTP Boot: Couldn't find the RAM Disk protocol - %r\n", Status));\r
     return Status;\r
@@ -742,12 +754,12 @@ HttpBootRegisterRamDisk (
   }\r
 \r
   Status = RamDisk->Register (\r
-             (UINTN)Buffer,\r
-             (UINT64)BufferSize,\r
-             RamDiskType,\r
-             Private->UsingIpv6 ? Private->Ip6Nic->DevicePath : Private->Ip4Nic->DevicePath,\r
-             &DevicePath\r
-             );\r
+                      (UINTN)Buffer,\r
+                      (UINT64)BufferSize,\r
+                      RamDiskType,\r
+                      Private->UsingIpv6 ? Private->Ip6Nic->DevicePath : Private->Ip4Nic->DevicePath,\r
+                      &DevicePath\r
+                      );\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((DEBUG_ERROR, "HTTP Boot: Failed to register RAM Disk - %r\n", Status));\r
   }\r
@@ -765,13 +777,14 @@ HttpBootRegisterRamDisk (
 **/\r
 BOOLEAN\r
 HttpBootIsHttpRedirectStatusCode (\r
-  IN   EFI_HTTP_STATUS_CODE        StatusCode\r
+  IN   EFI_HTTP_STATUS_CODE  StatusCode\r
   )\r
 {\r
-  if (StatusCode == HTTP_STATUS_301_MOVED_PERMANENTLY ||\r
-      StatusCode == HTTP_STATUS_302_FOUND ||\r
-      StatusCode == HTTP_STATUS_307_TEMPORARY_REDIRECT ||\r
-      StatusCode == HTTP_STATUS_308_PERMANENT_REDIRECT) {\r
+  if ((StatusCode == HTTP_STATUS_301_MOVED_PERMANENTLY) ||\r
+      (StatusCode == HTTP_STATUS_302_FOUND) ||\r
+      (StatusCode == HTTP_STATUS_307_TEMPORARY_REDIRECT) ||\r
+      (StatusCode == HTTP_STATUS_308_PERMANENT_REDIRECT))\r
+  {\r
     return TRUE;\r
   }\r
 \r