[FFmpeg-devel] [PATCH 1/5] lavu/bprint: reorder cases to match enum order

Rodger Combs rodger.combs at gmail.com
Wed Apr 12 10:00:40 EEST 2017


---
 libavutil/bprint.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 2f059c5ba6..652775bef9 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -271,19 +271,8 @@ void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_cha
         mode = AV_ESCAPE_MODE_BACKSLASH; /* TODO: implement a heuristic */
 
     switch (mode) {
-    case AV_ESCAPE_MODE_QUOTE:
-        /* enclose the string between '' */
-        av_bprint_chars(dstbuf, '\'', 1);
-        for (; *src; src++) {
-            if (*src == '\'')
-                av_bprintf(dstbuf, "'\\''");
-            else
-                av_bprint_chars(dstbuf, *src, 1);
-        }
-        av_bprint_chars(dstbuf, '\'', 1);
-        break;
-
     /* case AV_ESCAPE_MODE_BACKSLASH or unknown mode */
+    case AV_ESCAPE_MODE_BACKSLASH:
     default:
         /* \-escape characters */
         for (; *src; src++) {
@@ -301,5 +290,17 @@ void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_cha
             av_bprint_chars(dstbuf, *src, 1);
         }
         break;
+
+    case AV_ESCAPE_MODE_QUOTE:
+        /* enclose the string between '' */
+        av_bprint_chars(dstbuf, '\'', 1);
+        for (; *src; src++) {
+            if (*src == '\'')
+                av_bprintf(dstbuf, "'\\''");
+            else
+                av_bprint_chars(dstbuf, *src, 1);
+        }
+        av_bprint_chars(dstbuf, '\'', 1);
+        break;
     }
 }
-- 
2.11.1



More information about the ffmpeg-devel mailing list