| 1 | https://trac.bunkus.org/ticket/1051 |
| 2 | https://trac.bunkus.org/changeset/0c89ff941bfdd9f3378312f293a84f13cf3e2a96 |
| 3 | |
| 4 | --- src/common/iso639.cpp (revision 916450e3a7c9b670846ff87a8112f165c903ab19) |
| 5 | +++ src/common/iso639.cpp (revision 0c89ff941bfdd9f3378312f293a84f13cf3e2a96) |
| 6 | @@ -13,6 +13,7 @@ |
| 7 | |
| 8 | #include "common/common_pch.h" |
| 9 | |
| 10 | +#include <boost/version.hpp> |
| 11 | #include <unordered_map> |
| 12 | |
| 13 | #include "common/iso639.h" |
| 14 | @@ -592,20 +593,36 @@ map_to_iso639_2_code(std::string const &s, |
| 15 | auto range = iso639_languages | badap::indexed(0); |
| 16 | auto end = boost::end(range); |
| 17 | for (auto lang = boost::begin(range); lang != end; lang++) { |
| 18 | - auto names = split(lang->english_name, ";"); |
| 19 | +#if BOOST_VERSION < 105600 |
| 20 | + auto const &english_name = lang->english_name; |
| 21 | + auto index = lang.index(); |
| 22 | +#else |
| 23 | + auto const &english_name = lang->value().english_name; |
| 24 | + auto index = lang->index(); |
| 25 | +#endif |
| 26 | + |
| 27 | + auto names = split(english_name, ";"); |
| 28 | strip(names); |
| 29 | if (brng::find(names, source) != names.end()) |
| 30 | - return lang.index(); |
| 31 | + return index; |
| 32 | } |
| 33 | |
| 34 | if (!allow_short_english_name) |
| 35 | return -1; |
| 36 | |
| 37 | for (auto lang = boost::begin(range); lang != end; lang++) { |
| 38 | - auto names = split(lang->english_name, ";"); |
| 39 | +#if BOOST_VERSION < 105600 |
| 40 | + auto const &english_name = lang->english_name; |
| 41 | + auto index = lang.index(); |
| 42 | +#else |
| 43 | + auto const &english_name = lang->value().english_name; |
| 44 | + auto index = lang->index(); |
| 45 | +#endif |
| 46 | + |
| 47 | + auto names = split(english_name, ";"); |
| 48 | strip(names); |
| 49 | if (names.end() != brng::find_if(names, [&](std::string const &name) { return balg::istarts_with(name, source); })) |
| 50 | - return lang.index(); |
| 51 | + return index; |
| 52 | } |
| 53 | |
| 54 | return -1; |