wmix: fix multiple definitions of global variables.

The mixer API variables are declared in a header with no explicit
linkage.  This results in there being definitions of them in multiple
object files, which causes a link failure with GCC 10, since this
uses -fno-common by default.

Add `extern` to the header declarations and separate declarations with
no linkage in mixer.c where they are assigned.

Link: https://bugs.debian.org/957947
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
Jeremy Sowden 2020-04-18 18:03:42 +01:00 committed by Carlos R. Mafra
parent 554ab5db1b
commit 7e43b2a679
2 changed files with 50 additions and 25 deletions

View file

@ -55,28 +55,28 @@
* - Muting must occur independently of the volume level. * - Muting must occur independently of the volume level.
*/ */
void (*mixer_init)(const char *mixer_device, extern void (*mixer_init)(const char *mixer_device,
bool verbose, bool verbose,
const char *exclude[]); const char *exclude[]);
bool (*mixer_is_changed)(void); extern bool (*mixer_is_changed)(void);
int (*mixer_get_channel_count)(void); extern int (*mixer_get_channel_count)(void);
int (*mixer_get_channel)(void); extern int (*mixer_get_channel)(void);
const char *(*mixer_get_channel_name)(void); extern const char *(*mixer_get_channel_name)(void);
const char *(*mixer_get_short_name)(void); extern const char *(*mixer_get_short_name)(void);
void (*mixer_set_channel)(int channel); extern void (*mixer_set_channel)(int channel);
void (*mixer_set_channel_rel)(int delta_channel); extern void (*mixer_set_channel_rel)(int delta_channel);
float (*mixer_get_volume)(void); extern float (*mixer_get_volume)(void);
void (*mixer_set_volume)(float volume); extern void (*mixer_set_volume)(float volume);
void (*mixer_set_volume_rel)(float delta_volume); extern void (*mixer_set_volume_rel)(float delta_volume);
float (*mixer_get_balance)(void); extern float (*mixer_get_balance)(void);
void (*mixer_set_balance)(float balance); extern void (*mixer_set_balance)(float balance);
void (*mixer_set_balance_rel)(float delta_balance); extern void (*mixer_set_balance_rel)(float delta_balance);
void (*mixer_toggle_mute)(void); extern void (*mixer_toggle_mute)(void);
void (*mixer_toggle_rec)(void); extern void (*mixer_toggle_rec)(void);
bool (*mixer_is_muted)(void); extern bool (*mixer_is_muted)(void);
bool (*mixer_is_stereo)(void); extern bool (*mixer_is_stereo)(void);
bool (*mixer_is_rec)(void); extern bool (*mixer_is_rec)(void);
bool (*mixer_can_rec)(void); extern bool (*mixer_can_rec)(void);
bool (*is_exclude)(const char *short_name, extern bool (*is_exclude)(const char *short_name,
const char *exclude[]); const char *exclude[]);
void (*mixer_tick)(void); extern void (*mixer_tick)(void);

View file

@ -41,6 +41,31 @@
#include "include/mixer-oss.h" #include "include/mixer-oss.h"
#include "include/mixer-alsa.h" #include "include/mixer-alsa.h"
void (*mixer_init)(const char *mixer_device,
bool verbose,
const char *exclude[]);
bool (*mixer_is_changed)(void);
int (*mixer_get_channel_count)(void);
int (*mixer_get_channel)(void);
const char *(*mixer_get_channel_name)(void);
const char *(*mixer_get_short_name)(void);
void (*mixer_set_channel)(int channel);
void (*mixer_set_channel_rel)(int delta_channel);
float (*mixer_get_volume)(void);
void (*mixer_set_volume)(float volume);
void (*mixer_set_volume_rel)(float delta_volume);
float (*mixer_get_balance)(void);
void (*mixer_set_balance)(float balance);
void (*mixer_set_balance_rel)(float delta_balance);
void (*mixer_toggle_mute)(void);
void (*mixer_toggle_rec)(void);
bool (*mixer_is_muted)(void);
bool (*mixer_is_stereo)(void);
bool (*mixer_is_rec)(void);
bool (*mixer_can_rec)(void);
bool (*is_exclude)(const char *short_name,
const char *exclude[]);
void (*mixer_tick)(void);
static Display *display; static Display *display;
static bool button_pressed = false; static bool button_pressed = false;