https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d27286655018c15688afe2...
commit d27286655018c15688afe2dd88f1ac79dbc72aa9 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Sun Jan 6 18:34:49 2019 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Jan 6 18:42:01 2019 +0100
[FREELDR] Minor code formatting; constify some non-mutable data. --- boot/freeldr/freeldr/arch/i386/hwdisk.c | 2 +- boot/freeldr/freeldr/arch/i386/i386bug.c | 2 +- boot/freeldr/freeldr/arch/powerpc/mach.c | 2 +- boot/freeldr/freeldr/arch/realmode/amd64.S | 3 +-- boot/freeldr/freeldr/arch/realmode/i386.S | 4 ++-- boot/freeldr/freeldr/bootmgr.c | 4 ++-- boot/freeldr/freeldr/custom.c | 3 +-- boot/freeldr/freeldr/include/ver.h | 2 +- boot/freeldr/freeldr/ntldr/wlmemory.c | 2 +- boot/freeldr/freeldr/options.c | 5 ++--- boot/freeldr/freeldr/version.c | 12 +++++++----- 11 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/i386/hwdisk.c b/boot/freeldr/freeldr/arch/i386/hwdisk.c index 6123fc1d13a..a254aeeaa70 100644 --- a/boot/freeldr/freeldr/arch/i386/hwdisk.c +++ b/boot/freeldr/freeldr/arch/i386/hwdisk.c @@ -38,7 +38,7 @@ typedef struct tagDISKCONTEXT ULONGLONG SectorNumber; } DISKCONTEXT;
-static CHAR Hex[] = "0123456789abcdef"; +static const CHAR Hex[] = "0123456789abcdef";
/* Data cache for BIOS disks pre-enumeration */ UCHAR PcBiosDiskCount = 0; diff --git a/boot/freeldr/freeldr/arch/i386/i386bug.c b/boot/freeldr/freeldr/arch/i386/i386bug.c index c5c82af6886..6d42279d1ab 100644 --- a/boot/freeldr/freeldr/arch/i386/i386bug.c +++ b/boot/freeldr/freeldr/arch/i386/i386bug.c @@ -9,7 +9,7 @@ typedef struct _FRAME void *Address; } FRAME;
-char *i386ExceptionDescriptionText[] = +static const char *i386ExceptionDescriptionText[] = { "Exception 00: DIVIDE BY ZERO\n\n", "Exception 01: DEBUG EXCEPTION\n\n", diff --git a/boot/freeldr/freeldr/arch/powerpc/mach.c b/boot/freeldr/freeldr/arch/powerpc/mach.c index 552b75fd056..c00604ee923 100644 --- a/boot/freeldr/freeldr/arch/powerpc/mach.c +++ b/boot/freeldr/freeldr/arch/powerpc/mach.c @@ -24,7 +24,7 @@ #include "compat.h"
extern void BootMain( LPSTR CmdLine ); -extern PCHAR GetFreeLoaderVersionString(); +extern const PCSTR GetFreeLoaderVersionString(VOID); extern ULONG CacheSizeLimit; of_proxy ofproxy; void *PageDirectoryStart, *PageDirectoryEnd; diff --git a/boot/freeldr/freeldr/arch/realmode/amd64.S b/boot/freeldr/freeldr/arch/realmode/amd64.S index 0de7bf40417..528fd4b9e85 100644 --- a/boot/freeldr/freeldr/arch/realmode/amd64.S +++ b/boot/freeldr/freeldr/arch/realmode/amd64.S @@ -6,7 +6,6 @@ #define IMAGE_FILE_HEADER_SIZE 20 #define IMAGE_OPTIONAL_HEADER_AddressOfEntryPoint 16
- .code16
/* fat helper code */ @@ -292,7 +291,7 @@ ExitToLongMode: mov gs,ax mov ss,ax
- /* Safe current stack pointer */ + /* Save current stack pointer */ mov word ptr ds:[stack16], sp
/* Set PAE and PGE: 10100000b */ diff --git a/boot/freeldr/freeldr/arch/realmode/i386.S b/boot/freeldr/freeldr/arch/realmode/i386.S index 0c79ae1667d..4f47f4bc8fa 100644 --- a/boot/freeldr/freeldr/arch/realmode/i386.S +++ b/boot/freeldr/freeldr/arch/realmode/i386.S @@ -30,7 +30,7 @@ RealModeEntryPoint: /* Enable A20 address line */ call EnableA20
- /* Safe real mode entry point in shared memory */ + /* Save real mode entry point in shared memory */ mov dword ptr ds:[BSS_RealModeEntry], offset switch_to_real16
/* Address the image with es segment */ @@ -116,7 +116,7 @@ exit_to_protected:
cli
- /* Safe current stack pointer */ + /* Save current stack pointer */ mov word ptr ds:[stack16], sp
/* Load the GDT */ diff --git a/boot/freeldr/freeldr/bootmgr.c b/boot/freeldr/freeldr/bootmgr.c index e370c28752d..ed506aedd73 100644 --- a/boot/freeldr/freeldr/bootmgr.c +++ b/boot/freeldr/freeldr/bootmgr.c @@ -29,9 +29,9 @@ VOID (*OS_LOADING_METHOD)(IN OperatingSystemItem* OperatingSystem, IN USHORT OperatingSystemVersion);
-struct +static const struct { - CHAR BootType[80]; + PCHAR BootType; USHORT OperatingSystemVersion; OS_LOADING_METHOD Load; } OSLoadingMethods[] = diff --git a/boot/freeldr/freeldr/custom.c b/boot/freeldr/freeldr/custom.c index 802d2953644..02e55b62fde 100644 --- a/boot/freeldr/freeldr/custom.c +++ b/boot/freeldr/freeldr/custom.c @@ -51,13 +51,12 @@ VOID OptionMenuCustomBoot(VOID) #endif "ReactOS" }; - ULONG CustomBootMenuCount = sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]); ULONG SelectedMenuItem;
if (!UiDisplayMenu("Please choose a boot method:", "", FALSE, CustomBootMenuList, - CustomBootMenuCount, + sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]), 0, -1, &SelectedMenuItem, TRUE, diff --git a/boot/freeldr/freeldr/include/ver.h b/boot/freeldr/freeldr/include/ver.h index ad5c02a65f8..d796f7a6489 100644 --- a/boot/freeldr/freeldr/include/ver.h +++ b/boot/freeldr/freeldr/include/ver.h @@ -36,4 +36,4 @@ #define FREELOADER_MINOR_VERSION 0 #define FREELOADER_PATCH_VERSION 0
-PCHAR GetFreeLoaderVersionString(VOID); +const PCSTR GetFreeLoaderVersionString(VOID); diff --git a/boot/freeldr/freeldr/ntldr/wlmemory.c b/boot/freeldr/freeldr/ntldr/wlmemory.c index 99a1c9d9db8..8259c383863 100644 --- a/boot/freeldr/freeldr/ntldr/wlmemory.c +++ b/boot/freeldr/freeldr/ntldr/wlmemory.c @@ -17,7 +17,7 @@ DBG_DEFAULT_CHANNEL(WINDOWS);
extern ULONG LoaderPagesSpanned;
-PCHAR MemTypeDesc[] = { +static const PCSTR MemTypeDesc[] = { "ExceptionBlock ", // ? "SystemBlock ", // ? "Free ", diff --git a/boot/freeldr/freeldr/options.c b/boot/freeldr/freeldr/options.c index ebb7709823e..0300b025af4 100644 --- a/boot/freeldr/freeldr/options.c +++ b/boot/freeldr/freeldr/options.c @@ -50,6 +50,7 @@ PCSTR OptionsMenuList[] = #endif };
+const PCSTR FrldrDbgMsg = "Enable FreeLdr debug channels\n" "Acceptable syntax: [level1]#channel1[,[level2]#channel2]\n" "level can be one of: trace,warn,fixme,err\n" @@ -78,8 +79,6 @@ enum BootOption DIRECTORY_SERVICES_RESTORE_MODE, };
-ULONG OptionsMenuItemCount = sizeof(OptionsMenuList) / sizeof(OptionsMenuList[0]); - static enum BootOption BootOptionChoice = NO_OPTION; static BOOLEAN BootLogging = FALSE; static BOOLEAN VgaMode = FALSE; @@ -95,7 +94,7 @@ VOID DoOptionsMenu(VOID) if (!UiDisplayMenu("Select an option:", "", TRUE, OptionsMenuList, - OptionsMenuItemCount, + sizeof(OptionsMenuList) / sizeof(OptionsMenuList[0]), 11, // Use "Start ReactOS normally" as default; see the switch below. -1, &SelectedMenuItem, diff --git a/boot/freeldr/freeldr/version.c b/boot/freeldr/freeldr/version.c index e64864d5342..fcd25213bca 100644 --- a/boot/freeldr/freeldr/version.c +++ b/boot/freeldr/freeldr/version.c @@ -19,15 +19,17 @@
#include <freeldr.h>
-CHAR FreeLoaderVersionString[80]; +#define TOSTRING_(X) #X +#define TOSTRING(X) TOSTRING_(X)
-PCHAR GetFreeLoaderVersionString(VOID) -{ +static const PCSTR FreeLoaderVersionString = #if (FREELOADER_PATCH_VERSION == 0) - sprintf(FreeLoaderVersionString, "FreeLoader v%d.%d", FREELOADER_MAJOR_VERSION, FREELOADER_MINOR_VERSION); + "FreeLoader v" TOSTRING(FREELOADER_MAJOR_VERSION) "." TOSTRING(FREELOADER_MINOR_VERSION); #else - sprintf(FreeLoaderVersionString, "FreeLoader v%d.%d.%d", FREELOADER_MAJOR_VERSION, FREELOADER_MINOR_VERSION, FREELOADER_PATCH_VERSION); + "FreeLoader v" TOSTRING(FREELOADER_MAJOR_VERSION) "." TOSTRING(FREELOADER_MINOR_VERSION) "." TOSTRING(FREELOADER_PATCH_VERSION); #endif
+const PCSTR GetFreeLoaderVersionString(VOID) +{ return FreeLoaderVersionString; }