[FREELDR] Minor formatting for MsgBox functions + add SAL annotations
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 11 Mar 2024 16:22:37 +0000 (17:22 +0100)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 11 Mar 2024 21:37:38 +0000 (22:37 +0100)
boot/freeldr/freeldr/include/ui.h
boot/freeldr/freeldr/include/ui/gui.h
boot/freeldr/freeldr/include/ui/noui.h
boot/freeldr/freeldr/include/ui/tui.h
boot/freeldr/freeldr/ui/directui.c
boot/freeldr/freeldr/ui/gui.c
boot/freeldr/freeldr/ui/noui.c
boot/freeldr/freeldr/ui/tui.c
boot/freeldr/freeldr/ui/ui.c

index 7a7e5cf..1b47cc8 100644 (file)
@@ -49,11 +49,7 @@ extern CHAR UiTimeText[260];
 
 extern const PCSTR UiMonthNames[12];
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// User Interface Functions
-//
-///////////////////////////////////////////////////////////////////////////////////////
+/* User Interface Functions **************************************************/
 
 BOOLEAN    UiInitialize(BOOLEAN ShowUi);                                // Initialize User-Interface
 VOID    UiUnInitialize(PCSTR BootText);                        // Un-initialize User-Interface
@@ -91,10 +87,21 @@ UiDrawCenteredText(
 
 VOID    UiDrawStatusText(PCSTR StatusText);                    // Draws text at the very bottom line on the screen
 VOID    UiUpdateDateTime(VOID);                                    // Updates the date and time
-VOID    UiInfoBox(PCSTR MessageText);                            // Displays a info box on the screen
-VOID    UiMessageBox(PCSTR Format, ...);                        // Displays a message box on the screen with an ok button
-VOID    UiMessageBoxCritical(PCSTR MessageText);                // Displays a message box on the screen with an ok button using no system resources
 
+/* Displays an info box on the screen */
+VOID
+UiInfoBox(
+    _In_ PCSTR MessageText);
+
+/* Displays a message box on the screen with an ok button */
+VOID
+UiMessageBox(
+    _In_ PCSTR Format, ...);
+
+/* Displays a message box on the screen with an ok button using no system resources */
+VOID
+UiMessageBoxCritical(
+    _In_ PCSTR MessageText);
 
 /* Loading Progress-Bar Functions ********************************************/
 
@@ -192,11 +199,7 @@ UCHAR    UiTextToFillStyle(PCSTR FillStyleText);                // Converts the
 VOID    UiFadeInBackdrop(VOID);                                    // Draws the backdrop and fades the screen in
 VOID    UiFadeOut(VOID);                                        // Fades the screen out
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Menu Functions
-//
-///////////////////////////////////////////////////////////////////////////////////////
+/* Menu Functions ************************************************************/
 
 typedef struct tagUI_MENU_INFO
 {
index a2ce937..044b623 100644 (file)
 
 #define TITLE_BOX_CHAR_HEIGHT        5
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Graphical User Interface Functions
-//
-///////////////////////////////////////////////////////////////////////////////////////
+/* Graphical User Interface Functions ****************************************/
+
 VOID    GuiDrawBackdrop(VOID);                                    // Fills the entire screen with a backdrop
 VOID    GuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */);    // Fills the area specified with FillChar and Attr
 VOID    GuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom);    // Draws a shadow on the bottom and right sides of the area specified
@@ -36,18 +33,23 @@ VOID    GuiDrawStatusText(PCSTR StatusText);                    // Draws text at
 VOID    GuiUpdateDateTime(VOID);                                // Updates the date and time
 VOID    GuiSaveScreen(PUCHAR Buffer);                            // Saves the screen so that it can be restored later
 VOID    GuiRestoreScreen(PUCHAR Buffer);                        // Restores the screen from a previous save
-VOID    GuiMessageBox(PCSTR MessageText);                        // Displays a message box on the screen with an ok button
-VOID    GuiMessageBoxCritical(PCSTR MessageText);                // Displays a message box on the screen with an ok button using no system resources
+
+/* Displays a message box on the screen with an ok button */
+VOID
+GuiMessageBox(
+    _In_ PCSTR MessageText);
+
+/* Displays a message box on the screen with an ok button using no system resources */
+VOID
+GuiMessageBoxCritical(
+    _In_ PCSTR MessageText);
+
 VOID    GuiDrawProgressBar(ULONG Position, ULONG Range);        // Draws the progress bar showing nPos percent filled
 
 UCHAR    GuiTextToColor(PCSTR ColorText);                        // Converts the text color into it's equivalent color value
 UCHAR    GuiTextToFillStyle(PCSTR FillStyleText);                // Converts the text fill into it's equivalent fill value
 
-///////////////////////////////////////////////////////////////////////////////////////
-//
-// Menu Functions
-//
-///////////////////////////////////////////////////////////////////////////////////////
+/* Menu Functions ************************************************************/
 
 BOOLEAN
 GuiDisplayMenu(
index 72eca1a..df986bf 100644 (file)
@@ -47,8 +47,14 @@ NoUiDrawCenteredText(
 
 VOID NoUiDrawStatusText(PCSTR StatusText);
 VOID NoUiUpdateDateTime(VOID);
-VOID NoUiMessageBox(PCSTR MessageText);
-VOID NoUiMessageBoxCritical(PCSTR MessageText);
+
+VOID
+NoUiMessageBox(
+    _In_ PCSTR MessageText);
+
+VOID
+NoUiMessageBoxCritical(
+    _In_ PCSTR MessageText);
 
 /* Loading Progress-Bar Functions ********************************************/
 
index cb90ae2..1f61c1a 100644 (file)
@@ -103,8 +103,16 @@ VOID    TuiDrawStatusText(PCSTR StatusText);                    // Draws text at
 VOID    TuiUpdateDateTime(VOID);                                // Updates the date and time
 VOID    TuiSaveScreen(PUCHAR Buffer);                            // Saves the screen so that it can be restored later
 VOID    TuiRestoreScreen(PUCHAR Buffer);                        // Restores the screen from a previous save
-VOID    TuiMessageBox(PCSTR MessageText);                        // Displays a message box on the screen with an ok button
-VOID    TuiMessageBoxCritical(PCSTR MessageText);                // Displays a message box on the screen with an ok button using no system resources
+
+/* Displays a message box on the screen with an ok button */
+VOID
+TuiMessageBox(
+    _In_ PCSTR MessageText);
+
+/* Displays a message box on the screen with an ok button using no system resources */
+VOID
+TuiMessageBoxCritical(
+    _In_ PCSTR MessageText);
 
 BOOLEAN    TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length);
 UCHAR    TuiTextToColor(PCSTR ColorText);                        // Converts the text color into it's equivalent color value
index 8bd47b2..1970619 100644 (file)
@@ -93,19 +93,22 @@ UiDrawStatusText(IN PCSTR StatusText)
 }
 
 VOID
-UiInfoBox(IN PCSTR MessageText)
+UiInfoBox(
+    _In_ PCSTR MessageText)
 {
     TuiPrintf(MessageText);
 }
 
 VOID
-UiMessageBox(IN PCSTR MessageText)
+UiMessageBox(
+    _In_ PCSTR MessageText)
 {
     TuiPrintf(MessageText);
 }
 
 VOID
-UiMessageBoxCritical(IN PCSTR MessageText)
+UiMessageBoxCritical(
+    _In_ PCSTR MessageText)
 {
     TuiPrintf(MessageText);
 }
index d316019..38ec69b 100644 (file)
@@ -59,11 +59,15 @@ VOID GuiRestoreScreen(PUCHAR Buffer)
 {
 }
 
-VOID GuiMessageBox(PCSTR MessageText)
+VOID
+GuiMessageBox(
+    _In_ PCSTR MessageText)
 {
 }
 
-VOID GuiMessageBoxCritical(PCSTR MessageText)
+VOID
+GuiMessageBoxCritical(
+    _In_ PCSTR MessageText)
 {
 }
 
index 1e7c21d..e79598b 100644 (file)
@@ -77,23 +77,23 @@ VOID NoUiUpdateDateTime(VOID)
 {
 }
 
-VOID NoUiMessageBox(PCSTR MessageText)
+VOID
+NoUiMessageBox(
+    _In_ PCSTR MessageText)
 {
-    // We have not yet displayed the user interface
-    // We are probably still reading the .ini file
-    // and have encountered an error. Just use printf()
-    // and return.
-    printf("%s\n", MessageText);
-    printf("Press any key\n");
-    MachConsGetCh();
+    NoUiMessageBoxCritical(MessageText);
 }
 
-VOID NoUiMessageBoxCritical(PCSTR MessageText)
-{
-    // We have not yet displayed the user interface
-    // We are probably still reading the .ini file
-    // and have encountered an error. Just use printf()
-    // and return.
+VOID
+NoUiMessageBoxCritical(
+    _In_ PCSTR MessageText)
+{
+    /*
+     * We have not yet displayed the user interface
+     * We are probably still reading the .ini file
+     * and have encountered an error. Just use printf()
+     * and return.
+     */
     printf("%s\n", MessageText);
     printf("Press any key\n");
     MachConsGetCh();
index d8669ea..e425992 100644 (file)
@@ -629,7 +629,9 @@ VOID TuiRestoreScreen(PUCHAR Buffer)
     VideoCopyOffScreenBufferToVRAM();
 }
 
-VOID TuiMessageBox(PCSTR MessageText)
+VOID
+TuiMessageBox(
+    _In_ PCSTR MessageText)
 {
     PVOID    ScreenBuffer;
 
@@ -646,7 +648,9 @@ VOID TuiMessageBox(PCSTR MessageText)
     FrLdrTempFree(ScreenBuffer, TAG_TUI_SCREENBUFFER);
 }
 
-VOID TuiMessageBoxCritical(PCSTR MessageText)
+VOID
+TuiMessageBoxCritical(
+    _In_ PCSTR MessageText)
 {
     int        width = 8;
     unsigned int    height = 1;
index 7d1b379..87b0653 100644 (file)
@@ -293,22 +293,24 @@ VOID UiUpdateDateTime(VOID)
     UiVtbl.UpdateDateTime();
 }
 
-VOID UiInfoBox(PCSTR MessageText)
+VOID
+UiInfoBox(
+    _In_ PCSTR MessageText)
 {
-    SIZE_T        TextLength;
-    ULONG        BoxWidth;
-    ULONG        BoxHeight;
-    ULONG        LineBreakCount;
-    SIZE_T        Index;
-    SIZE_T        LastIndex;
-    ULONG        Left;
-    ULONG        Top;
-    ULONG        Right;
-    ULONG        Bottom;
+    SIZE_T TextLength;
+    ULONG  BoxWidth;
+    ULONG  BoxHeight;
+    ULONG  LineBreakCount;
+    SIZE_T Index;
+    SIZE_T LastIndex;
+    ULONG  Left;
+    ULONG  Top;
+    ULONG  Right;
+    ULONG  Bottom;
 
     TextLength = strlen(MessageText);
 
-    // Count the new lines and the box width
+    /* Count the new lines and the box width */
     LineBreakCount = 0;
     BoxWidth = 0;
     LastIndex = 0;
@@ -328,17 +330,17 @@ VOID UiInfoBox(PCSTR MessageText)
         }
     }
 
-    // Calc the box width & height
+    /* Calc the box width & height */
     BoxWidth += 6;
     BoxHeight = LineBreakCount + 4;
 
-    // Calc the box coordinates
+    /* Calc the box coordinates */
     Left = (UiScreenWidth / 2) - (BoxWidth / 2);
-    Top =(UiScreenHeight / 2) - (BoxHeight / 2);
-    Right = (UiScreenWidth / 2) + (BoxWidth / 2);
+    Top  = (UiScreenHeight / 2) - (BoxHeight / 2);
+    Right  = (UiScreenWidth / 2) + (BoxWidth / 2);
     Bottom = (UiScreenHeight / 2) + (BoxHeight / 2);
 
-    // Draw the box
+    /* Draw the box */
     UiDrawBox(Left,
               Top,
               Right,
@@ -347,17 +349,18 @@ VOID UiInfoBox(PCSTR MessageText)
               HORZ,
               TRUE,
               TRUE,
-              ATTR(UiMenuFgColor, UiMenuBgColor)
-              );
+              ATTR(UiMenuFgColor, UiMenuBgColor));
 
-    // Draw the text
+    /* Draw the text */
     UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor));
 }
 
-VOID UiMessageBox(PCSTR Format, ...)
+VOID
+UiMessageBox(
+    _In_ PCSTR Format, ...)
 {
-    CHAR Buffer[256];
     va_list ap;
+    CHAR Buffer[256];
 
     va_start(ap, Format);
     vsnprintf(Buffer, sizeof(Buffer) - sizeof(CHAR), Format, ap);
@@ -365,7 +368,9 @@ VOID UiMessageBox(PCSTR Format, ...)
     va_end(ap);
 }
 
-VOID UiMessageBoxCritical(PCSTR MessageText)
+VOID
+UiMessageBoxCritical(
+    _In_ PCSTR MessageText)
 {
     UiVtbl.MessageBoxCritical(MessageText);
 }
@@ -631,3 +636,4 @@ BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
     return UiVtbl.EditBox(MessageText, EditTextBuffer, Length);
 }
 
+/* EOF */