Skip to content

Add explicit casts for MSVC warnings#19

Merged
Sidelobe merged 1 commit intomhroth:masterfrom
gillesdegottex:fix/tinywav-msvc-warnings
Feb 13, 2026
Merged

Add explicit casts for MSVC warnings#19
Sidelobe merged 1 commit intomhroth:masterfrom
gillesdegottex:fix/tinywav-msvc-warnings

Conversation

@gillesdegottex
Copy link
Copy Markdown
Contributor

@gillesdegottex gillesdegottex commented Feb 11, 2026

Issue

Builds with MSVC compiler generate the following warnings:

tinywav.c(110,35): warning C4244: '=': conversion from 'int' to 'uint16_t', possible loss of data
tinywav.c(114,34): warning C4244: '=': conversion from 'int' to 'uint16_t', possible loss of data
tinywav.c(115,27): warning C4244: '=': conversion from 'int' to 'uint16_t', possible loss of data
tinywav.c(244,50): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data
tinywav.c(280,50): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data
tinywav.c(369,37): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data
tinywav.c(406,37): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data

Solution

This PR applies explicit type conversions, which clarify the type changes and clears the warnings.

Example

tw->h.BitsPerSample = 8 * tw->sampFmt;

becomes

tw->h.BitsPerSample = (uint16_t) (8 * tw->sampFmt);

@Sidelobe
Copy link
Copy Markdown
Collaborator

Fantastic, thank you!

@Sidelobe Sidelobe merged commit 35afe50 into mhroth:master Feb 13, 2026
20 of 26 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