Simplify BlDisplayInputDialog() saving input buffer
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 25s
Builds / ExectOS (i686) (push) Successful in 28s

This commit is contained in:
Rafal Kupiec 2024-01-02 12:12:59 +01:00
parent 5425abb19f
commit 3a0fd18211
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -528,21 +528,8 @@ BlDisplayInputDialog(IN PWCHAR Caption,
}
else if(Key.UnicodeChar == 0x0D)
{
/* ENTER key pressed, allocate memory for updated input text */
BufferLength = RtlWideStringLength(InputFieldBuffer, 0);
BlMemoryFreePool(*InputFieldText);
Status = BlMemoryAllocatePool(BufferLength * sizeof(WCHAR), (PVOID *)*InputFieldText);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to allocate memory, print error message and return status code */
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%lx)\n", Status);
BlDisplayErrorDialog(L"XTLDR", L"Failed to save input data.");
break;
}
/* Copy edit buffer into original buffer */
RtlZeroMemory(InputFieldText, BufferLength * sizeof(WCHAR));
RtlCopyMemory(*InputFieldText, InputFieldBuffer, BufferLength * sizeof(WCHAR));
/* ENTER key pressed, update input buffer */
*InputFieldText = InputFieldBuffer;
break;
}
else