From 1a8737e1466a3c17d77ab30e2035472feb7c2773 Mon Sep 17 00:00:00 2001 From: waker Date: Mon, 9 May 2011 22:19:11 +0200 Subject: don't write multiline fields in apev2 as separate fields per line --- junklib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'junklib.c') 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; } -- cgit v1.2.3