]> granicus.if.org Git - taglib/commitdiff
Avoid overwriting the audio stream when adding an ID3v1 tag to a FLAC file.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 18 Jun 2015 10:27:21 +0000 (19:27 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Mon, 3 Aug 2015 06:39:27 +0000 (15:39 +0900)
taglib/flac/flacfile.cpp

index dbf0d7674594f7a2a8a26e3051cbf56b337a627b..4d2d69e65a9614df2ffe32fa08c888e055bc8235 100644 (file)
@@ -258,8 +258,16 @@ bool FLAC::File::save()
   }
 
   if(ID3v1Tag()) {
-    seek(-128, End);
+    if(d->hasID3v1) {
+      seek(d->ID3v1Location);
+    }
+    else {
+      seek(0, End);
+      d->ID3v1Location = tell();
+    }
+
     writeBlock(ID3v1Tag()->render());
+    d->hasID3v1 = true;
   }
 
   return true;