HelloWorld: Use ConsolePrint to simplify code and fix GCC build
AsciiSprint takes a CHAR8 buffer to write to whereas ConsoleWrite expects a UINT8 buffer. This causes GCC to complain: /.../sources/slimbootloader/PayloadPkg/HelloWorld/HelloWorld.c: In function ‘PayloadMain’: /.../sources/slimbootloader/PayloadPkg/HelloWorld/HelloWorld.c:36:25: error: pointer targets in passing argument 1 of ‘ConsoleWrite’ differ in signedness [-Werror=pointer-sign] 36 | ConsoleWrite (Message, Len); | ^~~~~~~ | | | CHAR8 * {aka char *} In file included from /.../sources/slimbootloader/PayloadPkg/HelloWorld/HelloWorld.h:18, from /.../sources/slimbootloader/PayloadPkg/HelloWorld/HelloWorld.c:8: /.../sources/slimbootloader/BootloaderCommonPkg/Include/Library/ConsoleOutLib.h:103:17: note: expected ‘UINT8 *’ {aka ‘unsigned char *’} but argument is of type ‘CHAR8 *’ {aka ‘char *’} 103 | IN UINT8 *Buffer, | ~~~~~~~~~~~^~~~~~ Let's avoid the whole problem and simplify the code too by just calling ConsolePrint instead. Signed-off-by: Mike Crowe <mac@mcrowe.com>
This commit is contained in:
parent
5cc4995d6f
commit
632fad9a5e
|
@ -22,8 +22,6 @@ PayloadMain (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 Key;
|
UINT8 Key;
|
||||||
CHAR8 Message[64];
|
|
||||||
UINTN Len;
|
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "\n\n==================== Hello World ====================\n\n"));
|
DEBUG ((DEBUG_INFO, "\n\n==================== Hello World ====================\n\n"));
|
||||||
|
|
||||||
|
@ -32,8 +30,7 @@ PayloadMain (
|
||||||
if (ConsolePoll ()) {
|
if (ConsolePoll ()) {
|
||||||
if (ConsoleRead (&Key, 1) > 0) {
|
if (ConsoleRead (&Key, 1) > 0) {
|
||||||
if ((Key >= 0x20) && (Key < 0x7F)) {
|
if ((Key >= 0x20) && (Key < 0x7F)) {
|
||||||
Len = AsciiSPrint (Message, sizeof (Message), "Key '%c' pressed !\n", Key);
|
ConsolePrint("Key '%c' pressed !\n", Key);
|
||||||
ConsoleWrite (Message, Len);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue