Placate static analyzer
authorRichard Kettlewell <richard@deodand>
Thu, 17 Jun 2010 19:49:26 +0000 (20:49 +0100)
committerRichard Kettlewell <richard@deodand>
Thu, 17 Jun 2010 19:49:26 +0000 (20:49 +0100)
cgi/actions.c
disobedience/choose-search.c
disobedience/rtp.c
libtests/t-hash.c
server/speaker.c

index fae533a..f6755b0 100644 (file)
@@ -612,7 +612,7 @@ static int process_prefs(int numfile) {
     byte_xasprintf((char **)&name, "trackname_%s_%s", context, part);
     disorder_set(dcgi_client, file, name, value);
   }
-  if((value = numbered_arg("random", numfile)))
+  if(numbered_arg("random", numfile))
     disorder_unset(dcgi_client, file, "pick_at_random");
   else
     disorder_set(dcgi_client, file, "pick_at_random", "0");
index acfddfa..60df2ec 100644 (file)
@@ -441,6 +441,7 @@ static gboolean choose_get_visible_range(GtkTreeView *tree_view,
  * @param direction -1 for prev, +1 for next
  */
 static void choose_move(int direction) {
+  assert(direction);                    /* placate analyzer */
   /* Refocus the main view so typahead find continues to work */
   gtk_widget_grab_focus(choose_view);
   /* If there's no results we have nothing to do */
index cbedb18..4693173 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of Disobedience
- * Copyright (C) 2007 Richard Kettlewell
+ * Copyright (C) 2007-2010 Richard Kettlewell
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -108,7 +108,7 @@ void start_rtp(void) {
   if(!(pid = xfork())) {
     if(setsid() < 0)
       disorder_fatal(errno, "error calling setsid");
-    if(!(pid = xfork())) {
+    if(!xfork()) {
       /* grandchild */
       exitfn = _exit;
       /* log errors and output somewhere reasonably sane.  rtp_running()
index 4d8b68a..e23ee1a 100644 (file)
@@ -50,8 +50,10 @@ static void test_hash(void) {
   
   for(i = 0; i < 10000; ++i) {
     insist((ip = hash_find(h, do_printf("%d", i))) != 0);
-    check_integer(*ip, i);
-    insist(hash_add(h, do_printf("%d", i), &i, HASH_REPLACE) == 0);
+    if(ip) {
+      check_integer(*ip, i);
+      insist(hash_add(h, do_printf("%d", i), &i, HASH_REPLACE) == 0);
+    }
   }
   check_integer(hash_count(h), 10000);
   keys = hash_keys(h);
index a2c2e7c..3af36aa 100644 (file)
@@ -340,7 +340,8 @@ static int speaker_fill(struct track *t) {
         t->playable = 1;
       rc = 0;
     }
-  }
+  } else
+    rc = 0;
   return rc;
 }