From 6232660a46129d4db606fa1e7b64fad44cf0b57a Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Tue, 23 Sep 2014 14:44:53 +0300 Subject: [PATCH] build: fix build warnings. Most of the build warnings are: - Unused local variables/function arugments/functions - comparision between signed and unsigned types. --- configure.ac | 2 +- src/daemon/client.c | 2 +- src/daemon/config.c | 22 ++++++++-------- src/daemon/pulse.c | 10 ++++++++ src/daemon/recognizer.c | 7 +++-- src/daemon/resctl.c | 9 ++++--- src/daemon/voice.c | 30 ++++++++++++++-------- src/plugins/client-api/dbus/dbus-client.c | 28 +++----------------- src/plugins/client-api/dbus/test-client.c | 8 +++--- src/plugins/client-api/native/native-client.c | 13 +++++++--- src/plugins/client-api/native/native-server.c | 14 +++------- src/plugins/client-api/native/test-client.c | 26 +++++++------------ .../client-api/wrt-media-client/wrt-media-client.c | 8 +++++- src/plugins/input-handler/input-plugin.c | 4 +-- src/plugins/search-client/search-plugin.c | 5 +++- src/plugins/simple-disambiguator/disambiguator.c | 2 +- src/plugins/speech-to-text/sphinx/logger.c | 14 +++++----- src/plugins/speech-to-text/sphinx/utterance.c | 2 +- src/plugins/text-to-speech/espeak/espeak-voice.c | 5 ++-- .../text-to-speech/festival/festival-loader.c | 27 ++++++++++--------- .../text-to-speech/festival/festival-voice.c | 13 +++++----- src/plugins/text-to-speech/festival/libcarnival.cc | 8 +++--- 22 files changed, 130 insertions(+), 129 deletions(-) diff --git a/configure.ac b/configure.ac index 11ed4ee..c29c9b2 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AC_INIT([speech-recognition], AC_CONFIG_SRCDIR([src]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER([src/config.h]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([subdir-objects]) AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") diff --git a/src/daemon/client.c b/src/daemon/client.c index 1c11828..2657942 100644 --- a/src/daemon/client.c +++ b/src/daemon/client.c @@ -445,7 +445,7 @@ int client_query_voices(srs_client_t *c, const char *language, srs_context_t *srs = c->srs; const char *lang = language && *language ? language : NULL; - return srs_query_voices(c->srs, lang, actorsp); + return srs_query_voices(srs, lang, actorsp); } diff --git a/src/daemon/config.c b/src/daemon/config.c index 5044f9c..860e11f 100644 --- a/src/daemon/config.c +++ b/src/daemon/config.c @@ -69,7 +69,7 @@ static srs_cfg_t *find_config(srs_cfg_t *settings, const char *key); static int nblock = 0; -static int prflen = 0; +static size_t prflen = 0; static char blocks[MAX_DEPTH][MAX_BLOCK]; static char prefix[MAX_PREFIX]; @@ -167,9 +167,9 @@ static void print_usage(const char *argv0, int exit_code, const char *fmt, ...) } +#ifdef SYSTEMD_ENABLED static int set_passed_sockets(srs_context_t *srs, const char *variables) { -#ifdef SYSTEMD_ENABLED const char *b, *e; char key[256], val[64]; int nfd, i, n; @@ -207,7 +207,7 @@ static int set_passed_sockets(srs_context_t *srs, const char *variables) n = snprintf(val, sizeof(val), "%d", SD_LISTEN_FDS_START + i); - if (n < 0 || n >= sizeof(val)) + if (n < 0 || n >= (int)sizeof(val)) return -1; srs_set_config(srs, key, val); @@ -217,11 +217,8 @@ static int set_passed_sockets(srs_context_t *srs, const char *variables) } return 0; -#else - errno = EOPNOTSUPP; - return -1; -#endif } +#endif static void config_load_plugins(srs_context_t *srs, char *plugins) @@ -266,8 +263,6 @@ static void config_load_plugins(srs_context_t *srs, char *plugins) static void push_block(const char *block, int blen) { - int plen; - if (nblock >= MAX_DEPTH) { mrp_log_error("Too deeply nested configuration block: %s.%s", prefix, block); @@ -301,7 +296,7 @@ static void push_block(const char *block, int blen) static void pop_block(void) { char *block; - int blen; + size_t blen; if (nblock <= 0) { mrp_log_error("Unbalanced block open ({) and close (})."); @@ -398,9 +393,10 @@ static void config_parse_settings(srs_context_t *srs, char *settings) if (nblock > 0) snprintf(keybuf, sizeof(keybuf), "%s.%*.*s", prefix, - klen, klen, key); + (int)klen, (int)klen, key); else - snprintf(keybuf, sizeof(keybuf), "%*.*s", klen, klen, key); + snprintf(keybuf, sizeof(keybuf), "%*.*s", + (int)klen, (int)klen, key); strncpy(valbuf, val, vlen); valbuf[vlen] = '\0'; @@ -462,7 +458,9 @@ void config_parse_cmdline(srs_context_t *srs, int argc, char **argv, { "debug" , required_argument, NULL, 'd' }, { "foreground" , no_argument , NULL, 'f' }, { "valgrind" , optional_argument, NULL, 'V' }, +#ifdef SYSTEMD_ENABLED { "sockets" , required_argument, NULL, 'S' }, +#endif { "help" , no_argument , NULL, 'h' }, { NULL, 0, NULL, 0 } }; diff --git a/src/daemon/pulse.c b/src/daemon/pulse.c index 3d6012b..852c4ea 100644 --- a/src/daemon/pulse.c +++ b/src/daemon/pulse.c @@ -272,6 +272,10 @@ static void connect_timer_cb(pa_mainloop_api *api, pa_time_event *e, { srs_pulse_t *p = (srs_pulse_t *)user_data; + MRP_UNUSED(api); + MRP_UNUSED(e); + MRP_UNUSED(tv); + if (p->pc != NULL) { pa_context_unref(p->pc); p->pc = NULL; @@ -420,6 +424,8 @@ static void stream_state_cb(pa_stream *ps, void *user_data) pa_context_state_t cst = pa_context_get_state(p->pc); pa_stream_state_t sst; + MRP_UNUSED(ps); + if (cst == PA_CONTEXT_TERMINATED || cst == PA_CONTEXT_FAILED) return; @@ -468,6 +474,8 @@ static void stream_drain_cb(pa_stream *ps, int success, void *user_data) { stream_t *s = (stream_t *)user_data; + MRP_UNUSED(ps); + mrp_debug("pulse: stream #%u drained %s", s->id, success ? "successfully" : "failed"); @@ -483,6 +491,8 @@ static void stream_write_cb(pa_stream *ps, size_t size, void *user_data) stream_t *s = (stream_t *)user_data; int done; + MRP_UNUSED(ps); + stream_notify(s, SRS_STREAM_EVENT_PROGRESS); if (s->offs == s->size) { diff --git a/src/daemon/recognizer.c b/src/daemon/recognizer.c index 3a3ed59..62bba59 100644 --- a/src/daemon/recognizer.c +++ b/src/daemon/recognizer.c @@ -397,7 +397,7 @@ static void process_ambiguity(srs_srec_t *srec, srs_srec_result_t *res) return; } - +#if 0 static int get_effect_config(srs_context_t *srs, effect_t **cfgp) { static effect_t effects[32]; @@ -446,7 +446,7 @@ static int get_effect_config(srs_context_t *srs, effect_t **cfgp) return neffect; } - +#endif static void process_unrecognized(srs_srec_t *srec, srs_srec_result_t *res) { @@ -471,7 +471,10 @@ static void process_unrecognized(srs_srec_t *srec, srs_srec_result_t *res) srs_play_sound_file(srec->srs, e->data, NULL, NULL); else srs_say_msg(srec->srs, e->data, NULL, NULL); +#else + MRP_UNUSED(srec); #endif + MRP_UNUSED(res); } diff --git a/src/daemon/resctl.c b/src/daemon/resctl.c index fc635ba..9d0ac4c 100644 --- a/src/daemon/resctl.c +++ b/src/daemon/resctl.c @@ -174,7 +174,6 @@ static void context_event(mrp_res_context_t *rctx, mrp_res_error_t err, void *user_data) { srs_resctx_t *ctx = (srs_resctx_t *)user_data; - srs_context_t *srs = ctx->srs; MRP_UNUSED(err); @@ -254,7 +253,6 @@ srs_resset_t *srs_resctl_create(srs_context_t *srs, char *appclass, return set; } - fail: if (ctx != NULL) { if (set->set != NULL) mrp_res_delete_resource_set(set->set); @@ -358,8 +356,9 @@ int srs_resctl_acquire(srs_resset_t *set, int shared) if (mrp_res_acquire_resource_set(set->set) == 0) return TRUE; - else - /* fall through */; + else { + /* fall through */ + } fail: if (set->set != NULL) { @@ -395,6 +394,8 @@ static void set_event(mrp_res_context_t *rctx, mrp_res_resource_t *srec, *ssyn; srs_resctl_event_t e; + MRP_UNUSED(rctx); + srec = mrp_res_get_resource_by_name(rset, name_srec); ssyn = mrp_res_get_resource_by_name(rset, name_ssyn); diff --git a/src/daemon/voice.c b/src/daemon/voice.c index 33c8435..f5b7672 100644 --- a/src/daemon/voice.c +++ b/src/daemon/voice.c @@ -173,8 +173,7 @@ static char *canonical_actor_name(char *buf, size_t size, { const char *lang, *dialect, *gender, *s; char *d; - int idx, i; - ssize_t n; + int idx; lang = language->lang; dialect = actor->dialect; @@ -353,7 +352,6 @@ static void free_renderer(renderer_t *r) static void notify_request(request_t *req, srs_voice_event_t *event) { - renderer_t *r = req->r; int mask = (1 << event->type); srs_voice_event_t e; @@ -409,7 +407,6 @@ int srs_register_voice(srs_context_t *srs, const char *name, { state_t *state = (state_t *)srs->synthesizer; renderer_t *r; - srs_voice_actor_t *a; int i; if (state == NULL) { @@ -502,7 +499,7 @@ static renderer_t *find_renderer(state_t *state, const char *voice, if ((e = strchr(voice, '/')) != NULL) { n = e - voice; - if (n >= sizeof(renderer) - 1) + if (n >= (int)sizeof(renderer) - 1) return NULL; strncpy(renderer, voice, n); @@ -520,7 +517,8 @@ static renderer_t *find_renderer(state_t *state, const char *voice, l = find_language(state, voice, FALSE); else { n = e - voice; - if (snprintf(lang, sizeof(lang), "%*.*s", n, n, voice) >= sizeof(lang)) + if (snprintf(lang, sizeof(lang), "%*.*s", + (int)n, (int)n, voice) >= (int)sizeof(lang)) l = NULL; else l = find_language(state, lang, FALSE); @@ -662,6 +660,8 @@ static void request_timer_cb(mrp_timer_t *t, void *user_data) request_t *req = &qr->req; srs_voice_event_t event; + MRP_UNUSED(t); + mrp_log_info("Voice/TTS request #%u timed out.", qr->req.id); mrp_del_timer(req->timer); @@ -687,7 +687,11 @@ static request_t *enqueue_request(state_t *state, const char *msg, char **tags, double pitch, int timeout, int notify_mask, srs_voice_notify_t notify, void *notify_data) { - queued_t *qr; + queued_t *qr = NULL; + + MRP_UNUSED(rate); + MRP_UNUSED(pitch); + MRP_UNUSED(timeout); qr = mrp_allocz(sizeof(*qr)); @@ -787,7 +791,9 @@ request_t *render_request(state_t *state, const char *msg, char **tags, double pitch, int timeout, int notify_mask, srs_voice_notify_t notify, void *notify_data) { - request_t *req; + request_t *req = NULL; + + MRP_UNUSED(timeout); req = mrp_allocz(sizeof(*req)); @@ -870,14 +876,16 @@ static request_t *find_request(state_t *state, uint32_t rid, uint32_t vid) } if ((req = state->active) != NULL) { - if ((rid == -1 || req->id == rid) && (vid == -1 || req->vid == vid)) + if ((rid == SRS_VOICE_INVALID || req->id == rid) && + (vid == SRS_VOICE_INVALID || req->vid == vid)) return req; } mrp_list_foreach(&state->requests, p, n) { req = mrp_list_entry(p, typeof(*req), hook); - if ((rid == -1 || req->id == rid) && (vid == -1 || req->vid == vid)) + if ((rid == SRS_VOICE_INVALID || req->id == rid) && + (vid == SRS_VOICE_INVALID || req->vid == vid)) return req; } @@ -894,6 +902,8 @@ void srs_cancel_voice(srs_context_t *srs, uint32_t rid, int notify) request_t *req = find_request(state, rid, -1); renderer_t *voice = req ? req->r : NULL; + MRP_UNUSED(notify); + if (req == NULL) return; diff --git a/src/plugins/client-api/dbus/dbus-client.c b/src/plugins/client-api/dbus/dbus-client.c index 3cbc46b..4ded529 100644 --- a/src/plugins/client-api/dbus/dbus-client.c +++ b/src/plugins/client-api/dbus/dbus-client.c @@ -160,7 +160,6 @@ static int dbusif_setup(dbusif_t *bus) static void dbusif_cleanup(dbusif_t *bus) { - srs_context_t *srs = bus->self->srs; const char *path, *iface, *method; int (*cb)(mrp_dbus_t *, mrp_dbus_msg_t *, void *); @@ -311,23 +310,6 @@ static void reply_voice_query(mrp_dbus_t *dbus, mrp_dbus_msg_t *req, int nactor, MRP_DBUS_TYPE_INVALID); } - -static int parse_commands(mrp_dbus_msg_t *msg, char **commands, int ncommand) -{ - int n; - - n = 0; - while (n < ncommand - 1) { - if (mrp_dbus_msg_read_basic(msg, MRP_DBUS_TYPE_STRING, commands + n)) - n++; - else - return -1; - } - - return n; -} - - static int parse_register(mrp_dbus_msg_t *req, const char **id, const char **name, const char **appclass, char ***commands, int *ncommand, const char **errmsg) @@ -524,7 +506,6 @@ static int focus_req(mrp_dbus_t *dbus, mrp_dbus_msg_t *req, void *user_data) static int focus_notify(srs_client_t *c, srs_voice_focus_t focus) { dbusif_t *bus = (dbusif_t *)c->user_data; - srs_context_t *srs = c->srs; const char *dest = c->id; const char *path = SRS_CLIENT_PATH; const char *iface = SRS_CLIENT_INTERFACE; @@ -547,7 +528,6 @@ static int command_notify(srs_client_t *c, int idx, int ntoken, char **tokens, uint32_t *start, uint32_t *end, srs_audiobuf_t *audio) { dbusif_t *bus = (dbusif_t *)c->user_data; - srs_context_t *srs = c->srs; const char *dest = c->id; const char *path = SRS_CLIENT_PATH; const char *iface = SRS_CLIENT_INTERFACE; @@ -584,7 +564,6 @@ static int command_notify(srs_client_t *c, int idx, int ntoken, char **tokens, static int voice_notify(srs_client_t *c, srs_voice_event_t *event) { dbusif_t *bus = (dbusif_t *)c->user_data; - srs_context_t *srs = c->srs; const char *dest = c->id; const char *path = SRS_CLIENT_PATH; const char *iface = SRS_CLIENT_INTERFACE; @@ -629,8 +608,7 @@ static int parse_render_voice(mrp_dbus_msg_t *req, const char **id, int *notify_events, const char **errmsg) { char **events, *e; - int i; - size_t nevent; + size_t i, nevent; int32_t to; *id = mrp_dbus_msg_sender(req); @@ -685,7 +663,7 @@ static int render_voice_req(mrp_dbus_t *dbus, mrp_dbus_msg_t *req, { dbusif_t *bus = (dbusif_t *)user_data; srs_context_t *srs = bus->self->srs; - const char *id, *msg, *voice, *errmsg; + const char *id, *msg, *voice, *errmsg = NULL; double rate, pitch; int timeout, events, err; uint32_t reqid; @@ -877,6 +855,8 @@ static void stop_dbusif(srs_plugin_t *plugin) { dbusif_t *bus = (dbusif_t *)plugin->plugin_data; + MRP_UNUSED(bus); + mrp_debug("stop D-Bus client interface plugin"); return; diff --git a/src/plugins/client-api/dbus/test-client.c b/src/plugins/client-api/dbus/test-client.c index 2398aca..4384ea1 100644 --- a/src/plugins/client-api/dbus/test-client.c +++ b/src/plugins/client-api/dbus/test-client.c @@ -251,9 +251,8 @@ static void request_tts(client_t *c, int ntoken, char **tokens) int timeout = 5000; int events = FALSE; char msg[1024], *t, *e, *p; - int i, o; + int i, o, n; size_t l; - ssize_t n; if (c->registered) { print(c, "You need to unregister first to modify commands."); @@ -281,7 +280,7 @@ static void request_tts(client_t *c, int ntoken, char **tokens) } else { n = snprintf(p, l, "%s%s", sep, t); - if (n >= l) { + if ((size_t)n >= l) { print(c, "TTS message too long."); return; } @@ -948,10 +947,9 @@ static void voice_query_reply(mrp_dbus_t *dbus, mrp_dbus_msg_t *rpl, void *user_data) { client_t *c = (client_t *)user_data; - uint32_t nvoice; + uint32_t nvoice, i; char **voices, **lang, **dialect, **gender, **description; size_t dummy; - int i, n; MRP_UNUSED(dbus); diff --git a/src/plugins/client-api/native/native-client.c b/src/plugins/client-api/native/native-client.c index 0a0c429..80fb01d 100644 --- a/src/plugins/client-api/native/native-client.c +++ b/src/plugins/client-api/native/native-client.c @@ -125,7 +125,6 @@ static void recv_message(mrp_transport_t *t, void *data, uint32_t type_id, { srs_t *srs = (srs_t *)user_data; srs_msg_t *msg = (srs_msg_t *)data; - request_t *req; MRP_UNUSED(t); MRP_UNUSED(user_data); @@ -165,6 +164,8 @@ static void closed_event(mrp_transport_t *t, int error, void *user_data) int status = 0; char *msg = !error ? "connection closed" : "connection error"; + MRP_UNUSED(t); + mrp_debug("transport closed by server"); srs->conn_notify(srs, status, msg, srs->user_data); @@ -361,7 +362,7 @@ srs_t *srs_create(const char *name, const char *appclass, char **commands, srs_command_notify_t cmd_notify, void *user_data) { srs_t *srs; - int i; + size_t i; if (conn_notify == NULL) return NULL; @@ -423,7 +424,7 @@ srs_t *srs_create(const char *name, const char *appclass, char **commands, void srs_destroy(srs_t *srs) { - int i; + size_t i; if (srs == NULL) return; @@ -459,11 +460,13 @@ int srs_connect(srs_t *srs, const char *server, int reconnect) mrp_sockaddr_t addr; socklen_t alen; - const char *atype, *opt, *val; + const char *atype; int flags; void *typemap; srs_req_register_t reg; + MRP_UNUSED(reconnect); + if (server == NULL) server = DEFAULT_ADDRESS; @@ -520,6 +523,8 @@ static int check_connection(srs_t *srs) errno = ENOTCONN; return -1; } + + return 0; } diff --git a/src/plugins/client-api/native/native-server.c b/src/plugins/client-api/native/native-server.c index 1a7f66a..21cc579 100644 --- a/src/plugins/client-api/native/native-server.c +++ b/src/plugins/client-api/native/native-server.c @@ -216,7 +216,7 @@ static void cancel_voice(client_t *c, srs_ccl_voice_t *req) static void query_voices(client_t *c, srs_req_voiceqry_t *req) { - srs_voice_actor_t *actors; + srs_voice_actor_t *actors = NULL; int nactor; mrp_debug("received voice query request from native client #%d", c->id); @@ -326,9 +326,6 @@ static int reply_voiceqry(client_t *c, uint32_t reqno, mrp_debug("replying to request #%u from native client #%d", reqno, c->id); - if (actors < 0) - actors = 0; - rpl.type = SRS_REPLY_QUERYVOICES; rpl.reqno = reqno; rpl.actors = actors; @@ -431,13 +428,13 @@ static int transport_setup(server_t *s) srs_context_t *srs = s->self->srs; mrp_sockaddr_t addr; socklen_t alen; - const char *type, *opt, *val; + const char *type; int flags, state, sock; void *typemap; alen = mrp_transport_resolve(NULL, s->address, &addr, sizeof(addr), &type); - if (alen < 0) { + if (alen == 0) { mrp_log_error("Failed to resolve transport address '%s'.", s->address); goto fail; @@ -518,11 +515,6 @@ static int create_native(srs_plugin_t *plugin) plugin->plugin_data = s; return TRUE; - - fail: - mrp_free(s); - - return FALSE; } diff --git a/src/plugins/client-api/native/test-client.c b/src/plugins/client-api/native/test-client.c index a3bb378..52dbc5c 100644 --- a/src/plugins/client-api/native/test-client.c +++ b/src/plugins/client-api/native/test-client.c @@ -577,6 +577,8 @@ static void connect_notify(srs_t *srs, int status, const char *msg, { client_t *c = (client_t *)user_data; + MRP_UNUSED(srs); + if (status == 1) { set_prompt(c, "connected"); print(c, "Connection to server established."); @@ -593,6 +595,8 @@ static void focus_notify(srs_t *srs, srs_voice_focus_t focus, void *user_data) { client_t *c = (client_t *)user_data; + MRP_UNUSED(srs); + print(c, "Client has now %sfocus.", !focus ? "no " : focus == SRS_VOICE_FOCUS_SHARED ? "shared " : "exclusive "); } @@ -603,10 +607,10 @@ static void command_notify(srs_t *srs, int idx, char **tokens, int ntoken, void *user_data) { client_t *c = (client_t *)user_data; - char cmd[1024], *p; - size_t size; int i; + MRP_UNUSED(srs); + print(c, "Got command #%d: ", idx); for (i = 0; i < ntoken; i++) print(c, " token #%d: %s", i, tokens[i]); @@ -651,6 +655,7 @@ static void query_voices_reply(srs_t *srs, srs_voice_actor_t *actors, srs_voice_actor_t *a; int i; + MRP_UNUSED(srs); MRP_UNUSED(notify_data); print(c, "Server has %d available matching voices.", nactor); @@ -696,18 +701,6 @@ static void request_focus(client_t *c, const char *focusstr) } -static void tts_progress_cb(srs_t *srs, srs_voice_event_t *event, - void *user_data, void *notify_data) -{ - client_t *c = (client_t *)user_data; - - MRP_UNUSED(srs); - MRP_UNUSED(notify_data); - - print(c, "Got voice rendering event 0x%x.", event->type); -} - - static void request_tts(client_t *c, int ntoken, char **tokens) { const char *sep = ""; @@ -715,9 +708,8 @@ static void request_tts(client_t *c, int ntoken, char **tokens) int timeout = SRS_VOICE_QUEUE; int events = FALSE; char msg[1024], *t, *e, *p; - int i, o; + int i, o, n; size_t l; - ssize_t n; p = msg; l = sizeof(msg); @@ -740,7 +732,7 @@ static void request_tts(client_t *c, int ntoken, char **tokens) } else { n = snprintf(p, l, "%s%s", sep, t); - if (n >= l) { + if ((size_t)n >= l) { print(c, "TTS message too long."); return; } diff --git a/src/plugins/client-api/wrt-media-client/wrt-media-client.c b/src/plugins/client-api/wrt-media-client/wrt-media-client.c index 1c470b1..041b24c 100644 --- a/src/plugins/client-api/wrt-media-client/wrt-media-client.c +++ b/src/plugins/client-api/wrt-media-client/wrt-media-client.c @@ -216,6 +216,10 @@ static void tts_request_cb(GDBusConnection *c, const gchar *sender, char *voice, *msg; uint32_t id; + MRP_UNUSED(c); + MRP_UNUSED(path); + MRP_UNUSED(interface); + if (strcmp(method, "synthesize")) return; @@ -235,7 +239,7 @@ static void tts_request_cb(GDBusConnection *c, const gchar *sender, static void tts_setup(wrtc_t *wrtc) { - static GDBusInterfaceVTable vtable = { tts_request_cb, NULL, NULL }; + static GDBusInterfaceVTable vtable = { tts_request_cb, NULL, NULL, {} }; wrtc->intr = g_dbus_node_info_new_for_xml(TTS_INTERFACE_XML, NULL); @@ -417,6 +421,8 @@ static void stop_wrtc(srs_plugin_t *plugin) { wrtc_t *wrtc = (wrtc_t *)plugin->plugin_data; + MRP_UNUSED(wrtc); + mrp_debug("stop WRT media client plugin"); return; diff --git a/src/plugins/input-handler/input-plugin.c b/src/plugins/input-handler/input-plugin.c index e2e9479..0ff1a50 100644 --- a/src/plugins/input-handler/input-plugin.c +++ b/src/plugins/input-handler/input-plugin.c @@ -104,6 +104,8 @@ static int config_input(srs_plugin_t *plugin, srs_cfg_t *settings) { context_t *ctx = (context_t *)plugin->plugin_data; + MRP_UNUSED(settings); + mrp_log_info("configuring input plugin"); ctx->key = KEY_PAUSE; @@ -150,7 +152,6 @@ static void stop_input(srs_plugin_t *plugin) static void destroy_input(srs_plugin_t *plugin) { context_t *ctx = (context_t *)plugin->plugin_data; - size_t i; mrp_log_info("destroying input plugin"); @@ -234,7 +235,6 @@ static void handle_device(context_t *ctx, struct udev_device *dev) const char *path; const char *kbd; const char *key; - int fd; if ((path = udev_device_get_property_value(dev, "DEVNAME"))) { key = udev_device_get_property_value(dev, "ID_INPUT_KEY"); diff --git a/src/plugins/search-client/search-plugin.c b/src/plugins/search-client/search-plugin.c index add4b0a..40f61ef 100644 --- a/src/plugins/search-client/search-plugin.c +++ b/src/plugins/search-client/search-plugin.c @@ -166,7 +166,10 @@ static int command_cb(srs_client_t *c, int idx, int ntoken, char **tokens, if (l < (int)sizeof(cmd)) { mrp_log_info("search-client executing '%s'", cmd); - system(cmd); + if (system(cmd) < 0) { + mrp_log_error("search-client: failed to execute search command \ + '%s'", cmd); + } } } else diff --git a/src/plugins/simple-disambiguator/disambiguator.c b/src/plugins/simple-disambiguator/disambiguator.c index 653b863..dffc718 100644 --- a/src/plugins/simple-disambiguator/disambiguator.c +++ b/src/plugins/simple-disambiguator/disambiguator.c @@ -187,7 +187,7 @@ static node_t *get_token_node(node_t *prnt, const char *token, int insert) static node_t *get_dictionary_node(node_t *prnt, const char *token, int insert) { - srs_dict_op_t op; + srs_dict_op_t op = SRS_DICT_OP_UNKNOWN; char dict[MAX_DICT]; mrp_list_hook_t *p, *n; node_t *node; diff --git a/src/plugins/speech-to-text/sphinx/logger.c b/src/plugins/speech-to-text/sphinx/logger.c index 30b04a2..4db7f4a 100644 --- a/src/plugins/speech-to-text/sphinx/logger.c +++ b/src/plugins/speech-to-text/sphinx/logger.c @@ -127,8 +127,8 @@ static char *dig_origin(char *msg, char *e, char *name, size_t size, static void push_log(logger_t *logger) { - char *b, *e, *lb, *le, *file, lvl, name[1024], *msg; - int line, len, nlen; + char *b, *e, *file, lvl, name[1024], *msg; + int line, len; ssize_t n; name[sizeof(name) - 1] = '\0'; @@ -152,7 +152,7 @@ static void push_log(logger_t *logger) lvl = 0; if ((e = strchr(b, '\n')) == NULL) { - if (logger->n >= sizeof(logger->buf) - 1) { + if (logger->n >= (ssize_t)sizeof(logger->buf) - 1) { mrp_log_warning("Discarding too long sphinx log buffer."); logger->n = 0; } @@ -175,17 +175,17 @@ static void push_log(logger_t *logger) default: if (mrp_debug_check(file, "sphinx", line)) mrp_debug_msg("sphinx", line, file, - "%*.*s", n, n, msg); + "%*.*s", (int)n, (int)n, msg); break; case 'W': mrp_log_msg(MRP_LOG_WARNING, file, line, "sphinx", - "%*.*s", n, n, msg); + "%*.*s", (int)n, (int)n, msg); break; case 'E': case 'S': case 'F': mrp_log_msg(MRP_LOG_ERROR, file, line, "sphinx", - "%*.*s", n, n, msg); + "%*.*s", (int)n, (int)n, msg); break; } @@ -225,7 +225,7 @@ static void log_cb(mrp_io_watch_t *w, int fd, mrp_io_event_t events, FILE *logger_create(context_t *ctx) { - static logger_t logger = { { -1, -1 }, NULL, 0 }; + static logger_t logger = { { -1, -1 }, NULL, NULL, "", 0 }; mrp_mainloop_t *ml = plugin_get_mainloop(ctx->plugin); mrp_io_event_t events = MRP_IO_EVENT_IN | MRP_IO_EVENT_HUP; diff --git a/src/plugins/speech-to-text/sphinx/utterance.c b/src/plugins/speech-to-text/sphinx/utterance.c index c0d49a9..6c2a858 100644 --- a/src/plugins/speech-to-text/sphinx/utterance.c +++ b/src/plugins/speech-to-text/sphinx/utterance.c @@ -133,7 +133,7 @@ static void acoustic_processor(context_t *ctx, int32_t frlen; int32 start, end; size_t ncand; - srs_srec_candidate_t *cand; + srs_srec_candidate_t *cand = cands; srs_srec_token_t *tkn; int32_t length; diff --git a/src/plugins/text-to-speech/espeak/espeak-voice.c b/src/plugins/text-to-speech/espeak/espeak-voice.c index 27db37b..f59c088 100644 --- a/src/plugins/text-to-speech/espeak/espeak-voice.c +++ b/src/plugins/text-to-speech/espeak/espeak-voice.c @@ -121,7 +121,7 @@ static int espeak_setrate(double drate) static int espeak_setpitch(double dpitch) { - int min, max, step, pitch, orig; + int pitch, orig; if (0.0 < dpitch && dpitch <= 2.0) { pitch = (int)(50 * dpitch); @@ -326,7 +326,6 @@ static int start_espeak(srs_plugin_t *plugin) espeak_VOICE **voices, *v; int nvoice, i; const char *lang, *language, *dialect; - int nactor; if (e->srs->pulse == NULL) return FALSE; @@ -387,6 +386,8 @@ static int start_espeak(srs_plugin_t *plugin) static void stop_espeak(srs_plugin_t *plugin) { + MRP_UNUSED(plugin); + return; } diff --git a/src/plugins/text-to-speech/festival/festival-loader.c b/src/plugins/text-to-speech/festival/festival-loader.c index 97f3507..540c0ab 100644 --- a/src/plugins/text-to-speech/festival/festival-loader.c +++ b/src/plugins/text-to-speech/festival/festival-loader.c @@ -105,13 +105,13 @@ static int check_config(loader_t *l) while (*s && *s != ' ' && *s != '\t' && *s != ',' && *s != ':') { *b++ = *s++; - if (b - buf >= sizeof(buf) - 1) { + if (b - buf >= (int)sizeof(buf) - 1) { errno = ENOBUFS; return -1; } } - if (b - buf >= sizeof(buf) - 1) { + if (b - buf >= (int)sizeof(buf) - 1) { errno = ENOBUFS; return -1; } @@ -131,13 +131,13 @@ static int check_config(loader_t *l) while (*s && *s != ' ' && *s != '\t' && *s != ',' && *s != ':') { *b++ = *s++; - if (b - buf >= sizeof(buf) - 1) { + if (b - buf >= (int)sizeof(buf) - 1) { errno = ENOBUFS; return -1; } } - if (b - buf >= sizeof(buf) - 1) { + if (b - buf >= (int)sizeof(buf) - 1) { errno = ENOBUFS; return -1; } @@ -156,14 +156,14 @@ static char *find_matching(char *buf, size_t size, const char *dir, { char pattern[PATH_MAX], path[PATH_MAX], *p; const char *l; - int len, prfx, match, ok; + int len, prfx, ok; DIR *dp; struct dirent *de; regex_t re; regmatch_t rm; if (strchr(lib, '*') == NULL && strchr(lib, '?') == NULL) { - if (snprintf(buf, size, "%s/%s", dir, lib) >= size) + if ((size_t)snprintf(buf, size, "%s/%s", dir, lib) >= size) return NULL; if (access(buf, R_OK) == 0) return buf; @@ -224,14 +224,15 @@ static char *find_matching(char *buf, size_t size, const char *dir, if (prfx > 0 && strncmp(de->d_name, pattern, prfx) != 0) continue; - if (regexec(&re, de->d_name, 1, &rm, 0) == 0) { - ok = snprintf(buf, size, "%s/%s", dir, de->d_name) < size; + if (regexec(&re, de->d_name, 1, &rm, 0) != 0) + continue; - closedir(dp); - regfree(&re); + ok = (size_t)snprintf(buf, size, "%s/%s", dir, de->d_name) < size; - return ok ? buf : NULL; - } + closedir(dp); + regfree(&re); + + return ok ? buf : NULL; } else if (de->d_type == DT_LNK) { struct stat st; @@ -337,6 +338,8 @@ static int config_loader(srs_plugin_t *plugin, srs_cfg_t *settings) static int start_loader(srs_plugin_t *plugin) { + MRP_UNUSED(plugin); + return TRUE; } diff --git a/src/plugins/text-to-speech/festival/festival-voice.c b/src/plugins/text-to-speech/festival/festival-voice.c index a3819cf..c40237c 100644 --- a/src/plugins/text-to-speech/festival/festival-voice.c +++ b/src/plugins/text-to-speech/festival/festival-voice.c @@ -65,8 +65,8 @@ static uint32_t festival_render(const char *msg, char **tags, int actor, { festival_t *f = (festival_t *)api_data; void *samples; - uint32_t nsample, id; - int srate, nchannel; + uint32_t id; + int srate, nchannel, nsample; MRP_UNUSED(rate); MRP_UNUSED(pitch); @@ -156,7 +156,7 @@ static int config_festival(srs_plugin_t *plugin, srs_cfg_t *cfg) if (e != NULL) { len = e - b; - if (len >= sizeof(voice) - 1) { + if (len >= (int)sizeof(voice) - 1) { toolong: mrp_log_error("Voice name '%*.*s' too long.", len, len, b); return FALSE; @@ -166,7 +166,7 @@ static int config_festival(srs_plugin_t *plugin, srs_cfg_t *cfg) voice[len] = '\0'; } else { - if ((len = strlen(b)) >= sizeof(voice) - 1) + if ((len = strlen(b)) >= (int)sizeof(voice) - 1) goto toolong; strcpy(voice, b); @@ -231,11 +231,10 @@ static int start_festival(srs_plugin_t *plugin) }; festival_t *f = (festival_t *)plugin->plugin_data; - int nactor; char **voices; int nvoice; char *lang, *dial, *descr; - int female, age, i; + int female, i; if (f->srs->pulse == NULL) return FALSE; @@ -289,6 +288,8 @@ static int start_festival(srs_plugin_t *plugin) static void stop_festival(srs_plugin_t *plugin) { + MRP_UNUSED(plugin); + return; } diff --git a/src/plugins/text-to-speech/festival/libcarnival.cc b/src/plugins/text-to-speech/festival/libcarnival.cc index 07a9d1c..0d899bd 100644 --- a/src/plugins/text-to-speech/festival/libcarnival.cc +++ b/src/plugins/text-to-speech/festival/libcarnival.cc @@ -91,7 +91,7 @@ static void update_available_voices(void) static void update_loaded_voices(void) { voice_t *v; - LISP ll, lentry, lname, llang, ldescr, lgender, lp, lk, lv; + LISP ll, lentry, lname, ldescr, lp, lk, lv; const char *key; if ((ll = siod_get_lval("Voice_descriptions", NULL)) == NIL) @@ -158,8 +158,6 @@ static void update_loaded_voices(void) int carnival_init(void) { - voice_t *v; - festival_initialize(TRUE, FESTIVAL_HEAP_SIZE); update_available_voices(); @@ -301,7 +299,7 @@ int carnival_load_voice(const char *name) if ((v = find_voice_entry(name)) != NULL && v->language != NULL) return 0; /* already loaded, nothing to do */ - if (snprintf(loader, sizeof(loader), "voice_%s", name) >= sizeof(loader)) { + if (snprintf(loader, sizeof(loader), "voice_%s", name) >= (int)sizeof(loader)) { errno = EOVERFLOW; return -1; @@ -380,7 +378,7 @@ int carnival_select_voice(const char *name) return -1; /* not loaded, cannot select */ } - if (snprintf(sel, sizeof(sel), "voice_%s", name) >= sizeof(sel)) { + if (snprintf(sel, sizeof(sel), "voice_%s", name) >= (int)sizeof(sel)) { errno = EOVERFLOW; return -1; -- 2.7.4