Fix several gcc warnings about -Wformat=#3276
Closed
siteshwar wants to merge 1 commit intoExiv2:mainfrom
Closed
Conversation
```
Error: COMPILER_WARNING: [#def25]
exiv2-0.28.5/xmpsdk/src/XMPMeta.cpp: scope_hint: In function ‘XMP_Status DumpNodeOptions(XMP_OptionBits, XMP_TextOutputProc, void*)’
exiv2-0.28.5/xmpsdk/src/XMPMeta.cpp:90:70: warning[-Wformat=]: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘XMP_OptionBits’ {aka ‘unsigned int’}
90 | #define OutProcHexInt(num) { snprintf ( buffer, sizeof(buffer), "%lX", (num) ); /* AUDIT: Using sizeof for snprintf length is safe */ \
| ^~~~~ ~~~~~
exiv2-0.28.5/xmpsdk/src/XMPMeta.cpp:241:17: note: in expansion of macro ‘OutProcHexInt’
241 | OutProcHexInt ( options );
| ^~~~~~~~~~~~~
exiv2-0.28.5/xmpsdk/src/XMPMeta.cpp:90:73: note: format string is defined here
90 | #define OutProcHexInt(num) { snprintf ( buffer, sizeof(buffer), "%lX", (num) ); /* AUDIT: Using sizeof for snprintf length is safe */ \
| ~~^
| |
| long unsigned int
| %X
88| status = (*outProc) ( refCon, buffer, strlen(buffer) ); if ( status != 0 ) goto EXIT; }
89| #else
90|-> #define OutProcHexInt(num) { snprintf ( buffer, sizeof(buffer), "%lX", (num) ); /* AUDIT: Using sizeof for snprintf length is safe */ \
91| status = (*outProc) ( refCon, buffer, strlen(buffer) ); if ( status != 0 ) goto EXIT; }
92| #endif
Error: COMPILER_WARNING: [#def26]
exiv2-0.28.5/xmpsdk/src/XMPUtils.cpp: scope_hint: In static member function ‘static XMP_Int64 XMPUtils::ConvertToInt64(XMP_StringPtr)’
exiv2-0.28.5/xmpsdk/src/XMPUtils.cpp:1221:48: warning[-Wformat=]: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘XMP_Int64*’ {aka ‘long int*’}
1221 | count = sscanf ( strValue, "%lld%c", &result, &nextCh );
| ~~~^ ~~~~~~~
| | |
| | XMP_Int64* {aka long int*}
| long long int*
| %ld
1219|
1220| if ( ! XMP_LitNMatch ( strValue, "0x", 2 ) ) {
1221|-> count = sscanf ( strValue, "%lld%c", &result, &nextCh );
1222| } else {
1223| count = sscanf ( strValue, "%llx%c", &result, &nextCh );
Error: COMPILER_WARNING: [#def27]
exiv2-0.28.5/xmpsdk/src/XMPUtils.cpp:1223:48: warning[-Wformat=]: format ‘%llx’ expects argument of type ‘long long unsigned int*’, but argument 3 has type ‘XMP_Int64*’ {aka ‘long int*’}
1223 | count = sscanf ( strValue, "%llx%c", &result, &nextCh );
| ~~~^ ~~~~~~~
| | |
| | XMP_Int64* {aka long int*}
| long long unsigned int*
| %lx
1221| count = sscanf ( strValue, "%lld%c", &result, &nextCh );
1222| } else {
1223|-> count = sscanf ( strValue, "%llx%c", &result, &nextCh );
1224| }
1225|
```
Resolves: https://openscanhub.fedoraproject.org/task/51946/log/exiv2-0.28.5-1.fc43/scan-results.html#def25
Signed-off-by: Siteshwar Vashisht <svashisht@redhat.com>
Collaborator
|
Duplicate of #2671 |
siteshwar
added a commit
to siteshwar/known-false-positives
that referenced
this pull request
May 14, 2025
... as it contains third party sources. Related: Exiv2/exiv2#3276 Signed-off-by: Siteshwar Vashisht <svashisht@redhat.com>
siteshwar
added a commit
to openscanhub/known-false-positives
that referenced
this pull request
May 15, 2025
... as it contains third party sources. Related: Exiv2/exiv2#3276 Signed-off-by: Siteshwar Vashisht <svashisht@redhat.com>
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.
Resolves: https://openscanhub.fedoraproject.org/task/51946/log/exiv2-0.28.5-1.fc43/scan-results.html#def25