diff options
Diffstat (limited to 'src/ring.c')
-rw-r--r-- | src/ring.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,15 +1,15 @@ -// Copyright 2011-2022 David Robillard <d@drobilla.net> +// Copyright 2011-2024 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "zix/ring.h" +#include <zix/ring.h> #include "errno_status.h" #include "zix_config.h" -#include "zix/allocator.h" -#include "zix/status.h" +#include <zix/allocator.h> +#include <zix/status.h> -#if defined(_WIN32) +#if USE_VIRTUALLOCK # include <windows.h> #elif USE_MLOCK # include <sys/mman.h> @@ -108,7 +108,7 @@ zix_ring_free(ZixRing* const ring) ZixStatus zix_ring_mlock(ZixRing* const ring) { -#if defined(_WIN32) +#if USE_VIRTUALLOCK return (VirtualLock(ring, sizeof(ZixRing)) && VirtualLock(ring->buf, ring->size)) ? ZIX_STATUS_SUCCESS @@ -119,6 +119,7 @@ zix_ring_mlock(ZixRing* const ring) mlock(ring->buf, ring->size)); #else + (void)ring; return ZIX_STATUS_NOT_SUPPORTED; #endif } @@ -190,7 +191,7 @@ peek_internal(const ZixRing* const ring, } else { const uint32_t first_size = ring->size - r; memcpy(dst, &ring->buf[r], first_size); - memcpy((char*)dst + first_size, &ring->buf[0], size - first_size); + memcpy((char*)dst + first_size, &ring->buf[0], (size_t)size - first_size); } return size; |