Skip to content

Commit b6737d8

Browse files
committed
Fix recursion on some compilers due to wrong copy_part method used
1 parent 6b44b8d commit b6737d8

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/detail/uri_advance_parts.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,32 @@
88
#include <utility>
99
#include <limits>
1010

11-
namespace network {
12-
namespace detail {
11+
namespace network_detail = network::detail;
12+
using network::detail::uri_part;
13+
using network::string_view;
14+
1315
namespace {
1416
template <class Iterator>
1517
uri_part copy_part(Iterator first, Iterator last,
1618
string_view::const_iterator &it) {
1719
auto part_first = it;
1820
std::advance(it, std::distance(first, last));
19-
return detail::uri_part(part_first, it);
21+
return network_detail::uri_part(part_first, it);
2022
}
2123
} // namespace
2224

23-
uri_part copy_part(const std::string &uri, string_view::const_iterator &it) {
24-
return copy_part(std::begin(uri), std::end(uri), it);
25+
uri_part network_detail::copy_part(const std::string &uri,
26+
string_view::const_iterator &it) {
27+
return ::copy_part(std::begin(uri), std::end(uri), it);
2528
}
2629

27-
void advance_parts(string_view uri_view, uri_parts &parts,
28-
const uri_parts &existing_parts) {
30+
void network_detail::advance_parts(string_view uri_view, uri_parts &parts,
31+
const uri_parts &existing_parts) {
2932
auto first = std::begin(uri_view);
3033

3134
auto it = first;
3235
if (auto scheme = existing_parts.scheme) {
33-
parts.scheme = copy_part(std::begin(*scheme), std::end(*scheme), it);
36+
parts.scheme = ::copy_part(std::begin(*scheme), std::end(*scheme), it);
3437

3538
// ignore : for all URIs
3639
if (*it == ':') {
@@ -45,32 +48,31 @@ void advance_parts(string_view uri_view, uri_parts &parts,
4548

4649
if (auto user_info = existing_parts.hier_part.user_info) {
4750
parts.hier_part.user_info =
48-
copy_part(std::begin(*user_info), std::end(*user_info), it);
51+
::copy_part(std::begin(*user_info), std::end(*user_info), it);
4952
++it; // ignore @
5053
}
5154

5255
if (auto host = existing_parts.hier_part.host) {
53-
parts.hier_part.host = copy_part(std::begin(*host), std::end(*host), it);
56+
parts.hier_part.host = ::copy_part(std::begin(*host), std::end(*host), it);
5457
}
5558

5659
if (auto port = existing_parts.hier_part.port) {
5760
++it; // ignore :
58-
parts.hier_part.port = copy_part(std::begin(*port), std::end(*port), it);
61+
parts.hier_part.port = ::copy_part(std::begin(*port), std::end(*port), it);
5962
}
6063

6164
if (auto path = existing_parts.hier_part.path) {
62-
parts.hier_part.path = copy_part(std::begin(*path), std::end(*path), it);
65+
parts.hier_part.path = ::copy_part(std::begin(*path), std::end(*path), it);
6366
}
6467

6568
if (auto query = existing_parts.query) {
6669
++it; // ignore ?
67-
parts.query = copy_part(std::begin(*query), std::end(*query), it);
70+
parts.query = ::copy_part(std::begin(*query), std::end(*query), it);
6871
}
6972

7073
if (auto fragment = existing_parts.fragment) {
7174
++it; // ignore #
72-
parts.fragment = copy_part(std::begin(*fragment), std::end(*fragment), it);
75+
parts.fragment =
76+
::copy_part(std::begin(*fragment), std::end(*fragment), it);
7377
}
7478
}
75-
} // namespace detail
76-
} // namespace network

0 commit comments

Comments
 (0)