Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | Description: revert upstream bugfix (see:https://github.com/Microsoft/cpprestsdk/issues/1090) |
| 2 | Last-Update: 2019-03-28 |
| 3 | |
| 4 | --- cpprest-2.10.12.orig/Release/src/utilities/asyncrt_utils.cpp |
| 5 | +++ cpprest-2.10.12/Release/src/utilities/asyncrt_utils.cpp |
| 6 | @@ -1393,16 +1393,15 @@ utility::seconds __cdecl timespan::xml_d |
| 7 | return utility::seconds(numSecs); |
| 8 | } |
| 9 | |
| 10 | -static const char c_allowed_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
| 11 | -static const int chars_count = static_cast<int>(sizeof(c_allowed_chars) - 1); |
| 12 | +static const utility::char_t c_allowed_chars[] = |
| 13 | + _XPLATSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); |
| 14 | |
| 15 | utility::string_t nonce_generator::generate() |
| 16 | { |
| 17 | - std::uniform_int_distribution<> distr(0, chars_count - 1); |
| 18 | + std::uniform_int_distribution<> distr(0, static_cast<int>(sizeof(c_allowed_chars) / sizeof(utility::char_t)) - 1); |
| 19 | utility::string_t result; |
| 20 | result.reserve(length()); |
| 21 | - std::generate_n(std::back_inserter(result), length(), |
| 22 | - [&] { return static_cast<utility::char_t>(c_allowed_chars[distr(m_random)]); }); |
| 23 | + std::generate_n(std::back_inserter(result), length(), [&]() { return c_allowed_chars[distr(m_random)]; }); |
| 24 | return result; |
| 25 | } |
| 26 | |