Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/pnmixer/files/, media-sound/pnmixer/
Date: Sun, 28 Feb 2021 12:26:44
Message-Id: 1614515173.778f492d269a30b95d5d85222d96e005e518f087.asturm@gentoo
1 commit: 778f492d269a30b95d5d85222d96e005e518f087
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 26 19:03:49 2021 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 28 12:26:13 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=778f492d
7
8 media-sound/pnmixer: Various upstream fixes and port to EAPI-7
9
10 Package-Manager: Portage-3.0.15, Repoman-3.0.2
11 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
12
13 ...pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch | 37 ++++++++++++++
14 .../pnmixer-0.7.2-fix-possible-garbage-value.patch | 38 ++++++++++++++
15 .../files/pnmixer-0.7.2-fix-possible-memleak.patch | 21 ++++++++
16 media-sound/pnmixer/pnmixer-0.7.2-r1.ebuild | 59 ++++++++++++++++++++++
17 4 files changed, 155 insertions(+)
18
19 diff --git a/media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch
20 new file mode 100644
21 index 00000000000..6fd28572f90
22 --- /dev/null
23 +++ b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-assert-if-volume-gt-100.patch
24 @@ -0,0 +1,37 @@
25 +From 7eed10b2bd4650dadbc2c98f435d2bb10de7f75e Mon Sep 17 00:00:00 2001
26 +From: Arnaud Rebillout <elboulangero@×××××.com>
27 +Date: Mon, 19 Jun 2017 20:02:01 +0700
28 +Subject: [PATCH] Clip volume between 0 and 100 (thx to yunake) #162
29 +
30 +---
31 + src/audio.c | 13 ++++++++++++-
32 + 1 file changed, 12 insertions(+), 1 deletion(-)
33 +
34 +diff --git a/src/audio.c b/src/audio.c
35 +index 750f20f..06b245c 100644
36 +--- a/src/audio.c
37 ++++ b/src/audio.c
38 +@@ -437,11 +437,22 @@ gdouble
39 + audio_get_volume(Audio *audio)
40 + {
41 + AlsaCard *soundcard = audio->soundcard;
42 ++ gdouble volume;
43 +
44 + if (!soundcard)
45 + return 0;
46 +
47 +- return alsa_card_get_volume(soundcard);
48 ++ volume = alsa_card_get_volume(soundcard);
49 ++
50 ++ /* With PulseAudio, it is perfectly possible for the volume to go above 100%.
51 ++ * Since we don't really expect or handle that, let's clip it right now.
52 ++ */
53 ++ if (volume < 0)
54 ++ volume = 0;
55 ++ if (volume > 100)
56 ++ volume = 100;
57 ++
58 ++ return volume;
59 + }
60 +
61 + /**
62
63 diff --git a/media-sound/pnmixer/files/pnmixer-0.7.2-fix-possible-garbage-value.patch b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-possible-garbage-value.patch
64 new file mode 100644
65 index 00000000000..e85dcedd233
66 --- /dev/null
67 +++ b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-possible-garbage-value.patch
68 @@ -0,0 +1,38 @@
69 +From c8577027aa4597c8f194a84a73982aa0ce7f2dd0 Mon Sep 17 00:00:00 2001
70 +From: Julian Ospald <hasufell@××××××.de>
71 +Date: Mon, 19 Feb 2018 20:06:26 +0100
72 +Subject: [PATCH] MEM: fix possible garbage value wrt #174
73 +
74 +Not sure if the clang static analyzer has trouble
75 +with g_memdup() or if there is something more serious
76 +going on. Good old g_malloc() works too though.
77 +---
78 + src/ui-tray-icon.c | 6 ++++--
79 + 1 file changed, 4 insertions(+), 2 deletions(-)
80 +
81 +diff --git a/src/ui-tray-icon.c b/src/ui-tray-icon.c
82 +index 27b35f3..23ba947 100644
83 +--- a/src/ui-tray-icon.c
84 ++++ b/src/ui-tray-icon.c
85 +@@ -166,9 +166,11 @@ pixbuf_array_free(GdkPixbuf **pixbufs)
86 + static GdkPixbuf **
87 + pixbuf_array_new(int size)
88 + {
89 +- GdkPixbuf *pixbufs[N_VOLUME_PIXBUFS];
90 ++ GdkPixbuf **pixbufs;
91 + gboolean system_theme;
92 +
93 ++ pixbufs = g_new0(GdkPixbuf *, N_VOLUME_PIXBUFS);
94 ++
95 + DEBUG("Building pixbuf array (requesting size %d)", size);
96 +
97 + system_theme = prefs_get_boolean("SystemTheme", FALSE);
98 +@@ -202,7 +204,7 @@ pixbuf_array_new(int size)
99 + pixbufs[VOLUME_HIGH] = pixbuf_new_from_file("pnmixer-high.png");
100 + }
101 +
102 +- return g_memdup(pixbufs, sizeof pixbufs);
103 ++ return pixbufs;
104 + }
105 +
106 + /* Tray icon volume meter */
107
108 diff --git a/media-sound/pnmixer/files/pnmixer-0.7.2-fix-possible-memleak.patch b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-possible-memleak.patch
109 new file mode 100644
110 index 00000000000..a88013b9d4b
111 --- /dev/null
112 +++ b/media-sound/pnmixer/files/pnmixer-0.7.2-fix-possible-memleak.patch
113 @@ -0,0 +1,21 @@
114 +From 84c66c389cd7a8a47aa5f543726683a19dcca5ff Mon Sep 17 00:00:00 2001
115 +From: Julian Ospald <hasufell@××××××.de>
116 +Date: Mon, 19 Feb 2018 20:06:45 +0100
117 +Subject: [PATCH] MEM: fix possible memory leak wrt #174
118 +
119 +---
120 + src/alsa.c | 1 +
121 + 1 file changed, 1 insertion(+)
122 +
123 +diff --git a/src/alsa.c b/src/alsa.c
124 +index c46d4d8..d91c79f 100644
125 +--- a/src/alsa.c
126 ++++ b/src/alsa.c
127 +@@ -336,6 +336,7 @@ mixer_get_poll_descriptors(const char *hctl, snd_mixer_t *mixer)
128 + err = snd_mixer_poll_descriptors(mixer, fds, count);
129 + if (err < 0) {
130 + ALSA_CARD_ERR(hctl, err, "Couldn't get poll descriptors");
131 ++ g_free(fds);
132 + return NULL;
133 + }
134 +
135
136 diff --git a/media-sound/pnmixer/pnmixer-0.7.2-r1.ebuild b/media-sound/pnmixer/pnmixer-0.7.2-r1.ebuild
137 new file mode 100644
138 index 00000000000..4930d96eb60
139 --- /dev/null
140 +++ b/media-sound/pnmixer/pnmixer-0.7.2-r1.ebuild
141 @@ -0,0 +1,59 @@
142 +# Copyright 1999-2021 Gentoo Authors
143 +# Distributed under the terms of the GNU General Public License v2
144 +
145 +EAPI=7
146 +
147 +MY_P="${PN}-v${PV}"
148 +inherit cmake xdg-utils
149 +
150 +DESCRIPTION="Volume mixer for the system tray"
151 +HOMEPAGE="https://github.com/nicklan/pnmixer"
152 +SRC_URI="https://github.com/nicklan/${PN}/releases/download/v${PV}/${MY_P}.tar.gz"
153 +
154 +LICENSE="GPL-3"
155 +SLOT="0"
156 +KEYWORDS="~amd64 ~ppc ~x86"
157 +IUSE="doc libnotify nls"
158 +
159 +RDEPEND="
160 + dev-libs/glib:2
161 + media-libs/alsa-lib
162 + x11-libs/gtk+:3
163 + x11-libs/libX11
164 + libnotify? ( x11-libs/libnotify )
165 +"
166 +DEPEND="${RDEPEND}"
167 +BDEPEND="
168 + virtual/pkgconfig
169 + doc? (
170 + app-doc/doxygen
171 + media-gfx/graphviz
172 + )
173 + nls? ( sys-devel/gettext )
174 +"
175 +
176 +S="${WORKDIR}/${MY_P}"
177 +
178 +PATCHES=(
179 + "${FILESDIR}/${P}-fix-assert-if-volume-gt-100.patch"
180 + "${FILESDIR}/${P}-fix-possible-garbage-value.patch"
181 + "${FILESDIR}/${P}-fix-possible-memleak.patch"
182 +)
183 +
184 +src_configure() {
185 + local mycmakeargs=(
186 + -DBUILD_DOCUMENTATION="$(usex doc)"
187 + -DWITH_LIBNOTIFY="$(usex libnotify)"
188 + -DENABLE_NLS="$(usex nls)"
189 + -DCMAKE_INSTALL_DOCDIR="share/doc/${PF}"
190 + )
191 + cmake_src_configure
192 +}
193 +
194 +pkg_postinst() {
195 + xdg_icon_cache_update
196 +}
197 +
198 +pkg_postrm() {
199 + xdg_icon_cache_update
200 +}