From: Richard Kettlewell Date: Thu, 17 Jun 2010 20:14:26 +0000 (+0100) Subject: More clang-inspired fixes X-Git-Tag: branchpoint-5.1~73 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/b0896ce549728978ff8ec39ee92eb917fa4ea4dd?hp=85f0650b8304e3a1cd34eec40a272cda02371ff5 More clang-inspired fixes --- diff --git a/disobedience/playlists.c b/disobedience/playlists.c index c1a857d..c95db43 100644 --- a/disobedience/playlists.c +++ b/disobedience/playlists.c @@ -601,7 +601,7 @@ static void playlist_new_details(char **namep, if(privatep) *privatep = private; if(namep) *namep = name; if(fullnamep) { - if(shared) *fullnamep = *namep; + if(shared) *fullnamep = name; else byte_xasprintf(fullnamep, "%s.%s", config->username, name); } } diff --git a/lib/trackdb.c b/lib/trackdb.c index 628498a..24d04ac 100644 --- a/lib/trackdb.c +++ b/lib/trackdb.c @@ -2493,6 +2493,9 @@ char **trackdb_search(char **wordlist, int nwordlist, int *ntracks) { } if(trackdb_closecursor(cursor)) err = DB_LOCK_DEADLOCK; cursor = 0; + if(err) + goto fail; + cursor = 0; /* do a naive search over that (hopefuly fairly small) list of tracks */ u.nvec = 0; for(n = 0; n < v.nvec; ++n) { diff --git a/libtests/t-hex.c b/libtests/t-hex.c index a6f1b32..f2d5994 100644 --- a/libtests/t-hex.c +++ b/libtests/t-hex.c @@ -52,12 +52,15 @@ static void test_hex(void) { check_string(hex(h, sizeof h), "00ff807f"); check_string(hex(0, 0), ""); u = unhex("00ff807f", &ul); + insist(u != 0); insist(ul == 4); insist(memcmp(u, h, 4) == 0); u = unhex("00FF807F", &ul); + insist(u != 0); insist(ul == 4); insist(memcmp(u, h, 4) == 0); u = unhex("", &ul); + insist(u != 0); insist(ul == 0); fprintf(stderr, "2 ERROR reports expected {\n"); insist(unhex("F", 0) == 0); diff --git a/libtests/test.h b/libtests/test.h index cada395..87f0224 100644 --- a/libtests/test.h +++ b/libtests/test.h @@ -95,7 +95,7 @@ extern int skipped; const char *got = GOT; \ const char *want = WANT; \ \ - if(want == 0) { \ + if(got == 0) { \ fprintf(stderr, "%s:%d: %s returned 0\n", \ __FILE__, __LINE__, #GOT); \ count_error(); \