Fix motionmapper Too few arguments to formatting function #1493
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.
fix the problem, we need to ensure that the number of arguments passed to
vprint
matches the number of format specifiers in the format string. In this case, the format string"%s, %s, %s, path %s\n"
expects four arguments, but only three are provided. The best fix is to determine what the fourth argument should be. Based on the context, the format string is printing out some directory and file information. The three arguments provided areqdir
,gamedir
, andg_outfile
. The format string also includes "path %s", suggesting that a path variable should be printed. If there is a variable representing the path (possiblyfullpath
), it should be passed as the fourth argument. If not, and if only three items are intended to be printed, the format string should be changed to only include three%s
specifiers.The most likely intended variable for "path %s" is
g_outfile
orfullpath
. Sinceg_outfile
is already passed as the third argument, andfullpath
is set just below this code, it makes sense to usefullpath
as the fourth argument. line 3217 insrc/utils/motionmapper/motionmapper.cpp
to addfullpath
as the fourth argument tovprint
.References
CERT C Coding Standard: FIO47-C. Use valid format strings
Microsoft C Runtime Library Reference: printf, wprintf