diff --git a/src/crypto.cpp b/src/crypto.cpp index 29ac5d47a..eac8da2b2 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -161,7 +161,8 @@ namespace crypto { plaintext.resize(round_to_pkcs7_padded(cipher.size())); - int update_outlen, final_outlen; + int final_outlen; + int update_outlen; if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) { return -1; @@ -195,7 +196,8 @@ namespace crypto { return -1; } - int update_outlen, final_outlen; + int final_outlen; + int update_outlen; // Encrypt into the caller's buffer if (EVP_EncryptUpdate(encrypt_ctx.get(), ciphertext, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) { @@ -232,7 +234,8 @@ namespace crypto { EVP_CIPHER_CTX_set_padding(decrypt_ctx.get(), padding); plaintext.resize(round_to_pkcs7_padded(cipher.size())); - int update_outlen, final_outlen; + int final_outlen; + int update_outlen; if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) { return -1; @@ -259,7 +262,8 @@ namespace crypto { EVP_CIPHER_CTX_set_padding(encrypt_ctx.get(), padding); cipher.resize(round_to_pkcs7_padded(plaintext.size())); - int update_outlen, final_outlen; + int final_outlen; + int update_outlen; // Encrypt into the caller's buffer if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher.data(), &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) { @@ -290,7 +294,8 @@ namespace crypto { return false; } - int update_outlen, final_outlen; + int final_outlen; + int update_outlen; // Encrypt into the caller's buffer if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) { diff --git a/src/input.cpp b/src/input.cpp index c3bca20ab..db7618bfb 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1254,7 +1254,8 @@ namespace input { * @return The status of the batching operation. */ batch_result_e batch(PNV_REL_MOUSE_MOVE_PACKET dest, PNV_REL_MOUSE_MOVE_PACKET src) { - short deltaX, deltaY; + short deltaX; + short deltaY; // Batching is safe as long as the result doesn't overflow a 16-bit integer if (!__builtin_add_overflow(util::endian::big(dest->deltaX), util::endian::big(src->deltaX), &deltaX)) { diff --git a/src/input.h b/src/input.h index 5b564f048..4a3fe79ed 100644 --- a/src/input.h +++ b/src/input.h @@ -25,14 +25,18 @@ namespace input { std::shared_ptr alloc(safe::mail_t mail); struct touch_port_t: public platf::touch_port_t { - int env_width, env_height; + int env_height; + int env_width; // Offset x and y coordinates of the client - float client_offsetX, client_offsetY; + float client_offsetX; + float client_offsetY; - float scalar_inv, scalar_tpcoords; + float scalar_inv; + float scalar_tpcoords; - int env_logical_width, env_logical_height; + int env_logical_height; + int env_logical_width; explicit operator bool() const { return width != 0 && height != 0 && env_width != 0 && env_height != 0; diff --git a/src/platform/common.h b/src/platform/common.h index 6d38c00da..744aa168b 100644 --- a/src/platform/common.h +++ b/src/platform/common.h @@ -268,9 +268,14 @@ namespace platf { // Dimensions for touchscreen input struct touch_port_t { - int offset_x, offset_y; - int width, height; - int logical_width, logical_height; + int offset_x; + int offset_y; + + int height; + int width; + + int logical_height; + int logical_width; }; // These values must match Limelight-internal.h's SS_FF_* constants! @@ -534,12 +539,20 @@ namespace platf { virtual ~display_t() = default; // Offsets for when streaming a specific monitor. By default, they are 0. - int offset_x, offset_y; - int env_width, env_height; - int env_logical_width, env_logical_height; + int offset_x; + int offset_y; - int width, height; - int logical_width, logical_height; + int env_height; + int env_width; + + int env_logical_height; + int env_logical_width; + + int height; + int width; + + int logical_height; + int logical_width; protected: // collect capture timing data (at loglevel debug) diff --git a/src/platform/linux/cuda.cpp b/src/platform/linux/cuda.cpp index 5b3bb695b..9fd5e529b 100644 --- a/src/platform/linux/cuda.cpp +++ b/src/platform/linux/cuda.cpp @@ -188,7 +188,8 @@ namespace cuda { stream_t stream; frame_t hwframe; - int width, height; + int height; + int width; // When height and width don't change, it's not necessary to use linear interpolation bool linear_interpolation; @@ -447,7 +448,8 @@ namespace cuda { egl::nv12_t nv12; AVPixelFormat sw_format; - int width, height; + int height; + int width; std::uint64_t sequence; egl::rgb_t rgb; @@ -455,7 +457,8 @@ namespace cuda { registered_resource_t y_res; registered_resource_t uv_res; - int offset_x, offset_y; + int offset_x; + int offset_y; }; std::unique_ptr make_avcodec_encode_device(int width, int height, bool vram) { diff --git a/src/platform/linux/cuda.h b/src/platform/linux/cuda.h index 409575817..ac30c29e2 100644 --- a/src/platform/linux/cuda.h +++ b/src/platform/linux/cuda.h @@ -69,8 +69,11 @@ namespace cuda { stream_t make_stream(int flags = 0); struct viewport_t { - int width, height; - int offsetX, offsetY; + int height; + int width; + + int offsetX; + int offsetY; }; class tex_t { diff --git a/src/platform/linux/graphics.cpp b/src/platform/linux/graphics.cpp index 96cf95d1c..bcd1d33bd 100644 --- a/src/platform/linux/graphics.cpp +++ b/src/platform/linux/graphics.cpp @@ -361,7 +361,8 @@ namespace egl { return nullptr; } - int major, minor; + int major; + int minor; if (!eglInitialize(display.get(), &major, &minor)) { BOOST_LOG(error) << "Couldn't initialize EGL display: ["sv << util::hex(eglGetError()).to_string_view() << ']'; return nullptr; diff --git a/src/platform/linux/graphics.h b/src/platform/linux/graphics.h index d9bc1cdea..6dcdd191a 100644 --- a/src/platform/linux/graphics.h +++ b/src/platform/linux/graphics.h @@ -266,8 +266,10 @@ namespace egl { class cursor_t: public platf::img_t { public: - int x, y; - int src_w, src_h; + int src_h; + int src_w; + int x; + int y; unsigned long serial; @@ -329,9 +331,12 @@ namespace egl { gl::program_t program[3]; gl::buffer_t color_matrix; - int out_width, out_height; - int in_width, in_height; - int offsetX, offsetY; + int out_height; + int out_width; + int in_height; + int in_width; + int offsetX; + int offsetY; // Pointer to the texture to be converted to nv12 int loaded_texture; diff --git a/src/platform/linux/kmsgrab.cpp b/src/platform/linux/kmsgrab.cpp index 7859bcd3b..6e9d47885 100644 --- a/src/platform/linux/kmsgrab.cpp +++ b/src/platform/linux/kmsgrab.cpp @@ -296,14 +296,20 @@ namespace platf { struct cursor_t { // Public properties used during blending bool visible = false; - std::int32_t x, y; - std::uint32_t dst_w, dst_h; - std::uint32_t src_w, src_h; + std::uint32_t dst_h; + std::uint32_t dst_w; + std::uint32_t src_h; + std::uint32_t src_w; + std::int32_t x; + std::int32_t y; std::vector pixels; unsigned long serial; // Private properties used for tracking cursor changes - std::uint64_t prop_src_x, prop_src_y, prop_src_w, prop_src_h; + std::uint64_t prop_src_x; + std::uint64_t prop_src_y; + std::uint64_t prop_src_h; + std::uint64_t prop_src_w; std::uint32_t fb_id; }; @@ -1133,8 +1139,10 @@ namespace platf { std::chrono::nanoseconds delay; - int img_width, img_height; - int img_offset_x, img_offset_y; + int img_height; + int img_width; + int img_offset_x; + int img_offset_y; int plane_id; int crtc_id; @@ -1317,7 +1325,8 @@ namespace platf { gl::ctx.BindTexture(GL_TEXTURE_2D, rgb->tex[0]); // Don't remove these lines, see https://github.com/LizardByte/Sunshine/issues/453 - int w, h; + int h; + int w; gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w); gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h); BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h; diff --git a/src/platform/linux/vaapi.cpp b/src/platform/linux/vaapi.cpp index 21f0b3545..27dd77ea9 100644 --- a/src/platform/linux/vaapi.cpp +++ b/src/platform/linux/vaapi.cpp @@ -398,7 +398,8 @@ namespace va { egl::sws_t sws; egl::nv12_t nv12; - int width, height; + int height; + int width; }; class va_ram_t: public va_t { @@ -455,7 +456,8 @@ namespace va { std::uint64_t sequence; egl::rgb_t rgb; - int offset_x, offset_y; + int offset_x; + int offset_y; }; /** @@ -531,7 +533,8 @@ namespace va { vaSetErrorCallback(display.get(), __log, &error); vaSetErrorCallback(display.get(), __log, &info); - int major, minor; + int major; + int minor; auto status = vaInitialize(display.get(), &major, &minor); if (status) { BOOST_LOG(error) << "Couldn't initialize va display: "sv << vaErrorStr(status); @@ -595,7 +598,8 @@ namespace va { return false; } - int major, minor; + int major; + int minor; auto status = vaInitialize(display.get(), &major, &minor); if (status) { BOOST_LOG(error) << "Couldn't initialize va display: "sv << vaErrorStr(status); diff --git a/src/platform/linux/wlgrab.cpp b/src/platform/linux/wlgrab.cpp index 589d034ab..a8ec4a2fe 100644 --- a/src/platform/linux/wlgrab.cpp +++ b/src/platform/linux/wlgrab.cpp @@ -206,7 +206,8 @@ namespace wl { gl::ctx.BindTexture(GL_TEXTURE_2D, (*rgb_opt)->tex[0]); // Don't remove these lines, see https://github.com/LizardByte/Sunshine/issues/453 - int w, h; + int h; + int w; gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w); gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h); BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h; diff --git a/src/platform/windows/display.h b/src/platform/windows/display.h index a1f2b96fe..d2cf683b7 100644 --- a/src/platform/windows/display.h +++ b/src/platform/windows/display.h @@ -77,7 +77,8 @@ namespace platf::dxgi { std::vector img_data; DXGI_OUTDUPL_POINTER_SHAPE_INFO shape_info; - int x, y; + int x; + int y; bool visible; }; @@ -346,7 +347,8 @@ namespace platf::dxgi { winrt::Windows::Graphics::Capture::GraphicsCaptureItem item {nullptr}; winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool frame_pool {nullptr}; winrt::Windows::Graphics::Capture::GraphicsCaptureSession capture_session {nullptr}; - winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame produced_frame {nullptr}, consumed_frame {nullptr}; + winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame consumed_frame {nullptr}; + winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame produced_frame {nullptr}; SRWLOCK frame_lock = SRWLOCK_INIT; CONDITION_VARIABLE frame_present_cv; diff --git a/src/platform/windows/display_vram.cpp b/src/platform/windows/display_vram.cpp index 52a87c781..d659c4bbe 100644 --- a/src/platform/windows/display_vram.cpp +++ b/src/platform/windows/display_vram.cpp @@ -950,8 +950,10 @@ namespace platf::dxgi { ps_t convert_UV_ps; ps_t convert_UV_fp16_ps; - std::array out_Y_or_YUV_viewports, out_Y_or_YUV_viewports_for_clear; - D3D11_VIEWPORT out_UV_viewport, out_UV_viewport_for_clear; + std::array out_Y_or_YUV_viewports; + std::array out_Y_or_YUV_viewports_for_clear; + D3D11_VIEWPORT out_UV_viewport; + D3D11_VIEWPORT out_UV_viewport_for_clear; DXGI_FORMAT format; diff --git a/src/platform/windows/input.cpp b/src/platform/windows/input.cpp index 533e37900..28fe6fa57 100644 --- a/src/platform/windows/input.cpp +++ b/src/platform/windows/input.cpp @@ -138,7 +138,9 @@ namespace platf { auto &report = gamepad.report.ds4.Report; // Use int32 to process this data, so we can clamp if needed. - int32_t intX, intY, intZ; + int32_t intX; + int32_t intY; + int32_t intZ; switch (motion_type) { case LI_MOTION_TYPE_ACCEL: diff --git a/src/platform/windows/misc.cpp b/src/platform/windows/misc.cpp index 4736a4c73..40a23f00c 100644 --- a/src/platform/windows/misc.cpp +++ b/src/platform/windows/misc.cpp @@ -74,18 +74,20 @@ namespace { std::atomic used_nt_set_timer_resolution = false; bool nt_set_timer_resolution_max() { - ULONG minimum, maximum, current; - if (!NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) || - !NT_SUCCESS(NtSetTimerResolution(maximum, TRUE, ¤t))) { + ULONG maximum; + ULONG minimum; + if (ULONG current; !NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) || + !NT_SUCCESS(NtSetTimerResolution(maximum, TRUE, ¤t))) { return false; } return true; } bool nt_set_timer_resolution_min() { - ULONG minimum, maximum, current; - if (!NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) || - !NT_SUCCESS(NtSetTimerResolution(minimum, TRUE, ¤t))) { + ULONG maximum; + ULONG minimum; + if (ULONG current; !NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) || + !NT_SUCCESS(NtSetTimerResolution(minimum, TRUE, ¤t))) { return false; } return true; diff --git a/src/stream.cpp b/src/stream.cpp index b10307e99..8b303ef24 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -1377,9 +1377,8 @@ namespace stream { } std::array fec_blocks; - decltype(fec_blocks)::iterator - fec_blocks_begin = std::begin(fec_blocks), - fec_blocks_end = std::begin(fec_blocks) + fec_blocks_needed; + auto fec_blocks_begin = std::begin(fec_blocks); + auto fec_blocks_end = std::begin(fec_blocks) + fec_blocks_needed; BOOST_LOG(verbose) << "Generating "sv << fec_blocks_needed << " FEC blocks"sv; diff --git a/src/upnp.cpp b/src/upnp.cpp index 7fd219c1e..c65e0a664 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -118,7 +118,8 @@ namespace upnp { } if (data.IPv6FC.controlurl[0] != 0) { - int firewallEnabled, pinholeAllowed; + int firewallEnabled; + int pinholeAllowed; // Check if this firewall supports IPv6 pinholes err = UPNP_GetFirewallStatus(urls->controlURL_6FC, data.IPv6FC.servicetype, &firewallEnabled, &pinholeAllowed); diff --git a/src/video.h b/src/video.h index eb8bb46f0..8fa258500 100644 --- a/src/video.h +++ b/src/video.h @@ -61,8 +61,10 @@ namespace video { struct encoder_platform_formats_t { virtual ~encoder_platform_formats_t() = default; platf::mem_type_e dev_type; - platf::pix_fmt_e pix_fmt_8bit, pix_fmt_10bit; - platf::pix_fmt_e pix_fmt_yuv444_8bit, pix_fmt_yuv444_10bit; + platf::pix_fmt_e pix_fmt_8bit; + platf::pix_fmt_e pix_fmt_10bit; + platf::pix_fmt_e pix_fmt_yuv444_8bit; + platf::pix_fmt_e pix_fmt_yuv444_10bit; }; struct encoder_platform_formats_avcodec: encoder_platform_formats_t { @@ -93,10 +95,13 @@ namespace video { pix_fmt_yuv444_10bit = map_pix_fmt(avcodec_pix_fmt_yuv444_10bit); } - AVHWDeviceType avcodec_base_dev_type, avcodec_derived_dev_type; + AVHWDeviceType avcodec_base_dev_type; + AVHWDeviceType avcodec_derived_dev_type; AVPixelFormat avcodec_dev_pix_fmt; - AVPixelFormat avcodec_pix_fmt_8bit, avcodec_pix_fmt_10bit; - AVPixelFormat avcodec_pix_fmt_yuv444_8bit, avcodec_pix_fmt_yuv444_10bit; + AVPixelFormat avcodec_pix_fmt_8bit; + AVPixelFormat avcodec_pix_fmt_10bit; + AVPixelFormat avcodec_pix_fmt_yuv444_8bit; + AVPixelFormat avcodec_pix_fmt_yuv444_10bit; init_buffer_function_t init_avcodec_hardware_input_buffer; }; @@ -179,7 +184,11 @@ namespace video { std::bitset::reference operator[](flag_e flag) { return capabilities[(std::size_t) flag]; } - } av1, hevc, h264; + }; + + codec_t av1; + codec_t hevc; + codec_t h264; const codec_t &codec_from_config(const config_t &config) const { switch (config.videoFormat) { diff --git a/src/video_colorspace.cpp b/src/video_colorspace.cpp index 674c053a2..d88d71bff 100644 --- a/src/video_colorspace.cpp +++ b/src/video_colorspace.cpp @@ -123,7 +123,8 @@ namespace video { const color_t *color_vectors_from_colorspace(const sunshine_colorspace_t &colorspace, bool unorm_output) { constexpr auto generate_color_vectors = [](const sunshine_colorspace_t &colorspace, bool unorm_output) -> color_t { // "Table 4 – Interpretation of matrix coefficients (MatrixCoefficients) value" section of ITU-T H.273 - double Kr, Kb; + double Kb; + double Kr; switch (colorspace.colorspace) { case colorspace_e::rec601: Kr = 0.299; @@ -142,8 +143,10 @@ namespace video { } double Kg = 1.0 - Kr - Kb; - double y_mult, y_add; - double uv_mult, uv_add; + double uv_add; + double uv_mult; + double y_add; + double y_mult; // "8.3 Matrix coefficients" section of ITU-T H.273 if (colorspace.full_range) {