diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2016-10-31 11:30:04 +0100 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2016-10-31 12:24:35 +0100 |
commit | 8cf0cc7a688a76fbe3bf855984f7df0244570c29 (patch) | |
tree | 99e4764e3b8ef31c934e4231b44ce8b3e98e6d0f | |
parent | 6d72123012eb399f1478a6807db8265802a4417c (diff) |
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/lyrics_fetcher.cpp | 2 | ||||
-rw-r--r-- | src/utility/html.cpp | 33 |
4 files changed, 18 insertions, 22 deletions
@@ -1,3 +1,6 @@ +ncmpcpp-0.7.7 (2016-10-31) +* Fixed compilation on 32bit platforms. + ncmpcpp-0.7.6 (2016-10-30) * Fixed assertion failure on trying to search backwards in an empty list. * Updated installation instructions in INSTALL file. diff --git a/configure.ac b/configure.ac index 2f348ded..b6381e4d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_INIT(configure.ac) AC_CONFIG_HEADERS(config.h) -AM_INIT_AUTOMAKE(ncmpcpp, 0.7.6) +AM_INIT_AUTOMAKE(ncmpcpp, 0.7.7) m4_include([m4/ax_lib_readline.m4]) diff --git a/src/lyrics_fetcher.cpp b/src/lyrics_fetcher.cpp index f41a9a2b..0ae8b936 100644 --- a/src/lyrics_fetcher.cpp +++ b/src/lyrics_fetcher.cpp @@ -109,7 +109,7 @@ void LyricsFetcher::postProcess(std::string &data) const stripHtmlTags(data); // Remove indentation from each line and collapse multiple newlines into one. std::vector<std::string> lines; - boost::split(lines, data, boost::is_any_of("\r\n")); + boost::split(lines, data, boost::is_any_of("\n")); for (auto &line : lines) boost::trim(line); std::unique(lines.begin(), lines.end(), [](std::string &a, std::string &b) { diff --git a/src/utility/html.cpp b/src/utility/html.cpp index 341cd675..de834dc2 100644 --- a/src/utility/html.cpp +++ b/src/utility/html.cpp @@ -62,29 +62,22 @@ void unescapeHtmlEntities(std::string &s) void stripHtmlTags(std::string &s) { - bool erase = 0; + bool is_p, is_slash_p; for (size_t i = s.find("<"); i != std::string::npos; i = s.find("<")) { - size_t j = s.find(">", i)+1; - if (s.compare(i, std::min(3ul, j-i), "<p ") == 0 || s.compare(i, j-i, "</p>") == 0) - s.replace(i, j-i, "\n"); - else - s.replace(i, j-i, ""); - } - unescapeHtmlEntities(s); - for (size_t i = 0; i < s.length(); ++i) - { - if (erase) + size_t j = s.find(">", i); + if (j != std::string::npos) { - s.erase(s.begin()+i); - erase = 0; - } - if (s[i] == 13) // ascii code for windows line ending, get rid of this shit - { - s[i] = '\n'; - erase = 1; + ++j; + is_p = s.compare(i, j-i, "<p ") == 0 || s.compare(i, j-i, "<p>") == 0; + is_slash_p = s.compare(i, j-i, "</p>") == 0; + if (is_p || is_slash_p) + s.replace(i, j-i, "\n"); + else + s.replace(i, j-i, ""); } - else if (s[i] == '\t') - s[i] = ' '; + else + break; } + unescapeHtmlEntities(s); } |