]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Safely use MDE StrSize(), instead of its own function calculating string size, becaus...
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Apr 2007 08:36:34 +0000 (08:36 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Apr 2007 08:36:34 +0000 (08:36 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2582 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c

index cd38536836460ca85780c2e48e51d89aa7fcef18..589217a992c3a88e28ce9b362159b994e9485f9e 100644 (file)
@@ -59,39 +59,6 @@ ReleaseLockOnlyAtBootTime (
   }\r
 }\r
 \r
   }\r
 }\r
 \r
-/**
-  A temparaty function that returns the size of a Null-terminated Unicode
-  string in bytes, including the Null terminator.
-
-  This function returns the size, in bytes, of the Null-terminated Unicode
-  string specified by String. It duplicates the functionality of StrSize()
-  in MDE library, but avoids using PCD, because IPF currently cannot convert
-  address of global variable for runtime.
-
-  If String is NULL, then ASSERT().
-  If String is not aligned on a 16-bit boundary, then ASSERT().
-
-  @param  String  Pointer to a Null-terminated Unicode string.
-
-  @return The size of String.
-
-**/
-STATIC
-UINTN
-StrSizeOfVariableName (
-  IN      CONST CHAR16              *String
-  )
-{
-  UINTN                             Length;
-
-  ASSERT (String != NULL);
-  ASSERT (((UINTN) String & 0x01) == 0);
-
-  for (Length = 0; *String != L'\0'; String++, Length++);
-
-  return (Length + 1) * sizeof (*String);
-}
-\r
 STATIC\r
 BOOLEAN\r
 EFIAPI\r
 STATIC\r
 BOOLEAN\r
 EFIAPI\r
@@ -868,7 +835,7 @@ Returns:
     //\r
     Status = EFI_WRITE_PROTECTED;\r
     goto Done;\r
     //\r
     Status = EFI_WRITE_PROTECTED;\r
     goto Done;\r
-  } else if (sizeof (VARIABLE_HEADER) + StrSizeOfVariableName (VariableName) + DataSize > MAX_VARIABLE_SIZE) {\r
+  } else if (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE) {\r
     //\r
     //  The size of the VariableName, including the Unicode Null in bytes plus\r
     //  the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
     //\r
     //  The size of the VariableName, including the Unicode Null in bytes plus\r
     //  the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
@@ -977,7 +944,7 @@ Returns:
     //\r
     NextVariable->Reserved  = 0;\r
     VarNameOffset           = sizeof (VARIABLE_HEADER);\r
     //\r
     NextVariable->Reserved  = 0;\r
     VarNameOffset           = sizeof (VARIABLE_HEADER);\r
-    VarNameSize             = StrSizeOfVariableName (VariableName);\r
+    VarNameSize             = StrSize (VariableName);\r
     CopyMem (\r
       (UINT8 *) ((UINTN) NextVariable + VarNameOffset),\r
       VariableName,\r
     CopyMem (\r
       (UINT8 *) ((UINTN) NextVariable + VarNameOffset),\r
       VariableName,\r