summaryrefslogtreecommitdiff
path: root/apps/metadata/mp4.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-20 16:12:05 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-20 16:12:05 +0000
commita7e25a01baaa3594fa59c0c09a0fbef38428dd81 (patch)
treebed1de279f5c4bff17c4ef41f2bf6fe756d2971a /apps/metadata/mp4.c
parent85e40257dc65e3542b785898ddf60482e2d1ab0c (diff)
downloadrockbox-a7e25a01baaa3594fa59c0c09a0fbef38428dd81.tar.gz
rockbox-a7e25a01baaa3594fa59c0c09a0fbef38428dd81.zip
FS#11920: Do not overwrite already existing metadata and take into account string termination. This can save several bytes of the metadata buffer when tags have multiple entries (e.g. multiple gerne tags)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29349 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata/mp4.c')
-rw-r--r--apps/metadata/mp4.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c
index 706e621234..14aad2203c 100644
--- a/apps/metadata/mp4.c
+++ b/apps/metadata/mp4.c
@@ -117,11 +117,17 @@ static unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer,
117 117
118 if (bytes_read) 118 if (bytes_read)
119 { 119 {
120 (*buffer)[bytes_read] = 0; 120 /* Do not overwrite already available metadata. Especially when reading
121 *dest = *buffer; 121 * tags with e.g. multiple genres / artists. This way only the first
122 length = strlen(*buffer) + 1; 122 * of multiple entries is used, all following are dropped. */
123 *buffer_left -= length; 123 if (*dest == NULL)
124 *buffer += length; 124 {
125 (*buffer)[bytes_read] = 0;
126 *dest = *buffer;
127 length = strlen(*buffer) + 1;
128 *buffer_left -= length;
129 *buffer += length;
130 }
125 } 131 }
126 else 132 else
127 { 133 {