mprintf: fix flag handling and add tests for those#21398
Closed
mprintf: fix flag handling and add tests for those#21398
Conversation
As 'flags' may already have been set to something when parse_conversion() is called, make sure to only OR the new flags. Follow-up to 4e0bfd8
Remove superfluous and never-built test code for systems with 16-bit and 64-bit ints and 16-bit longs, as we don't know any such.
There was a problem hiding this comment.
Pull request overview
This PR adjusts curl_mprintf’s conversion parsing to preserve already-parsed flags when applying conversion-specific flags, and extends the existing libtest coverage to exercise + flag handling for unsigned/octal/hex conversions.
Changes:
- Fix
parse_conversion()to OR in conversion-implied flags instead of overwriting the working flag set. - Refactor/relocate common test helpers in
lib557.cand simplify some type-size conditionals. - Add new formatting tests covering
+with%u,%o,%x,%X(and long variants).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tests/libtest/lib557.c |
Adds new +-flag test cases and rearranges helper routines for reuse across tests. |
lib/mprintf.c |
Ensures conversion-specific flags are applied without clobbering existing parsed flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Follow-up to 4e0bfd8