Merge commit 'ad9d95cca240fa0edd8e033126877ec58ed848d8'
[feed/routing.git] / mcproxy / patches / 100-stoi_remove.patch
1 --- a/mcproxy/src/parser/parser.cpp
2 +++ b/mcproxy/src/parser/parser.cpp
3 @@ -125,7 +125,10 @@ void parser::parse_instance_definition(i
4 get_next_token();
5 if (m_current_token.get_type() == TT_STRING) {
6 try {
7 - table_number = std::stoi(m_current_token.get_string());
8 + std::stringstream convert;
9 +
10 + convert << m_current_token.get_string();
11 + convert >> table_number;
12 user_selected_table_number = true;
13 } catch (std::logic_error e) {
14 HC_LOG_ERROR("failed to parse line " << m_current_line << " table number: " << table_number << " is not a number");
15 @@ -298,7 +301,11 @@ std::unique_ptr<addr_match> parser::pars
16 get_next_token();
17 if (m_current_token.get_type() == TT_STRING) {
18 try {
19 - unsigned int prefix = std::stoi(m_current_token.get_string());
20 + std::stringstream convert;
21 + unsigned int prefix;
22 +
23 + convert << m_current_token.get_string();
24 + convert >> prefix;
25 if (prefix > 128) {
26 throw;
27 }
28 @@ -560,7 +567,11 @@ void parser::parse_interface_rule_match_
29 get_next_token();
30 if (m_current_token.get_type() == TT_STRING) {
31 try {
32 - int tmp_timeout = std::stoi(m_current_token.get_string());
33 + std::stringstream convert;
34 + int tmp_timeout;
35 +
36 + convert << m_current_token.get_string();
37 + convert >> tmp_timeout;
38 timeout = std::chrono::milliseconds(tmp_timeout);
39 } catch (...) {
40 error_notification();
41 --- a/mcproxy/src/utils/addr_storage.cpp
42 +++ b/mcproxy/src/utils/addr_storage.cpp
43 @@ -298,7 +298,13 @@ addr_storage& addr_storage::set_port(uin
44
45 addr_storage& addr_storage::set_port(const std::string& port)
46 {
47 - set_port(std::stoi(port.c_str()));
48 + std::stringstream convert;
49 + int num_port;
50 +
51 + convert << port;
52 + convert >> num_port;
53 +
54 + set_port(num_port);
55 return *this;
56 }
57