From 810071751d7d7f6a33046dd5b7926af99d73d467 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 10 Mar 2019 08:35:55 +0100 Subject: [PATCH] BytePointer: address Axel's post-merge comments These changes had been on review on Gerrit for a few weeks, why do the comment come only after they were merged? Change-Id: I54064973e08b8b4dc0624f4c09c7cafb7f04e437 Reviewed-on: https://review.haiku-os.org/c/1185 Reviewed-by: waddlesplash --- src/system/kernel/messaging/MessagingService.cpp | 6 ++++-- src/system/kernel/slab/SmallObjectCache.cpp | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/messaging/MessagingService.cpp b/src/system/kernel/messaging/MessagingService.cpp index fe83fd3da0..e20b29e7d2 100644 --- a/src/system/kernel/messaging/MessagingService.cpp +++ b/src/system/kernel/messaging/MessagingService.cpp @@ -200,7 +200,8 @@ MessagingArea::AllocateCommand(uint32 commandWhat, int32 dataSize, } // init the command - BytePointer command((char*)fHeader + commandOffset); + BytePointer command(fHeader); + command += commandOffset; command->next_command = 0; command->command = commandWhat; command->size = size; @@ -243,7 +244,8 @@ MessagingArea::_CheckCommand(int32 offset, int32 &size) } // get and check size - BytePointer command((char*)fHeader + offset); + BytePointer command(fHeader); + command += offset; size = command->size; if (size < (int32)sizeof(messaging_command)) return NULL; diff --git a/src/system/kernel/slab/SmallObjectCache.cpp b/src/system/kernel/slab/SmallObjectCache.cpp index 8e6df40f8f..73c82cf9c4 100644 --- a/src/system/kernel/slab/SmallObjectCache.cpp +++ b/src/system/kernel/slab/SmallObjectCache.cpp @@ -17,9 +17,10 @@ RANGE_MARKER_FUNCTION_BEGIN(SlabSmallObjectCache) static inline slab * -slab_in_pages(const void *pages, size_t slab_size) +slab_in_pages(void *pages, size_t slab_size) { - BytePointer pointer(((uint8 *)pages) + slab_size - sizeof(slab)); + BytePointer pointer(pages); + pointer += slab_size - sizeof(slab); return &pointer; }