From b5a6c9d9e0d288b0eb4438e4558f8e1d4f2731a7 Mon Sep 17 00:00:00 2001 From: mdkinney Date: Tue, 18 Aug 2009 21:00:02 +0000 Subject: [PATCH] Update BasePrintLib to work correctly on compilers where VA_LIST is a structure git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9109 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BasePrintLib/PrintLib.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/BasePrintLib/PrintLib.c index 2066c7a1dd..3bf4d0c2ff 100644 --- a/MdePkg/Library/BasePrintLib/PrintLib.c +++ b/MdePkg/Library/BasePrintLib/PrintLib.c @@ -2,6 +2,7 @@ Base Print Library instance implementation. Copyright (c) 2006 - 2008, Intel Corporation
+ Portions Copyright (c) 2008-2009 Apple Inc.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -14,6 +15,14 @@ #include "PrintLibInternal.h" +// +// Declare a VA_LIST global variable that is used in calls to BasePrintLibSPrintMarker() +// when the BASE_LIST parameter is valid and the VA_LIST parameter is ignored. +// A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some +// compilers define VA_LIST to be a structure. +// +VA_LIST gNullVaList; + #define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0) /** @@ -109,7 +118,7 @@ UnicodeBSPrint ( { ASSERT_UNICODE_BUFFER (StartOfBuffer); ASSERT_UNICODE_BUFFER (FormatString); - return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, NULL, Marker); + return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker); } /** @@ -250,7 +259,7 @@ UnicodeBSPrintAsciiFormat ( ) { ASSERT_UNICODE_BUFFER (StartOfBuffer); - return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, NULL, Marker); + return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, gNullVaList, Marker); } /** @@ -441,7 +450,7 @@ AsciiBSPrint ( IN BASE_LIST Marker ) { - return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, NULL, Marker); + return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker); } /** @@ -581,7 +590,7 @@ AsciiBSPrintUnicodeFormat ( ) { ASSERT_UNICODE_BUFFER (FormatString); - return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, NULL, Marker); + return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker); } /**