[Spice-devel] [PATCH spice-server 04/33] Avoids %m in formatting for Windows

Marc-André Lureau marcandre.lureau at gmail.com
Sat Dec 22 10:11:07 UTC 2018


On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio <fziglio at redhat.com> wrote:
>
> Not supported.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> --
> TODO find a better solution

May be unnecessary with __USE_MINGW_ANSI_STDIO (to check)


> ---
>  server/reds.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/server/reds.c b/server/reds.c
> index aa3f8ca7..2874bd4c 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -3582,7 +3582,14 @@ static const char* parse_next_video_codec(const char *codecs, char **encoder,
>      }
>      int n;
>      *encoder = *codec = NULL;
> +#ifndef _WIN32
>      if (sscanf(codecs, "%m[0-9a-zA-Z_]:%m[0-9a-zA-Z_]%n", encoder, codec, &n) == 2) {
> +#else
> +    char encoder_buf[130], codec_buf[130];
> +    if (sscanf(codecs, "%128[0-9a-zA-Z_]:%128[0-9a-zA-Z_]%n", encoder_buf, codec_buf, &n) == 2) {
> +        *encoder = strdup(encoder_buf);
> +        *codec = strdup(codec_buf);
> +#endif
>          // this avoids accepting "encoder:codec" followed by garbage like "$%*"
>          if (codecs[n] != ';' && codecs[n] != '\0') {
>              free(*codec);
> --
> 2.17.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



--
Marc-André Lureau


More information about the Spice-devel mailing list