kernel/fs/fd: use BytePointer
Change-Id: I0fcb549d313fe7193d8e1c2b6b0a44ae4b2fcb95 Reviewed-on: https://review.haiku-os.org/c/1090 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
1b312d7f0a
commit
401f42f794
@ -16,6 +16,7 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <AutoDeleter.h>
|
#include <AutoDeleter.h>
|
||||||
|
#include <BytePointer.h>
|
||||||
|
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
#include <syscall_restart.h>
|
#include <syscall_restart.h>
|
||||||
@ -966,11 +967,11 @@ _user_read_dir(int fd, struct dirent* userBuffer, size_t bufferSize,
|
|||||||
|
|
||||||
// copy the buffer back -- determine the total buffer size first
|
// copy the buffer back -- determine the total buffer size first
|
||||||
size_t sizeToCopy = 0;
|
size_t sizeToCopy = 0;
|
||||||
struct dirent* entry = buffer;
|
BytePointer<struct dirent> entry = buffer;
|
||||||
for (uint32 i = 0; i < count; i++) {
|
for (uint32 i = 0; i < count; i++) {
|
||||||
size_t length = entry->d_reclen;
|
size_t length = entry->d_reclen;
|
||||||
sizeToCopy += length;
|
sizeToCopy += length;
|
||||||
entry = (struct dirent*)((uint8*)entry + length);
|
entry += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_memcpy(userBuffer, buffer, sizeToCopy) != B_OK)
|
if (user_memcpy(userBuffer, buffer, sizeToCopy) != B_OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user