From 63fffe4e7227291ae5a74d0ee1b44ec2af0eff6a Mon Sep 17 00:00:00 2001 From: eric_tian Date: Thu, 4 Jun 2009 13:50:14 +0000 Subject: [PATCH] fix the issue when passing a L"" string to PrintXY. 1. According to the value of RowInfoArraySize to get the actual number of printed line. 2. If RowInfoArraySize equates 0, then it means nothing is printed. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8464 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/UefiLib/UefiLibPrint.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/MdePkg/Library/UefiLib/UefiLibPrint.c b/MdePkg/Library/UefiLib/UefiLibPrint.c index 9dc3a5a200..55487259fc 100644 --- a/MdePkg/Library/UefiLib/UefiLibPrint.c +++ b/MdePkg/Library/UefiLib/UefiLibPrint.c @@ -347,6 +347,9 @@ InternalPrintGraphic ( EFI_UGA_DRAW_PROTOCOL *UgaDraw; EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto; EFI_HANDLE ConsoleHandle; + UINTN Width; + UINTN Height; + UINTN Delta; HorizontalResolution = 0; VerticalResolution = 0; @@ -485,6 +488,15 @@ InternalPrintGraphic ( // ASSERT (RowInfoArraySize <= 1); + if (RowInfoArraySize != 0) { + Width = RowInfoArray[0].LineWidth; + Height = RowInfoArray[0].LineHeight; + Delta = Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL); + } else { + Width = 0; + Height = 0; + Delta = 0; + } Status = UgaDraw->Blt ( UgaDraw, (EFI_UGA_PIXEL *) Blt->Image.Bitmap, @@ -493,9 +505,9 @@ InternalPrintGraphic ( PointY, PointX, PointY, - RowInfoArray[0].LineWidth, - RowInfoArray[0].LineHeight, - Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) + Width, + Height, + Delta ); } else { goto Error; @@ -507,7 +519,11 @@ InternalPrintGraphic ( // // Calculate the number of actual printed characters // - PrintNum = RowInfoArray[0].EndIndex - RowInfoArray[0].StartIndex + 1; + if (RowInfoArraySize != 0) { + PrintNum = RowInfoArray[0].EndIndex - RowInfoArray[0].StartIndex + 1; + } else { + PrintNum = 0; + } FreePool (RowInfoArray); FreePool (Blt); -- 2.39.2