From 6b87898af5966561770a79a17f13415c47c38aa0 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Fri, 22 Jun 2012 11:56:55 +0100 Subject: [PATCH] Code style fixes. --- .../private/kernel/util/FixedWidthPointer.h | 18 ++++++++++-------- src/system/boot/platform/cfe/arch/ppc/mmu.cpp | 9 +++++---- .../platform/openfirmware/arch/ppc/mmu.cpp | 9 +++++---- src/system/kernel/fs/vfs_boot.cpp | 2 +- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/headers/private/kernel/util/FixedWidthPointer.h b/headers/private/kernel/util/FixedWidthPointer.h index b8ceaaf0af..b6e9662e72 100644 --- a/headers/private/kernel/util/FixedWidthPointer.h +++ b/headers/private/kernel/util/FixedWidthPointer.h @@ -30,23 +30,23 @@ public: return (addr_t)fValue; } - Type &operator*() const + Type& operator*() const { return *(Type *)*this; } - Type *operator->() const + Type* operator->() const { return *this; } - FixedWidthPointer &operator=(const FixedWidthPointer &p) + FixedWidthPointer& operator=(const FixedWidthPointer& p) { fValue = p.fValue; return *this; } - FixedWidthPointer &operator=(Type *p) + FixedWidthPointer& operator=(Type* p) { fValue = (addr_t)p; return *this; @@ -69,6 +69,7 @@ public: { fValue = addr; } + private: uint64 fValue; } _PACKED; @@ -80,13 +81,13 @@ class FixedWidthPointer { public: operator void*() const { - return (void *)(addr_t)fValue; + return (void*)(addr_t)fValue; } template operator OtherType*() const { - return (OtherType *)(addr_t)fValue; + return (OtherType*)(addr_t)fValue; } operator addr_t() const @@ -94,13 +95,13 @@ public: return (addr_t)fValue; } - FixedWidthPointer &operator=(const FixedWidthPointer &p) + FixedWidthPointer& operator=(const FixedWidthPointer& p) { fValue = p.fValue; return *this; } - FixedWidthPointer &operator=(void *p) + FixedWidthPointer& operator=(void* p) { fValue = (addr_t)p; return *this; @@ -115,6 +116,7 @@ public: { fValue = addr; } + private: uint64 fValue; } _PACKED; diff --git a/src/system/boot/platform/cfe/arch/ppc/mmu.cpp b/src/system/boot/platform/cfe/arch/ppc/mmu.cpp index b20495e59a..68c709ee74 100644 --- a/src/system/boot/platform/cfe/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/cfe/arch/ppc/mmu.cpp @@ -261,8 +261,8 @@ find_free_physical_range(size_t size) } for (uint32 i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) { - void *address = - (void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start + void *address + = (void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start + gKernelArgs.physical_allocated_range[i].size); if (!is_physical_allocated(address, size) && is_physical_memory(address, size)) @@ -281,8 +281,9 @@ find_free_virtual_range(void *base, size_t size) void *firstFound = NULL; void *firstBaseFound = NULL; for (uint32 i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) { - void *address = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start - + gKernelArgs.virtual_allocated_range[i].size); + void *address + = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start + + gKernelArgs.virtual_allocated_range[i].size); if (!is_virtual_allocated(address, size)) { if (!base) return address; diff --git a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp index 7f46272238..a89fec7f53 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp +++ b/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp @@ -442,8 +442,8 @@ find_free_physical_range(size_t size) } for (uint32 i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) { - void *address = - (void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start + void *address + = (void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start + gKernelArgs.physical_allocated_range[i].size); if (!is_physical_allocated(address, size) && is_physical_memory(address, size)) @@ -462,8 +462,9 @@ find_free_virtual_range(void *base, size_t size) void *firstFound = NULL; void *firstBaseFound = NULL; for (uint32 i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) { - void *address = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start - + gKernelArgs.virtual_allocated_range[i].size); + void *address + = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start + + gKernelArgs.virtual_allocated_range[i].size); if (!is_virtual_allocated(address, size)) { if (!base) return address; diff --git a/src/system/kernel/fs/vfs_boot.cpp b/src/system/kernel/fs/vfs_boot.cpp index c01a132c82..21b1b9e627 100644 --- a/src/system/kernel/fs/vfs_boot.cpp +++ b/src/system/kernel/fs/vfs_boot.cpp @@ -320,7 +320,7 @@ DiskBootMethod::SortPartitions(KPartition** partitions, int32 count) The boot code should then just try them one by one. */ static status_t -get_boot_partitions(KMessage &bootVolume, PartitionStack& partitions) +get_boot_partitions(KMessage& bootVolume, PartitionStack& partitions) { dprintf("get_boot_partitions(): boot volume message:\n"); bootVolume.Dump(&dprintf);