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 <waddlesplash@gmail.com>
This commit is contained in:
Adrien Destugues 2019-03-10 08:35:55 +01:00 committed by waddlesplash
parent fb7498fe2e
commit 810071751d
2 changed files with 7 additions and 4 deletions

View File

@ -200,7 +200,8 @@ MessagingArea::AllocateCommand(uint32 commandWhat, int32 dataSize,
} }
// init the command // init the command
BytePointer<messaging_command> command((char*)fHeader + commandOffset); BytePointer<messaging_command> command(fHeader);
command += commandOffset;
command->next_command = 0; command->next_command = 0;
command->command = commandWhat; command->command = commandWhat;
command->size = size; command->size = size;
@ -243,7 +244,8 @@ MessagingArea::_CheckCommand(int32 offset, int32 &size)
} }
// get and check size // get and check size
BytePointer<messaging_command> command((char*)fHeader + offset); BytePointer<messaging_command> command(fHeader);
command += offset;
size = command->size; size = command->size;
if (size < (int32)sizeof(messaging_command)) if (size < (int32)sizeof(messaging_command))
return NULL; return NULL;

View File

@ -17,9 +17,10 @@ RANGE_MARKER_FUNCTION_BEGIN(SlabSmallObjectCache)
static inline slab * static inline slab *
slab_in_pages(const void *pages, size_t slab_size) slab_in_pages(void *pages, size_t slab_size)
{ {
BytePointer<slab> pointer(((uint8 *)pages) + slab_size - sizeof(slab)); BytePointer<slab> pointer(pages);
pointer += slab_size - sizeof(slab);
return &pointer; return &pointer;
} }