]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/MnpDxe/ComponentName.c
BaseTools:Change the path of the file that Binary Cache
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / ComponentName.c
index 9e66dc254b4d041adcf94bda21a68168958cd25e..fe85c3bc239b1d075a90b945470f97b9cefcb613 100644 (file)
@@ -1,15 +1,8 @@
 /** @file\r
   UEFI Component Name(2) protocol implementation for MnpDxe driver.\r
 \r
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions\r
-of the BSD License which accompanies this distribution.  The full\r
-text of the license may be found at<BR>\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -107,10 +100,10 @@ MnpComponentNameGetDriverName (
 \r
   @param  Mnp[in]                 A pointer to the EFI_MANAGED_NETWORK_PROTOCOL.\r
 \r
-  \r
+\r
   @retval EFI_SUCCESS             Update the ControllerNameTable of this instance successfully.\r
   @retval EFI_INVALID_PARAMETER   The input parameter is invalid.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 UpdateName (\r
@@ -148,21 +141,22 @@ UpdateName (
     for (Index = 0; Index < SnpModeData.HwAddressSize; Index++) {\r
       OffSet += UnicodeSPrint (\r
                   HandleName + OffSet,\r
-                  sizeof (HandleName) - OffSet,\r
+                  sizeof (HandleName) - OffSet * sizeof (CHAR16),\r
                   L"%02X-",\r
                   SnpModeData.CurrentAddress.Addr[Index]\r
                   );\r
     }\r
+    ASSERT (OffSet > 0);\r
     //\r
     // Remove the last '-'\r
     //\r
-    OffSet--;  \r
+    OffSet--;\r
     //\r
     // Print the ProtocolType and VLAN ID for this instance.\r
     //\r
     OffSet += UnicodeSPrint (\r
                 HandleName + OffSet,\r
-                sizeof (HandleName) - OffSet,\r
+                sizeof (HandleName) - OffSet * sizeof (CHAR16),\r
                 L", ProtocolType=0x%X, VlanId=%d)",\r
                 MnpConfigData.ProtocolTypeFilter,\r
                 Instance->MnpServiceData->VlanId\r
@@ -176,12 +170,12 @@ UpdateName (
   } else {\r
     return Status;\r
   }\r
-  \r
+\r
   if (gMnpControllerNameTable != NULL) {\r
     FreeUnicodeStringTable (gMnpControllerNameTable);\r
     gMnpControllerNameTable = NULL;\r
   }\r
-  \r
+\r
   Status = AddUnicodeString2 (\r
              "eng",\r
              gMnpComponentName.SupportedLanguages,\r
@@ -192,7 +186,7 @@ UpdateName (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   return AddUnicodeString2 (\r
            "en",\r
            gMnpComponentName2.SupportedLanguages,\r
@@ -289,22 +283,22 @@ MnpComponentNameGetControllerName (
   if (ChildHandle == NULL) {\r
     return EFI_UNSUPPORTED;\r
   }\r
\r
-  // \r
-  // Make sure this driver is currently managing ControllerHandle  \r
-  // \r
+\r
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
   Status = EfiTestManagedDevice (\r
              ControllerHandle,\r
              gMnpDriverBinding.DriverBindingHandle,\r
              &gEfiSimpleNetworkProtocolGuid\r
              );\r
-  if (EFI_ERROR (Status)) { \r
+  if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
-  // \r
-  // Make sure this driver produced ChildHandle \r
-  // \r
+\r
+  //\r
+  // Make sure this driver produced ChildHandle\r
+  //\r
   Status = EfiTestChildHandle (\r
              ControllerHandle,\r
              ChildHandle,\r
@@ -314,9 +308,9 @@ MnpComponentNameGetControllerName (
     return Status;\r
   }\r
 \r
-  // \r
-  // Retrieve an instance of a produced protocol from ChildHandle  \r
-  // \r
+  //\r
+  // Retrieve an instance of a produced protocol from ChildHandle\r
+  //\r
   Status = gBS->OpenProtocol (\r
                   ChildHandle,\r
                   &gEfiManagedNetworkProtocolGuid,\r