chiark / gitweb /
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 fae533a7b3f45ee37c4ab6e2ed5838ef71c4a0e4..f6755b0317ad2ca080c1d28098e3902df38cb559 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 acfddfa8d536c6b735d59585472d86748f51a1fb..60df2ec095b9c6d92e8ae2012f7151d320df3323 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 cbedb18aaf8eb4f07b0675f64a6f22df31cf39b9..46931736b42665a205229aafd0289da15d7ef26f 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 4d8b68aaa4afa348367aaef3f397e85bcef7d35d..e23ee1a961879a55445ab3560f52d53f01bd0e40 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 a2c2e7c7650a8b45a7f5de5b0a406d5a360e1fca..3af36aaac22289ab6616f0a63282f2c6ffe091a5 100644 (file)
@@ -340,7 +340,8 @@ static int speaker_fill(struct track *t) {
         t->playable = 1;
       rc = 0;
     }
-  }
+  } else
+    rc = 0;
   return rc;
 }