# HG changeset patch # User yaz # Date 1171374513 28800 # Node ID 1e6d2d719876f7efc538745791e42c352891fe6b # Parent 3a1fc6f7c1876ac9e875134343eb07020867a314 [svn] - delete id3 tag feature has been added. - debug code in id3_render_paddedstring() which had prevented proper id3v1 rendering has been removed. diff -r 3a1fc6f7c187 -r 1e6d2d719876 ChangeLog --- a/ChangeLog Mon Feb 12 14:26:29 2007 -0800 +++ b/ChangeLog Tue Feb 13 05:48:33 2007 -0800 @@ -1,3 +1,11 @@ +2007-02-12 22:26:29 +0000 William Pitcock + revision [4034] + - unbreak relative path support. closes #791. + + trunk/src/audacious/main.c | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + + 2007-02-12 20:51:11 +0000 William Pitcock revision [4032] - add Catalan translation file. Closes #786. diff -r 3a1fc6f7c187 -r 1e6d2d719876 src/audacious/build_stamp.c --- a/src/audacious/build_stamp.c Mon Feb 12 14:26:29 2007 -0800 +++ b/src/audacious/build_stamp.c Tue Feb 13 05:48:33 2007 -0800 @@ -1,2 +1,2 @@ #include -const gchar *svn_stamp = "20070212-4032"; +const gchar *svn_stamp = "20070212-4034"; diff -r 3a1fc6f7c187 -r 1e6d2d719876 src/libid3tag/file.c --- a/src/libid3tag/file.c Mon Feb 12 14:26:29 2007 -0800 +++ b/src/libid3tag/file.c Tue Feb 13 05:48:33 2007 -0800 @@ -349,7 +349,6 @@ /* restore seek position */ -// if (fsetpos(file->iofile, &save_position) == -1) if (vfs_fseek(file->iofile, save_position, SEEK_SET) == -1) return -1; @@ -546,7 +545,7 @@ int v1_write(struct id3_file *file, id3_byte_t const *data, id3_length_t length) { - assert(!data || length == 128); +// assert(!data || length == 128); if (data) { long location; @@ -589,7 +588,6 @@ (length >= 0 && length < 128)) return -1; -// if (ftruncate(fileno(file->iofile), length - 128) == -1) //XXX if (vfs_truncate(file->iofile, length - 128) == -1) return -1; @@ -612,7 +610,45 @@ int v2_write(struct id3_file *file, id3_byte_t const *data, id3_length_t length) { - assert(!data || length > 0); +// assert(!data || length > 0); + + // delete tag request + if(!data && length == 0){ + int file_size; + int remainder_size; + char *remainder; + + /* read in the remainder of the file */ + vfs_fseek(file->iofile, 0, SEEK_END); + file_size = vfs_ftell(file->iofile); + remainder_size = file_size - file->tags[0].location - file->tags[0].length; + remainder = (char*)malloc(remainder_size); + + if (vfs_fseek(file->iofile, file->tags[0].location + file->tags[0].length, SEEK_SET) == -1 || + vfs_fread(remainder, remainder_size, 1, file->iofile) != 1) { + free(remainder); + return -1; + } + + /* write the remainder where the old tag was */ + if (vfs_fseek(file->iofile, file->tags[0].location, SEEK_SET) == -1 || + vfs_fwrite(remainder, remainder_size, 1, file->iofile) != 1) { + free(remainder); + return -1; + } + + free(remainder); + + /* flush the FILE */ +#ifndef AUDACIOUS + if (fflush(file->iofile) == EOF) + return -1; +#endif + /* truncate if required */ + if (vfs_ftell(file->iofile) < file_size) + vfs_truncate(file->iofile, vfs_ftell(file->iofile)); + + } // append a new id3v2 tag to the file which doesn't have any tag or only have v1tag. if(data && @@ -669,14 +705,14 @@ remainder = (char*)malloc(remainder_size); if (vfs_fseek(file->iofile, file->tags[0].location + file->tags[0].length, SEEK_SET) == -1 || vfs_fread(remainder, remainder_size, 1, file->iofile) != 1) { - free(remainder); + free(remainder); return -1; } /* write the tag where the old one was */ if (vfs_fseek(file->iofile, file->tags[0].location, SEEK_SET) == -1 || vfs_fwrite(data, length, 1, file->iofile) != 1) { - free(remainder); + free(remainder); return -1; } @@ -753,7 +789,7 @@ /* write tags */ - if (v2_write(file, id3v2, v2size) == -1 || + if (v2_write(file, id3v2, v2size) == -1 && v1_write(file, id3v1, v1size) == -1) goto fail; diff -r 3a1fc6f7c187 -r 1e6d2d719876 src/libid3tag/render.c --- a/src/libid3tag/render.c Mon Feb 12 14:26:29 2007 -0800 +++ b/src/libid3tag/render.c Tue Feb 13 05:48:33 2007 -0800 @@ -116,7 +116,7 @@ id3_length_t size; if (latin1 == 0) - latin1 = ""; + latin1 = (id3_latin1_t *)""; size = id3_latin1_size(latin1); if (!terminate) @@ -196,6 +196,5 @@ *data = 0; - return length; -// return id3_latin1_serialize(ptr, padded, 0); + return id3_latin1_serialize(ptr, padded, 0); }