Misc tiny fixes to issues spotted by Clang#4111
Open
pmatilai wants to merge 6 commits intorpm-software-management:masterfrom
Open
Misc tiny fixes to issues spotted by Clang#4111pmatilai wants to merge 6 commits intorpm-software-management:masterfrom
pmatilai wants to merge 6 commits intorpm-software-management:masterfrom
Conversation
Clang is clever enough to spot this: the cases in the switch are of rpmTagClass enum, whereas RPM_NULL_TYPE is rpmTagType. The value is 0 for both so this is of academic interest in this case, but in some other situation could be a real bug. Kudos to clang. Having the NULL type/class explicitly listed here adds no value whatsoever because it falls through to the default case anyhow. Related: rpm-software-management#4105
Clang complains we're not using the rc value in removeSBITS() anything, which is entirely correct - we don't know what the heck to do with it. Returning the rc makes the complaint go away, despite callers not actually checking for it. So this is just kicking the issue further down the road, not an actual fix. Related: rpm-software-management#4105
This is a bit silly: 32*BUFSIZ is a compile time calculation, but when when assigned to a non-const variable and used as an array size, Clang thinks it's a variable length array. Which it isn't, unless you're a language lawyer. Add a const in front to shoo the lawyers away. Related: rpm-software-management#4105
Clang was clever enough to spot this ancient typo/thinko and complain. Related: rpm-software-management#4105
The cpio modulo has been hardcoded to value of 4 for 25+ years already. It's not going to change now, so drop the silly parameter from rpmcpioWritePad() and make it a const to make it clear to the compiler this is not a VLA. The rpmcpioReadPad() counterpart never had a modulo argument, but instead it duplicates the size. Make modulo const there too, and use it for the buffer size. Related: rpm-software-management#4105
We cap the maximum file name length to 4096 in the line above, might as well use that limit for the buffer size too. Add and use CPIO_NAMESIZE_MAX define for it to avoid duplicating the value. Related: rpm-software-management#4105
Conan-Kudo
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are mostly on the cosmetic department...