]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/avstring.c
avcodec/zmbvenc: Simplify setting keyframe flag
[ffmpeg] / libavutil / avstring.c
index e33d4aac5199d6e13c5674f26026c3e727faf02c..49e8df55aa3bc24d58bccd3c54556114855b4f31 100644 (file)
@@ -336,17 +336,18 @@ int av_escape(char **dst, const char *src, const char *special_chars,
               enum AVEscapeMode mode, int flags)
 {
     AVBPrint dstbuf;
+    int ret;
 
-    av_bprint_init(&dstbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
+    av_bprint_init(&dstbuf, 1, INT_MAX); /* (int)dstbuf.len must be >= 0 */
     av_bprint_escape(&dstbuf, src, special_chars, mode, flags);
 
     if (!av_bprint_is_complete(&dstbuf)) {
         av_bprint_finalize(&dstbuf, NULL);
         return AVERROR(ENOMEM);
-    } else {
-        av_bprint_finalize(&dstbuf, dst);
-        return dstbuf.len;
     }
+    if ((ret = av_bprint_finalize(&dstbuf, dst)) < 0)
+        return ret;
+    return dstbuf.len;
 }
 
 int av_match_name(const char *name, const char *names)