Ticket #7077: po.patch
File po.patch, 6.9 KB (added by , 10 years ago) |
---|
-
libs\program_options\src\cmdline.cpp
246 246 vector<option> result; 247 247 while(!args.empty()) 248 248 { 249 249 bool ok = false; 250 250 for(unsigned i = 0; i < style_parsers.size(); ++i) 251 251 { 252 unsigned current_size = args.size();252 unsigned current_size = static_cast<unsigned>(args.size()); 253 253 vector<option> next = style_parsers[i](args); 254 254 255 255 // Check that option names 256 256 // are valid, and that all values are in place. 257 257 if (!next.empty()) 258 258 { … … 318 318 if (min_tokens < max_tokens && opt.value.size() < max_tokens) 319 319 { 320 320 // This option may grab some more tokens. 321 321 // We only allow to grab tokens that are not already 322 322 // recognized as key options. 323 323 324 int can_take_more = max_tokens - opt.value.size();324 int can_take_more = max_tokens - static_cast<int>(opt.value.size()); 325 325 unsigned j = i+1; 326 326 for (; can_take_more && j < result.size(); --can_take_more, ++j) 327 327 { 328 328 option& opt2 = result[j]; 329 329 if (!opt2.string_key.empty()) 330 330 break; … … 437 437 438 438 // We don't check if those tokens look like option, or not! 439 439 440 440 unsigned min_tokens = d.semantic()->min_tokens(); 441 441 unsigned max_tokens = d.semantic()->max_tokens(); 442 442 443 unsigned present_tokens = opt.value.size() + other_tokens.size();443 unsigned present_tokens = static_cast<unsigned>(opt.value.size() + other_tokens.size()); 444 444 445 445 if (present_tokens >= min_tokens) 446 446 { 447 447 if (!opt.value.empty() && max_tokens == 0) 448 448 { 449 449 boost::throw_exception( … … 452 452 453 453 // If an option wants, at minimum, N tokens, we grab them there, 454 454 // when adding these tokens as values to current option we check 455 455 // if they look like options 456 456 if (opt.value.size() <= min_tokens) 457 457 { 458 min_tokens -= opt.value.size();458 min_tokens -= static_cast<unsigned>(opt.value.size()); 459 459 } 460 460 else 461 461 { 462 462 min_tokens = 0; 463 463 } 464 464 -
libs\program_options\src\options_description.cpp
466 466 } 467 467 } 468 468 469 469 // Take care to never increment the iterator past 470 470 // the end, since MSVC 8.0 (brokenly), assumes that 471 471 // 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)); 473 473 string::const_iterator line_end = line_begin + 474 474 ((remaining < line_length) ? remaining : line_length); 475 475 476 476 // prevent chopped words 477 477 // Is line_end between two non-space characters? 478 478 if ((*(line_end - 1) != ' ') && … … 486 486 .base(); 487 487 488 488 if (last_space != line_begin) 489 489 { 490 490 // is last_space within the second half ot the 491 491 // current line 492 if (static_cast<unsigned>( distance(last_space, line_end)) <492 if (static_cast<unsigned>(std::distance(last_space, line_end)) < 493 493 (line_length / 2)) 494 494 { 495 495 line_end = last_space; 496 496 } 497 497 } 498 498 } // prevent chopped words 499 499 500 500 // write line to stream 501 501 copy(line_begin, line_end, ostream_iterator<char>(os)); 502 502 503 503 if (first_line) 504 504 { 505 indent += par_indent;506 line_length -= par_indent; // there's less to work with now505 indent += static_cast<unsigned>(par_indent); 506 line_length -= static_cast<unsigned>(par_indent); // there's less to work with now 507 507 first_line = false; 508 508 } 509 509 510 510 // more lines to follow? 511 511 if (line_end != par_end) 512 512 { … … 589 589 os.put('\n'); // first column is too long, lets put description in new line 590 590 for (unsigned pad = first_column_width; pad > 0; --pad) 591 591 { 592 592 os.put(' '); 593 593 } 594 594 } else { 595 for(unsigned pad = first_column_width - s s.str().size(); pad > 0; --pad)595 for(unsigned pad = first_column_width - static_cast<unsigned>(ss.str().size()); pad > 0; --pad) 596 596 { 597 597 os.put(' '); 598 598 } 599 599 } 600 600 601 601 format_description(os, opt.description(), -
libs\program_options\src\positional_options.cpp
31 31 } 32 32 33 33 unsigned 34 34 positional_options_description::max_total_count() const 35 35 { 36 36 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)(); 38 38 } 39 39 40 40 const std::string& 41 41 positional_options_description::name_for_position(unsigned position) const 42 42 { 43 43 assert(position < max_total_count()); -
libs\program_options\src\winmain.cpp
86 86 #ifndef BOOST_NO_STD_WSTRING 87 87 BOOST_PROGRAM_OPTIONS_DECL std::vector<std::wstring> 88 88 split_winmain(const std::wstring& cmdline) 89 89 { 90 90 std::vector<std::wstring> result; 91 91 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) 93 93 result.push_back(from_utf8(aux[i])); 94 94 return result; 95 95 } 96 96 #endif 97 97 98 98 }} 99 99 #endif 100 100