Skip to content

Commit 8fb37a4

Browse files
committed
1 parent f0b1b5d commit 8fb37a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

httplib.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,8 @@ inline void read_file(const std::string &path, std::string &out) {
10111011

10121012
inline std::string file_extension(const std::string &path) {
10131013
std::smatch m;
1014-
auto pat = std::regex("\\.([a-zA-Z0-9]+)$");
1015-
if (std::regex_search(path, m, pat)) { return m[1].str(); }
1014+
auto re = std::regex("\\.([a-zA-Z0-9]+)$");
1015+
if (std::regex_search(path, m, re)) { return m[1].str(); }
10161016
return std::string();
10171017
}
10181018

@@ -1898,16 +1898,16 @@ inline bool parse_multipart_formdata(const std::string &boundary,
18981898

18991899
inline bool parse_range_header(const std::string &s, Ranges &ranges) {
19001900
try {
1901-
static auto re = std::regex(R"(bytes=(\d*-\d*(?:,\s*\d*-\d*)*))");
1901+
static auto re_first_range = std::regex(R"(bytes=(\d*-\d*(?:,\s*\d*-\d*)*))");
19021902
std::smatch m;
1903-
if (std::regex_match(s, m, re)) {
1903+
if (std::regex_match(s, m, re_first_range)) {
19041904
auto pos = m.position(1);
19051905
auto len = m.length(1);
19061906
detail::split(&s[pos], &s[pos + len], ',',
19071907
[&](const char *b, const char *e) {
1908-
static auto re = std::regex(R"(\s*(\d*)-(\d*))");
1908+
static auto re_another_range = std::regex(R"(\s*(\d*)-(\d*))");
19091909
std::cmatch m;
1910-
if (std::regex_match(b, e, m, re)) {
1910+
if (std::regex_match(b, e, m, re_another_range)) {
19111911
ssize_t first = -1;
19121912
if (!m.str(1).empty()) {
19131913
first = static_cast<ssize_t>(std::stoll(m.str(1)));

0 commit comments

Comments
 (0)