[packages/libdom] upstream fix for gcc 14

atler atler at pld-linux.org
Sun Oct 6 17:30:43 CEST 2024


commit 4a9caf29fcda2b99b9f03e4ecb5bc21412698318
Author: Jan Palus <atler at pld-linux.org>
Date:   Sun Oct 6 16:57:45 2024 +0200

    upstream fix for gcc 14

 gcc14.patch | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 libdom.spec |  2 ++
 2 files changed, 62 insertions(+)
---
diff --git a/libdom.spec b/libdom.spec
index db90a3d..0f50788 100644
--- a/libdom.spec
+++ b/libdom.spec
@@ -11,6 +11,7 @@ License:	MIT
 Group:		Libraries
 Source0:	http://download.netsurf-browser.org/libs/releases/%{name}-%{version}-src.tar.gz
 # Source0-md5:	715c8018dbf0ed8b61a1afcc8cb13ed9
+Patch0:		gcc14.patch
 URL:		http://www.netsurf-browser.org/projects/libdom/
 BuildRequires:	expat-devel >= 1.95
 BuildRequires:	libhubbub-devel >= 0.3.8
@@ -65,6 +66,7 @@ Statyczna biblioteka libdom.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 export AR="%{__ar}"
diff --git a/gcc14.patch b/gcc14.patch
new file mode 100644
index 0000000..72d3e34
--- /dev/null
+++ b/gcc14.patch
@@ -0,0 +1,60 @@
+From 2687282d56dfef19e26e9639a5c0cd81de957e22 Mon Sep 17 00:00:00 2001
+From: Peter Shkenev <petershh at disroot.org>
+Date: Sat, 10 Aug 2024 14:01:59 +0100
+Subject: fixes libdom build on gcc 14 due to calloc-transposed-args warning
+
+---
+ bindings/xml/expat_xmlparser.c | 2 +-
+ src/core/node.c                | 2 +-
+ src/html/html_document.c       | 5 ++---
+ 3 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/bindings/xml/expat_xmlparser.c b/bindings/xml/expat_xmlparser.c
+index a63ccf1..ba5b4e7 100644
+--- a/bindings/xml/expat_xmlparser.c
++++ b/bindings/xml/expat_xmlparser.c
+@@ -484,7 +484,7 @@ dom_xml_parser_create(const char *enc, const char *int_enc,
+ 
+ 	UNUSED(int_enc);
+ 
+-	parser = calloc(sizeof(*parser), 1);
++	parser = calloc(1, sizeof(*parser));
+ 	if (parser == NULL) {
+ 		msg(DOM_MSG_CRITICAL, mctx, "No memory for parser");
+ 		return NULL;
+diff --git a/src/core/node.c b/src/core/node.c
+index da179c3..9eabd2f 100644
+--- a/src/core/node.c
++++ b/src/core/node.c
+@@ -2379,7 +2379,7 @@ static inline dom_exception _dom_event_targets_expand(
+ 	if (t == NULL) {
+ 		/* Create the event target list */
+ 		size = 64;
+-		t = calloc(sizeof(*t), size);
++		t = calloc(size, sizeof(*t));
+ 		if (t == NULL) {
+ 			return DOM_NO_MEM_ERR;
+ 		}
+diff --git a/src/html/html_document.c b/src/html/html_document.c
+index cf3c25d..71b693a 100644
+--- a/src/html/html_document.c
++++ b/src/html/html_document.c
+@@ -134,13 +134,12 @@ dom_exception _dom_html_document_initialise(dom_html_document *doc,
+ 	doc->cookie = NULL;
+ 	doc->body = NULL;
+ 
+-	doc->memoised = calloc(sizeof(dom_string *), hds_COUNT);
++	doc->memoised = calloc(hds_COUNT, sizeof(dom_string *));
+ 	if (doc->memoised == NULL) {
+ 		error = DOM_NO_MEM_ERR;
+ 		goto out;
+ 	}
+-	doc->elements = calloc(sizeof(dom_string *),
+-			DOM_HTML_ELEMENT_TYPE__COUNT);
++	doc->elements = calloc(DOM_HTML_ELEMENT_TYPE__COUNT, sizeof(dom_string *));
+ 	if (doc->elements == NULL) {
+ 		error = DOM_NO_MEM_ERR;
+ 		goto out;
+-- 
+cgit v1.2.3
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libdom.git/commitdiff/4a9caf29fcda2b99b9f03e4ecb5bc21412698318



More information about the pld-cvs-commit mailing list