Re: [PATCH spice-gtk v2 2/4] Avoid warning about snprintf on non-Linux platforms

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

 



> On 16 May 2017, at 15:00, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
> 
> On Thu, May 11, 2017 at 12:47:06PM +0200, Christophe de Dinechin wrote:
>> From: Christophe de Dinechin <dinechin@xxxxxxxxxx>
>> 
>> Without #include <stdio.h>, calls to snprintf in the file
>> cause a warning. The file <unistd.h> is left aside on purpose,
>> since src/usbutil.c may be compiled on Windows where this
>> file does not exist.
> 
> I'd just switch to g_snprintf.

This may be useful too. But what the macOS build exposed is that the #if linux is at the wrong place anyway. IMO, it would be even better to turn the problem backwards. If Windows has issues with specific headers, we should #if on windows, not linux.

Christophe

> 
> Christophe
> 
>> 
>> Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx>
>> ---
>> src/usbutil.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/src/usbutil.c b/src/usbutil.c
>> index b68a2e1..e96ab11 100644
>> --- a/src/usbutil.c
>> +++ b/src/usbutil.c
>> @@ -27,8 +27,8 @@
>> #include <stdlib.h>
>> 
>> #ifdef USE_USBREDIR
>> -#ifdef __linux__
>> #include <stdio.h>
>> +#ifdef __linux__
>> #include <unistd.h>
>> #include <sys/sysmacros.h>
>> #ifndef major /* major and minor macros were moved to sys/sysmacros.h from sys/types.h */
>> -- 
>> 2.11.0 (Apple Git-81)
>> 
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
>> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

_______________________________________________
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]