speech-recognition: get rid of most(ly unused variable) warnings.
authorKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 6 Jun 2013 13:41:36 +0000 (16:41 +0300)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 6 Jun 2013 13:55:42 +0000 (16:55 +0300)
13 files changed:
src/plugins/bluetooth-client/bluetooth-plugin.c
src/plugins/bluetooth-client/clients.c
src/plugins/bluetooth-client/dbusif.c
src/plugins/bluetooth-client/pulseif.c
src/plugins/mpris2-client/clients.c
src/plugins/mpris2-client/dbusif.c
src/plugins/mpris2-client/mpris2-plugin.c
src/plugins/sphinx-speech-engine/filter-buffer.c
src/plugins/sphinx-speech-engine/input-buffer.c
src/plugins/sphinx-speech-engine/options.c
src/plugins/sphinx-speech-engine/pulse-interface.c
src/plugins/sphinx-speech-engine/sphinx-plugin.c
src/plugins/sphinx-speech-engine/utterance.c

index 0ec182e..802aa9e 100644 (file)
@@ -51,7 +51,6 @@ static int create_bt_voicerec(srs_plugin_t *plugin)
 {
     srs_context_t *srs = plugin->srs;
     context_t     *ctx = NULL;
-    int            sts;
 
     mrp_debug("creating bluetooth voice recognition client plugin");
 
@@ -77,13 +76,14 @@ static int create_bt_voicerec(srs_plugin_t *plugin)
 
 static int config_bt_voicerec(srs_plugin_t *plugin, srs_cfg_t *settings)
 {
-    context_t *ctx = (context_t *)plugin->plugin_data;
-    srs_cfg_t *cfgs, *c, *s;
+    srs_cfg_t *cfgs, *c;
     const char *key;
     int pfxlen;
     int n, i;
     int success;
 
+    MRP_UNUSED(plugin);
+
     mrp_debug("configuring bluetooth voice recognition client plugin");
 
     n = srs_collect_config(settings, BLUETOOTH_PREFIX, &cfgs);
@@ -139,8 +139,7 @@ static void stop_bt_voicerec(srs_plugin_t *plugin)
 
 static void destroy_bt_voicerec(srs_plugin_t *plugin)
 {
-    srs_context_t *srs = plugin->srs;
-    context_t     *ctx = (context_t *)plugin->plugin_data;
+    context_t *ctx = (context_t *)plugin->plugin_data;
 
     mrp_debug("destroy bluetooth voice recognition client plugin");
 
index 8dc1f7a..94f6318 100644 (file)
@@ -52,12 +52,12 @@ static void init_samples(const char *file)
     int fd;
 
     if (stat(file, &buf) < 0) {
-        printf("*** could not stat sample file '%s'\n");
+        printf("*** could not stat sample file '%s'\n", file);
         return;
     }
 
     if ((size = buf.st_size) > 500000) {
-        printf("*** file too length %u exceeds the max 500000\n", size);
+        printf("*** file too length %zd exceeds the max 500000\n", size);
         return;
     }
 
@@ -90,7 +90,7 @@ static void init_samples(const char *file)
 
     nsample = len / sizeof(int16_t);
 
-    printf("*** succesfully read %u samples\n", nsample);
+    printf("*** succesfully read %zd samples\n", nsample);
 }
 
 
@@ -166,6 +166,8 @@ int clients_start(context_t *ctx)
 
 int clients_stop(context_t *ctx)
 {
+    MRP_UNUSED(ctx);
+
     return 0;
 }
 
@@ -327,6 +329,9 @@ static int play_samples(context_t *ctx, size_t nsample, int16_t *samples)
 
 static int notify_focus(srs_client_t *srs_client, srs_voice_focus_t focus)
 {
+    MRP_UNUSED(srs_client);
+    MRP_UNUSED(focus);
+
     return TRUE;
 }
 
index 9175dab..b8cca9e 100644 (file)
@@ -179,6 +179,8 @@ static modem_t *create_modem(context_t *ctx,
     reference_modem(modem);
 
     mrp_list_prepend(&dbusif->modems, &modem->link);
+
+    return modem;
 }
 
 static void destroy_modem(modem_t *modem)
@@ -356,6 +358,8 @@ static int modem_property_changed_cb(mrp_dbus_t *dbus,
     int type;
     DBusBasicValue value;
 
+    MRP_UNUSED(dbus);
+
     if (ctx && (dbusif = ctx->dbusif) && dbus_message_iter_init(msg, &mit)) {
         path = dbus_message_get_path(msg);
 
@@ -398,6 +402,8 @@ static int handsfree_property_changed_cb(mrp_dbus_t *dbus,
     DBusBasicValue value;
     hfp_state_t state;
 
+    MRP_UNUSED(dbus);
+
     if (ctx && (dbusif = ctx->dbusif) && dbus_message_iter_init(msg, &mit)) {
         path = dbus_message_get_path(msg);
 
@@ -431,10 +437,11 @@ static void modem_query_all_cb(mrp_dbus_t *dbus,
     const char *addr;
     const char *name;
     dbus_bool_t online;
-    hfp_state_t state;
     modem_t *modem;
     DBusMessageIter mit, ait, sit;
 
+    MRP_UNUSED(dbus);
+
     if (ctx && (dbusif = ctx->dbusif) && dbus_message_iter_init(msg, &mit)) {
         if (dbus_message_iter_get_arg_type(&mit) != DBUS_TYPE_ARRAY)
             return;
@@ -479,8 +486,9 @@ static void modem_query_cb(mrp_dbus_t *dbus,
     const char *addr;
     const char *name;
     dbus_bool_t online;
-    hfp_state_t state;
-    DBusMessageIter mit, ait, sit;
+    DBusMessageIter mit;
+
+    MRP_UNUSED(dbus);
 
     if (modem && (ctx = modem->ctx)) {
 
@@ -517,7 +525,9 @@ static void handsfree_query_cb(mrp_dbus_t *dbus,
     modem_t *modem = (modem_t *)user_data;
     context_t *ctx;
     hfp_state_t state;
-    DBusMessageIter mit, ait, sit;
+    DBusMessageIter mit;
+
+    MRP_UNUSED(dbus);
 
     if (modem && (ctx = modem->ctx)) {
 
@@ -574,7 +584,6 @@ static void parse_modem_properties(context_t *ctx,
                                    const char **btname,
                                    dbus_bool_t *online)
 {
-    modem_t *modem;
     const char *prop;
     int type;
     DBusBasicValue value;
@@ -648,8 +657,7 @@ static void parse_handsfree_properties(modem_t *modem,
     const char *prop;
     int type;
     DBusBasicValue value;
-    DBusMessageIter ait, dit, vit, iit;
-    dbus_bool_t has_handsfree_interface = FALSE;
+    DBusMessageIter ait, dit, vit;
 
     if (!modem || !sit || !state)
         return;
index 2d71dab..55227e1 100644 (file)
@@ -62,14 +62,16 @@ static void sink_info_callback(pa_context *, const pa_sink_info *,
 int pulseif_create(context_t *ctx, pa_mainloop *mloop)
 {
     pulseif_t *pulseif = NULL;
-    pa_mainloop_api *api = NULL;
+#if 0
+    pa_mainloop_api *api;
+#endif
 
     if (!(pulseif = mrp_allocz(sizeof(pulseif_t))))
         goto failed;
 
+#if 0
     api = pa_mainloop_get_api(mloop);
 
-#if 0
     if (pa_signal_init(api) < 0)
         goto failed;
 #endif
@@ -630,6 +632,8 @@ static void read_callback(pa_stream *stream, size_t bytes, void *userdata)
     double m;
     int16_t *s;
 
+    MRP_UNUSED(bytes);
+
     if (!card || !(device = card->device) || !(ctx = device->ctx) ||
         !(pulseif = ctx->pulseif))
         goto confused;
@@ -737,7 +741,7 @@ static void write_callback(pa_stream *stream, size_t bytes, void *userdata)
     return;
 
  could_not_write:
-    mrp_log_error("bluetooth plugin: could not write %u bytes to stream %s",
+    mrp_log_error("bluetooth plugin: could not write %zd bytes to stream %s",
                   bytes, device->btaddr);
 }
 
@@ -980,6 +984,8 @@ static void card_info_callback(pa_context *c,
     const char *btaddr;
     uint32_t j;
 
+    MRP_UNUSED(c);
+
     if (pend && (ctx = pend->ctx)) {
         if (eol)
             remove_pending_op(pend);
@@ -1024,7 +1030,8 @@ static void source_info_callback(pa_context *c,
     modem_t *modem;
     const char *proto;
     const char *btaddr;
-    uint32_t j;
+
+    MRP_UNUSED(c);
 
     if (pend && (ctx = pend->ctx)) {
         if (eol)
@@ -1062,7 +1069,8 @@ static void sink_info_callback(pa_context *c,
     modem_t *modem;
     const char *proto;
     const char *btaddr;
-    uint32_t j;
+
+    MRP_UNUSED(c);
 
     if (pend && (ctx = pend->ctx)) {
         if (eol)
index bc7a227..6ac8fb3 100644 (file)
@@ -99,7 +99,6 @@ int clients_start(context_t *ctx)
     srs_plugin_t *pl;
     srs_context_t *srs;
     clients_t *clients;
-    player_t *player;
     srs_client_ops_t callbacks;
 
     if (!ctx || !(pl = ctx->plugin) || !(srs = pl->srs) ||
@@ -123,6 +122,8 @@ int clients_start(context_t *ctx)
 
 int clients_stop(context_t *ctx)
 {
+    MRP_UNUSED(ctx);
+
     return 0;
 }
 
@@ -363,6 +364,9 @@ void clients_player_quit(player_t *player)
 
 static int notify_focus(srs_client_t *srs_client, srs_voice_focus_t focus)
 {
+    MRP_UNUSED(srs_client);
+    MRP_UNUSED(focus);
+
     return TRUE;
 }
 
@@ -427,6 +431,10 @@ static void handle_delayed_request(pa_mainloop_api *api,
 {
     player_t *player = (player_t *)user_data;
 
+    MRP_UNUSED(api);
+    MRP_UNUSED(e);
+    MRP_UNUSED(tv);
+
     dbusif_query_playlists(player);
     dbusif_set_player_state(player, player->request.state);
     memset(&player->request, 0, sizeof(player->request));
@@ -467,7 +475,8 @@ static int player_register(void *key, void *object, void *user_data)
 {
     context_t *ctx = (context_t *)user_data;
     player_t *player = (player_t *)object;
-    int sts;
+
+    MRP_UNUSED(key);
 
     dbusif_register_player(ctx, player->name);
 
@@ -484,7 +493,8 @@ static void player_free(void *key, void *object)
 
 
     if (strcmp(key, player->name))
-        mrp_log_error("mpris2-client: corrupt hashtable (key '%s')", key);
+        mrp_log_error("mpris2-client: corrupt hashtable (key '%s')",
+                      (char *)key);
     else {
         if (player->timer && (ctx = player->ctx) && (pl = ctx->plugin) &&
             (srs = pl->srs) && (api = pa_mainloop_get_api(srs->pa)))
index 102dd06..e703a18 100644 (file)
@@ -146,7 +146,6 @@ void dbusif_set_player_property(player_t *player,
     DBusMessage *msg;
     DBusMessageIter mit;
     DBusMessageIter vit;
-    int success;
 
     if (!player || !player->name || !player->address ||
         !(ctx = player->ctx) || !(dbusif = ctx->dbusif))
@@ -330,7 +329,6 @@ void dbusif_raise_player(player_t *player)
     context_t *ctx;
     dbusif_t *dbusif;
     DBusMessage *msg;
-    const char *member;
 
     if (!player || !player->address ||
         !(ctx = player->ctx) || !(dbusif = ctx->dbusif))
@@ -351,7 +349,6 @@ void dbusif_quit_player(player_t *player)
     context_t *ctx;
     dbusif_t *dbusif;
     DBusMessage *msg;
-    const char *member;
 
     if (!player || !player->address ||
         !(ctx = player->ctx) || !(dbusif = ctx->dbusif))
@@ -378,6 +375,9 @@ static void name_follow_cb(mrp_dbus_t *dbus,
     const char *dot;
     const char *name;
 
+    MRP_UNUSED(dbus);
+    MRP_UNUSED(error);
+
     if (ctx && (dbusif = ctx->dbusif) && (dot = strrchr(dbus_name, '.'))) {
         name = dot + 1;
 
@@ -412,6 +412,8 @@ static void property_query_cb(mrp_dbus_t *dbus,
     context_t *ctx;
     DBusMessageIter mit;
 
+    MRP_UNUSED(dbus);
+
     if (player && (ctx = player->ctx) && dbus_message_iter_init(msg, &mit))
         parse_properties(ctx, player, &mit);
 }
@@ -422,10 +424,11 @@ static void introspect_cb(mrp_dbus_t *dbus,
 {
     player_t *player = (player_t *)user_data;
     context_t *ctx;
-    DBusMessageIter mit;
     dbus_bool_t success;
     const char *xml;
 
+    MRP_UNUSED(dbus);
+
     if (player && (ctx = player->ctx)) {
         success = dbus_message_get_args(msg, NULL,
                                         DBUS_TYPE_STRING, &xml,
@@ -448,6 +451,8 @@ static void playlist_query_cb(mrp_dbus_t *dbus,
     playlist_t *list;
     size_t nlist;
 
+    MRP_UNUSED(dbus);
+
     if (!player || !(ctx = player->ctx))
         return;
 
@@ -490,6 +495,8 @@ static int property_changed_cb(mrp_dbus_t *dbus,
     const char *interface;
     DBusMessageIter mit;
 
+    MRP_UNUSED(dbus);
+
     if (!ctx || ! sender)
         return FALSE;
 
index d068c28..51aecb7 100644 (file)
@@ -50,7 +50,6 @@ static int create_mpris2(srs_plugin_t *plugin)
 {
     srs_context_t *srs = plugin->srs;
     context_t     *ctx = NULL;
-    int            sts;
 
     mrp_debug("creating Mpris2 client plugin");
 
@@ -131,7 +130,6 @@ static int config_mpris2(srs_plugin_t *plugin, srs_cfg_t *settings)
 
 static int start_mpris2(srs_plugin_t *plugin)
 {
-    srs_context_t *srs = plugin->srs;
     context_t *ctx = (context_t *)plugin->plugin_data;
 
     mrp_debug("start Mpris2 client plugin");
@@ -154,8 +152,7 @@ static void stop_mpris2(srs_plugin_t *plugin)
 
 static void destroy_mpris2(srs_plugin_t *plugin)
 {
-    srs_context_t *srs = plugin->srs;
-    context_t     *ctx = (context_t *)plugin->plugin_data;
+    context_t *ctx = (context_t *)plugin->plugin_data;
 
     mrp_debug("destroy Mpris2 client plugin");
 
index f1797d8..a363aaf 100644 (file)
@@ -160,7 +160,7 @@ void filter_buffer_process_data(context_t *ctx)
     input_buf_t *inpbuf;
     filter_buf_t *filtbuf;
     cont_ad_t *cont;
-    int32_t l, max, len, rem;
+    int32_t l, max, len;
 
     if (!ctx || !(decset = ctx->decset) || !(dec = decset->curdec) ||
         !(inpbuf = ctx->inpbuf) || !(cont = inpbuf->cont) ||
index c33c6ae..a89607e 100644 (file)
@@ -96,12 +96,10 @@ void input_buffer_process_data(context_t *ctx, const void *buf, size_t len)
     input_buf_t *inpbuf;
     filter_buf_t *filtbuf;
     cont_ad_t *cont;
-    int32 l, max, rem;
     uint32_t minreq;
     size_t maxlen;
     size_t totlen;
     size_t extra;
-    size_t move;
 
     if (!ctx || !(decset = ctx->decset) || !(dec = decset->curdec) ||
         !(inpbuf = ctx->inpbuf) || !(cont = inpbuf->cont) ||
@@ -118,13 +116,13 @@ void input_buffer_process_data(context_t *ctx, const void *buf, size_t len)
     if ((totlen = len + inpbuf->len) > maxlen) {
         extra = totlen - maxlen;
 
-        mrp_log_error("input buffer overflow (%u bytes). "
+        mrp_log_error("input buffer overflow (%zd bytes). "
                       "throwing away extra bytes", extra);
 
         if (extra > maxlen) {
             buf += (len - (len % maxlen));
             len = maxlen;
-        }       
+        }
         else {
             inpbuf->len -= extra;
             memmove(inpbuf->buf, inpbuf->buf + extra, inpbuf->len);
@@ -162,7 +160,6 @@ void input_buffer_process_data(context_t *ctx, const void *buf, size_t len)
 static int32 ad_buffer_read(ad_rec_t *ud, int16 *buf, int32 reqlen)
 {
     input_buf_t *inpbuf = (input_buf_t *)ud;
-    context_t *ctx = inpbuf->ctx;
     size_t len = reqlen * sizeof(int16);
 
     if (!inpbuf->max || !inpbuf->buf)
@@ -179,9 +176,9 @@ static int32 ad_buffer_read(ad_rec_t *ud, int16 *buf, int32 reqlen)
                 memmove(inpbuf->buf, inpbuf->buf + len, inpbuf->len);
         }
     }
-    
+
     if ((len % sizeof(int16)))
-        mrp_log_error("%s(): odd buffer size %u", __FUNCTION__, len);
+        mrp_log_error("%s(): odd buffer size %zd", __FUNCTION__, len);
 
     return (int32)(len / sizeof(int16));
 }
index f37551a..b5d60e6 100644 (file)
@@ -21,7 +21,6 @@ int options_create(context_t *ctx, int ncfg, srs_cfg_t *cfgs)
     const char *key;
     const char *value;
     char *e;
-    int c;
     bool verbose;
     int i;
     int sts;
index 1403f24..c0638e0 100644 (file)
@@ -115,9 +115,6 @@ static int stream_create(context_t *ctx)
     options_t *opts = ctx->opts;
     pulse_interface_t *pulseif = ctx->pulseif;
     input_buf_t *inpbuf = ctx->inpbuf;
-    decoder_set_t *decset = ctx->decset;
-    decoder_t *dec = decset->decs;
-    cmd_ln_t  *cfg  = dec->cfg;
     double rate = opts->rate;
     double dsilen = opts->silen;
     const char *source = opts->srcnam;
@@ -278,6 +275,8 @@ static void read_callback(pa_stream *stream, size_t bytes, void *userdata)
     const void *data;
     size_t size;
 
+    MRP_UNUSED(bytes);
+
     if (pulseif->stream != stream) {
         mrp_log_error("sphinx plugin: %s() confused with internal "
                       "data structures", __FUNCTION__);
index 9556de5..45175af 100644 (file)
@@ -215,7 +215,7 @@ static int config_sphinx(srs_plugin_t *plugin, srs_cfg_t *settings)
 {
     context_t *ctx = (context_t *)plugin->plugin_data;
     srs_cfg_t *cfg;
-    int        n, i;
+    int        n;
 
     mrp_debug("configuring CMU Sphinx speech recognition backend plugin");
 
index 1467e5d..d231844 100644 (file)
@@ -116,15 +116,11 @@ static void acoustic_processor(context_t *ctx,
     double prob;
     ps_nbest_t *nb;
     ps_seg_t *seg;
-    ps_lattice_t *dag;
-    ps_latnode_iter_t *it;
-    ps_latlink_t *lnk;
-    ps_latnode_t *nod;
     int32 start, end;
-    size_t ncand, nsort;
+    size_t ncand;
     srs_srec_candidate_t *cand;
     srs_srec_token_t *tkn;
-    int32_t length, purgelen;
+    int32_t length;
 
     if (!ctx || !(decset = ctx->decset) || !(dec = decset->curdec))
         return;
@@ -218,7 +214,6 @@ static void fsg_processor(context_t *ctx,
     decoder_set_t *decset;
     decoder_t *dec;
     logmath_t *lmath;
-    const char *hyp;
     const char *uttid;
     int32_t score;
     double prob;
@@ -230,13 +225,11 @@ static void fsg_processor(context_t *ctx,
     const char *token;
     int32_t start;
     int16 fef, lef;
-    int32_t purgelen;
 
     if (!ctx || !(decset = ctx->decset) || !(dec = decset->curdec))
         return;
 
     lmath = ps_get_logmath(dec->ps);
-    hyp = ps_get_hyp(dec->ps, &score, &uttid);
     prob = logmath_exp(lmath, score);
 
     cand = cands;
@@ -269,7 +262,7 @@ static void fsg_processor(context_t *ctx,
                 {
                     start = ps_latnode_times(nod, &fef, &lef);
 
-                    if (tkn && start < tkn->end)
+                    if (tkn && start < (int32_t)tkn->end)
                         break;  /* just take one candidate */
 
                     if (!tkn || !tkneq(token, tkn->token)) {
@@ -303,10 +296,10 @@ static void print_utterance(context_t *ctx, srs_srec_utterance_t *utt)
     size_t i,j;
 
     if (ctx && (decset = ctx->decset) && (dec = decset->curdec)) {
-        mrp_log_info("*** %15s  (%.4lf) %u candidates, length %u",
+        mrp_log_info("*** %15s  (%.4lf) %zd candidates, length %u",
                      utt->id, utt->score, utt->ncand, utt->length);
 
-        for (i = 0; cand = utt->cands[i];  i++) {
+        for (i = 0; (cand = utt->cands[i]) != NULL;  i++) {
             mrp_log_info("  (%.4lf) ----------------------", cand->score);
 
             for (j = 0;  j < cand->ntoken;  j++) {
@@ -388,7 +381,7 @@ static uint32_t candidate_sort(srs_srec_candidate_t *cands,
 static bool tkneq(const char *tkn1, const char *tkn2)
 {
     const char *e1, *e2;
-    int l1, l2, l;
+    int l1, l2;
 
     if (!tkn1 || !tkn2)
         return false;