From 9efa107eac1540d89f8f88829f825f54882b091c Mon Sep 17 00:00:00 2001 From: Richard Kettlewell Date: Thu, 17 Jun 2010 20:49:26 +0100 Subject: [PATCH] Placate static analyzer --- cgi/actions.c | 2 +- disobedience/choose-search.c | 1 + disobedience/rtp.c | 4 ++-- libtests/t-hash.c | 6 ++++-- server/speaker.c | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cgi/actions.c b/cgi/actions.c index fae533a..f6755b0 100644 --- a/cgi/actions.c +++ b/cgi/actions.c @@ -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"); diff --git a/disobedience/choose-search.c b/disobedience/choose-search.c index acfddfa..60df2ec 100644 --- a/disobedience/choose-search.c +++ b/disobedience/choose-search.c @@ -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 */ diff --git a/disobedience/rtp.c b/disobedience/rtp.c index cbedb18..4693173 100644 --- a/disobedience/rtp.c +++ b/disobedience/rtp.c @@ -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() diff --git a/libtests/t-hash.c b/libtests/t-hash.c index 4d8b68a..e23ee1a 100644 --- a/libtests/t-hash.c +++ b/libtests/t-hash.c @@ -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); diff --git a/server/speaker.c b/server/speaker.c index a2c2e7c..3af36aa 100644 --- a/server/speaker.c +++ b/server/speaker.c @@ -340,7 +340,8 @@ static int speaker_fill(struct track *t) { t->playable = 1; rc = 0; } - } + } else + rc = 0; return rc; } -- 2.11.0