summaryrefslogtreecommitdiff
path: root/junklib.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-05-09 22:19:11 +0200
committerGravatar waker <wakeroid@gmail.com>2011-05-09 22:19:32 +0200
commit1a8737e1466a3c17d77ab30e2035472feb7c2773 (patch)
tree1380a39f62c908aa0b8dc3affdaa8701b7f92e1e /junklib.c
parente5a28a916f1675ec8aca61e790ffc93c095cce4f (diff)
don't write multiline fields in apev2 as separate fields per line
Diffstat (limited to 'junklib.c')
-rw-r--r--junklib.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/junklib.c b/junklib.c
index 5ee58edb..086cc44e 100644
--- a/junklib.c
+++ b/junklib.c
@@ -2379,6 +2379,7 @@ junk_apev2_add_text_frame (DB_apev2_tag_t *tag, const char *frame_id, const char
tail = tail->next;
}
+#if 0 // this will split every line into separate field
const char *next = value;
while (*value) {
while (*next && *next != '\n') {
@@ -2417,6 +2418,26 @@ junk_apev2_add_text_frame (DB_apev2_tag_t *tag, const char *frame_id, const char
value = next;
}
+#endif
+ size_t size = strlen (value);
+ DB_apev2_frame_t *f = malloc (sizeof (DB_apev2_frame_t) + size);
+ if (!f) {
+ trace ("junk_apev2_add_text_frame: failed to allocate %d bytes\n", size);
+ return NULL;
+ }
+ memset (f, 0, sizeof (DB_apev2_frame_t));
+ f->flags = 0;
+ strcpy (f->key, frame_id);
+ f->size = size;
+ memcpy (f->data, value, size);
+
+ if (tail) {
+ tail->next = f;
+ }
+ else {
+ tag->frames = f;
+ }
+ tail = f;
return tail;
}