blob_get_name_by_id(): Treat id of dummy row as invalid.
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index 35e513ffb8a76c099544ac865742810caac10abc..f14440e6fb903548e25ccfdf611f4c2f2881aa49 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -696,7 +696,13 @@ static int get_local_time(uint64_t *seconds, char *buf, size_t size,
                        return -E_STRFTIME;
                return 1;
        }
-       if (!strftime(buf, size, "%b %e %Y", tm))
+       /*
+        * If the given time is more than six month away from the current time,
+        * we print only the year. The additional space character in the format
+        * string below makes the formated date align nicely with dates that
+        * contain the time (those written by the above strftime() statement).
+        */
+       if (!strftime(buf, size, "%b %e  %Y", tm))
                return -E_STRFTIME;
        return 1;
 }
@@ -921,12 +927,14 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
        WRITE_STATUS_ITEM(b, SI_FREQUENCY, "%dHz\n", afhi->frequency);
        WRITE_STATUS_ITEM(b, SI_CHANNELS, "%d\n", afhi->channels);
        WRITE_STATUS_ITEM(b, SI_DURATION, "%s\n", duration_buf);
-       WRITE_STATUS_ITEM(b, SI_SECONDS_TOTAL, "%lu\n", afhi->seconds_total);
+       WRITE_STATUS_ITEM(b, SI_SECONDS_TOTAL, "%" PRIu32 "\n",
+               afhi->seconds_total);
        WRITE_STATUS_ITEM(b, SI_LAST_PLAYED, "%s\n", last_played_time);
        WRITE_STATUS_ITEM(b, SI_NUM_PLAYED, "%d\n", afsi->num_played);
        WRITE_STATUS_ITEM(b, SI_AMPLIFICATION, "%u\n", afsi->amp);
        WRITE_STATUS_ITEM(b, SI_CHUNK_TIME, "%lu\n", tv2ms(&afhi->chunk_tv));
-       WRITE_STATUS_ITEM(b, SI_NUM_CHUNKS, "%lu\n", afhi->chunks_total);
+       WRITE_STATUS_ITEM(b, SI_NUM_CHUNKS, "%" PRIu32 "\n",
+               afhi->chunks_total);
        WRITE_STATUS_ITEM(b, SI_TECHINFO, "%s\n", afhi->techinfo);
        WRITE_STATUS_ITEM(b, SI_ARTIST, "%s\n", afhi->tags.artist);
        WRITE_STATUS_ITEM(b, SI_TITLE, "%s\n", afhi->tags.title);
@@ -1743,6 +1751,8 @@ static int com_add_callback(struct afs_callback_arg *aca)
        objs[AFTCOL_AFSI].size = AFSI_SIZE;
        save_afsi(&default_afsi, &objs[AFTCOL_AFSI]);
        ret = osl(osl_add_and_get_row(audio_file_table, objs, &aft_row));
+       if (ret < 0)
+               goto out;
        ret = afs_event(AUDIO_FILE_ADD, &aca->pbout, aft_row);
 out:
        if (ret < 0)
@@ -2397,6 +2407,7 @@ static int com_setatt_callback(struct afs_callback_arg *aca)
        ) {
                char c;
                unsigned char bitnum;
+               uint64_t one = 1;
 
                len = strlen(p);
                ret = -E_ATTR_SYNTAX;
@@ -2412,9 +2423,9 @@ static int com_setatt_callback(struct afs_callback_arg *aca)
                        goto out;
                }
                if (c == '+')
-                       cad.add_mask |= (1UL << bitnum);
+                       cad.add_mask |= (one << bitnum);
                else
-                       cad.del_mask |= (1UL << bitnum);
+                       cad.del_mask |= (one << bitnum);
        }
        ret = -E_ATTR_SYNTAX;
        if (!cad.add_mask && !cad.del_mask)