@@ -791,28 +804,37 @@
tracks = (struct track_data*)(track_names + borrowed);
while (rb->tagcache_get_next(&tcs))
{
+ int len = 0, fn_off = 0;
+
avail -= sizeof(struct track_data);
track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1;
disc_num = rb->tagcache_get_numeric(&tcs, tag_discnumber);
- int len = 0;
+
if (disc_num < 0)
disc_num = 0;
retry:
if (track_num >= 0)
{
if (disc_num)
- len = 1 + rb->snprintf(track_names + string_index , avail,
- "%d.%02d: %s", disc_num, track_num + 1, tcs.result);
+ fn_off = 1 + rb->snprintf(track_names + string_index , avail,
+ "%d.%02d: %s", disc_num, track_num + 1, tcs.result);
else
- len = 1 + rb->snprintf(track_names + string_index , avail,
- "%d: %s", track_num + 1, tcs.result);
+ fn_off = 1 + rb->snprintf(track_names + string_index , avail,
+ "%d: %s", track_num + 1, tcs.result);
}
else
{
track_num = 0;
- len = tcs.result_len;
- rb->strncpy(track_names + string_index, tcs.result, avail);
+ fn_off = 1 + rb->snprintf(track_names + string_index, avail,
+ "%s", tcs.result);
}
+ rb->tagcache_retrieve(&tcs, tcs.idx_id, tag_filename,
+ track_names + string_index + fn_off, avail);
+ len = fn_off + rb->strlen(track_names + string_index + fn_off) + 1;
+ /* make sure track name and file name are really split by a \0, else
+ * get_track_name might fail */
+ *(track_names + string_index + fn_off -1) = '\0';
+
if (len > avail)
{
while (len > avail)