1
Fork 0

Fix bunch of warnings

This commit is contained in:
Nedko Arnaudov 2023-11-09 21:35:15 +02:00
parent 8105b81b25
commit 353509147c
14 changed files with 50 additions and 35 deletions

View File

@ -65,7 +65,7 @@ midi_action(snd_seq_t *seq_handle)
if (count > 0 && count < 16) {
buffer[0] = (unsigned char)count;
count++;
if (jack_ringbuffer_write(jack_ringbuffer, (char *)buffer, count) != count) {
if (jack_ringbuffer_write(jack_ringbuffer, (char *)buffer, count) != (jack_nframes_t)count) {
fprintf(stderr, "ringbuffer overflow!\n");
}
}
@ -82,6 +82,8 @@ jack_callback(jack_nframes_t nframes, void *arg)
unsigned char *p;
void* port_buf = jack_port_get_buffer(jack_midi_port, nframes);
((void)(arg)); /* unreferenced parameter */
jack_midi_clear_buffer(port_buf);
while (jack_ringbuffer_read_space(jack_ringbuffer)) {
@ -110,6 +112,7 @@ void
jack_shutdown(
void * arg)
{
((void)(arg)); /* unreferenced parameter */
fprintf(stderr, "JACK shutdown notification received.\n");
g_keep_walking = false;
}
@ -119,6 +122,7 @@ void
sigint_handler(
int i)
{
((void)(i)); /* unreferenced parameter */
g_keep_walking = false;
}

View File

@ -76,6 +76,7 @@ void
a2j_sigint_handler(
int i)
{
((void)(i)); /* unreferenced parameter */
g_keep_walking = false;
}
@ -104,6 +105,7 @@ void
a2j_stream_attach(
struct a2j_stream * stream_ptr)
{
((void)(stream_ptr)); /* unreferenced parameter */
}
static
@ -418,7 +420,7 @@ bool a2j_stop(void)
}
bool
a2j_is_started()
a2j_is_started(void)
{
return g_started;
}

4
conf.h
View File

@ -26,9 +26,9 @@ extern bool g_disable_port_uniqueness;
extern char * g_a2j_jack_server_name;
void
a2j_conf_save();
a2j_conf_save(void);
void
a2j_conf_load();
a2j_conf_load(void);
#endif /* #ifndef CONF_H__AE361BE4_EE60_4F5C_B2D4_13D71A525018__INCLUDED */

18
dbus.c
View File

@ -236,6 +236,8 @@ a2j_dbus_message_handler_unregister(
DBusConnection *connection,
void *data)
{
((void)(connection)); /* unreferenced parameter */
((void)(data)); /* unreferenced parameter */
a2j_debug("Message handler was unregistered");
}
@ -278,22 +280,20 @@ struct a2j_dbus_interface_descriptor * g_a2j_dbus_interfaces[] =
};
bool
a2j_dbus_is_available()
a2j_dbus_is_available(void)
{
return g_dbus_connection_ptr != NULL;
}
bool
a2j_dbus_init()
a2j_dbus_init(void)
{
DBusError dbus_error;
int ret;
DBusObjectPathVTable vtable =
{
a2j_dbus_message_handler_unregister,
a2j_dbus_message_handler,
NULL
};
DBusObjectPathVTable vtable = {
.unregister_function = a2j_dbus_message_handler_unregister,
.message_function = a2j_dbus_message_handler
};
dbus_error_init(&dbus_error);
g_dbus_connection_ptr = dbus_bus_get(DBUS_BUS_SESSION, &dbus_error);
@ -352,7 +352,7 @@ a2j_dbus_run(
}
void
a2j_dbus_uninit()
a2j_dbus_uninit(void)
{
dbus_connection_unref(g_dbus_connection_ptr);
g_dbus_connection_ptr = NULL;

6
dbus.h
View File

@ -22,16 +22,16 @@
#define DBUS_H__DB007DDB_C5CF_4E9F_B73A_C3C8AC7D47DC__INCLUDED
bool
a2j_dbus_is_available();
a2j_dbus_is_available(void);
bool
a2j_dbus_init();
a2j_dbus_init(void);
bool
a2j_dbus_run(
int timeout_milliseconds);
void
a2j_dbus_uninit();
a2j_dbus_uninit(void);
#endif /* #ifndef DBUS_H__DB007DDB_C5CF_4E9F_B73A_C3C8AC7D47DC__INCLUDED */

View File

@ -36,13 +36,13 @@
#define INTERFACE_NAME "org.gna.home.a2jmidid.control"
void
a2j_dbus_signal_emit_bridge_started()
a2j_dbus_signal_emit_bridge_started(void)
{
a2j_dbus_signal("/", INTERFACE_NAME, "bridge_started", DBUS_TYPE_INVALID);
}
void
a2j_dbus_signal_emit_bridge_stopped()
a2j_dbus_signal_emit_bridge_stopped(void)
{
a2j_dbus_signal("/", INTERFACE_NAME, "bridge_stopped", DBUS_TYPE_INVALID);
}

View File

@ -24,9 +24,9 @@
extern struct a2j_dbus_interface_descriptor g_a2j_iface_control;
void
a2j_dbus_signal_emit_bridge_started();
a2j_dbus_signal_emit_bridge_started(void);
void
a2j_dbus_signal_emit_bridge_stopped();
a2j_dbus_signal_emit_bridge_stopped(void);
#endif /* #ifndef DBUS_IFACE_CONTROL_H__4CC2B789_43D9_4A3F_9518_E38D517F1C4B__INCLUDED */

View File

@ -74,10 +74,10 @@ write_line(const char * line)
write_line_format("%s\n", line);
}
void a2j_introspect_init() __attribute__((constructor));
void a2j_introspect_init(void) __attribute__((constructor));
void
a2j_introspect_init()
a2j_introspect_init(void)
{
struct a2j_dbus_interface_descriptor ** interface_ptr_ptr;
const struct a2j_dbus_interface_method_descriptor * method_ptr;

View File

@ -68,7 +68,7 @@ int init_alsa(const char * client_name);
int init_jack(const char * client_name);
void sigint_handler(int i);
int jack_callback(jack_nframes_t nframes, void *arg);
void output_event();
void output_event(void);
int main(int argc, char **argv) {
@ -186,6 +186,7 @@ int init_jack(const char * client_name) {
/* This is just so we can clean up if the user presses Ctrl-C in the shell */
void sigint_handler(int i) {
((void)(i)); /* unreferenced parameter */
keep_running = 0;
}
@ -224,7 +225,7 @@ int jack_callback(jack_nframes_t nframes, void *arg) {
}
void output_event() {
void output_event(void) {
size_t event_size;
static char event_buffer[1024];
snd_seq_event_t alsa_event;

14
jack.c
View File

@ -62,10 +62,12 @@ a2j_process_incoming (
jack_nframes_t nframes)
{
struct a2j_alsa_midi_event ev;
jack_nframes_t now;
//jack_nframes_t now;
jack_nframes_t one_period;
char *ev_buf;
((void)(nframes)); /* unreferenced parameter */
/* grab data queued by the ALSA input thread and write it into the JACK
port buffer. it will delivered during the JACK period that this
function is called from.
@ -78,7 +80,7 @@ a2j_process_incoming (
jack_midi_clear_buffer (port->jack_buf);
now = jack_frame_time (self->jack_client);
/* now = */jack_frame_time (self->jack_client);
one_period = jack_get_buffer_size (self->jack_client);
while (jack_ringbuffer_peek (port->inbound_events, (char*)&ev, sizeof(ev) ) == sizeof(ev) ) {
@ -241,7 +243,7 @@ a2j_process_outgoing (
int nevents;
jack_ringbuffer_data_t vec[2];
int i;
int written = 0;
size_t written = 0;
size_t limit;
struct a2j_delivery_event* dev;
size_t gap = 0;
@ -324,7 +326,7 @@ void * a2j_alsa_output_thread(void * arg)
struct a2j_delivery_event* ev;
float sr;
jack_nframes_t now;
int err;
//int err;
int limit;
while (g_keep_alsa_walking) {
@ -412,7 +414,7 @@ void * a2j_alsa_output_thread(void * arg)
}
/* its time to deliver */
err = snd_seq_event_output(self->seq, &alsa_event);
/* err = */snd_seq_event_output(self->seq, &alsa_event);
snd_seq_drain_output (self->seq);
now = jack_frame_time (self->jack_client);
a2j_debug("alsa_out: written %d bytes to %s at %d, DELTA = %d", ev->jack_event.size, ev->port->name, now,
@ -582,6 +584,7 @@ a2j_jack_freewheel(
int starting,
void * arg)
{
((void)(arg)); /* unreferenced parameter */
g_freewheeling = starting;
}
@ -590,6 +593,7 @@ void
a2j_jack_shutdown(
void * arg)
{
((void)(arg)); /* unreferenced parameter */
a2j_warning("JACK server shutdown notification received.");
g_stop_request = true;
}

2
log.h
View File

@ -52,6 +52,6 @@ a2j_log_init(
bool use_logfile);
void
a2j_log_uninit();
a2j_log_uninit(void);
#endif /* #ifndef LOG_H__76222A51_98D8_40C2_A67E_0FF38615A1DD__INCLUDED */

View File

@ -149,7 +149,7 @@ exit:
}
bool
a2j_paths_init()
a2j_paths_init(void)
{
const char * home_dir;
@ -182,7 +182,7 @@ exit:
}
void
a2j_paths_uninit()
a2j_paths_uninit(void)
{
if (g_a2j_conf_path != NULL)
{

View File

@ -25,9 +25,9 @@ extern char * g_a2j_log_path;
extern char * g_a2j_conf_path;
bool
a2j_paths_init();
a2j_paths_init(void);
void
a2j_paths_uninit();
a2j_paths_uninit(void);
#endif /* #ifndef PATHS_H__7D9E0C44_6826_464C_819D_A9A05B70E3D6__INCLUDED */

6
port.c
View File

@ -81,9 +81,13 @@ a2j_port_setdead(
{
struct a2j_port *port = a2j_port_get(hash, addr);
if (port)
{
port->is_dead = true; // see jack_process_internal
}
else
{
a2j_debug("port_setdead: not found (%d:%d)", addr.client, addr.port);
}
}
void
@ -138,7 +142,7 @@ a2j_port_fill_name(
if (!JACK_IS_VALID_PORT_NAME_CHAR(*c))
*c = ' ';
if (ret < 0 || ret >= g_max_jack_port_name_size)
if (ret < 0 || ret >= (int)g_max_jack_port_name_size)
{
/* force terminating nul char because the man page does not specify whether the resulting buffer is nul terminated in this case */
port_ptr->name[g_max_jack_port_name_size] = 0;