diff mbox series

[FFmpeg-devel] ffprobe: use quotation marks in the xml header output

Message ID 20210714145723.1104-1-jamrial@gmail.com
State Accepted
Commit 022e50c002e23d4f370ea38802e78b0d2247c874
Headers show
Series [FFmpeg-devel] ffprobe: use quotation marks in the xml header output | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer July 14, 2021, 2:57 p.m. UTC
xmllint (silently) replaces the ' with " when fixing and validating the output
of ffprobe in fate-ffprobe_xsd.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 fftools/ffprobe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Tobias Rapp July 15, 2021, 3:38 p.m. UTC | #1
On 14.07.2021 16:57, James Almer wrote:
> xmllint (silently) replaces the ' with " when fixing and validating the output
> of ffprobe in fate-ffprobe_xsd.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   fftools/ffprobe.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 2d452c212e..94c73fd32c 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -1682,9 +1682,9 @@ static void xml_print_section_header(WriterContext *wctx)
>           wctx->section[wctx->level-1] : NULL;
>   
>       if (wctx->level == 0) {
> -        const char *qual = " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
> -            "xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' "
> -            "xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'";
> +        const char *qual = " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
> +            "xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
> +            "xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
>   
>           printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
>           printf("<%sffprobe%s>\n",
> 

Both, single and double quotes are technically valid for XML attributes. 
But I agree that it is better to use double quotes here as they are used 
for attributes throughout the ffprobe XML writer.

Regards,
Tobias
diff mbox series

Patch

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 2d452c212e..94c73fd32c 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -1682,9 +1682,9 @@  static void xml_print_section_header(WriterContext *wctx)
         wctx->section[wctx->level-1] : NULL;
 
     if (wctx->level == 0) {
-        const char *qual = " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
-            "xmlns:ffprobe='http://www.ffmpeg.org/schema/ffprobe' "
-            "xsi:schemaLocation='http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd'";
+        const char *qual = " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+            "xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
+            "xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
 
         printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
         printf("<%sffprobe%s>\n",