From 4ebc2dcfb071e0c0b85e2be49c3e233a91712e9c Mon Sep 17 00:00:00 2001 From: Alexey Shilov Date: Thu, 10 Mar 2011 15:17:07 +0200 Subject: [PATCH] Changes: removed compilation warnings RevBy: Pertti Kellomaki --- debian/changelog | 1 + src/launcherlib/booster.cpp | 104 ++++++++++++++++++------------------ 2 files changed, 54 insertions(+), 51 deletions(-) diff --git a/debian/changelog b/debian/changelog index 59aa2b6..1bf112e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ applauncherd (0.23.0) unstable; urgency=low * Changes: Removed extra prctl(PR_SET_DUMPABLE, ...) * Changes: e-booster refactoring + * Changes: removed compilation warnings -- Alexey Shilov Thu, 10 Mar 2011 14:52:40 +0200 diff --git a/src/launcherlib/booster.cpp b/src/launcherlib/booster.cpp index cf1ca2a..fe897d1 100644 --- a/src/launcherlib/booster.cpp +++ b/src/launcherlib/booster.cpp @@ -308,59 +308,61 @@ void Booster::requestSplash(const int pid, const std::string &wmclass, const std::string &pixmapId) { std::stringstream st; - st << getpid(); + st << pid; std::string pidStr = st.str(); Display * dpy = XOpenDisplay(NULL); - if (dpy) { - const char *compositorWindowIdProperty = "_NET_SUPPORTING_WM_CHECK"; - Atom compositorWindowIdAtom = XInternAtom(dpy, compositorWindowIdProperty, False); - Atom type; - int format; - unsigned long nItems; - unsigned long bytesAfter; - unsigned char *prop = 0; - - // Get the compositor window id - Window rootWin = XDefaultRootWindow(dpy); - int retval = XGetWindowProperty(dpy, rootWin, compositorWindowIdAtom, - 0, 0x7fffffff, False, XA_WINDOW, - &type, &format, &nItems, &bytesAfter, &prop); - if(retval == Success) { - - // Package up the data and set the property - int len = pidStr.length() + 1 - + wmclass.length() + 1 - + portraitSplash.length() + 1 - + landscapeSplash.length() + 1 - + pixmapId.length() + 1; - char *data = new char[len]; - char *d = data; - - strcpy(d, pidStr.c_str()); - d = d + pidStr.length() + 1; - strcpy(d, wmclass.c_str()); - d = d + wmclass.length() + 1; - strcpy(d, portraitSplash.c_str()); - d = d + portraitSplash.length() + 1; - strcpy(d, landscapeSplash.c_str()); - d = d + landscapeSplash.length() + 1; - strcpy(d, pixmapId.c_str()); - - Window compositorWindow = *reinterpret_cast(prop); - const char* splashProperty = "_MEEGO_SPLASH_SCREEN"; - Atom splashPropertyAtom = XInternAtom(dpy, splashProperty, False); - Atom stringAtom = XInternAtom(dpy, "STRING", False); - - XChangeProperty(dpy, compositorWindow, splashPropertyAtom, stringAtom, - 8, PropModeReplace, (unsigned char *)data, - len); - - // Without flushing, the change seems to loiter in X's queue - XFlush(dpy); - delete[] data; - XFree(prop); - } + if (dpy) + { + const char *compositorWindowIdProperty = "_NET_SUPPORTING_WM_CHECK"; + Atom compositorWindowIdAtom = XInternAtom(dpy, compositorWindowIdProperty, False); + Atom type; + int format; + unsigned long nItems; + unsigned long bytesAfter; + unsigned char *prop = 0; + + // Get the compositor window id + Window rootWin = XDefaultRootWindow(dpy); + int retval = XGetWindowProperty(dpy, rootWin, compositorWindowIdAtom, + 0, 0x7fffffff, False, XA_WINDOW, + &type, &format, &nItems, &bytesAfter, &prop); + if (retval == Success) + { + + // Package up the data and set the property + int len = pidStr.length() + 1 + + wmclass.length() + 1 + + portraitSplash.length() + 1 + + landscapeSplash.length() + 1 + + pixmapId.length() + 1; + char *data = new char[len]; + char *d = data; + + strcpy(d, pidStr.c_str()); + d = d + pidStr.length() + 1; + strcpy(d, wmclass.c_str()); + d = d + wmclass.length() + 1; + strcpy(d, portraitSplash.c_str()); + d = d + portraitSplash.length() + 1; + strcpy(d, landscapeSplash.c_str()); + d = d + landscapeSplash.length() + 1; + strcpy(d, pixmapId.c_str()); + + Window compositorWindow = *reinterpret_cast(prop); + const char* splashProperty = "_MEEGO_SPLASH_SCREEN"; + Atom splashPropertyAtom = XInternAtom(dpy, splashProperty, False); + Atom stringAtom = XInternAtom(dpy, "STRING", False); + + XChangeProperty(dpy, compositorWindow, splashPropertyAtom, stringAtom, + 8, PropModeReplace, (unsigned char *)data, + len); + + // Without flushing, the change seems to loiter in X's queue + XFlush(dpy); + delete[] data; + XFree(prop); + } } } @@ -431,7 +433,7 @@ void Booster::setEnvironmentBeforeLaunch() } // Load the application and find out the address of main() - void* handle = loadMain(); + loadMain(); // Make sure that boosted application can dump core. This must be // done after set[ug]id().