diff options
author | waker <wakeroid@gmail.com> | 2011-05-09 22:19:11 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-05-09 22:19:32 +0200 |
commit | 1a8737e1466a3c17d77ab30e2035472feb7c2773 (patch) | |
tree | 1380a39f62c908aa0b8dc3affdaa8701b7f92e1e /junklib.c | |
parent | e5a28a916f1675ec8aca61e790ffc93c095cce4f (diff) |
don't write multiline fields in apev2 as separate fields per line
Diffstat (limited to 'junklib.c')
-rw-r--r-- | junklib.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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; } |