LayerManagement: fixed several compiler warnings
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Wed, 9 May 2012 12:17:50 +0000 (14:17 +0200)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Wed, 9 May 2012 12:17:50 +0000 (14:17 +0200)
fixed trivial compiler warnings without changing behaviour.
removed mostly unsed vars.

LayerManagerExamples/EGLX11ApplicationExample/src/egl_helper.cpp
LayerManagerExamples/EGLX11MockNavigation/src/OpenGLES2App.cpp
LayerManagerPlugins/Communicators/DBUSCommunicator/src/DBUSCommunicator.cpp
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h
LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp
LayerManagerPlugins/Renderers/Platform/X11GLESRenderer/src/X11GLESRenderer.cpp
LayerManagerUtils/src/Log.cpp

index fba9ebe..a29b91b 100644 (file)
@@ -125,11 +125,9 @@ t_ilm_bool createX11Context(t_ilm_int width, t_ilm_int height)
 
 t_ilm_bool createEGLContext(t_ilm_int width, t_ilm_int height)
 {
-    t_ilm_bool result = ILM_TRUE;
     g_eglContextStruct.eglDisplay = NULL;
     g_eglContextStruct.eglSurface = NULL;
     g_eglContextStruct.eglContext = NULL;
-    ilmErrorTypes error = ILM_FAILED;
 
     g_eglContextStruct.eglDisplay = eglGetDisplay((EGLNativeDisplayType) g_x11ContextStruct.x11Display); // TODO: remove all C style casts in C++ code; use C++ casts
     EGLint eglstatus = eglGetError();
@@ -194,39 +192,27 @@ t_ilm_bool createEGLContext(t_ilm_int width, t_ilm_int height)
     t_ilm_layer layerid = (t_ilm_layer)LAYER_EXAMPLE_GLES_APPLICATIONS;
     t_ilm_surface surfaceid = (t_ilm_surface)SURFACE_EXAMPLE_EGLX11_APPLICATION;
 
-    // TODO: if (error == ILM_FAILED) return ILM_FALSE;
-
     printf("create a surface %lu\n", (t_ilm_nativehandle) g_x11ContextStruct.x11Window);
-    error = ilm_surfaceCreate( (t_ilm_nativehandle) g_x11ContextStruct.x11Window, width, height,
+    ilm_surfaceCreate( (t_ilm_nativehandle) g_x11ContextStruct.x11Window, width, height,
             ILM_PIXELFORMAT_RGBA_8888, &surfaceid);
 
-    // TODO: if (error == ILM_FAILED) return ILM_FALSE;
-
     printf("set surface dest region\n");
-    error = ilm_surfaceSetDestinationRectangle(surfaceid, 0, 0, width, height);
-
-    // TODO: if (error == ILM_FAILED) return ILM_FALSE;
+    ilm_surfaceSetDestinationRectangle(surfaceid, 0, 0, width, height);
 
     printf("set surface src region\n");
-    error = ilm_surfaceSetSourceRectangle(surfaceid, 0, 0, width, height);
-
-    // TODO: if (error == ILM_FAILED) return ILM_FALSE;
+    ilm_surfaceSetSourceRectangle(surfaceid, 0, 0, width, height);
 
     printf("add surface to layer\n");
-    error = ilm_layerAddSurface(layerid, surfaceid);
+    ilm_layerAddSurface(layerid, surfaceid);
+
     printf("Set surface visible\n");
-    error = ilm_surfaceSetVisibility(surfaceid, ILM_TRUE);
-    printf("Set surface opacity\n");
-    error = ilm_surfaceSetOpacity(surfaceid, 0.75f);
+    ilm_surfaceSetVisibility(surfaceid, ILM_TRUE);
 
-    //if (error == ILM_FAILED) return ILM_FALSE;
+    printf("Set surface opacity\n");
+    ilm_surfaceSetOpacity(surfaceid, 0.75f);
 
     printf("commit\n");
-    error = ilm_commitChanges();
-
-    //if (error == ILM_FAILED) return ILM_FALSE;
-
-    return result;
+    return (ILM_SUCCESS == ilm_commitChanges()) ? ILM_TRUE : ILM_FALSE;
 }
 
 void destroyEglContext()
index b2a674f..a1beb86 100644 (file)
@@ -244,8 +244,6 @@ bool OpenGLES2App::createEGLContext()
 
 bool OpenGLES2App::setupLayerMangement(SurfaceConfiguration* config)
 {
-    ilmErrorTypes error = ILM_FAILED;
-
     // register surfaces to layermanager
     t_ilm_layer layerid = (t_ilm_layer)config->layerId;//LAYER_EXAMPLE_GLES_APPLICATIONS;
     t_ilm_surface surfaceid = (t_ilm_surface)config->surfaceId;//SURFACE_EXAMPLE_EGLX11_APPLICATION;
@@ -253,28 +251,26 @@ bool OpenGLES2App::setupLayerMangement(SurfaceConfiguration* config)
     int height = config->surfaceHeight;
 
     cout << "creating surface " << surfaceid << "\n";
-    error = ilm_surfaceCreate( (t_ilm_nativehandle) m_x11ContextStruct.x11Window, width, height,
+    ilm_surfaceCreate( (t_ilm_nativehandle) m_x11ContextStruct.x11Window, width, height,
             ILM_PIXELFORMAT_RGBA_8888, &surfaceid);
 
     cout << "set surface " << surfaceid << " dest region " << 0 << ", " << 0 << ", " << width << ", " << height << "\n";
-    error = ilm_surfaceSetDestinationRectangle(surfaceid, 0, 0, width, height);
+    ilm_surfaceSetDestinationRectangle(surfaceid, 0, 0, width, height);
 
     cout << "set surface " << surfaceid << " src region " << 0 << ", " << 0 << ", " << width << ", " << height << "\n";
-    error = ilm_surfaceSetSourceRectangle(surfaceid, 0, 0, width, height);
+    ilm_surfaceSetSourceRectangle(surfaceid, 0, 0, width, height);
 
     cout << "Set surface " << surfaceid << " visible\n";
-    error = ilm_surfaceSetVisibility(surfaceid, ILM_TRUE);
+    ilm_surfaceSetVisibility(surfaceid, ILM_TRUE);
 
     cout << "Set surface " << surfaceid << " opacity 1.0\n";
-    error = ilm_surfaceSetOpacity(surfaceid, 1.0f);
+    ilm_surfaceSetOpacity(surfaceid, 1.0f);
 
     cout << "add surface " << surfaceid << " to layer " << layerid << "\n";
-    error = ilm_layerAddSurface(layerid, surfaceid);
+    ilm_layerAddSurface(layerid, surfaceid);
 
     cout << "commit\n";
-    error = ilm_commitChanges();
-
-    return ILM_TRUE;
+    return (ILM_SUCCESS == ilm_commitChanges()) ? true : false;
 }
 
 void OpenGLES2App::destroyEglContext()
index 21db4cc..e8b8f87 100644 (file)
@@ -445,10 +445,8 @@ DBusHandlerResult DBUSCommunicator::processMessageFunc(DBusConnection* conn,DBus
 
 void DBUSCommunicator::unregisterMessageFunc(DBusConnection* conn, void *user_data)
 {
-    DBusConnection* connection = NULL;
-    DBUSCommunicator* cominstance = NULL;
-    connection = conn;
-    cominstance = (DBUSCommunicator*)user_data;
+    (void)conn;
+    (void)user_data;
 }
 
 void DBUSCommunicator::ListLayersOfLayergroup(DBusConnection* conn, DBusMessage* msg)
index 40affd9..019739b 100644 (file)
@@ -79,7 +79,7 @@ private:
     bool m_initialized;
     bool m_success;
     X11WindowSystemStates m_systemState;
-    char* m_displayEnvironment;
+    const char* m_displayEnvironment;
 
 protected:
     Display* x11Display;
index 9ee8909..8799f69 100644 (file)
@@ -54,16 +54,13 @@ GLESGraphicsystem::GLESGraphicsystem(int windowWidth, int windowHeight, PfnShade
 
 void GLESGraphicsystem::activateGraphicContext()
 {
-    EGLBoolean eglStatus = false;
-    eglStatus = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
-    
+    eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
 }
 
 void GLESGraphicsystem::releaseGraphicContext() 
 {
-    EGLBoolean eglStatus = false;
-    eglStatus = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-}   
+    eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+}
 
 bool GLESGraphicsystem::init(EGLNativeDisplayType display, EGLNativeWindowType NativeWindow)
 {
@@ -137,8 +134,7 @@ bool GLESGraphicsystem::init(EGLNativeDisplayType display, EGLNativeWindowType N
     }
     LOG_INFO("GLESGraphicsystem", "EGL make current ...");
     // Make the context and surface current for rendering
-    EGLBoolean eglStatus = false;
-    eglStatus = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
+    eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
     LOG_INFO("GLESGraphicsystem", "made current");
 
     eglSwapInterval(m_eglDisplay, 1); // TODO: does not seem to work
index da5a895..0b85592 100644 (file)
@@ -902,8 +902,10 @@ init_complete:
 
 void X11WindowSystem::ManageXInputEvent(XEvent *pevent)
 {
-    XEvent* currentEvent = pevent;
+    (void)pevent;
+
 #ifdef WITH_INPUT_EVENTS
+    XEvent* currentEvent = pevent;
     Surface * surf;
     int *pX = NULL;
     int *pY = NULL;
@@ -930,8 +932,8 @@ void X11WindowSystem::ManageXInputEvent(XEvent *pevent)
         pevent->xany.window = surf->getNativeContent();
         XSendEvent(x11Display, currentEvent->xany.window, false, 0, currentEvent);
     }
-#endif
     currentEvent = NULL;
+#endif
 }
 
 
index 12a55b9..e2c73cc 100644 (file)
@@ -112,16 +112,15 @@ void X11GLESRenderer::doScreenShotOfSurface(std::string fileToSave, uint id, uin
 
 uint X11GLESRenderer::getNumberOfHardwareLayers(uint screenID)
 {
-    uint screen_id;
-    screen_id = screenID;
+    (void)screenID;
 
     return 0; // TODO provide real value here
 }
 
 uint* X11GLESRenderer::getScreenResolution(uint screenID)
 {
-    uint screen_id;
-    screen_id = screenID;   
+    (void)screenID;
+
     // TODO provide value of real screen here
     uint * resolution = new uint[2];
     resolution[0] = m_width;
index 70f9d8b..fffa370 100644 (file)
@@ -117,9 +117,10 @@ void Log::debug (LogContext logContext, const std::string& moduleName, const std
 
 void Log::log(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output)
 {
+    (void)logContext;
+
     std::string logString[LOG_MAX_LEVEL] = {"","ERROR","INFO","WARNING","DEBUG"};
     std::string logOutLevelString = logString[LOG_INFO];
-    LogContext currentContext = logContext;
     pthread_mutex_lock(&m_LogBufferMutex);
     if ( logMode < LOG_MAX_LEVEL ) 
     {
@@ -136,11 +137,10 @@ void Log::log(LogContext logContext, LOG_MODES logMode, const std::string& modul
 #ifdef WITH_DLT
     if ( dltLogLevel >= logMode ) 
     {
-        LogToDltDaemon(currentContext, logMode, moduleName, output);
+        LogToDltDaemon(logContext, logMode, moduleName, output);
     }   
 #endif    
     pthread_mutex_unlock(&m_LogBufferMutex);
-    currentContext = NULL;
 }
 
 void Log::LogToFile(std::string logMode, const std::string& moduleName,const std::basic_string<char>& output)