Code style fixes.

This commit is contained in:
Alex Smith
2012-06-22 11:56:55 +01:00
parent 17e407e945
commit 6b87898af5
4 changed files with 21 additions and 17 deletions
@@ -30,23 +30,23 @@ public:
return (addr_t)fValue; return (addr_t)fValue;
} }
Type &operator*() const Type& operator*() const
{ {
return *(Type *)*this; return *(Type *)*this;
} }
Type *operator->() const Type* operator->() const
{ {
return *this; return *this;
} }
FixedWidthPointer &operator=(const FixedWidthPointer &p) FixedWidthPointer& operator=(const FixedWidthPointer& p)
{ {
fValue = p.fValue; fValue = p.fValue;
return *this; return *this;
} }
FixedWidthPointer &operator=(Type *p) FixedWidthPointer& operator=(Type* p)
{ {
fValue = (addr_t)p; fValue = (addr_t)p;
return *this; return *this;
@@ -69,6 +69,7 @@ public:
{ {
fValue = addr; fValue = addr;
} }
private: private:
uint64 fValue; uint64 fValue;
} _PACKED; } _PACKED;
@@ -80,13 +81,13 @@ class FixedWidthPointer<void> {
public: public:
operator void*() const operator void*() const
{ {
return (void *)(addr_t)fValue; return (void*)(addr_t)fValue;
} }
template<typename OtherType> template<typename OtherType>
operator OtherType*() const operator OtherType*() const
{ {
return (OtherType *)(addr_t)fValue; return (OtherType*)(addr_t)fValue;
} }
operator addr_t() const operator addr_t() const
@@ -94,13 +95,13 @@ public:
return (addr_t)fValue; return (addr_t)fValue;
} }
FixedWidthPointer &operator=(const FixedWidthPointer &p) FixedWidthPointer& operator=(const FixedWidthPointer& p)
{ {
fValue = p.fValue; fValue = p.fValue;
return *this; return *this;
} }
FixedWidthPointer &operator=(void *p) FixedWidthPointer& operator=(void* p)
{ {
fValue = (addr_t)p; fValue = (addr_t)p;
return *this; return *this;
@@ -115,6 +116,7 @@ public:
{ {
fValue = addr; fValue = addr;
} }
private: private:
uint64 fValue; uint64 fValue;
} _PACKED; } _PACKED;
@@ -261,8 +261,8 @@ find_free_physical_range(size_t size)
} }
for (uint32 i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) { for (uint32 i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) {
void *address = void *address
(void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start = (void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start
+ gKernelArgs.physical_allocated_range[i].size); + gKernelArgs.physical_allocated_range[i].size);
if (!is_physical_allocated(address, size) if (!is_physical_allocated(address, size)
&& is_physical_memory(address, size)) && is_physical_memory(address, size))
@@ -281,8 +281,9 @@ find_free_virtual_range(void *base, size_t size)
void *firstFound = NULL; void *firstFound = NULL;
void *firstBaseFound = NULL; void *firstBaseFound = NULL;
for (uint32 i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) { for (uint32 i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) {
void *address = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start void *address
+ gKernelArgs.virtual_allocated_range[i].size); = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start
+ gKernelArgs.virtual_allocated_range[i].size);
if (!is_virtual_allocated(address, size)) { if (!is_virtual_allocated(address, size)) {
if (!base) if (!base)
return address; return address;
@@ -442,8 +442,8 @@ find_free_physical_range(size_t size)
} }
for (uint32 i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) { for (uint32 i = 0; i < gKernelArgs.num_physical_allocated_ranges; i++) {
void *address = void *address
(void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start = (void *)(addr_t)(gKernelArgs.physical_allocated_range[i].start
+ gKernelArgs.physical_allocated_range[i].size); + gKernelArgs.physical_allocated_range[i].size);
if (!is_physical_allocated(address, size) if (!is_physical_allocated(address, size)
&& is_physical_memory(address, size)) && is_physical_memory(address, size))
@@ -462,8 +462,9 @@ find_free_virtual_range(void *base, size_t size)
void *firstFound = NULL; void *firstFound = NULL;
void *firstBaseFound = NULL; void *firstBaseFound = NULL;
for (uint32 i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) { for (uint32 i = 0; i < gKernelArgs.num_virtual_allocated_ranges; i++) {
void *address = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start void *address
+ gKernelArgs.virtual_allocated_range[i].size); = (void *)(addr_t)(gKernelArgs.virtual_allocated_range[i].start
+ gKernelArgs.virtual_allocated_range[i].size);
if (!is_virtual_allocated(address, size)) { if (!is_virtual_allocated(address, size)) {
if (!base) if (!base)
return address; return address;
+1 -1
View File
@@ -320,7 +320,7 @@ DiskBootMethod::SortPartitions(KPartition** partitions, int32 count)
The boot code should then just try them one by one. The boot code should then just try them one by one.
*/ */
static status_t 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"); dprintf("get_boot_partitions(): boot volume message:\n");
bootVolume.Dump(&dprintf); bootVolume.Dump(&dprintf);