logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 55680dadfb6a5c9c5d728e67d674153af6c781e0
parent a8c0e988fb2b1a636d2828fc3b81141cc4d3c0f2
Author: Michael Forney <mforney@mforney.org>
Date:   Tue,  2 Jul 2019 00:28:05 -0700

alsa-utils: Fix a few portability issues

Diffstat:

Apkg/alsa-utils/patch/0003-Use-__func__-instead-of-__FUNCTION__.patch65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/alsa-utils/patch/0004-aplay-Avoid-pointer-arithmetic-on-void.patch35+++++++++++++++++++++++++++++++++++
Apkg/alsa-utils/patch/0005-amixer-Use-lli-for-long-long-in-printf.patch34++++++++++++++++++++++++++++++++++
Mpkg/alsa-utils/ver2+-
4 files changed, 135 insertions(+), 1 deletion(-)

diff --git a/pkg/alsa-utils/patch/0003-Use-__func__-instead-of-__FUNCTION__.patch b/pkg/alsa-utils/patch/0003-Use-__func__-instead-of-__FUNCTION__.patch @@ -0,0 +1,65 @@ +From a0d257af5b6e2ecdc1300263b232a7829b3e5f3e Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 1 Jul 2019 23:44:21 -0700 +Subject: [PATCH] Use __func__ instead of __FUNCTION__ + +They are equivalent, but __func__ is in C99. __FUNCTION__ exists only +for backwards compatibility with old gcc versions. + +Signed-off-by: Michael Forney <mforney@mforney.org> +--- + alsactl/alsactl.h | 16 ++++++++-------- + aplay/aplay.c | 4 ++-- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h +index 4f969ec..69b539c 100644 +--- a/alsactl/alsactl.h ++++ b/alsactl/alsactl.h +@@ -13,15 +13,15 @@ void cerror_(const char *fcn, long line, int cond, const char *fmt, ...); + void dbg_(const char *fcn, long line, const char *fmt, ...); + + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +-#define info(...) do { info_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0) +-#define error(...) do { error_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0) +-#define cerror(cond, ...) do { cerror_(__FUNCTION__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0) +-#define dbg(...) do { dbg_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0) ++#define info(...) do { info_(__func__, __LINE__, __VA_ARGS__); } while (0) ++#define error(...) do { error_(__func__, __LINE__, __VA_ARGS__); } while (0) ++#define cerror(cond, ...) do { cerror_(__func__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0) ++#define dbg(...) do { dbg_(__func__, __LINE__, __VA_ARGS__); } while (0) + #else +-#define info(args...) do { info_(__FUNCTION__, __LINE__, ##args); } while (0) +-#define error(args...) do { error_(__FUNCTION__, __LINE__, ##args); } while (0) +-#define cerror(cond, ...) do { error_(__FUNCTION__, __LINE__, (cond) != 0, ##args); } while (0) +-#define dbg(args...) do { dbg_(__FUNCTION__, __LINE__, ##args); } while (0) ++#define info(args...) do { info_(__func__, __LINE__, ##args); } while (0) ++#define error(args...) do { error_(__func__, __LINE__, ##args); } while (0) ++#define cerror(cond, ...) do { error_(__func__, __LINE__, (cond) != 0, ##args); } while (0) ++#define dbg(args...) do { dbg_(__func__, __LINE__, ##args); } while (0) + #endif + + int init(const char *file, const char *cardname); +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 33e0f77..ecfc8b8 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -184,13 +184,13 @@ static const struct fmt_capture { + + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) + #define error(...) do {\ +- fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \ ++ fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \ + fprintf(stderr, __VA_ARGS__); \ + putc('\n', stderr); \ + } while (0) + #else + #define error(args...) do {\ +- fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \ ++ fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \ + fprintf(stderr, ##args); \ + putc('\n', stderr); \ + } while (0) +-- +2.22.0 + diff --git a/pkg/alsa-utils/patch/0004-aplay-Avoid-pointer-arithmetic-on-void.patch b/pkg/alsa-utils/patch/0004-aplay-Avoid-pointer-arithmetic-on-void.patch @@ -0,0 +1,35 @@ +From c77b78a4a71d8e0950bde18e1a38f8795f4deac7 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Tue, 2 Jul 2019 00:26:12 -0700 +Subject: [PATCH] aplay: Avoid pointer arithmetic on `void *` + +Signed-off-by: Michael Forney <mforney@mforney.org> +--- + aplay/aplay.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/aplay/aplay.c b/aplay/aplay.c +index ecfc8b8..d789222 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -440,7 +440,7 @@ static ssize_t xwrite(int fd, const void *buf, size_t count) + size_t offset = 0; + + while (offset < count) { +- written = write(fd, buf + offset, count - offset); ++ written = write(fd, (char *)buf + offset, count - offset); + if (written <= 0) + return written; + +@@ -1208,7 +1208,7 @@ static int test_au(int fd, void *buffer) + hwparams.channels = BE_INT(ap->channels); + if (hwparams.channels < 1 || hwparams.channels > 256) + return -1; +- if ((size_t)safe_read(fd, buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) { ++ if ((size_t)safe_read(fd, (char *)buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) { + error(_("read error")); + prg_exit(EXIT_FAILURE); + } +-- +2.22.0 + diff --git a/pkg/alsa-utils/patch/0005-amixer-Use-lli-for-long-long-in-printf.patch b/pkg/alsa-utils/patch/0005-amixer-Use-lli-for-long-long-in-printf.patch @@ -0,0 +1,34 @@ +From e835394dfbff2f34bbb081a6b0bd302e99e384b6 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Tue, 2 Jul 2019 00:26:36 -0700 +Subject: [PATCH] amixer: Use %lli for long long in printf + +--- + amixer/amixer.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/amixer/amixer.c b/amixer/amixer.c +index 64fd4bb..00b0018 100644 +--- a/amixer/amixer.c ++++ b/amixer/amixer.c +@@ -617,7 +617,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem, + snd_ctl_elem_info_get_step(info)); + break; + case SND_CTL_ELEM_TYPE_INTEGER64: +- printf(",min=%Li,max=%Li,step=%Li\n", ++ printf(",min=%lli,max=%lli,step=%lli\n", + snd_ctl_elem_info_get_min64(info), + snd_ctl_elem_info_get_max64(info), + snd_ctl_elem_info_get_step64(info)); +@@ -659,7 +659,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem, + printf("%li", snd_ctl_elem_value_get_integer(control, idx)); + break; + case SND_CTL_ELEM_TYPE_INTEGER64: +- printf("%Li", snd_ctl_elem_value_get_integer64(control, idx)); ++ printf("%lli", snd_ctl_elem_value_get_integer64(control, idx)); + break; + case SND_CTL_ELEM_TYPE_ENUMERATED: + printf("%u", snd_ctl_elem_value_get_enumerated(control, idx)); +-- +2.22.0 + diff --git a/pkg/alsa-utils/ver b/pkg/alsa-utils/ver @@ -1 +1 @@ -1.1.9 r0 +1.1.9 r1