Re: [vdagent-win PATCH] fix format string for Visual Studio

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

 



On Mon, Jul 24, 2017 at 11:44:25AM -0400, Frediano Ziglio wrote:
> > 
> > The "z" size specifier is not supported by Visual Studio.
> > Use "I" if Visual Studio is detected.
> > 
> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > ---
> >  vdagent/desktop_layout.cpp | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
> > index 11ad009..3272be5 100644
> > --- a/vdagent/desktop_layout.cpp
> > +++ b/vdagent/desktop_layout.cpp
> > @@ -17,6 +17,16 @@
> >  
> >  #include <spice/qxl_windows.h>
> >  #include <spice/qxl_dev.h>
> > +
> > +#define __STDC_FORMAT_MACROS
> > +#define __USE_MINGW_ANSI_STDIO 1
> > +
> > +#ifdef _MSC_VER // compiling with Visual Studio
> > +#define PRIuPTR "Iu"
> > +#else // compiling with mingw
> > +#include <inttypes.h>
> > +#endif // compiler specific definitions
> > +
> >  #include "desktop_layout.h"
> >  #include "display_configuration.h"
> >  #include "vdlog.h"
> > @@ -147,7 +157,7 @@ void DesktopLayout::set_displays()
> >              break;
> >          }
> >          if (display_id >= _displays.size()) {
> > -            vd_printf("display_id %lu out of range, #displays %zu" ,
> > display_id, _displays.size());
> > +            vd_printf("display_id %lu out of range, #displays %" PRIuPTR ,
> > display_id, _displays.size());
> >              break;
> >          }
> >          DisplayMode * mode(_displays.at(display_id));
> 
> Another smaller solution would be to use %lu and case to unsigned long,
> I hardly think we can have a bigger array that need the size to be >32 bit.

yup, probably easier.

Christophe

Attachment: signature.asc
Description: PGP signature

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

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