xfreerdp: fix build warnings

This commit is contained in:
Marc-André Moreau
2014-06-23 12:08:34 -04:00
parent c156006195
commit 95a0d96b58
2 changed files with 40 additions and 23 deletions

View File

@@ -154,9 +154,9 @@ int main(int argc, char *argv[])
fprintf(fp, "\t\t\t\t\t<para>%s</para>\n", format);
fprintf(fp, "\t\t\t\t</listitem>\n");
fprintf(fp, "\t\t\t</varlistentry>\n");
free(name);
free(format);
free(text);
free((void*) name);
free((void*) format);
free((void*) text);
}
fprintf(fp, "\t\t</variablelist>\n");
fprintf(fp, "\t</refsect1>\n");

View File

@@ -299,15 +299,16 @@ static const char *get_shm_id()
return shm_id;
}
xfWindow *xf_CreateDesktopWindow(xfContext *xfc, char *name, int width, int height, BOOL decorations)
xfWindow* xf_CreateDesktopWindow(xfContext *xfc, char *name, int width, int height, BOOL decorations)
{
xfWindow *window;
xfWindow* window;
XEvent xevent;
rdpSettings *settings;
window = (xfWindow *) malloc(sizeof(xfWindow));
ZeroMemory(window, sizeof(xfWindow));
rdpSettings* settings;
window = (xfWindow*) calloc(1, sizeof(xfWindow));
settings = xfc->instance->settings;
if(window)
if (window)
{
int input_mask;
XClassHint *class_hints;
@@ -322,48 +323,65 @@ xfWindow *xf_CreateDesktopWindow(xfContext *xfc, char *name, int width, int heig
xfc->workArea.x, xfc->workArea.y, xfc->workArea.width, xfc->workArea.height, 0, xfc->depth, InputOutput, xfc->visual,
CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
CWBorderPixel | CWWinGravity | CWBitGravity, &xfc->attribs);
window->shmid = shm_open(get_shm_id(), O_CREAT | O_EXCL | O_RDWR, S_IREAD | S_IWRITE);
if(window->shmid < 0)
if (window->shmid < 0)
{
DEBUG_X11("xf_CreateDesktopWindow: failed to get access to shared memory - shmget()\n");
}
else
{
void* mem;
ftruncate(window->shmid, sizeof(window->handle));
window->xfwin = mmap(0, sizeof(window->handle), PROT_READ | PROT_WRITE, MAP_SHARED, window->shmid, 0);
if(window->xfwin == (int *) -1)
mem = mmap(0, sizeof(window->handle), PROT_READ | PROT_WRITE, MAP_SHARED, window->shmid, 0);
if (mem == ((int*) -1))
{
DEBUG_X11("xf_CreateDesktopWindow: failed to assign pointer to the memory address - shmat()\n");
}
else
{
window->xfwin = mem;
*window->xfwin = window->handle;
}
}
class_hints = XAllocClassHint();
if(class_hints)
if (class_hints)
{
class_hints->res_name = "xfreerdp";
if(xfc->instance->settings->WmClass)
if (xfc->instance->settings->WmClass)
class_hints->res_class = xfc->instance->settings->WmClass;
else
class_hints->res_class = "xfreerdp";
XSetClassHint(xfc->display, window->handle, class_hints);
XFree(class_hints);
}
xf_ResizeDesktopWindow(xfc, window, width, height);
xf_SetWindowDecorations(xfc, window, decorations);
xf_SetWindowPID(xfc, window, 0);
input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |
PointerMotionMask | ExposureMask | PropertyChangeMask;
if(xfc->grab_keyboard)
if (xfc->grab_keyboard)
input_mask |= EnterWindowMask | LeaveWindowMask;
XChangeProperty(xfc->display, window->handle, xfc->_NET_WM_ICON, XA_CARDINAL, 32,
PropModeReplace, (BYTE *) xf_icon_prop, ARRAYSIZE(xf_icon_prop));
if(xfc->settings->ParentWindowId)
if (xfc->settings->ParentWindowId)
XReparentWindow(xfc->display, window->handle, (Window) xfc->settings->ParentWindowId, 0, 0);
XSelectInput(xfc->display, window->handle, input_mask);
XClearWindow(xfc->display, window->handle);
XMapWindow(xfc->display, window->handle);
@@ -382,15 +400,14 @@ xfWindow *xf_CreateDesktopWindow(xfContext *xfc, char *name, int width, int heig
* monitor instead of the upper-left monitor for remote app mode(which uses all monitors).
* This extra call after the window is mapped will position the login window correctly
*/
if(xfc->instance->settings->RemoteApplicationMode)
if (xfc->instance->settings->RemoteApplicationMode)
{
XMoveWindow(xfc->display, window->handle, 0, 0);
}
else
if(settings->DesktopPosX || settings->DesktopPosY)
{
XMoveWindow(xfc->display, window->handle, settings->DesktopPosX, settings->DesktopPosY);
}
else if(settings->DesktopPosX || settings->DesktopPosY)
{
XMoveWindow(xfc->display, window->handle, settings->DesktopPosX, settings->DesktopPosY);
}
}
xf_SetWindowText(xfc, window, name);
return window;
@@ -845,7 +862,7 @@ void xf_DestroyWindow(xfContext *xfc, xfWindow *window)
shm_unlink(get_shm_id());
window->xfwin = -1;
window->xfwin = (Window*) -1;
window->shmid = -1;
free(window);