Эх сурвалжийг харах

Define UnicodeSPrint/UnicodeVSPrint as our main SPrint/VSPrint calls

Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintLib.h
those are the names used by EDK2, so make these our official names as well.

For compatibility with older gnu-efi versions, also keep SPrint and VSPrint defined.
Pete Batard 4 жил өмнө
parent
commit
b39be0d5a9
4 өөрчлөгдсөн 20 нэмэгдсэн , 16 устгасан
  1. 9 5
      inc/efilib.h
  2. 1 1
      lib/error.c
  3. 2 2
      lib/guid.c
  4. 8 8
      lib/print.c

+ 9 - 5
inc/efilib.h

@@ -527,7 +527,7 @@ VPrint (
     );
 
 UINTN
-SPrint (
+UnicodeSPrint (
     OUT CHAR16        *Str,
     IN UINTN          StrSize,
     IN CONST CHAR16   *fmt,
@@ -535,7 +535,7 @@ SPrint (
     );
 
 UINTN
-VSPrint (
+UnicodeVSPrint (
     OUT CHAR16        *Str,
     IN UINTN          StrSize,
     IN CONST CHAR16   *fmt,
@@ -597,9 +597,6 @@ AsciiPrint (
     ...
     );
 
-/* For compatibility with previous versions */
-#define APrint AsciiPrint
-
 UINTN
 AsciiVSPrint(
     OUT CHAR8         *Str,
@@ -608,6 +605,13 @@ AsciiVSPrint(
     va_list           args
 );
 
+//
+// For compatibility with previous gnu-efi versions
+//
+#define SPrint      UnicodeSPrint
+#define VSPrint     UnicodeVSPrint
+#define APrint      AsciiPrint
+
 VOID
 ValueToHex (
     IN CHAR16   *Buffer,

+ 1 - 1
lib/error.c

@@ -79,5 +79,5 @@ StatusToString (
         }
     }
 
-    SPrint (Buffer, 0, L"%X", Status);
+    UnicodeSPrint (Buffer, 0, L"%X", Status);
 }

+ 2 - 2
lib/guid.c

@@ -154,7 +154,7 @@ GuidToString (
 
     for (Index=0; KnownGuids[Index].Guid; Index++) {
         if (CompareGuid(Guid, KnownGuids[Index].Guid) == 0) {
-            SPrint (Buffer, 0, KnownGuids[Index].GuidName);
+            UnicodeSPrint (Buffer, 0, KnownGuids[Index].GuidName);
             return ;
         }
     }
@@ -163,7 +163,7 @@ GuidToString (
     // Else dump it
     //
 
-    SPrint (Buffer, 0, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+    UnicodeSPrint (Buffer, 0, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
         Guid->Data1,
         Guid->Data2,
         Guid->Data3,

+ 8 - 8
lib/print.c

@@ -315,7 +315,7 @@ _SPrint (
     IN VOID     *Context,
     IN CHAR16   *Buffer
     )
-// Append string worker for SPrint, PoolPrint and CatPrint
+// Append string worker for UnicodeSPrint, PoolPrint and CatPrint
 {
     UINTN           len;
     POOL_PRINT      *spc;
@@ -405,7 +405,7 @@ _PoolCatPrint (
     IN OUT POOL_PRINT   *spc,
     IN INTN             (EFIAPI *Output)(VOID *context, CHAR16 *str)
     )
-// Dispatch function for SPrint, PoolPrint, and CatPrint
+// Dispatch function for UnicodeSPrint, PoolPrint, and CatPrint
 {
     PRINT_STATE         ps;
 
@@ -421,7 +421,7 @@ _PoolCatPrint (
 
 
 UINTN
-VSPrint (
+UnicodeVSPrint (
     OUT CHAR16        *Str,
     IN UINTN          StrSize,
     IN CONST CHAR16   *fmt,
@@ -463,7 +463,7 @@ Returns:
 }
 
 UINTN
-SPrint (
+UnicodeSPrint (
     OUT CHAR16        *Str,
     IN UINTN          StrSize,
     IN CONST CHAR16   *fmt,
@@ -494,7 +494,7 @@ Returns:
     UINTN            len;
 
     va_start (args, fmt);
-    len = VSPrint(Str, StrSize, fmt, args);
+    len = UnicodeVSPrint(Str, StrSize, fmt, args);
     va_end (args);
 
     return len;
@@ -872,7 +872,7 @@ Returns:
     String length returned in buffer
 
 --*/
-// Use Unicode VSPrint() and convert back to ASCII
+// Use UnicodeVSPrint() and convert back to ASCII
 {
     CHAR16 *UnicodeStr, *UnicodeFmt;
     UINTN i, Len;
@@ -887,7 +887,7 @@ Returns:
         return 0;
     }
 
-    Len = VSPrint(UnicodeStr, StrSize, UnicodeFmt, args);
+    Len = UnicodeVSPrint(UnicodeStr, StrSize, UnicodeFmt, args);
     FreePool(UnicodeFmt);
 
     // The strings are ASCII so just do a plain Unicode conversion
@@ -1467,7 +1467,7 @@ TimeToString (
     Year = Time->Year % 100;
 
     // bugbug: for now just print it any old way
-    SPrint (Buffer, 0, L"%02d/%02d/%02d  %02d:%02d%c",
+    UnicodeSPrint (Buffer, 0, L"%02d/%02d/%02d  %02d:%02d%c",
         Time->Month,
         Time->Day,
         Year,