From 5cc735b22570f1667d62958e59ce4910b529f5af Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 16 Aug 2021 21:13:24 +0200 Subject: Add MyAnimeList (wip) --- src/NetUtils.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/NetUtils.cpp') diff --git a/src/NetUtils.cpp b/src/NetUtils.cpp index 28256cb..0f957d5 100644 --- a/src/NetUtils.cpp +++ b/src/NetUtils.cpp @@ -34,17 +34,6 @@ namespace QuickMedia { std::string unescaped_str; }; - static bool to_num(const char *str, size_t size, int &num) { - num = 0; - for(size_t i = 0; i < size; ++i) { - const char num_c = str[i] - '0'; - if(num_c < 0 || num_c > 9) - return false; - num = (num * 10) + num_c; - } - return true; - } - static void html_unescape_sequence_numbers(std::string &str) { size_t index = 0; while(true) { @@ -69,10 +58,13 @@ namespace QuickMedia { void html_unescape_sequences(std::string &str) { html_unescape_sequence_numbers(str); - const std::array unescape_sequences = { + // TODO: Use string find and find & and ; instead of string_replace_all + const std::array unescape_sequences = { HtmlUnescapeSequence { """, "\"" }, HtmlUnescapeSequence { "<", "<" }, HtmlUnescapeSequence { ">", ">" }, + HtmlUnescapeSequence { "—", "—" }, + HtmlUnescapeSequence { " ", " " }, HtmlUnescapeSequence { "&", "&" } // This should be last, to not accidentally replace a new sequence caused by replacing this }; -- cgit v1.2.3