[FREELDR] Minor code formatting; constify some non-mutable data.

This commit is contained in:
Hermès Bélusca-Maïto 2019-01-06 18:34:49 +01:00
parent 95564d5e30
commit d272866550
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
11 changed files with 20 additions and 21 deletions

View file

@ -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;

View file

@ -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",

View file

@ -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;

View file

@ -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 */

View file

@ -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 */

View file

@ -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[] =

View file

@ -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,

View file

@ -36,4 +36,4 @@
#define FREELOADER_MINOR_VERSION 0
#define FREELOADER_PATCH_VERSION 0
PCHAR GetFreeLoaderVersionString(VOID);
const PCSTR GetFreeLoaderVersionString(VOID);

View file

@ -17,7 +17,7 @@ DBG_DEFAULT_CHANNEL(WINDOWS);
extern ULONG LoaderPagesSpanned;
PCHAR MemTypeDesc[] = {
static const PCSTR MemTypeDesc[] = {
"ExceptionBlock ", // ?
"SystemBlock ", // ?
"Free ",

View file

@ -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,

View file

@ -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;
}