From 5e6512d8251407eb3e95d9358892e8967bf5cf6d Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Mon, 30 Sep 2024 23:12:41 +0200 Subject: [PATCH] Fix various warnings --- client/hardware.cpp | 2 ++ common/vk/allocation.cpp | 4 ++-- common/wivrn_sockets.cpp | 2 +- server/active_runtime.cpp | 2 +- server/audio/audio_pipewire.cpp | 4 ++-- server/avahi_publisher.cpp | 2 +- server/encoder/ffmpeg/video_encoder_va.cpp | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/hardware.cpp b/client/hardware.cpp index 7e735b39..21c4bef2 100644 --- a/client/hardware.cpp +++ b/client/hardware.cpp @@ -176,6 +176,7 @@ const char * permission_name(feature f) case model::unknown: return nullptr; } + __builtin_unreachable(); case feature::face_tracking: switch (guess_model()) { @@ -192,6 +193,7 @@ const char * permission_name(feature f) case model::unknown: return nullptr; } + __builtin_unreachable(); } __builtin_unreachable(); } diff --git a/common/vk/allocation.cpp b/common/vk/allocation.cpp index 35bb9ad9..8048374b 100644 --- a/common/vk/allocation.cpp +++ b/common/vk/allocation.cpp @@ -35,7 +35,7 @@ std::pair basic_allocation_traits::cr VmaAllocation allocation; VkBuffer tmp; - CHECK_VK(vmaCreateBuffer(allocator, &(NativeCreateInfo &)buffer_info, &alloc_info, &tmp, &allocation, nullptr)); + CHECK_VK(vmaCreateBuffer(allocator, &(const NativeCreateInfo &)buffer_info, &alloc_info, &tmp, &allocation, nullptr)); return std::pair{vk::raii::Buffer{device, tmp}, allocation}; } @@ -79,7 +79,7 @@ std::pair basic_allocation_traits::crea VmaAllocation allocation; VkImage tmp; - CHECK_VK(vmaCreateImage(allocator, &(NativeCreateInfo &)image_info, &alloc_info, &tmp, &allocation, nullptr)); + CHECK_VK(vmaCreateImage(allocator, &(const NativeCreateInfo &)image_info, &alloc_info, &tmp, &allocation, nullptr)); return std::pair{vk::raii::Image{device, tmp}, allocation}; } diff --git a/common/wivrn_sockets.cpp b/common/wivrn_sockets.cpp index 198ce88c..c5764d04 100644 --- a/common/wivrn_sockets.cpp +++ b/common/wivrn_sockets.cpp @@ -478,7 +478,7 @@ void xrt::drivers::wivrn::TCP::send_raw(const std::vector> & } if (hdr.msg_iovlen == 0) return; - *(uintptr_t *)&hdr.msg_iov[0].iov_base += sent; + hdr.msg_iov[0].iov_base = (void *)((uintptr_t)hdr.msg_iov[0].iov_base + sent); hdr.msg_iov[0].iov_len -= sent; } } diff --git a/server/active_runtime.cpp b/server/active_runtime.cpp index e4f3d776..12ef973c 100644 --- a/server/active_runtime.cpp +++ b/server/active_runtime.cpp @@ -51,7 +51,7 @@ std::filesystem::path active_runtime::manifest_path() } active_runtime::active_runtime() : - pid(getpid()), active_runtime_json(xdg_config_home() / "openxr/1/active_runtime.json") + active_runtime_json(xdg_config_home() / "openxr/1/active_runtime.json"), pid(getpid()) { try { diff --git a/server/audio/audio_pipewire.cpp b/server/audio/audio_pipewire.cpp index e0900788..74b50478 100644 --- a/server/audio/audio_pipewire.cpp +++ b/server/audio/audio_pipewire.cpp @@ -196,7 +196,7 @@ void pipewire_device::mic_process(void * self_v) auto buffer = pw_stream_dequeue_buffer(self->microphone.get()); if (not buffer) { - pw_log_warn("Out of buffers: %m"); + U_LOG_W("Out of buffers: %s", strerror(errno)); return; } @@ -264,7 +264,7 @@ void pipewire_device::speaker_process(void * self_v) auto buffer = pw_stream_dequeue_buffer(self->speaker.get()); if (not buffer) { - pw_log_warn("Out of buffers: %m"); + U_LOG_W("Out of buffers: %s", strerror(errno)); return; } diff --git a/server/avahi_publisher.cpp b/server/avahi_publisher.cpp index 575840b2..5979af45 100644 --- a/server/avahi_publisher.cpp +++ b/server/avahi_publisher.cpp @@ -134,7 +134,7 @@ void avahi_publisher::client_callback(AvahiClient * s, } avahi_publisher::avahi_publisher(const AvahiPoll * poll_api, const std::string & name, std::string type, int port, const std::map & txt) : - poll_api(poll_api), name(avahi_strdup(name.c_str())), type(std::move(type)), port(port) + name(avahi_strdup(name.c_str())), type(std::move(type)), port(port), poll_api(poll_api) { for (const auto & [key, value]: txt) { diff --git a/server/encoder/ffmpeg/video_encoder_va.cpp b/server/encoder/ffmpeg/video_encoder_va.cpp index fe4d2b08..19bf9b16 100644 --- a/server/encoder/ffmpeg/video_encoder_va.cpp +++ b/server/encoder/ffmpeg/video_encoder_va.cpp @@ -75,7 +75,7 @@ av_buffer_ptr make_hwframe_ctx(AVBufferRef * hw_device_ctx, AVPixelFormat hw_for { throw std::system_error(err, av_error_category(), "Failed to initialize frame context"); } - return std::move(hw_frames_ref); + return hw_frames_ref; } std::optional