]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/id3v2enc.c
x86/tx_float: Fixes compilation with old yasm
[ffmpeg] / libavformat / id3v2enc.c
index 9040501869df36546eec95dc50e315f6dd3339db..5d821ea4db247754c5fe90c47e9c3b3ea0169b7e 100644 (file)
@@ -65,11 +65,11 @@ static void id3v2_encode_string(AVIOContext *pb, const uint8_t *str,
 static int id3v2_put_ttag(ID3v2EncContext *id3, AVIOContext *avioc, const char *str1, const char *str2,
                           uint32_t tag, enum ID3v2Encoding enc)
 {
-    int len;
+    int len, ret;
     uint8_t *pb;
     AVIOContext *dyn_buf;
-    if (avio_open_dyn_buf(&dyn_buf) < 0)
-        return AVERROR(ENOMEM);
+    if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+        return ret;
 
     /* check if the strings are ASCII-only and use UTF16 only if
      * they're not */
@@ -103,7 +103,7 @@ static int id3v2_put_ttag(ID3v2EncContext *id3, AVIOContext *avioc, const char *
  */
 static int id3v2_put_priv(ID3v2EncContext *id3, AVIOContext *avioc, const char *key, const char *data)
 {
-    int len;
+    int len, ret;
     uint8_t *pb;
     AVIOContext *dyn_buf;
 
@@ -111,8 +111,8 @@ static int id3v2_put_priv(ID3v2EncContext *id3, AVIOContext *avioc, const char *
         return 0;
     }
 
-    if (avio_open_dyn_buf(&dyn_buf) < 0)
-        return AVERROR(ENOMEM);
+    if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+        return ret;
 
     // owner + null byte.
     avio_write(dyn_buf, key, strlen(key) + 1);
@@ -268,15 +268,15 @@ static int write_ctoc(AVFormatContext *s, ID3v2EncContext *id3, int enc)
     if ((ret = avio_open_dyn_buf(&dyn_bc)) < 0)
         return ret;
 
-    id3->len += avio_put_str(dyn_bc, "toc");
+    avio_put_str(dyn_bc, "toc");
     avio_w8(dyn_bc, 0x03);
     avio_w8(dyn_bc, s->nb_chapters);
     for (int i = 0; i < s->nb_chapters; i++) {
         snprintf(name, 122, "ch%d", i);
-        id3->len += avio_put_str(dyn_bc, name);
+        avio_put_str(dyn_bc, name);
     }
     len = avio_get_dyn_buf(dyn_bc, &dyn_buf);
-    id3->len += 16 + ID3v2_HEADER_SIZE;
+    id3->len += len + ID3v2_HEADER_SIZE;
 
     avio_wb32(s->pb, MKBETAG('C', 'T', 'O', 'C'));
     avio_wb32(s->pb, len);
@@ -359,7 +359,7 @@ int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
     const char  *mimetype = NULL, *desc = "";
     int enc = id3->version == 3 ? ID3v2_ENCODING_UTF16BOM :
                                   ID3v2_ENCODING_UTF8;
-    int i, len, type = 0;
+    int i, len, type = 0, ret;
 
     /* get the mimetype*/
     while (mime->id != AV_CODEC_ID_NONE) {
@@ -393,8 +393,8 @@ int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
         enc = ID3v2_ENCODING_ISO8859;
 
     /* start writing */
-    if (avio_open_dyn_buf(&dyn_buf) < 0)
-        return AVERROR(ENOMEM);
+    if ((ret = avio_open_dyn_buf(&dyn_buf)) < 0)
+        return ret;
 
     avio_w8(dyn_buf, enc);
     avio_put_str(dyn_buf, mimetype);