summaryrefslogtreecommitdiff
path: root/app-admin/syslog-ng/files/patches/syslog-ng-glib-2.64-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/syslog-ng/files/patches/syslog-ng-glib-2.64-support.patch')
-rw-r--r--app-admin/syslog-ng/files/patches/syslog-ng-glib-2.64-support.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/app-admin/syslog-ng/files/patches/syslog-ng-glib-2.64-support.patch b/app-admin/syslog-ng/files/patches/syslog-ng-glib-2.64-support.patch
new file mode 100644
index 000000000000..fdd98624a6ea
--- /dev/null
+++ b/app-admin/syslog-ng/files/patches/syslog-ng-glib-2.64-support.patch
@@ -0,0 +1,63 @@
+diff --git a/lib/compat/glib.c b/lib/compat/glib.c
+index 8b6e52447..5b8ed8891 100644
+--- a/lib/compat/glib.c
++++ b/lib/compat/glib.c
+@@ -315,3 +315,18 @@ slng_g_hash_table_insert(GHashTable *hash_table, gpointer key, gpointer value)
+ return exists;
+ }
+ #endif
++
++
++#if !GLIB_CHECK_VERSION(2, 64, 0)
++gunichar
++g_utf8_get_char_validated_fixed(const gchar *p, gssize max_len)
++{
++ // https://github.com/GNOME/glib/commit/1963821a57584b4674c20895e8a5adccd2d9effd
++
++#undef g_utf8_get_char_validated
++ if (*p == '\0' && max_len > 0)
++ return (gunichar)-2;
++
++ return g_utf8_get_char_validated(p, max_len);
++}
++#endif
+diff --git a/lib/compat/glib.h b/lib/compat/glib.h
+index a9782ed2d..0fbdbd12d 100644
+--- a/lib/compat/glib.h
++++ b/lib/compat/glib.h
+@@ -109,4 +109,9 @@ gchar *g_base64_encode_fixed(const guchar *data, gsize len);
+ gboolean slng_g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value);
+ #endif
+
++#if !GLIB_CHECK_VERSION(2, 64, 0)
++#define g_utf8_get_char_validated g_utf8_get_char_validated_fixed
++gunichar g_utf8_get_char_validated_fixed (const gchar *p, gssize max_len);
++#endif
++
+ #endif
+diff --git a/modules/cef/tests/test-format-cef-extension.c b/modules/cef/tests/test-format-cef-extension.c
+index d7f6ee3c1..f4233f96f 100644
+--- a/modules/cef/tests/test-format-cef-extension.c
++++ b/modules/cef/tests/test-format-cef-extension.c
+@@ -104,7 +104,7 @@ Test(format_cef, test_null_in_value)
+
+ configuration->template_options.on_error = ON_ERROR_DROP_MESSAGE | ON_ERROR_SILENT;
+ log_msg_set_value_by_name(msg, ".cef.k", "a\0b", 3);
+- assert_template_format_msg("$(format-cef-extension --subkeys .cef.)", "k=a\\u0000b", msg);
++ assert_template_format_msg("$(format-cef-extension --subkeys .cef.)", "k=a\\x00b", msg);
+ log_msg_unref(msg);
+ }
+
+diff --git a/modules/json/tests/test_format_json.c b/modules/json/tests/test_format_json.c
+index 92c61e9f1..1224ddb33 100644
+--- a/modules/json/tests/test_format_json.c
++++ b/modules/json/tests/test_format_json.c
+@@ -55,7 +55,7 @@ Test(format_json, test_format_json)
+ assert_template_format("$(format-json MSG=$escaping)",
+ "{\"MSG\":\"binary stuff follows \\\"\\\\xad árvíztűrőtükörfúrógép\"}");
+ assert_template_format("$(format-json MSG=$escaping2)", "{\"MSG\":\"\\\\xc3\"}");
+- assert_template_format("$(format-json MSG=$null)", "{\"MSG\":\"binary\\u0000stuff\"}");
++ assert_template_format("$(format-json MSG=$null)", "{\"MSG\":\"binary\\\\x00stuff\"}");
+ assert_template_format_with_context("$(format-json MSG=$MSG)",
+ "{\"MSG\":\"árvíztűrőtükörfúrógép\"}{\"MSG\":\"árvíztűrőtükörfúrógép\"}");
+ assert_template_format("$(format-json --scope rfc3164)",