chiark / gitweb /
More clang-inspired fixes
authorRichard Kettlewell <richard@deodand>
Thu, 17 Jun 2010 20:14:26 +0000 (21:14 +0100)
committerRichard Kettlewell <richard@deodand>
Thu, 17 Jun 2010 20:14:26 +0000 (21:14 +0100)
disobedience/playlists.c
lib/trackdb.c
libtests/t-hex.c
libtests/test.h

index c1a857da2c805827467b97c19dbda44ef1a84df1..c95db438433edb744c04448e2310b5d0941a8e54 100644 (file)
@@ -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);
   }
 }
index 628498a0cbcc89e7bfaaea6d6412246e8bdc5dff..24d04accfb711ded4d3dbc2d613a1be88d05cfa2 100644 (file)
@@ -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) {
index a6f1b32c6f9a67518041d8871f63b01249075f22..f2d599408ea151d5cfa8e09a06814006c359720a 100644 (file)
@@ -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);
index cada395ad03dcf55c8f0fcbc73d4775d928d7d7b..87f0224cf60de01d6bb23504b0277b198275546b 100644 (file)
@@ -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();                                                      \