Skip to content

obs-qsv11: Cast width*height to fix sign-compare warning #12114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danhle0711
Copy link

@danhle0711 danhle0711 commented May 2, 2025

Fix sign-compare warning in QSV_Encoder_Internal.cpp (#10200)

Description

The change casts the product of pParams->nWidth * pParams->nHeight to uint32_t to avoid a signed vs unsigned comparison warning that breaks builds on strict compilers.

Motivation and Context

Without this cast, OBS Studio fails to compile on platforms (e.g., NixOS) where sign-compare warnings are treated as errors, blocking package maintainers from building from source.
This fix restores cross-platform build compatibility without altering any runtime behavior.

How Has This Been Tested?

  • Built OBS Studio on macOS 15.4.1 using Xcode 16.3 and verified no new warnings.
  • Confirmed CI Linux build passes with -Werror=sign-compare enabled.
  • Launched OBS and ran Intel QSV encoding to ensure functionality remains unchanged.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the CONTRIBUTING document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation (none required).

@WizardCM WizardCM added the Bug Fix Non-breaking change which fixes an issue label May 2, 2025
@RytoEX RytoEX requested a review from kkartaltepe May 2, 2025 19:34
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use merge commits to catch up git history. Use git rebase and force push.j

Use "obs-qsv11: ` as the commit prefix and PR prefix.
Do not specify the filename(s) in the commit title. The git history will show that.

@danhle0711 danhle0711 changed the title Fix sign-compare warning in QSV_Encoder_Internal.cpp obs-qsv11: Fix sign-compare warning May 2, 2025
@danhle0711 danhle0711 changed the title obs-qsv11: Fix sign-compare warning obs-qsv11: Cast width*height to fix sign-compare warning May 2, 2025
@danhle0711 danhle0711 force-pushed the fix-sign-compare-warning branch from ed16742 to 56b1c7c Compare May 2, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants