Merge pull request #14 from yazevnul/master

Fix Clang -Wsign-conversion and -Wshorten-64-to-32 warnings.
This commit is contained in:
jarro2783 2015-05-11 16:34:50 +10:00
commit 8844335d40

View File

@ -25,6 +25,11 @@ THE SOFTWARE.
#ifndef CXX_OPTS_HPP #ifndef CXX_OPTS_HPP
#define CXX_OPTS_HPP #define CXX_OPTS_HPP
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#include <map> #include <map>
@ -196,7 +201,7 @@ namespace cxxopts
inline inline
String& String&
stringAppend(String& s, int n, char c) stringAppend(String& s, size_t n, char c)
{ {
return s.append(n, c); return s.append(n, c);
} }
@ -846,8 +851,8 @@ namespace cxxopts
format_description format_description
( (
const HelpOptionDetails& o, const HelpOptionDetails& o,
int start, size_t start,
int width size_t width
) )
{ {
auto desc = o.desc; auto desc = o.desc;
@ -863,7 +868,7 @@ namespace cxxopts
auto startLine = current; auto startLine = current;
auto lastSpace = current; auto lastSpace = current;
int size = 0; auto size = size_t{};
while (current != std::end(desc)) while (current != std::end(desc))
{ {
@ -1228,7 +1233,7 @@ Options::help_one_group(const std::string& g) const
longest = std::min(longest, static_cast<size_t>(OPTION_LONGEST)); longest = std::min(longest, static_cast<size_t>(OPTION_LONGEST));
//widest allowed description //widest allowed description
int allowed = 76 - longest - OPTION_DESC_GAP; auto allowed = size_t{76} - longest - OPTION_DESC_GAP;
auto fiter = format.begin(); auto fiter = format.begin();
for (const auto& o : group->second.options) for (const auto& o : group->second.options)
@ -1299,4 +1304,9 @@ Options::group_help(const std::string& group) const
} }
} }
#if defined(__GNU__)
#pragma GCC diagnostic pop
#endif
#endif //CXX_OPTS_HPP #endif //CXX_OPTS_HPP