From dbd6d47caeb2ecdc181d5c637a103ae037ecf034 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Fri, 15 Mar 2013 16:17:32 +0100 Subject: [PATCH] LayerManagement: fixed several warnings raised by cppcheck Signed-off-by: Timo Lotterbach --- LayerManagerClient/ilmControl/src/ilm_control.c | 46 +++++++++++----------- LayerManagerControl/src/sceneio.cpp | 2 +- .../src/GraphicSystems/GLESGraphicSystem.cpp | 12 +++--- .../src/WindowSystems/WaylandBaseWindowSystem.cpp | 4 +- .../src/WindowSystems/WaylandDrmWindowSystem.cpp | 2 +- .../Graphic/src/WindowSystems/X11WindowSystem.cpp | 4 +- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/LayerManagerClient/ilmControl/src/ilm_control.c b/LayerManagerClient/ilmControl/src/ilm_control.c index 4405a51..8bbc290 100644 --- a/LayerManagerClient/ilmControl/src/ilm_control.c +++ b/LayerManagerClient/ilmControl/src/ilm_control.c @@ -60,30 +60,32 @@ ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreen { ilmErrorTypes returnValue = ILM_FAILED; - t_ilm_message response = 0; - t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfScreen"); - if (pScreenProperties - && command - && gIpcModule.appendUint(command, screenID) - && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue) - && gIpcModule.getUintArray(response, &pScreenProperties->layerIds, (int*)(&pScreenProperties->layerCount)) - && gIpcModule.getUint(response, &pScreenProperties->harwareLayerCount) - && gIpcModule.getUint(response, &pScreenProperties->screenWidth) - && gIpcModule.getUint(response, &pScreenProperties->screenHeight)) + if (pScreenProperties) { - returnValue = ILM_SUCCESS; - } - else - { - pScreenProperties->layerCount = 0; - pScreenProperties->harwareLayerCount = 0; - pScreenProperties->layerIds = NULL; - pScreenProperties->screenWidth = 0; - pScreenProperties->screenHeight = 0; - } + t_ilm_message response = 0; + t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfScreen"); + if (command + && gIpcModule.appendUint(command, screenID) + && sendAndWaitForResponse(command, &response, RESPONSE_TIMEOUT_IN_MS, &returnValue) + && gIpcModule.getUintArray(response, &pScreenProperties->layerIds, (int*)(&pScreenProperties->layerCount)) + && gIpcModule.getUint(response, &pScreenProperties->harwareLayerCount) + && gIpcModule.getUint(response, &pScreenProperties->screenWidth) + && gIpcModule.getUint(response, &pScreenProperties->screenHeight)) + { + returnValue = ILM_SUCCESS; + } + else + { + pScreenProperties->layerCount = 0; + pScreenProperties->harwareLayerCount = 0; + pScreenProperties->layerIds = NULL; + pScreenProperties->screenWidth = 0; + pScreenProperties->screenHeight = 0; + } - gIpcModule.destroyMessage(response); - gIpcModule.destroyMessage(command); + gIpcModule.destroyMessage(response); + gIpcModule.destroyMessage(command); + } return returnValue; } diff --git a/LayerManagerControl/src/sceneio.cpp b/LayerManagerControl/src/sceneio.cpp index 39bd5f9..7c15998 100644 --- a/LayerManagerControl/src/sceneio.cpp +++ b/LayerManagerControl/src/sceneio.cpp @@ -728,7 +728,7 @@ void exportXtext(string fileName, string grammar, string url) list doneTypes; list waitingNodes; waitingNodes.push_back(&grammarTree); - while (waitingNodes.size() != 0) + while (!waitingNodes.empty()) { //pop first element of the waiting types StringMapTree* typeNode = *(waitingNodes.begin()); diff --git a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp index 5711d89..6b0dcfd 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp @@ -368,7 +368,7 @@ void GLESGraphicsystem::renderSWLayer(Layer *layer, bool clear) } SurfaceList surfaces = m_currentLayer->getAllSurfaces(); - for (std::list::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++) + for (std::list::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); ++currentS) { if ((*currentS)->hasNativeContent() && (*currentS)->visibility && (*currentS)->opacity>0.0f) { @@ -596,7 +596,7 @@ void GLESGraphicsystem::renderSWLayers(LayerList layers, bool clear) bool blend = !clear; - for (std::list::const_iterator region = regions.begin(); region != regions.end(); region++) + for (std::list::const_iterator region = regions.begin(); region != regions.end(); ++region) { renderRegion(*region, blend); } @@ -616,7 +616,7 @@ void GLESGraphicsystem::renderSWLayers(LayerList layers, bool clear) LayerList singleLayer; singleLayer.push_back(*layer); std::list regions = computeRegions(singleLayer, true); //do clear - for (std::list::const_iterator region = regions.begin(); region != regions.end(); region++) + for (std::list::const_iterator region = regions.begin(); region != regions.end(); ++region) { renderRegion(*region, false); //don't blend } @@ -1271,7 +1271,7 @@ std::list GLESGraphicsystem::computeRegions(std::listm_rect = FloatRectangle(x1, y1, x2-x1, y2-y1); std::list::iterator si; - for (si = regionsurfaces.begin(); si != regionsurfaces.end(); si++) + for (si = regionsurfaces.begin(); si != regionsurfaces.end(); ++si) { if ((*si).surface) { @@ -1280,7 +1280,7 @@ std::list GLESGraphicsystem::computeRegions(std::list 0) + if (clear || !regionsurfaces.empty()) { regions.push_back(region); } @@ -1298,7 +1298,7 @@ std::list GLESGraphicsystem::computeRegions(std::list::iterator si; - for (si = regionsurfaces.begin(); si != regionsurfaces.end(); si++) + for (si = regionsurfaces.begin(); si != regionsurfaces.end(); ++si) { if ((*si).depth >= xlimits[x].orderedSurface.depth) { diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp index 429fe54..b9df97f 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp @@ -326,7 +326,7 @@ void WaylandBaseWindowSystem::calculateFps() sprintf(floatStringBuffer, "Overall fps: %f", FPS); timeSinceLastCalc = (float)(tv.tv_sec-tv0_forRender.tv_sec) + 0.000001*((float)(tv.tv_usec-tv0_forRender.tv_usec)); - for (std::list::const_iterator current = layers.begin(); current != layers.end(); current++) + for (std::list::const_iterator current = layers.begin(); current != layers.end(); ++current) { SurfaceList surfaceList = (*current)->getAllSurfaces(); SurfaceListIterator surfaceIter = surfaceList.begin(); @@ -359,7 +359,7 @@ void WaylandBaseWindowSystem::RedrawAllLayers(bool clear, bool swap) } #endif /* WL_OMIT_CLEAR_GB */ } - for (std::list::const_iterator current = layers.begin(); current != layers.end(); current++) + for (std::list::const_iterator current = layers.begin(); current != layers.end(); ++current) { if ((*current)->getLayerType() == Hardware) { diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandDrmWindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandDrmWindowSystem.cpp index 4f4b8d2..b892970 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandDrmWindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandDrmWindowSystem.cpp @@ -199,7 +199,7 @@ void WaylandDrmWindowSystem::RedrawAllLayers(bool clear, bool swap) graphicSystem->clearBackground(); } } - for (std::list::const_iterator current = layers.begin(); current != layers.end(); current++) + for (std::list::const_iterator current = layers.begin(); current != layers.end(); ++current) { if ((*current)->getLayerType() == Hardware) { diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp index 060ba54..1dc6014 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp @@ -590,7 +590,7 @@ void X11WindowSystem::calculateFps() FPS = ((float)(Frame)) / timeSinceLastCalc; char floatStringBuffer[256]; sprintf(floatStringBuffer, "Overall fps: %f", FPS); - for (std::list::const_iterator current = layers.begin(); current != layers.end(); current++) + for (std::list::const_iterator current = layers.begin(); current != layers.end(); ++current) { SurfaceList surfaceList = (*current)->getAllSurfaces(); SurfaceListIterator surfaceIter = surfaceList.begin(); @@ -612,7 +612,7 @@ void X11WindowSystem::RedrawAllLayers(bool clear, bool swap) LayerList swLayers; // Refresh HW Layers, find SW Layers - for (LayerListConstIterator current = layers.begin(); current != layers.end(); current++) + for (LayerListConstIterator current = layers.begin(); current != layers.end(); ++current) { if ((*current)->getLayerType() == Hardware) { -- 2.7.4