Fixed C99 correctness and signed/unsigned compiler warning SDL-1.2
authorSam Lantinga
Sat, 07 Jan 2012 02:07:38 -0500
branchSDL-1.2
changeset 6170044ca54328b4
parent 6169 6f3e5ccfd585
child 6173 5619adf4736d
Fixed C99 correctness and signed/unsigned compiler warning
src/video/x11/SDL_x11video.c
     1.1 --- a/src/video/x11/SDL_x11video.c	Tue Jun 28 22:26:47 2011 +0200
     1.2 +++ b/src/video/x11/SDL_x11video.c	Sat Jan 07 02:07:38 2012 -0500
     1.3 @@ -418,21 +418,18 @@
     1.4      }
     1.5  
     1.6  	{
     1.7 +		pid_t pid = getpid();
     1.8  		char hostname[256];
     1.9  
    1.10 -		if (gethostname(hostname, sizeof(hostname)) > -1) {
    1.11 +		if (pid > 0 && gethostname(hostname, sizeof(hostname)) > -1) {
    1.12 +			Atom _NET_WM_PID = XInternAtom(SDL_Display, "_NET_WM_PID", False);
    1.13 +			Atom WM_CLIENT_MACHINE = XInternAtom(SDL_Display, "WM_CLIENT_MACHINE", False);
    1.14 +			
    1.15  			hostname[sizeof(hostname)-1] = '\0';
    1.16 -			pid_t pid = getpid();
    1.17 -
    1.18 -			if (pid > 0) {
    1.19 -				Atom _NET_WM_PID = XInternAtom(SDL_Display, "_NET_WM_PID", False);
    1.20 -				Atom WM_CLIENT_MACHINE = XInternAtom(SDL_Display, "WM_CLIENT_MACHINE", False);
    1.21 -				
    1.22 -				XChangeProperty(SDL_Display, WMwindow, _NET_WM_PID, XA_CARDINAL, 32,
    1.23 -				                PropModeReplace, (unsigned char *)&pid, 1);
    1.24 -				XChangeProperty(SDL_Display, WMwindow, WM_CLIENT_MACHINE, XA_STRING, 8,
    1.25 -				                PropModeReplace, hostname, SDL_strlen(hostname));
    1.26 -			}
    1.27 +			XChangeProperty(SDL_Display, WMwindow, _NET_WM_PID, XA_CARDINAL, 32,
    1.28 +					PropModeReplace, (unsigned char *)&pid, 1);
    1.29 +			XChangeProperty(SDL_Display, WMwindow, WM_CLIENT_MACHINE, XA_STRING, 8,
    1.30 +					PropModeReplace, (unsigned char *)hostname, SDL_strlen(hostname));
    1.31  		}
    1.32  	}
    1.33