Skip to content
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

[interfaces] legacy: fix format error when building with -Werror=form… #11656

Merged
merged 1 commit into from Feb 12, 2017

Conversation

@wsnipex
Copy link
Member

commented Feb 11, 2017

…at-security

fixes PPA builds. which use -Werror=format-security by default

‘std::vector<std::__cxx11::basic_string > XBMCAddon::xbmcgui::ListItem::getStringArray(const InfoLabelValue&, const string&, std::__cxx11::string)’:
/data/src/xbmc/xbmc/interfaces/legacy/ListItem.cpp:860:176: error: format not a string literal and no format arguments [-Werror=format-security]
throw WrongTypeException(StringUtils::Format("When using "%s" you need to supply a string or list of strings for the value in the dictionary", tag.c_str()).c_str());
^
cc1plus: some warnings being treated as errors

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the Code guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my change
  • All new and existing tests passed
@wsnipex wsnipex added the Type: Fix label Feb 11, 2017
@wsnipex

This comment has been minimized.

Copy link
Member Author

commented Feb 11, 2017

jenkins build this please

@@ -857,7 +857,7 @@ namespace XBMCAddon
for (const auto& el : alt.later())
{
if (el.which() == second)
throw WrongTypeException(StringUtils::Format("When using \"%s\" you need to supply a string or list of strings for the value in the dictionary", tag.c_str()).c_str());
throw WrongTypeException("%s", StringUtils::Format("When using \"%s\" you need to supply a string or list of strings for the value in the dictionary", tag.c_str()).c_str());

This comment has been minimized.

Copy link
@Rechi

Rechi Feb 11, 2017

Member

Is there a benefit from formatting with StringUtils::Format and pass the result in a new format string instead of just calling WrongTypeException with the format string that is passed to StringUtils::Format?

This comment has been minimized.

Copy link
@wsnipex

wsnipex Feb 11, 2017

Author Member

I have no idea, but Stringutils has some platform specific handling and was used here before, so I didn't want to unwillingly change behavior.
I can change it to remove its use if preferred.

@wsnipex wsnipex force-pushed the wsnipex:formating branch from c251c52 to f777798 Feb 11, 2017
@wsnipex

This comment has been minimized.

Copy link
Member Author

commented Feb 11, 2017

updated to drop the stringutils call.
jenkins build this please

@wsnipex

This comment has been minimized.

Copy link
Member Author

commented Feb 12, 2017

jenkins build this please

@wsnipex wsnipex merged commit 99c25f6 into xbmc:master Feb 12, 2017
2 of 3 checks passed
2 of 3 checks passed
jenkins4kodi Yeah yeah I'll get to it when i have some time
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@MartijnKaijser MartijnKaijser added this to the L 18.0-alpha1 milestone Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.