summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/metadata.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/apps/metadata.c b/apps/metadata.c
index 4e4ffb6ad2..1680fd760b 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -379,40 +379,33 @@ void strip_tags(int handle_id)
379#endif /* CONFIG_CODEC == SWCODEC */ 379#endif /* CONFIG_CODEC == SWCODEC */
380#endif /* ! __PCTOOL__ */ 380#endif /* ! __PCTOOL__ */
381 381
382#define MOVE_ENTRY(x) if (x) x += offset;
383
382void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig) 384void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig)
383{ 385{
384 long offset; 386 long offset;
385 if (orig > dest) 387 if (orig > dest)
386 offset = - ((size_t)orig - (size_t)dest); 388 offset = -((size_t)orig - (size_t)dest);
387 else 389 else
388 offset = (size_t)dest - (size_t)orig; 390 offset = ((size_t)dest - (size_t)orig);
389 391
390 if (entry->title) 392 MOVE_ENTRY(entry->title)
391 entry->title += offset; 393 MOVE_ENTRY(entry->artist)
392 if (entry->artist) 394 MOVE_ENTRY(entry->album)
393 entry->artist += offset; 395
394 if (entry->album) 396 if (entry->genre_string > (char*)orig &&
395 entry->album += offset; 397 entry->genre_string < (char*)orig + sizeof(struct mp3entry))
396 if (entry->genre_string > (char*)orig
397 && entry->genre_string < (char*)orig + sizeof(struct mp3entry))
398 /* Don't adjust that if it points to an entry of the "genres" array */ 398 /* Don't adjust that if it points to an entry of the "genres" array */
399 entry->genre_string += offset; 399 entry->genre_string += offset;
400 if (entry->track_string) 400
401 entry->track_string += offset; 401 MOVE_ENTRY(entry->track_string)
402 if (entry->disc_string) 402 MOVE_ENTRY(entry->disc_string)
403 entry->disc_string += offset; 403 MOVE_ENTRY(entry->year_string)
404 if (entry->year_string) 404 MOVE_ENTRY(entry->composer)
405 entry->year_string += offset; 405 MOVE_ENTRY(entry->comment)
406 if (entry->composer) 406 MOVE_ENTRY(entry->albumartist)
407 entry->composer += offset; 407 MOVE_ENTRY(entry->grouping)
408 if (entry->comment) 408 MOVE_ENTRY(entry->mb_track_id)
409 entry->comment += offset;
410 if (entry->albumartist)
411 entry->albumartist += offset;
412 if (entry->grouping)
413 entry->grouping += offset;
414 if (entry->mb_track_id)
415 entry->mb_track_id += offset;
416} 409}
417 410
418void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig) 411void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig)