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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

On Sat, Dec 22, 2018 at 5:49 PM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
>
> >
> > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> > >
> > > Not supported.
> > >
> > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > > --
> > > TODO find a better solution
> >
> > May be unnecessary with __USE_MINGW_ANSI_STDIO (to check)
> >
>
> Not sure but this surely would limit the compiler(s?) to MingW only.

Probably, I don't care much about other compilers. I don't think you
can compile qemu for windows without mingw either, fwiw

In any case, if you adopt this patch, it should run the same code
instead of 2 code paths.

>
> >
> > > ---
> > >  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);
>
> Frediano



-- 
Marc-André Lureau
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]