Skip to content

fix C4244 narrowing conversion warnings on 32-bit (Win32) - #3

Merged
igagis merged 1 commit into
cppfw:mainfrom
igagis-bot:fix/win32-narrowing-casts
Nov 23, 2026
Merged

igagis merged 1 commit into
cppfw:mainfrom
igagis-bot:fix/win32-narrowing-casts

Conversation

@igagis-bot

Copy link
Copy Markdown
Contributor

On 32-bit targets size_t/unsigned int are 32-bit while VkDeviceSize is 64-bit, so passing buffer sizes of type VkDeviceSize to host-side calls (std::vector constructor, std::memcpy) triggers C4244, which the CI build turns into an error.

Changes the local size variables to size_t at the declaration site. The Vulkan API calls (VkBufferCreateInfo::size, vkMapMemory) accept the wider VkDeviceSize, so the values are simply widened there, and the host-side calls receive size_t directly.

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (ace5f65) to head (6d7c2ab).

Files with missing lines Patch % Lines
src/ruis/render/vulkan/context.cpp 0.00% 1 Missing ⚠️
src/ruis/render/vulkan/factory.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main      #3   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         24      24           
  Lines       1387    1387           
  Branches     498     498           
=====================================
  Misses      1387    1387           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

On 32-bit targets size_t and unsigned int are 32-bit while VkDeviceSize
is 64-bit, so passing buffer sizes of type VkDeviceSize to host-side
calls (std::vector constructor, std::memcpy) triggers C4244, which the
CI build turns into an error.

Change the local size variables to size_t at the declaration site. The
Vulkan API calls (VkBufferCreateInfo::size, vkMapMemory) accept the
wider VkDeviceSize, so the values are simply widened there, and the
host-side calls receive size_t directly.
@igagis-bot
igagis-bot force-pushed the fix/win32-narrowing-casts branch from b1e77bd to 6d7c2ab Compare November 23, 2026 02:44
@igagis
igagis merged commit a4fdb26 into cppfw:main Nov 23, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants