Add patch to fix ICalAttach handling of the icalattach native structure
This commit is contained in:
parent
2260be4f88
commit
a744e8c3f1
138
libical-3.0.6-ICalAttach.patch
Normal file
138
libical-3.0.6-ICalAttach.patch
Normal file
@ -0,0 +1,138 @@
|
||||
From 3e25fb01f0909308b87dfbd90ef53d54a8dc203f Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Mon, 14 Oct 2019 13:45:02 +0200
|
||||
Subject: [PATCH 1/2] libical-glib: Fix ICalAttach handling of the icalattach
|
||||
native structure
|
||||
|
||||
The icalattach structure is specific, it has its own ref-counting, thus
|
||||
let the ICalAttach wrapper depend on it, rather than depend on the owner
|
||||
ICalProperty or ICalValue. This way the "owner" can be freed and the ICalAttach
|
||||
will still hold valid structure.
|
||||
---
|
||||
src/libical-glib/api/i-cal-attach.xml | 2 +-
|
||||
src/libical-glib/tools/generator.c | 10 ++++++++++
|
||||
.../source-structure-boilerplate-template | 1 +
|
||||
src/libical-glib/tools/xml-parser.c | 20 +++++++++++++++++++
|
||||
src/libical-glib/tools/xml-parser.h | 1 +
|
||||
6 files changed, 34 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/libical-glib/api/i-cal-attach.xml b/src/libical-glib/api/i-cal-attach.xml
|
||||
index c0c1e108..e4fcf0d2 100644
|
||||
--- a/src/libical-glib/api/i-cal-attach.xml
|
||||
+++ b/src/libical-glib/api/i-cal-attach.xml
|
||||
@@ -13,7 +13,7 @@
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
-<structure namespace="ICal" name="Attach" native="icalattach" destroy_func="icalattach_unref">
|
||||
+<structure namespace="ICal" name="Attach" native="icalattach" destroy_func="icalattach_unref" new_full_extra_code="if (owner) { icalattach_ref (native); owner = NULL; }">
|
||||
<method name="i_cal_attach_new_from_url" corresponds="icalattach_new_from_url" kind="constructor" since="1.0">
|
||||
<parameter type="const gchar *" name="url" comment="The url from which the object is created"/>
|
||||
<returns type="ICalAttach *" annotation="transfer full" comment="The newly created #ICalAttach from the @url" />
|
||||
diff --git a/src/libical-glib/tools/generator.c b/src/libical-glib/tools/generator.c
|
||||
index 712d9bc1..64a9f5ea 100644
|
||||
--- a/src/libical-glib/tools/generator.c
|
||||
+++ b/src/libical-glib/tools/generator.c
|
||||
@@ -911,6 +911,12 @@ void generate_code_from_template(FILE *in, FILE *out, Structure *structure, GHas
|
||||
val = g_hash_table_lookup(table, buffer);
|
||||
write_str(out, val);
|
||||
val = NULL;
|
||||
+
|
||||
+ if (g_strcmp0(buffer, "new_full_extraCode") == 0)
|
||||
+ write_str(out, "\n ");
|
||||
+ } else if (g_strcmp0(buffer, "new_full_extraCode") == 0) {
|
||||
+ /* For simplicity, after lookup in the 'table', to
|
||||
+ not force declaration of it in every .xml file */
|
||||
} else if (g_strcmp0(buffer, "structure_boilerplate") == 0) {
|
||||
if (structure->native != NULL)
|
||||
generate_header_structure_boilerplate(out, structure, table);
|
||||
@@ -1266,6 +1272,10 @@ GHashTable *get_hash_table_from_structure(Structure *structure)
|
||||
(void)g_hash_table_insert(table, (gchar *)"defaultNative",
|
||||
g_strdup(structure->defaultNative));
|
||||
}
|
||||
+ if (structure->new_full_extraCode && *structure->new_full_extraCode) {
|
||||
+ (void)g_hash_table_insert(table, (gchar *)"new_full_extraCode",
|
||||
+ g_strdup(structure->new_full_extraCode));
|
||||
+ }
|
||||
}
|
||||
|
||||
(void)g_hash_table_insert(table, (char *)"native", g_strdup(structure->native));
|
||||
diff --git a/src/libical-glib/tools/source-structure-boilerplate-template b/src/libical-glib/tools/source-structure-boilerplate-template
|
||||
index ceddd505..77d20aae 100644
|
||||
--- a/src/libical-glib/tools/source-structure-boilerplate-template
|
||||
+++ b/src/libical-glib/tools/source-structure-boilerplate-template
|
||||
@@ -26,6 +26,7 @@ ${new_full}
|
||||
${native} *clone;^$$^!${isBare}
|
||||
if (native == NULL)
|
||||
return NULL;^$
|
||||
+ ${new_full_extraCode}
|
||||
$^${isBare}
|
||||
clone = g_new (${native}, 1);
|
||||
*clone = native;^$
|
||||
diff --git a/src/libical-glib/tools/xml-parser.c b/src/libical-glib/tools/xml-parser.c
|
||||
index e7b1b42f..c5520119 100644
|
||||
--- a/src/libical-glib/tools/xml-parser.c
|
||||
+++ b/src/libical-glib/tools/xml-parser.c
|
||||
@@ -27,6 +27,7 @@ Structure *structure_new()
|
||||
structure->methods = NULL;
|
||||
structure->isBare = FALSE;
|
||||
structure->isPossibleGlobal = FALSE;
|
||||
+ structure->new_full_extraCode = NULL;
|
||||
structure->enumerations = NULL;
|
||||
structure->destroyFunc = NULL;
|
||||
structure->cloneFunc = NULL;
|
||||
@@ -68,6 +69,7 @@ void structure_free(Structure * structure)
|
||||
g_free(structure->destroyFunc);
|
||||
g_free(structure->cloneFunc);
|
||||
g_free(structure->defaultNative);
|
||||
+ g_free(structure->new_full_extraCode);
|
||||
g_hash_table_destroy(structure->dependencies);
|
||||
g_free(structure);
|
||||
}
|
||||
@@ -251,6 +253,22 @@ void enumeration_free(Enumeration * enumeration)
|
||||
g_free(enumeration);
|
||||
}
|
||||
|
||||
+static gchar *dup_attribute_value(xmlDocPtr doc, const xmlNode * list, int inLine)
|
||||
+{
|
||||
+ xmlChar *xml_value;
|
||||
+ gchar *glib_value;
|
||||
+
|
||||
+ xml_value = xmlNodeListGetString(doc, list, inLine);
|
||||
+ if (!xml_value)
|
||||
+ return NULL;
|
||||
+
|
||||
+ glib_value = g_strdup((const gchar *) xml_value);
|
||||
+
|
||||
+ xmlFree(xml_value);
|
||||
+
|
||||
+ return glib_value;
|
||||
+}
|
||||
+
|
||||
GList *get_list_from_string(const gchar * str)
|
||||
{
|
||||
gchar **ret;
|
||||
@@ -530,6 +548,8 @@ gboolean parse_structure(xmlNode * node, Structure * structure)
|
||||
structure->destroyFunc = (gchar *) xmlNodeListGetString(attr->doc, attr->children, 1);
|
||||
} else if (xmlStrcmp(attr->name, (xmlChar *) "clone_func") == 0) {
|
||||
structure->cloneFunc = (gchar *) xmlNodeListGetString(attr->doc, attr->children, 1);
|
||||
+ } else if (xmlStrcmp(attr->name, (xmlChar *) "new_full_extra_code") == 0) {
|
||||
+ structure->new_full_extraCode = dup_attribute_value(attr->doc, attr->children, 1);
|
||||
} else if (xmlStrcmp(attr->name, (xmlChar *) "default_native") == 0) {
|
||||
structure->defaultNative = (gchar *) xmlNodeListGetString(attr->doc, attr->children, 1);
|
||||
} else if (xmlStrcmp(attr->name, (xmlChar *) "is_bare") == 0) {
|
||||
diff --git a/src/libical-glib/tools/xml-parser.h b/src/libical-glib/tools/xml-parser.h
|
||||
index 33527c0c..3313753f 100644
|
||||
--- a/src/libical-glib/tools/xml-parser.h
|
||||
+++ b/src/libical-glib/tools/xml-parser.h
|
||||
@@ -61,6 +61,7 @@ typedef struct Structure {
|
||||
GList *methods;
|
||||
gboolean isBare;
|
||||
gboolean isPossibleGlobal;
|
||||
+ gchar *new_full_extraCode;
|
||||
GList *enumerations;
|
||||
GHashTable *dependencies;
|
||||
gchar *destroyFunc;
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,13 +1,16 @@
|
||||
Summary: Reference implementation of the iCalendar data type and serialization format
|
||||
Name: libical
|
||||
Version: 3.0.6
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: LGPLv2 or MPLv2.0
|
||||
URL: https://libical.github.io/libical/
|
||||
Source: https://github.com/%{name}/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch01: libical-3.0.3-load-builtin-timezone.patch
|
||||
|
||||
# https://github.com/libical/libical/pull/412
|
||||
Patch02: libical-3.0.6-ICalAttach.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: cmake
|
||||
@ -64,6 +67,7 @@ Development files needed for building things which link against %{name}-glib.
|
||||
%setup -q
|
||||
|
||||
%patch01 -p1 -b .load-builtin-timezone
|
||||
%patch02 -p1 -b .ICalAttach
|
||||
|
||||
%build
|
||||
mkdir -p %{_target_platform}
|
||||
@ -133,6 +137,9 @@ make test ARGS="-V" -C %{_target_platform}
|
||||
%{_datadir}/gtk-doc/html/%{name}-glib
|
||||
|
||||
%changelog
|
||||
* Mon Oct 14 2019 Milan Crha <mcrha@redhat.com> - 3.0.6-2
|
||||
- Add patch to fix ICalAttach handling of the icalattach native structure
|
||||
|
||||
* Mon Sep 16 2019 Milan Crha <mcrha@redhat.com> - 3.0.6-1
|
||||
- Update to 3.0.6
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user