aboutsummaryrefslogtreecommitdiff
path: root/src/NetUtils.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-17 09:47:45 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-17 09:59:29 +0100
commit453eac7f1f5ef70390ec51087fc1f190811a7507 (patch)
tree21a32ef6de9a3d7c29562484104b56c12518a6f0 /src/NetUtils.cpp
parentfc49d40c0d2f6edbbe9dde1f1b53d6a17e9d9f7d (diff)
Replace sfml with mgl
Diffstat (limited to 'src/NetUtils.cpp')
-rw-r--r--src/NetUtils.cpp45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/NetUtils.cpp b/src/NetUtils.cpp
index 4f5fce8..2dab2b8 100644
--- a/src/NetUtils.cpp
+++ b/src/NetUtils.cpp
@@ -273,51 +273,6 @@ namespace QuickMedia {
return strings;
}
- static size_t is_start_of_utf8_codepoint(uint8_t c) {
- if((c & 0x80) == 0)
- return true;
- else if((c & 0xE0) == 0xC0)
- return true;
- else if((c & 0xF0) == 0xE0)
- return true;
- else if((c & 0xF8) == 0xF0)
- return true;
- else
- return false;
- }
-
- void convert_utf8_to_utf32_ranges(const std::string &str, std::vector<Range> &ranges) {
- if(ranges.empty())
- return;
-
- size_t ranges_index = 0;
- size_t prev_range_offset = 0;
- size_t num_codepoints = 0;
- bool in_range = false;
-
- for(size_t i = 0; i < str.size(); ++i) {
- if(ranges_index > 0 && in_range) {
- ++prev_range_offset;
- if(prev_range_offset == ranges[ranges_index - 1].length) {
- ranges[ranges_index - 1].length = num_codepoints - ranges[ranges_index - 1].start;
- prev_range_offset = 0;
- in_range = false;
- }
- }
-
- if(i == ranges[ranges_index].start) {
- in_range = true;
- ranges[ranges_index].start = num_codepoints;
- ++ranges_index;
- if(ranges_index == ranges.size())
- break;
- }
-
- if(is_start_of_utf8_codepoint(*(uint8_t*)&str[i]))
- ++num_codepoints;
- }
- }
-
std::string header_extract_value(const std::string &header, const std::string &type) {
std::string result;
string_split(header, '\n', [&type, &result](const char *str, size_t size) {