[grilo-plugins] lua-factory: Use HTML entities helper
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] lua-factory: Use HTML entities helper
- Date: Fri, 5 Dec 2014 10:57:43 +0000 (UTC)
commit 74604bd75c21a6b9ddcafd6a862d6c462a0e3975
Author: Bastien Nocera <hadess hadess net>
Date: Thu Nov 27 15:42:47 2014 +0100
lua-factory: Use HTML entities helper
Which now supports more entities than what we supported.
https://bugzilla.gnome.org/show_bug.cgi?id=729680
src/lua-factory/grl-lua-library.c | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index 4a6a253..430d2f3 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -30,6 +30,7 @@
#include "grl-lua-common.h"
#include "grl-lua-library.h"
#include "lua-library/lua-libraries.h"
+#include "lua-library/htmlentity.h"
#define GRL_LOG_DOMAIN_DEFAULT lua_library_log_domain
GRL_LOG_DOMAIN_STATIC (lua_library_log_domain);
@@ -122,23 +123,15 @@ unescape_string (const char *orig_from)
} else {
continue;
}
- } else if (strncmp (from, "lt;", 3) == 0) {
- *to = '<';
- from += 2;
- } else if (strncmp (from, "gt;", 3) == 0) {
- *to = '>';
- from += 2;
- } else if (strncmp (from, "amp;", 4) == 0) {
- *to = '&';
- from += 3;
- } else if (strncmp (from, "quot;", 5) == 0) {
- *to = '"';
- from += 4;
- } else if (strncmp (from, "apos;", 5) == 0) {
- *to = '\'';
- from += 4;
} else {
- continue;
+ gchar *end = NULL;
+
+ end = strstr (from, ";");
+ if (!end)
+ continue;
+
+ *to = html_entity_parse (from, end - from);
+ from = end;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]