aboutsummaryrefslogtreecommitdiff
path: root/libid3tag
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-03-17 11:59:19 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-03-17 11:59:19 +0200
commite25a44d9bdc40ca8bf2efcd12ed73e2104fdb360 (patch)
treeb805996c317f299b5421d6f48c9528664da00981 /libid3tag
parenta0a067bde62b828a09f165524dc993580ac7e450 (diff)
downloadidest-e25a44d9bdc40ca8bf2efcd12ed73e2104fdb360.tar.gz
idest-e25a44d9bdc40ca8bf2efcd12ed73e2104fdb360.tar.bz2
Improve scripting, implement v1->v2 conversion, implement --delete command.
* libid3tag/file.c (v2_write): Change for make it possible to convert v1 to v2. * src/.gitignore: Add guile.x. * src/Makefile.am (idest_SOURCES): Add guile.x (BUILT_SOURCES): Add guile.x (SUFFIXES): Add .x (.c.x): New rule * src/cmdline.opt: New option: --trace. * src/guile.c: Rewrite. * src/idest.h (MODE_QUERY, MODE_MOD, MODE_DELETE): New defines (from main.c). (guile_transform, guile_list): New protos. (guile_apply): Remove. * src/idop.c (set_tags): Handle convert_version == 2. (del_tags): New function. * src/main.c (del_id3): Call del_tags
Diffstat (limited to 'libid3tag')
-rw-r--r--libid3tag/file.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libid3tag/file.c b/libid3tag/file.c
index 5ad025b..9210571 100644
--- a/libid3tag/file.c
+++ b/libid3tag/file.c
@@ -701,23 +701,23 @@ int v2_write(struct id3_file *file,
return -1;
tmp = make_temp_file(file, &tmpname);
if (!tmp)
return -1;
- rc = copy_block(file->iofile, tmp, 0, file->tags[0].location);
- if (rc == 0) {
- if (data && length)
- rc = fwrite(data, length, 1, tmp) != 1;
- else
- rc = 0;
+ if (data && length)
+ rc = fwrite(data, length, 1, tmp) != 1;
+ else
+ rc = 0;
- if (rc == 0)
- rc = copy_block(file->iofile, tmp,
- file->tags[0].location + file->tags[0].length, -1);
- }
+ if (rc == 0)
+ rc = copy_block(file->iofile, tmp,
+ /* FIXME: Should I check tag->version instead? */
+ (file->tags[0].location == 0) ?
+ file->tags[0].length : 0, -1);
+
fclose(tmp);
if (rc)
unlink(tmpname);
else {
file->tags[0].length = length;
fclose(file->iofile);

Return to:

Send suggestions and report system problems to the System administrator.