Skip to content

Commit

Permalink
Constify some of the code.
Browse files Browse the repository at this point in the history
Integrating the new Chalk interpreter into setup caused some consts to
bleed out into their surroundings. This cascaded as it bled into some of
the common libraries. This change lets those consts bleed out as far as
they naturally went. The most painful one was a change to the prototype of
AddDevice, which affected nearly all drivers.
  • Loading branch information
evangreen committed Oct 25, 2016
1 parent 3e8584b commit da594e8
Show file tree
Hide file tree
Showing 110 changed files with 548 additions and 546 deletions.
20 changes: 10 additions & 10 deletions apps/libc/dynamic/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,15 @@ Return Value:
{

double Double;
PSTR RemainingString;
PCSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

StringLength = MAX_ULONG;
RemainingString = (PSTR)String;
Status = RtlStringScanDouble(&RemainingString, &StringLength, &Double);
if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -758,7 +758,7 @@ Return Value:
{

LONGLONG Integer;
PSTR RemainingString;
PCSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -771,7 +771,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -853,7 +853,7 @@ Return Value:
{

LONGLONG Integer;
PSTR RemainingString;
PCSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -866,7 +866,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -928,7 +928,7 @@ Return Value:
{

LONGLONG Integer;
PSTR RemainingString;
PCSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -941,7 +941,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -1009,7 +1009,7 @@ Return Value:
{

LONGLONG Integer;
PSTR RemainingString;
PCSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -1022,7 +1022,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down
20 changes: 10 additions & 10 deletions apps/libc/dynamic/wscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,15 @@ Return Value:
{

double Double;
PWSTR RemainingString;
PCWSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

StringLength = MAX_ULONG;
RemainingString = (PWSTR)String;
Status = RtlStringScanDoubleWide(&RemainingString, &StringLength, &Double);
if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PWSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -623,7 +623,7 @@ Return Value:
{

LONGLONG Integer;
PWSTR RemainingString;
PCWSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -636,7 +636,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PWSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -718,7 +718,7 @@ Return Value:
{

LONGLONG Integer;
PWSTR RemainingString;
PCWSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -731,7 +731,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PWSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -793,7 +793,7 @@ Return Value:
{

LONGLONG Integer;
PWSTR RemainingString;
PCWSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -806,7 +806,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PWSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down Expand Up @@ -874,7 +874,7 @@ Return Value:
{

LONGLONG Integer;
PWSTR RemainingString;
PCWSTR RemainingString;
KSTATUS Status;
ULONG StringLength;

Expand All @@ -887,7 +887,7 @@ Return Value:
&Integer);

if (StringAfterScan != NULL) {
*StringAfterScan = RemainingString;
*StringAfterScan = (PWSTR)RemainingString;
}

if (!KSUCCESS(Status)) {
Expand Down
2 changes: 1 addition & 1 deletion apps/osbase/osbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ OS_API
KSTATUS
OsOpen (
HANDLE Directory,
PSTR Path,
PCSTR Path,
ULONG PathLength,
ULONG Flags,
FILE_PERMISSIONS CreatePermissions,
Expand Down
4 changes: 2 additions & 2 deletions apps/osbase/osimag.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ OspImFreeMemory (
KSTATUS
OspImOpenFile (
PVOID SystemContext,
PSTR BinaryName,
PCSTR BinaryName,
PIMAGE_FILE_INFORMATION File
);

Expand Down Expand Up @@ -1136,7 +1136,7 @@ Return Value:
KSTATUS
OspImOpenFile (
PVOID SystemContext,
PSTR BinaryName,
PCSTR BinaryName,
PIMAGE_FILE_INFORMATION File
)

Expand Down
12 changes: 6 additions & 6 deletions apps/testapps/ktest/driver/ktestdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ KTestUnload (
KSTATUS
KTestAddDevice (
PVOID Driver,
PSTR DeviceId,
PSTR ClassId,
PSTR CompatibleIds,
PCSTR DeviceId,
PCSTR ClassId,
PCSTR CompatibleIds,
PVOID DeviceToken
);

Expand Down Expand Up @@ -226,9 +226,9 @@ Return Value:
KSTATUS
KTestAddDevice (
PVOID Driver,
PSTR DeviceId,
PSTR ClassId,
PSTR CompatibleIds,
PCSTR DeviceId,
PCSTR ClassId,
PCSTR CompatibleIds,
PVOID DeviceToken
)

Expand Down
4 changes: 2 additions & 2 deletions boot/bootman/bootim.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ BmpImFreeMemory (
KSTATUS
BmpImOpenFile (
PVOID SystemContext,
PSTR BinaryName,
PCSTR BinaryName,
PIMAGE_FILE_INFORMATION File
);

Expand Down Expand Up @@ -323,7 +323,7 @@ Return Value:
KSTATUS
BmpImOpenFile (
PVOID SystemContext,
PSTR BinaryName,
PCSTR BinaryName,
PIMAGE_FILE_INFORMATION File
)

Expand Down
2 changes: 1 addition & 1 deletion boot/bootman/bootman.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Return Value:
PDEBUG_DEVICE_DESCRIPTION DebugDevice;
PDEBUG_MODULE DebugModule;
PLOADED_IMAGE LoaderImage;
PSTR LoaderName;
PCSTR LoaderName;
UINTN LoaderNameSize;
PBOOT_INITIALIZATION_BLOCK LoaderParameters;
ULONG LoadFlags;
Expand Down
4 changes: 2 additions & 2 deletions boot/fatboot/fatboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ RtlZeroMemory (
PVOID
RtlCopyMemory (
PVOID Destination,
PVOID Source,
PCVOID Source,
UINTN ByteCount
);

Expand Down Expand Up @@ -1288,7 +1288,7 @@ Return Value:
PVOID
RtlCopyMemory (
PVOID Destination,
PVOID Source,
PCVOID Source,
UINTN ByteCount
)

Expand Down
2 changes: 1 addition & 1 deletion boot/lib/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ KSTATUS
BoLookupPath (
PBOOT_VOLUME Volume,
PFILE_ID StartingDirectory,
PSTR Path,
PCSTR Path,
PFILE_PROPERTIES FileProperties
)

Expand Down
2 changes: 1 addition & 1 deletion boot/lib/include/bootlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ KSTATUS
BoLookupPath (
PBOOT_VOLUME Volume,
PFILE_ID StartingDirectory,
PSTR Path,
PCSTR Path,
PFILE_PROPERTIES FileProperties
);

Expand Down
6 changes: 3 additions & 3 deletions boot/loader/bootim.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ BopImFreeMemory (
KSTATUS
BopImOpenFile (
PVOID SystemContext,
PSTR BinaryName,
PCSTR BinaryName,
PIMAGE_FILE_INFORMATION File
);

Expand Down Expand Up @@ -257,7 +257,7 @@ Return Value:
PSTR DriversDirectoryPath;
FILE_PROPERTIES Properties;
KSTATUS Status;
PSTR SystemRootPath;
PCSTR SystemRootPath;

INITIALIZE_LIST_HEAD(&BoLoadedImageList);

Expand Down Expand Up @@ -376,7 +376,7 @@ Return Value:
KSTATUS
BopImOpenFile (
PVOID SystemContext,
PSTR BinaryName,
PCSTR BinaryName,
PIMAGE_FILE_INFORMATION File
)

Expand Down
2 changes: 1 addition & 1 deletion boot/loader/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Return Value:
PLOADED_IMAGE KernelImage;
PDEBUG_MODULE KernelModule;
PKERNEL_INITIALIZATION_BLOCK KernelParameters;
PSTR KernelPath;
PCSTR KernelPath;
PHYSICAL_ADDRESS KernelStackPhysical;
PDEBUG_MODULE LoaderModule;
ULONG LoaderModuleNameLength;
Expand Down
12 changes: 6 additions & 6 deletions drivers/acpi/acpidrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ AcpiUnload (
KSTATUS
AcpiAddDevice (
PVOID Driver,
PSTR DeviceId,
PSTR ClassId,
PSTR CompatibleIds,
PCSTR DeviceId,
PCSTR ClassId,
PCSTR CompatibleIds,
PVOID DeviceToken
);

Expand Down Expand Up @@ -242,9 +242,9 @@ Return Value:
KSTATUS
AcpiAddDevice (
PVOID Driver,
PSTR DeviceId,
PSTR ClassId,
PSTR CompatibleIds,
PCSTR DeviceId,
PCSTR ClassId,
PCSTR CompatibleIds,
PVOID DeviceToken
)

Expand Down
12 changes: 6 additions & 6 deletions drivers/ata/ata.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ AtapServiceInterruptForChannel (
KSTATUS
AtaAddDevice (
PVOID Driver,
PSTR DeviceId,
PSTR ClassId,
PSTR CompatibleIds,
PCSTR DeviceId,
PCSTR ClassId,
PCSTR CompatibleIds,
PVOID DeviceToken
);

Expand Down Expand Up @@ -360,9 +360,9 @@ Return Value:
KSTATUS
AtaAddDevice (
PVOID Driver,
PSTR DeviceId,
PSTR ClassId,
PSTR CompatibleIds,
PCSTR DeviceId,
PCSTR ClassId,
PCSTR CompatibleIds,
PVOID DeviceToken
)

Expand Down
Loading

0 comments on commit da594e8

Please sign in to comment.