From 0bbb12f9912957b40bfd70e6fc7c29c5e5753385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Mon, 15 Jul 2024 10:30:54 +0200 Subject: [PATCH] [NTOS:FSTUB] Make some macros more "conforming" i.e. parenthesized parameters; parenthesize compound macros, etc. --- ntoskrnl/fstub/fstubex.c | 10 ++++----- ntoskrnl/include/internal/hal.h | 40 ++++++++++++++++----------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ntoskrnl/fstub/fstubex.c b/ntoskrnl/fstub/fstubex.c index 05551fa065b..b8cfed6814b 100644 --- a/ntoskrnl/fstub/fstubex.c +++ b/ntoskrnl/fstub/fstubex.c @@ -94,11 +94,11 @@ C_ASSERT(sizeof(MASTER_BOOT_RECORD) == 512); #define EFI_GUID_STRING_SIZE 0x27 #define IS_VALID_DISK_INFO(Disk) \ - (Disk) && \ - (Disk->DeviceObject) && \ - (Disk->SectorSize) && \ - (Disk->Buffer) && \ - (Disk->SectorCount) + ((Disk) && \ + ((Disk)->DeviceObject) && \ + ((Disk)->SectorSize) && \ + ((Disk)->Buffer) && \ + ((Disk)->SectorCount)) VOID NTAPI diff --git a/ntoskrnl/include/internal/hal.h b/ntoskrnl/include/internal/hal.h index 2b2e89ca5bd..045a9a7f85e 100644 --- a/ntoskrnl/include/internal/hal.h +++ b/ntoskrnl/include/internal/hal.h @@ -240,36 +240,36 @@ xKdUnmapVirtualAddress( // // Various offsets in the boot record // -#define DISK_SIGNATURE_OFFSET 0x1B8 -#define PARTITION_TABLE_OFFSET 0x1BE -#define BOOT_SIGNATURE_OFFSET (0x200 - 2) +#define DISK_SIGNATURE_OFFSET 0x1B8 +#define PARTITION_TABLE_OFFSET 0x1BE +#define BOOT_SIGNATURE_OFFSET (0x200 - 2) -#define BOOT_RECORD_SIGNATURE 0xAA55 -#define NUM_PARTITION_TABLE_ENTRIES 4 +#define BOOT_RECORD_SIGNATURE 0xAA55 +#define NUM_PARTITION_TABLE_ENTRIES 4 // // Helper Macros // -#define GET_STARTING_SECTOR(p) \ - ((ULONG)(p->StartingSectorLsb0) + \ - (ULONG)(p->StartingSectorLsb1 << 8 ) + \ - (ULONG)(p->StartingSectorMsb0 << 16) + \ - (ULONG)(p->StartingSectorMsb1 << 24)) +#define GET_STARTING_SECTOR(p) \ + ((ULONG)((p)->StartingSectorLsb0) + \ + (ULONG)((p)->StartingSectorLsb1 << 8 ) + \ + (ULONG)((p)->StartingSectorMsb0 << 16) + \ + (ULONG)((p)->StartingSectorMsb1 << 24)) -#define GET_ENDING_S_OF_CHS(p) \ - ((UCHAR)(p->EndingCylinderLsb & 0x3F)) +#define GET_ENDING_S_OF_CHS(p) \ + ((UCHAR)((p)->EndingCylinderLsb & 0x3F)) #define GET_PARTITION_LENGTH(p) \ - ((ULONG)(p->PartitionLengthLsb0) + \ - (ULONG)(p->PartitionLengthLsb1 << 8) + \ - (ULONG)(p->PartitionLengthMsb0 << 16) + \ - (ULONG)(p->PartitionLengthMsb1 << 24)) + ((ULONG)((p)->PartitionLengthLsb0) + \ + (ULONG)((p)->PartitionLengthLsb1 << 8 ) + \ + (ULONG)((p)->PartitionLengthMsb0 << 16) + \ + (ULONG)((p)->PartitionLengthMsb1 << 24)) #define SET_PARTITION_LENGTH(p, l) \ - p->PartitionLengthLsb0 = l & 0xFF; \ - p->PartitionLengthLsb1 = (l >> 8) & 0xFF; \ - p->PartitionLengthMsb0 = (l >> 16) & 0xFF; \ - p->PartitionLengthMsb1 = (l >> 24) & 0xFF + ((p)->PartitionLengthLsb0 = (l) & 0xFF, \ + (p)->PartitionLengthLsb1 = ((l) >> 8 ) & 0xFF, \ + (p)->PartitionLengthMsb0 = ((l) >> 16) & 0xFF, \ + (p)->PartitionLengthMsb1 = ((l) >> 24) & 0xFF) // // Structure describing a partition