fix basepath for headless stylesheets
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace mbgl {
|
||||
namespace util {
|
||||
@@ -25,5 +26,25 @@ std::string percentEncode(const std::string& input) {
|
||||
return encoded.str();
|
||||
}
|
||||
|
||||
std::string percentDecode(const std::string& input) {
|
||||
std::string decoded;
|
||||
|
||||
auto it = input.begin();
|
||||
const auto end = input.end();
|
||||
char hex[3] = "00";
|
||||
|
||||
while (it != end) {
|
||||
auto cur = std::find(it, end, '%');
|
||||
decoded.append(it, cur);
|
||||
it = cur;
|
||||
if (cur != end) {
|
||||
it += input.copy(hex, 2, cur - input.begin() + 1) + 1;
|
||||
decoded += static_cast<char>(std::strtoul(hex, nullptr, 16));
|
||||
}
|
||||
}
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user