Skip to content

Commit d27da53

Browse files
committed
Fix warnings on 64-bit systems.
Closes #7077. [SVN r79283]
1 parent 94fc1c6 commit d27da53

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/cmdline.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ namespace boost { namespace program_options { namespace detail {
249249
bool ok = false;
250250
for(unsigned i = 0; i < style_parsers.size(); ++i)
251251
{
252-
unsigned current_size = args.size();
252+
unsigned current_size = static_cast<unsigned>(args.size());
253253
vector<option> next = style_parsers[i](args);
254254

255255
// Check that option names
@@ -321,7 +321,7 @@ namespace boost { namespace program_options { namespace detail {
321321
// We only allow to grab tokens that are not already
322322
// recognized as key options.
323323

324-
int can_take_more = max_tokens - opt.value.size();
324+
int can_take_more = max_tokens - static_cast<int>(opt.value.size());
325325
unsigned j = i+1;
326326
for (; can_take_more && j < result.size(); --can_take_more, ++j)
327327
{
@@ -440,7 +440,7 @@ namespace boost { namespace program_options { namespace detail {
440440
unsigned min_tokens = d.semantic()->min_tokens();
441441
unsigned max_tokens = d.semantic()->max_tokens();
442442

443-
unsigned present_tokens = opt.value.size() + other_tokens.size();
443+
unsigned present_tokens = static_cast<unsigned>(opt.value.size() + other_tokens.size());
444444

445445
if (present_tokens >= min_tokens)
446446
{
@@ -455,7 +455,7 @@ namespace boost { namespace program_options { namespace detail {
455455
// if they look like options
456456
if (opt.value.size() <= min_tokens)
457457
{
458-
min_tokens -= opt.value.size();
458+
min_tokens -= static_cast<unsigned>(opt.value.size());
459459
}
460460
else
461461
{

src/options_description.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ namespace boost { namespace program_options {
469469
// Take care to never increment the iterator past
470470
// the end, since MSVC 8.0 (brokenly), assumes that
471471
// doing that, even if no access happens, is a bug.
472-
unsigned remaining = std::distance(line_begin, par_end);
472+
unsigned remaining = static_cast<unsigned>(std::distance(line_begin, par_end));
473473
string::const_iterator line_end = line_begin +
474474
((remaining < line_length) ? remaining : line_length);
475475

@@ -502,8 +502,8 @@ namespace boost { namespace program_options {
502502

503503
if (first_line)
504504
{
505-
indent += par_indent;
506-
line_length -= par_indent; // there's less to work with now
505+
indent += static_cast<unsigned>(par_indent);
506+
line_length -= static_cast<unsigned>(par_indent); // there's less to work with now
507507
first_line = false;
508508
}
509509

@@ -592,7 +592,7 @@ namespace boost { namespace program_options {
592592
os.put(' ');
593593
}
594594
} else {
595-
for(unsigned pad = first_column_width - ss.str().size(); pad > 0; --pad)
595+
for(unsigned pad = first_column_width - static_cast<unsigned>(ss.str().size()); pad > 0; --pad)
596596
{
597597
os.put(' ');
598598
}

src/positional_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace boost { namespace program_options {
3434
positional_options_description::max_total_count() const
3535
{
3636
return m_trailing.empty() ?
37-
m_names.size() : (std::numeric_limits<unsigned>::max)();
37+
static_cast<unsigned>(m_names.size()) : (std::numeric_limits<unsigned>::max)();
3838
}
3939

4040
const std::string&

src/winmain.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <boost/program_options/parsers.hpp>
88
#include <cctype>
99

10+
using std::size_t;
11+
1012
#ifdef _WIN32
1113
namespace boost { namespace program_options {
1214

@@ -89,7 +91,7 @@ namespace boost { namespace program_options {
8991
{
9092
std::vector<std::wstring> result;
9193
std::vector<std::string> aux = split_winmain(to_internal(cmdline));
92-
for (unsigned i = 0, e = aux.size(); i < e; ++i)
94+
for (size_t i = 0, e = aux.size(); i < e; ++i)
9395
result.push_back(from_utf8(aux[i]));
9496
return result;
9597
}

0 commit comments

Comments
 (0)