Ticket #7077: po.patch

File po.patch, 6.9 KB (added by Luke Elliott <lukester_null@…>, 10 years ago)
  • libs\program_options\src\cmdline.cpp

     
    246246        vector<option> result;
    247247        while(!args.empty())
    248248        {
    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
    256256                // are valid, and that all values are in place.
    257257                if (!next.empty())
    258258                {
     
    318318            if (min_tokens < max_tokens && opt.value.size() < max_tokens)
    319319            {
    320320                // This option may grab some more tokens.
    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                {
    328328                    option& opt2 = result[j];
    329329                    if (!opt2.string_key.empty())
    330330                        break;
     
    437437
    438438            // We don't check if those tokens look like option, or not!
    439439
    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            {
    447447                if (!opt.value.empty() && max_tokens == 0)
    448448                {
    449449                    boost::throw_exception(
     
    452452
    453453                // If an option wants, at minimum, N tokens, we grab them there,
    454454                // when adding these tokens as values to current option we check
    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                {
    462462                    min_tokens = 0;
    463463                }
    464464
  • libs\program_options\src\options_description.cpp

     
    466466                        }
    467467                    }
    468468
    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 = 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
    476476                    // prevent chopped words
    477477                    // Is line_end between two non-space characters?
    478478                    if ((*(line_end - 1) != ' ') &&
     
    486486                            .base();
    487487
    488488                        if (last_space != line_begin)
    489489                        {
    490490                            // is last_space within the second half ot the
    491491                            // current line
    492                             if (static_cast<unsigned>(distance(last_space, line_end)) <
     492                            if (static_cast<unsigned>(std::distance(last_space, line_end)) <
    493493                                (line_length / 2))
    494494                            {
    495495                                line_end = last_space;
    496496                            }
    497497                        }
    498498                    } // prevent chopped words
    499499
    500500                    // write line to stream
    501501                    copy(line_begin, line_end, ostream_iterator<char>(os));
    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
    510510                    // more lines to follow?
    511511                    if (line_end != par_end)
    512512                    {
     
    589589                   os.put('\n'); // first column is too long, lets put description in new line
    590590                   for (unsigned pad = first_column_width; pad > 0; --pad)
    591591                   {
    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                   }
    599599                }
    600600
    601601                format_description(os, opt.description(),
  • libs\program_options\src\positional_options.cpp

     
    3131    }
    3232
    3333    unsigned
    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&
    4141    positional_options_description::name_for_position(unsigned position) const
    4242    {
    4343        assert(position < max_total_count());
  • libs\program_options\src\winmain.cpp

     
    8686#ifndef BOOST_NO_STD_WSTRING
    8787    BOOST_PROGRAM_OPTIONS_DECL std::vector<std::wstring>
    8888    split_winmain(const std::wstring& cmdline)
    8989    {
    9090        std::vector<std::wstring> result;
    9191        std::vector<std::string> aux = split_winmain(to_internal(cmdline));
    92         for (unsigned i = 0, e = aux.size(); i < e; ++i)
     92        for (unsigned i = 0, e = static_cast<unsigned>(aux.size()); i < e; ++i)
    9393            result.push_back(from_utf8(aux[i]));
    9494        return result;
    9595    }
    9696#endif
    9797
    9898}}
    9999#endif
    100100