#! /bin/sh /usr/share/dpatch/dpatch-run ## 10_id3v1_zeropadding.dpatch by ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Use zero padding instead of space padding for ID3V1 fields ## DP: (as requested by http://id3lib.sourceforge.net/id3/id3v1.html). @DPATCH@ diff -urNad libid3tag-0.15.1b~/render.c libid3tag-0.15.1b/render.c --- libid3tag-0.15.1b~/render.c 2004-01-23 10:41:32.000000000 +0100 +++ libid3tag-0.15.1b/render.c 2009-11-08 13:41:57.570279022 +0100 @@ -198,3 +198,23 @@ return id3_latin1_serialize(ptr, padded, 0); } + +/* + * NAME: render->zeropaddedstring() + * DESCRIPTION: render a zero-padded string using latin1 encoding + */ +id3_length_t id3_render_zeropaddedstring(id3_byte_t **ptr, id3_ucs4_t const *ucs4, + id3_length_t length) +{ + id3_length_t size; + + /* latin1 encoding only (this is used for ID3v1 fields) */ + + assert(length <= 30); + + size = id3_latin1_serialize(ptr, ucs4, 0); + memset(*ptr, 0, length - size); + *ptr += length - size; + + return size; +} diff -urNad libid3tag-0.15.1b~/render.h libid3tag-0.15.1b/render.h --- libid3tag-0.15.1b~/render.h 2004-01-23 10:41:32.000000000 +0100 +++ libid3tag-0.15.1b/render.h 2009-11-08 13:42:23.162281992 +0100 @@ -36,5 +36,7 @@ id3_length_t id3_render_paddedstring(id3_byte_t **, id3_ucs4_t const *, id3_length_t); +id3_length_t id3_render_zeropaddedstring(id3_byte_t **, id3_ucs4_t const *, + id3_length_t); # endif diff -urNad libid3tag-0.15.1b~/tag.c libid3tag-0.15.1b/tag.c --- libid3tag-0.15.1b~/tag.c 2004-02-17 03:04:10.000000000 +0100 +++ libid3tag-0.15.1b/tag.c 2009-11-08 13:43:02.646282262 +0100 @@ -685,7 +685,7 @@ string = id3_field_getstrings(&frame->fields[1], 0); } - id3_render_paddedstring(buffer, string, length); + id3_render_zeropaddedstring(buffer, string, length); } /*