char *att_text;
int ret;
- ret = WRITE_STATUS_ITEM(b, SI_ATTRIBUTES_BITMAP, "%s\n", att_bitmap);
- if (ret < 0)
- return ret;
+ WRITE_STATUS_ITEM(b, SI_ATTRIBUTES_BITMAP, "%s\n", att_bitmap);
ret = get_attribute_text(&afsi->attributes, " ", &att_text);
if (ret < 0)
return ret;
- ret = WRITE_STATUS_ITEM(b, SI_ATTRIBUTES_TXT, "%s\n", att_text);
+ WRITE_STATUS_ITEM(b, SI_ATTRIBUTES_TXT, "%s\n", att_text);
free(att_text);
return ret;
}
-static int write_lyrics_items(struct para_buffer *b, struct afs_info *afsi)
+static void write_lyrics_items(struct para_buffer *b, struct afs_info *afsi)
{
char *lyrics_name;
- int ret;
- ret = WRITE_STATUS_ITEM(b, SI_LYRICS_ID, "%u\n", afsi->lyrics_id);
- if (ret < 0)
- return ret;
+ WRITE_STATUS_ITEM(b, SI_LYRICS_ID, "%u\n", afsi->lyrics_id);
lyr_get_name_by_id(afsi->lyrics_id, &lyrics_name);
- return WRITE_STATUS_ITEM(b, SI_LYRICS_NAME, "%s\n", lyrics_name?
+ WRITE_STATUS_ITEM(b, SI_LYRICS_NAME, "%s\n", lyrics_name?
lyrics_name : "(none)");
}
-static int write_image_items(struct para_buffer *b, struct afs_info *afsi)
+static void write_image_items(struct para_buffer *b, struct afs_info *afsi)
{
char *image_name;
- int ret;
- ret = WRITE_STATUS_ITEM(b, SI_IMAGE_ID, "%u\n", afsi->image_id);
- if (ret < 0)
- return ret;
+ WRITE_STATUS_ITEM(b, SI_IMAGE_ID, "%u\n", afsi->image_id);
img_get_name_by_id(afsi->image_id, &image_name);
- return WRITE_STATUS_ITEM(b, SI_IMAGE_NAME, "%s\n", image_name?
+ WRITE_STATUS_ITEM(b, SI_IMAGE_NAME, "%s\n", image_name?
image_name : "(none)");
}
-static int write_filename_items(struct para_buffer *b, const char *path,
+static void write_filename_items(struct para_buffer *b, const char *path,
unsigned flags)
{
char *val;
- int ret;
- if (!(flags & LS_FLAG_FULL_PATH))
- return WRITE_STATUS_ITEM(b, SI_BASENAME, "%s\n", path);
- ret = WRITE_STATUS_ITEM(b, SI_PATH, "%s\n", path);
- if (ret < 0)
- return ret;
+ if (!(flags & LS_FLAG_FULL_PATH)) {
+ WRITE_STATUS_ITEM(b, SI_BASENAME, "%s\n", path);
+ return;
+ }
+ WRITE_STATUS_ITEM(b, SI_PATH, "%s\n", path);
val = para_basename(path);
- ret = WRITE_STATUS_ITEM(b, SI_BASENAME, "%s\n", val? val : "");
- if (ret < 0)
- return ret;
+ WRITE_STATUS_ITEM(b, SI_BASENAME, "%s\n", val? val : "");
val = para_dirname(path);
- ret = WRITE_STATUS_ITEM(b, SI_DIRECTORY, "%s\n", val? val : "");
+ WRITE_STATUS_ITEM(b, SI_DIRECTORY, "%s\n", val? val : "");
free(val);
- return ret;
}
static int print_chunk_table(struct ls_data *d, struct para_buffer *b)
return ret;
}
-static int write_score(struct para_buffer *b, struct ls_data *d,
+static void write_score(struct para_buffer *b, struct ls_data *d,
struct ls_options *opts)
{
if (!(opts->flags & LS_FLAG_ADMISSIBLE_ONLY)) /* no score*/
- return 0;
- return WRITE_STATUS_ITEM(b, SI_SCORE, "%li\n", d->score);
+ return;
+ WRITE_STATUS_ITEM(b, SI_SCORE, "%li\n", d->score);
}
static int print_list_item(struct ls_data *d, struct ls_options *opts,
last_played_time,
bn? bn : "?");
}
- ret = write_filename_items(b, d->path, opts->flags);
- if (ret < 0)
- goto out;
- ret = write_score(b, d, opts);
- if (ret < 0)
- goto out;
+ write_filename_items(b, d->path, opts->flags);
+ write_score(b, d, opts);
ret = write_attribute_items(b, att_buf, afsi);
if (ret < 0)
goto out;
- ret = write_image_items(b, afsi);
- if (ret < 0)
- goto out;
- ret = write_lyrics_items(b, afsi);
- if (ret < 0)
- goto out;
+ write_image_items(b, afsi);
+ write_lyrics_items(b, afsi);
hash_to_asc(d->hash, asc_hash);
- ret = WRITE_STATUS_ITEM(b, SI_HASH, "%s\n", asc_hash);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_BITRATE, "%dkbit/s\n", afhi->bitrate);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_FORMAT, "%s\n",
+ WRITE_STATUS_ITEM(b, SI_HASH, "%s\n", asc_hash);
+ WRITE_STATUS_ITEM(b, SI_BITRATE, "%dkbit/s\n", afhi->bitrate);
+ WRITE_STATUS_ITEM(b, SI_FORMAT, "%s\n",
audio_format_name(afsi->audio_format_id));
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_FREQUENCY, "%dHz\n", afhi->frequency);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_CHANNELS, "%d\n", afhi->channels);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_DURATION, "%s\n", duration_buf);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_SECONDS_TOTAL, "%lu\n",
- afhi->seconds_total);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_LAST_PLAYED, "%s\n", last_played_time);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_NUM_PLAYED, "%d\n", afsi->num_played);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_AMPLIFICATION, "%u\n", afsi->amp);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_CHUNK_TIME, "%lu\n",
- tv2ms(&afhi->chunk_tv));
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_NUM_CHUNKS, "%lu\n",
- afhi->chunks_total);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_TECHINFO, "%s\n", afhi->techinfo);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_ARTIST, "%s\n", afhi->tags.artist);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_TITLE, "%s\n", afhi->tags.title);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_YEAR, "%s\n", afhi->tags.year);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_ALBUM, "%s\n", afhi->tags.album);
- if (ret < 0)
- goto out;
- ret = WRITE_STATUS_ITEM(b, SI_COMMENT, "%s\n", afhi->tags.comment);
- if (ret < 0)
- goto out;
+ 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_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_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);
+ WRITE_STATUS_ITEM(b, SI_YEAR, "%s\n", afhi->tags.year);
+ WRITE_STATUS_ITEM(b, SI_ALBUM, "%s\n", afhi->tags.album);
+ WRITE_STATUS_ITEM(b, SI_COMMENT, "%s\n", afhi->tags.comment);
if (opts->mode == LS_MODE_MBOX) {
struct osl_object lyrics_def;
lyr_get_def_by_id(afsi->lyrics_id, &lyrics_def);
ret = strftime(mtime_str, 29, "%b %d %Y", &mtime_tm);
assert(ret > 0); /* number of bytes placed in mtime_str */
out:
- /* We don't care too much about errors here */
- (void)WRITE_STATUS_ITEM(pb, SI_MTIME, "%s\n", mtime_str);
- (void)WRITE_STATUS_ITEM(pb, SI_FILE_SIZE, "%ld\n", statbuf.st_size / 1024);
+ WRITE_STATUS_ITEM(pb, SI_MTIME, "%s\n", mtime_str);
+ WRITE_STATUS_ITEM(pb, SI_FILE_SIZE, "%ld\n", statbuf.st_size / 1024);
}
static int make_status_items(void)