From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1693960-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 1FC371581F3
	for <garchives@archives.gentoo.org>; Mon, 25 Nov 2024 20:42:42 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4A20FE087F;
	Mon, 25 Nov 2024 20:42:41 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 4CB5EE08B1
	for <gentoo-commits@lists.gentoo.org>; Mon, 25 Nov 2024 20:42:40 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 1EC9234300A
	for <gentoo-commits@lists.gentoo.org>; Mon, 25 Nov 2024 20:42:39 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 7CDEB1898
	for <gentoo-commits@lists.gentoo.org>; Mon, 25 Nov 2024 20:42:37 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1732567281.1ee8d51644d75b0ecfeeffbecaf575b44e0e1038.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/files/, media-video/ffmpeg/
X-VCS-Repository: repo/gentoo
X-VCS-Files: media-video/ffmpeg/ffmpeg-4.4.5-r1.ebuild media-video/ffmpeg/files/ffmpeg-4.4.5-wint-inconversion-libgcrypt.patch
X-VCS-Directories: media-video/ffmpeg/ media-video/ffmpeg/files/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 1ee8d51644d75b0ecfeeffbecaf575b44e0e1038
X-VCS-Branch: master
Date: Mon, 25 Nov 2024 20:42:37 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 06cebc14-01d5-4493-8c81-721c9516b6e1
X-Archives-Hash: 144f9f51dc62464bb9ede1f4d3921fc6

commit:     1ee8d51644d75b0ecfeeffbecaf575b44e0e1038
Author:     Kostadin Shishmanov <kocelfc <AT> tutanota <DOT> com>
AuthorDate: Mon Nov 25 20:18:56 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 20:41:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ee8d516

media-video/ffmpeg: fix -Wint-conversion in 4.4.5 (libgcrypt)

Backport patch to fix build failure with GCC 14.

Closes: https://bugs.gentoo.org/944785
Signed-off-by: Kostadin Shishmanov <kocelfc <AT> tutanota.com>
Closes: https://github.com/gentoo/gentoo/pull/39470
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-video/ffmpeg/ffmpeg-4.4.5-r1.ebuild          |  1 +
 .../ffmpeg-4.4.5-wint-inconversion-libgcrypt.patch | 69 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/media-video/ffmpeg/ffmpeg-4.4.5-r1.ebuild b/media-video/ffmpeg/ffmpeg-4.4.5-r1.ebuild
index ecf24fe33e56..6da94c8906df 100644
--- a/media-video/ffmpeg/ffmpeg-4.4.5-r1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-4.4.5-r1.ebuild
@@ -348,6 +348,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-4.4.4-glslang.patch
 	"${FILESDIR}"/${PN}-4.4.4-amd-av1-vaapi.patch
 	"${FILESDIR}"/${PN}-4.4.5-incmptbl-pntr-types.patch
+	"${FILESDIR}"/${PN}-4.4.5-wint-inconversion-libgcrypt.patch
 )
 
 MULTILIB_WRAPPED_HEADERS=(

diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.5-wint-inconversion-libgcrypt.patch b/media-video/ffmpeg/files/ffmpeg-4.4.5-wint-inconversion-libgcrypt.patch
new file mode 100644
index 000000000000..a9c4fb2ab437
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.5-wint-inconversion-libgcrypt.patch
@@ -0,0 +1,69 @@
+https://bugs.gentoo.org/944785
+https://bugs.gentoo.org/935377
+https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/42982b5a5d461530a792e69b3e8abdd9d6d67052
+
+From 42982b5a5d461530a792e69b3e8abdd9d6d67052 Mon Sep 17 00:00:00 2001
+From: Frank Plowman <post@frankplowman.com>
+Date: Fri, 22 Dec 2023 12:00:01 +0000
+Subject: [PATCH 1/1] avformat/ffrtmpcrypt: Fix int-conversion warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+The gcrypt definition of `bn_new` used to use the return statement
+on errors, with an AVERROR return value, regardless of the signature
+of the function where the macro is used - it is called in
+`dh_generate_key` and `ff_dh_init` which return pointers. As a result,
+compiling with gcrypt and the ffrtmpcrypt protocol resulted in an
+int-conversion warning. GCC 14 may upgrade these to errors [1].
+
+This patch fixes the problem by changing the macro to remove `AVERROR`
+and instead set `bn` to null if the allocation fails. This is the
+behaviour of all the other `bn_new` implementations and so the result is
+already checked at all the callsites. AFAICT, this should be the only
+change needed to get ffmpeg off Fedora's naughty list of projects with
+warnings which may be upgraded to errors in GCC 14 [2].
+
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html
+[2]: https://www.mail-archive.com/devel@lists.fedoraproject.org/msg196024.html
+
+Signed-off-by: Frank Plowman <post@frankplowman.com>
+Signed-off-by: Martin Storsjö <martin@martin.st>
+---
+ libavformat/rtmpdh.c | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c
+index 5ddae537a1..6a6c2ccd87 100644
+--- a/libavformat/rtmpdh.c
++++ b/libavformat/rtmpdh.c
+@@ -113,15 +113,18 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p)
+     return 0;
+ }
+ #elif CONFIG_GCRYPT
+-#define bn_new(bn)                                              \
+-    do {                                                        \
+-        if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \
+-            if (!gcry_check_version("1.5.4"))                   \
+-                return AVERROR(EINVAL);                         \
+-            gcry_control(GCRYCTL_DISABLE_SECMEM, 0);            \
+-            gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);   \
+-        }                                                       \
+-        bn = gcry_mpi_new(1);                                   \
++#define bn_new(bn)                                                \
++    do {                                                          \
++        if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) {   \
++            if (gcry_check_version("1.5.4")) {                    \
++                gcry_control(GCRYCTL_DISABLE_SECMEM, 0);          \
++                gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \
++            }                                                     \
++        }                                                         \
++        if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P))      \
++            bn = gcry_mpi_new(1);                                 \
++        else                                                      \
++            bn = NULL;                                            \
+     } while (0)
+ #define bn_free(bn)                 gcry_mpi_release(bn)
+ #define bn_set_word(bn, w)          gcry_mpi_set_ui(bn, w)
+--
+2.25.1