Maintenenace: fix several compiler warnings in C code
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Fri, 18 Jan 2013 11:45:09 +0000 (03:45 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Tue, 5 Feb 2013 13:19:31 +0000 (05:19 -0800)
Due to incorrect handling of C source files, the typical compiler warning
settings had not been applied to C code, but instead only to C++ code.

After fixing the build system setting, this patch fixed most of the
compiler warnings in C code.

other fixes:
- GLXApplicationExample: fixed compiler warnings
- CMake: fixed several compiler warnings
- LayerManagerBase: fix compiler warning
- LayerManagerUtils: suppress DLT macro related warnings, if DLT is enabled
- TextureBinders: fixed compiler warning

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
34 files changed:
LayerManagerBase/include/LmScreen.h
LayerManagerBase/tests/InputManagerTest.cpp
LayerManagerClient/ilmClient/include/ilm_client.h
LayerManagerClient/ilmClient/src/generic_ilm_client.c
LayerManagerControl/include/LMControl.h
LayerManagerControl/include/SceneStore.h
LayerManagerControl/src/Expression.cpp
LayerManagerControl/src/analyze.cpp
LayerManagerControl/src/commands.cpp
LayerManagerControl/src/common.cpp
LayerManagerControl/src/control.cpp
LayerManagerControl/src/demo.cpp
LayerManagerControl/src/print.cpp
LayerManagerControl/src/scatter.cpp
LayerManagerControl/src/sceneio.cpp
LayerManagerControl/src/util.cpp
LayerManagerExamples/GLXApplicationExample/src/gl2application.cpp
LayerManagerPlugins/IpcModules/DbusIpcModule/include/DBUSConfiguration.h
LayerManagerPlugins/IpcModules/DbusIpcModule/include/callbacks.h
LayerManagerPlugins/IpcModules/DbusIpcModule/include/common.h
LayerManagerPlugins/IpcModules/DbusIpcModule/include/introspection.h
LayerManagerPlugins/IpcModules/DbusIpcModule/src/bool.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/callbacks.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/double.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/initialization.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/int.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/introspection.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/message.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/string.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/uint.c
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp
LayerManagerUtils/src/Bitmap.cpp
LayerManagerUtils/src/Log.cpp
cmake/modules/DefaultSettings.txt

index aa68ba9..8955c68 100644 (file)
@@ -60,7 +60,7 @@ inline LmScreen::LmScreen()
 inline LmScreen::LmScreen(unsigned int id, const char* deviceName)
 : m_id(id)
 {
-    m_deviceName = new char[strlen(deviceName)];
+    m_deviceName = new char[strlen(deviceName) + 1];
     strcpy(m_deviceName, deviceName);
 }
 
index 27332ee..ff11ec9 100644 (file)
@@ -471,26 +471,38 @@ TEST_F(InputManagerTest, PointerEvent_Focus_On_Pressed)
 
     createComplexScene(m_pScene);
 
-    p = (Point) {INPUT_STATE_MOTION, 42, 43};
+    p.state = INPUT_STATE_MOTION;
+    p.x = 42;
+    p.x = 43;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(surf, (Surface*)NULL);  // No focus, so NULL is returned
     EXPECT_EQ(42, p.x);         // Coordinates are kept unchanged
     EXPECT_EQ(43, p.y);
 
-    p = (Point) {INPUT_STATE_RELEASED, 44, 45};
+    p.state = INPUT_STATE_RELEASED;
+    p.x = 44;
+    p.x = 45;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ((Surface*)NULL, surf);
     EXPECT_EQ(44, p.x);
     EXPECT_EQ(45, p.y);
 
-    p = (Point) {INPUT_STATE_OTHER, 46, 47};
+    p.state = INPUT_STATE_OTHER;
+    p.x = 46;
+    p.x = 47;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ((Surface*)NULL, surf);
     EXPECT_EQ(46, p.x);
     EXPECT_EQ(47, p.y);
 
     // Pressed somewhere in Content
-    p = (Point) {INPUT_STATE_PRESSED, 700, 400};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 700;
+    p.x = 400;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_NE(surf, (Surface*)NULL);  // Pressed under a surface, so not NULL is returned
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());  // Make sure the elected surface is the appropriate one
@@ -510,7 +522,10 @@ TEST_F(InputManagerTest, PointerEvent_Focus_Remain)
     createComplexScene(m_pScene);
 
     // Pressed somewhere in Content
-    p = (Point) {INPUT_STATE_PRESSED, 700, 400};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 700;
+    p.x = 400;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_NE(surf, (Surface*)NULL);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
@@ -518,21 +533,30 @@ TEST_F(InputManagerTest, PointerEvent_Focus_Remain)
     EXPECT_NE(400, p.y);
 
     // motion somewhere outside of Content
-    p = (Point) {INPUT_STATE_MOTION, 10, 20};
+    p.state = INPUT_STATE_MOTION;
+    p.x = 10;
+    p.x = 20;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
     EXPECT_NE(10, p.x);
     EXPECT_NE(20, p.y);
 
     // motion somewhere outside of Content
-    p = (Point) {INPUT_STATE_MOTION, 0, 200};
+    p.state = INPUT_STATE_MOTION;
+    p.x = 0;
+    p.x = 200;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
     EXPECT_NE(0, p.x);
     EXPECT_NE(200, p.y);
 
     // release somewhere outside of Content
-    p = (Point) {INPUT_STATE_RELEASED, 500, 30};
+    p.state = INPUT_STATE_RELEASED;
+    p.x = 500;
+    p.x = 30;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
     EXPECT_NE(500, p.x);
@@ -541,19 +565,28 @@ TEST_F(InputManagerTest, PointerEvent_Focus_Remain)
     // Let's do some click on the background layer
 
     // Pressed somewhere in Status bar
-    p = (Point) {INPUT_STATE_PRESSED, 100, 30};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 30;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY1_SURF_STATUSBAR_ID, surf->getID());
     EXPECT_EQ(100, p.x);
     EXPECT_EQ(30, p.y);
 
     // Motion somewhere outside of Status bar
-    p = (Point) {INPUT_STATE_MOTION, 500, 500};
+    p.state = INPUT_STATE_MOTION;
+    p.x = 500;
+    p.x = 500;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY1_SURF_STATUSBAR_ID, surf->getID());
 
     // Released somewhere outside of Status bar
-    p = (Point) {INPUT_STATE_RELEASED, 800, 480};
+    p.state = INPUT_STATE_RELEASED;
+    p.x = 800;
+    p.x = 480;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY1_SURF_STATUSBAR_ID, surf->getID());
 }
@@ -582,27 +615,39 @@ TEST_F(InputManagerTest, PointerEvent_Focus_Conditions)
     m_pPopup->setNativeContent(DUMMY_NATIVE_CONTENT);
 
     // (100,225) is in the middle of the popup
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_POPUP_ID, surf->getID());
 
     // popup not visible
     m_pPopup->setVisibility(false);
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
 
     // popup visible and small opacity
     m_pPopup->setVisibility(true);
     m_pPopup->setOpacity(0.1);
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_POPUP_ID, surf->getID());
 
     // popup visible and no opacity
     m_pPopup->setVisibility(true);
     m_pPopup->setOpacity(0);
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
 
@@ -610,7 +655,10 @@ TEST_F(InputManagerTest, PointerEvent_Focus_Conditions)
     m_pPopup->setVisibility(true);
     m_pPopup->setOpacity(1);
     m_pPopup->removeNativeContent();
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
 
@@ -637,7 +685,10 @@ TEST_F(InputManagerTest, PointerEvent_Election_Conditions_Check)
     layerTop = m_pScene->getLayer(CPLX_SCREEN_LAY2_ID);
 
     // Pressed somewhere in Content
-    p = (Point) {INPUT_STATE_PRESSED, 700, 400};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 700;
+    p.x = 400;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_NE(surf, (Surface*)NULL);
     EXPECT_EQ(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
@@ -645,7 +696,10 @@ TEST_F(InputManagerTest, PointerEvent_Election_Conditions_Check)
     // No visibility
     layerTop->setVisibility(false);
     // Pressed somewhere in Content
-    p = (Point) {INPUT_STATE_PRESSED, 700, 400};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 700;
+    p.x = 400;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_NE(surf, (Surface*)NULL);
     EXPECT_EQ(CPLX_SCREEN_LAY1_SURF_BACKGROUND_ID, surf->getID());
@@ -655,7 +709,10 @@ TEST_F(InputManagerTest, PointerEvent_Election_Conditions_Check)
     layerTop->setVisibility(true);
     layerTop->setOpacity(0);
     // Pressed somewhere in Content
-    p = (Point) {INPUT_STATE_PRESSED, 700, 400};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 700;
+    p.x = 400;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_NE(surf, (Surface*)NULL);
     EXPECT_EQ(CPLX_SCREEN_LAY1_SURF_BACKGROUND_ID, surf->getID());
@@ -696,7 +753,10 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_translation)
 
     // Let send a first pointer pressed to get it's focus
     // Since no transformation, screen wide (10,20) coordinate should become ... (10,20) in the surface coordinate system
-    p = (Point) {INPUT_STATE_PRESSED, 10, 20};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 10;
+    p.x = 20;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(10, p.x);
@@ -704,21 +764,30 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_translation)
 
     // Let's move newSurf by 10 to the left and 100 down and retry the same test
     newSurf->setDestinationRegion(Rectangle(10, 100, sw, sh));
-    p = (Point) {INPUT_STATE_PRESSED, 10, 150};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 10;
+    p.x = 150;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(0, p.x);  // 10 global is 0 local
     EXPECT_EQ(50, p.y); // 150 global is 50 local
 
     // motion at (0,40) global should still elect newSurf at (-10,-60)
-    p = (Point) {INPUT_STATE_MOTION, 0, 40};
+    p.state = INPUT_STATE_MOTION;
+    p.x = 0;
+    p.x = 40;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(-10, p.x);  // 10 global is 0 local
     EXPECT_EQ(-60, p.y);
 
     // release at (800,100) global should still elect newSurf at (790,0)
-    p = (Point) {INPUT_STATE_RELEASED, 800, 100};
+    p.state = INPUT_STATE_RELEASED;
+    p.x = 800;
+    p.x = 100;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(790, p.x);  // 10 global is 0 local
@@ -760,7 +829,10 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_croping)
     newSurf->setSourceRegion(Rectangle(50, 50, 50, 50));
     newSurf->setDestinationRegion(Rectangle(0, 0, 50, 50));
 
-    p = (Point) {INPUT_STATE_PRESSED, 10, 20};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 10;
+    p.x = 20;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(60, p.x);
@@ -768,14 +840,20 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_croping)
 
     // Let's move newSurf by 10 to the left and 100 down and retry the same test
     newSurf->setDestinationRegion(Rectangle(10, 100, 50, 50));
-    p = (Point) {INPUT_STATE_PRESSED, 20, 120};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 20;
+    p.x = 120;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(60, p.x);
     EXPECT_EQ(70, p.y);
 
     // motion at (10,40) global should still elect newSurf at (40,-10)
-   p = (Point) {INPUT_STATE_MOTION, 0, 40};
+    p.state = INPUT_STATE_MOTION;
+    p.x = 0;
+    p.x = 40;
+
    surf = m_pInputManager->reportPointerEvent(p);
    EXPECT_EQ(sid, surf->getID());
    EXPECT_EQ(40, p.x);  // 10 global is 0 local
@@ -818,7 +896,10 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_scaling)
     newSurf->setSourceRegion(Rectangle(0, 0, sw/2, sh/2));
     newSurf->setDestinationRegion(Rectangle(0, 0, sw, sh));
 
-    p = (Point) {INPUT_STATE_PRESSED, 10, 20};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 10;
+    p.x = 20;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(5, p.x);
@@ -826,7 +907,10 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_scaling)
 
     // Scale & Move newSurf
     newSurf->setDestinationRegion(Rectangle(10, 100, sw, sh));
-    p = (Point) {INPUT_STATE_PRESSED, 20, 120};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 20;
+    p.x = 120;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(5, p.x);
@@ -834,7 +918,10 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_scaling)
 
     // Scale & Move & Crope surface
     newSurf->setSourceRegion(Rectangle(10, 10, sw/2, sh/2));
-    p = (Point) {INPUT_STATE_PRESSED, 30, 140};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 30;
+    p.x = 140;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ(sid, surf->getID());
     EXPECT_EQ(20, p.x);
@@ -864,14 +951,20 @@ TEST_F(InputManagerTest, PointerEvent_InputEventAcceptance)
     pPopup->setVisibility(true);
 
     // (100,225) is in the middle of the popup
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ((uint)CPLX_SCREEN_LAY2_SURF_POPUP_ID, surf->getID());
 
     pPopup->updateInputEventAcceptanceFrom(INPUT_DEVICE_POINTER, false);
 
     // (100,225) is in the middle of the popup, but popup now refuse pointer event
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_NE((uint)CPLX_SCREEN_LAY2_SURF_POPUP_ID, surf->getID());
     EXPECT_EQ((uint)CPLX_SCREEN_LAY2_SURF_CONTENT_ID, surf->getID());
@@ -882,7 +975,10 @@ TEST_F(InputManagerTest, PointerEvent_InputEventAcceptance)
     // (100,225) is in the middle of the popup, but popup refuse pointer event
     // so event should be dispatched to Content, but content now refuse pointer event
     // Finally event should be dispatched to Background of Layer 1
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_EQ((uint)CPLX_SCREEN_LAY1_SURF_BACKGROUND_ID, surf->getID());
 
@@ -891,7 +987,10 @@ TEST_F(InputManagerTest, PointerEvent_InputEventAcceptance)
 
     // (100,225) is in the middle of the popup.
     // popup -> content -> Background -> NULL
-    p = (Point) {INPUT_STATE_PRESSED, 100, 225};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 100;
+    p.x = 225;
+
     surf = m_pInputManager->reportPointerEvent(p);
     EXPECT_FALSE(surf);
 
@@ -914,13 +1013,28 @@ TEST_F(InputManagerTest, TouchEvent)
     // to guarentee good performances. So let's do this in the test.
     pv.reserve(10);
     pv.resize(4);
-    pv[0] = (Point) {INPUT_STATE_MOTION, 100,  50};
-    pv[1] = (Point) {INPUT_STATE_MOTION, 800, 480};
-    pv[2] = (Point) {INPUT_STATE_MOTION, 300, 200};
-    pv[3] = (Point) {INPUT_STATE_MOTION, 0,  10};
+
+    pv[0].state = INPUT_STATE_MOTION;
+    pv[0].x = 100;
+    pv[0].y = 50;
+
+    pv[1].state = INPUT_STATE_MOTION;
+    pv[1].x = 800;
+    pv[1].y = 480;
+
+    pv[2].state = INPUT_STATE_MOTION;
+    pv[2].x = 300;
+    pv[2].y = 200;
+
+    pv[3].state = INPUT_STATE_MOTION;
+    pv[3].x = 0;
+    pv[3].y = 10;
 
     // Pressed somewhere in Content to set the pointer focus
-    p = (Point) {INPUT_STATE_PRESSED, 700, 400};
+    p.state = INPUT_STATE_PRESSED;
+    p.x = 700;
+    p.y = 400;
+
     m_pInputManager->reportPointerEvent(p);
 
     // set popup not visible
index 55d611a..b44862b 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif // __cplusplus
+#endif /* __cplusplus */
 
 #include "ilm_types.h"
 /**
@@ -781,8 +781,8 @@ ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer);
 ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties);
 
 #ifdef __cplusplus
-} //
-#endif // __cplusplus
+} /**/
+#endif /* __cplusplus */
 
 #endif /* _ILM_CLIENT_H_ */
 
index 1f01300..e337960 100644 (file)
 #include <sys/types.h>
 #include <unistd.h>
 
-
-//=============================================================================
-// global settings
-//=============================================================================
-const int gReceiveTimeout  = -1;  // in ms, negative value for infinite
-const int gResponseTimeout = 500; // in ms
-
-// must be same as GraphicalObject::INVALID_ID, but this is defined in C++
-// and can not be used here
+/*
+ *=============================================================================
+ * global settings
+ *=============================================================================
+ */
+const int gReceiveTimeout  = -1;  /* in ms, negative value for infinite */
+const int gResponseTimeout = 500; /* in ms */
+
+/*
+ * must be same as GraphicalObject::INVALID_ID, but this is defined in C++
+ * and can not be used here
+ */
 #define INVALID_ID 0xFFFFFFFF
 
-// queue names for incoming notifications and messages
+/* queue names for incoming notifications and messages */
 #define NOTIFICATION_QUEUE_NAME "/ilmClient%dNotification"
 #define INCOMING_QUEUE_NAME     "/ilmClient%dIncoming"
 
-//=============================================================================
-// global vars
-//=============================================================================
-extern char *__progname; // automatically gets assigned argv[0]
+/*
+ *=============================================================================
+ * global vars
+ *=============================================================================
+ */
+extern char *__progname; /* automatically gets assigned argv[0] */
 
 static struct IpcModule gIpcModule;
 
@@ -66,21 +71,23 @@ static mqd_t notificationMqWrite;
 
 static t_ilm_bool gInitialized = ILM_FALSE;
 
-//=============================================================================
-// notification management
-//=============================================================================
+/*
+ *=============================================================================
+ * notification management
+ *=============================================================================
+ */
 #define MAX_CALLBACK_COUNT 64
-struct
+static struct
 {
     t_ilm_uint id;
     layerNotificationFunc callback;
-} static gLayerNotificationCallbacks[MAX_CALLBACK_COUNT];
+} gLayerNotificationCallbacks[MAX_CALLBACK_COUNT];
 
-struct
+static struct
 {
     t_ilm_uint id;
     surfaceNotificationFunc callback;
-} static gSurfaceNotificationCallbacks[MAX_CALLBACK_COUNT];
+} gSurfaceNotificationCallbacks[MAX_CALLBACK_COUNT];
 
 void initNotificationCallbacks()
 {
@@ -124,7 +131,7 @@ t_ilm_bool findLayerCallback(t_ilm_layer layer)
 {
     int i = 0;
 
-    // try to overwrite existing entry for layer id
+    /* try to overwrite existing entry for layer id */
     for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
     {
         if (gLayerNotificationCallbacks[i].id == layer)
@@ -144,7 +151,7 @@ t_ilm_bool addLayerCallback(t_ilm_layer layer, layerNotificationFunc func)
         return ILM_FALSE;
     }
 
-    // find free slot and store callback
+    /* find free slot and store callback */
     for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
     {
         if (gLayerNotificationCallbacks[i].id == INVALID_ID)
@@ -162,7 +169,7 @@ t_ilm_bool findSurfaceCallback(t_ilm_surface surface)
 {
     int i = 0;
 
-    // try to overwrite existing entry for layer id
+    /* try to overwrite existing entry for layer id */
     for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
     {
         if (gSurfaceNotificationCallbacks[i].id == surface)
@@ -182,7 +189,7 @@ t_ilm_bool addSurfaceCallback(t_ilm_surface surface, surfaceNotificationFunc fun
         return ILM_FALSE;
     }
 
-    // find free slot and store callback
+    /* find free slot and store callback */
     for (i = 0; i < MAX_CALLBACK_COUNT; ++i)
     {
         if (gSurfaceNotificationCallbacks[i].id == INVALID_ID)
@@ -224,27 +231,31 @@ void removeSurfaceCallback(t_ilm_surface layer)
     }
 }
 
-//=============================================================================
-// handling of internal notification thread for dispatching notifications
-// Note: notification callbacks may be blocked by client, but receive thread
-// must not be blocked
-//=============================================================================
+
+/*
+ *=============================================================================
+ * handling of internal notification thread for dispatching notifications
+ * Note: notification callbacks may be blocked by client, but receive thread
+ * must not be blocked
+ *=============================================================================
+ */
 void* notificationThreadLoop(void* param)
 {
-    (void)param;
-
     t_ilm_message notification;
 
+    (void)param;
+
     while (-1 != mq_receive(notificationMqRead, (char*)&notification, sizeof(notification), NULL))
     {
         t_ilm_const_string name = gIpcModule.getMessageName(notification);
 
-        // this depends on message name, but it is fast
+        /* this depends on message name, but it is fast */
         if ('L' == name[15])
         {
             t_ilm_uint id;
             t_ilm_uint mask;
             struct ilmLayerProperties properties;
+            layerNotificationFunc func;
 
             gIpcModule.getUint(notification, &id);
             gIpcModule.getUint(notification, &mask);
@@ -268,7 +279,7 @@ void* notificationThreadLoop(void* param)
             gIpcModule.getUint(notification, &properties.chromaKeyBlue);
             gIpcModule.getInt(notification, &properties.creatorPid);
 
-            layerNotificationFunc func = getLayerNotificationCallback(id);
+            func = getLayerNotificationCallback(id);
             if (func)
             {
                 (*func)(id, &properties, mask);
@@ -284,6 +295,7 @@ void* notificationThreadLoop(void* param)
             t_ilm_uint id;
             t_ilm_uint mask;
             struct ilmSurfaceProperties properties;
+            surfaceNotificationFunc func;
 
             gIpcModule.getUint(notification, &id);
             gIpcModule.getUint(notification, &mask);
@@ -312,7 +324,7 @@ void* notificationThreadLoop(void* param)
             gIpcModule.getUint(notification, &properties.chromaKeyBlue);
             gIpcModule.getInt(notification, &properties.creatorPid);
 
-            surfaceNotificationFunc func = getSurfaceNotificationCallback(id);
+            func = getSurfaceNotificationCallback(id);
             if (func)
             {
                 (*func)(id, &properties, mask);
@@ -327,15 +339,18 @@ void* notificationThreadLoop(void* param)
     return NULL;
 }
 
-//=============================================================================
-// handling of internal receive thread for event handling
-//=============================================================================
+
+/*
+ *=============================================================================
+ * handling of internal receive thread for event handling
+ *=============================================================================
+ */
 void* receiveThreadLoop(void* param)
 {
-    (void)param;
-
     t_ilm_bool running = ILM_TRUE;
 
+    (void)param;
+
     while (running)
     {
         t_ilm_message message = gIpcModule.receive(gReceiveTimeout);
@@ -378,24 +393,25 @@ void* receiveThreadLoop(void* param)
 
 void calculateTimeout(struct timeval* currentTime, int giventimeout, struct timespec* timeout)
 {
-    // nanoseconds is old value in nanoseconds + the given milliseconds as nanoseconds
+    /* nanoseconds is old value in nanoseconds + the given milliseconds as nanoseconds */
     t_ilm_ulong newNanoSeconds = currentTime->tv_usec * 1000 + giventimeout * (1000 * 1000);
 
-    // only use non full seconds, otherwise overflow!
+    /* only use non full seconds, otherwise overflow! */
     timeout->tv_nsec = newNanoSeconds % (1000000000);
 
-    // new seconds are old seconds + full seconds from new nanoseconds part
+    /* new seconds are old seconds + full seconds from new nanoseconds part */
     timeout->tv_sec  = currentTime->tv_sec + (newNanoSeconds / 1000000000 );
 }
 
 t_ilm_bool sendAndWaitForResponse(t_ilm_message command, t_ilm_message* response, int timeoutInMs)
 {
+    t_ilm_message_type responseType = IpcMessageTypeNone;
+
     (void)timeoutInMs;
 
     *response = 0;
-    t_ilm_message_type responseType = IpcMessageTypeNone;
 
-    // send / receive may only be performed by one thread at a time
+    /* send / receive may only be performed by one thread at a time */
     pthread_mutex_lock(&gSendReceiveLock);
 
     if (gIpcModule.sendToService(command))
@@ -414,12 +430,17 @@ t_ilm_bool sendAndWaitForResponse(t_ilm_message command, t_ilm_message* response
     return (*response && (IpcMessageTypeCommand == responseType));
 }
 
-//=============================================================================
-// implementation
-//=============================================================================
+
+/*
+ *=============================================================================
+ * implementation
+ *=============================================================================
+ */
 ilmErrorTypes ilm_init()
 {
     ilmErrorTypes result = ILM_FAILED;
+    t_ilm_message response = 0;
+    t_ilm_message command;
 
     if (gInitialized)
     {
@@ -435,27 +456,28 @@ ilmErrorTypes ilm_init()
 
         if (gIpcModule.initClientMode())
         {
-            result = ILM_SUCCESS;
+            char mqName[30];
+            pthread_attr_t notificationThreadAttributes;
+            int ret;
 
-            struct mq_attr mqAttr =
-            {
-                .mq_maxmsg = 4,
-                .mq_msgsize = sizeof(t_ilm_message),
-                .mq_flags = 0, //O_NONBLOCK,
-                .mq_curmsgs = 0
-            };
+            struct mq_attr mqAttr;
+            mqAttr.mq_maxmsg = 4;
+            mqAttr.mq_msgsize = sizeof(t_ilm_message);
+            mqAttr.mq_flags = 0; /*O_NONBLOCK, */
+            mqAttr.mq_curmsgs = 0;
+
+            result = ILM_SUCCESS;
 
-            char mqName[30];
             snprintf(mqName, sizeof(mqName), NOTIFICATION_QUEUE_NAME, getpid());
 
             notificationMqWrite = mq_open(mqName, O_WRONLY | O_CREAT, 0600, &mqAttr);
             notificationMqRead = mq_open(mqName, O_RDONLY);
-            mq_unlink(mqName); // is destroyed on closed filedescriptor
+            mq_unlink(mqName); /* is destroyed on closed filedescriptor */
 
             snprintf(mqName, sizeof(mqName), INCOMING_QUEUE_NAME, getpid());
             incomingMqWrite = mq_open(mqName, O_WRONLY | O_CREAT, 0600, &mqAttr);
             incomingMqRead = mq_open(mqName, O_RDONLY);
-            mq_unlink(mqName); // is destroyed on closed filedescriptor
+            mq_unlink(mqName); /* is destroyed on closed filedescriptor */
 
             if ((mqd_t)-1 == notificationMqRead || (mqd_t)-1 == notificationMqWrite)
             {
@@ -465,12 +487,11 @@ ilmErrorTypes ilm_init()
 
             pthread_mutex_init(&gSendReceiveLock, NULL);
 
-            pthread_attr_t notificationThreadAttributes;
             pthread_attr_init(&notificationThreadAttributes);
             pthread_attr_setdetachstate(&notificationThreadAttributes,
                                         PTHREAD_CREATE_JOINABLE);
 
-            int ret = pthread_create(&gReceiveThread,
+            ret = pthread_create(&gReceiveThread,
                                      &notificationThreadAttributes,
                                      receiveThreadLoop,
                                      NULL);
@@ -499,8 +520,7 @@ ilmErrorTypes ilm_init()
             return result;
         }
 
-        t_ilm_message response = 0;
-        t_ilm_message command = gIpcModule.createMessage("ServiceConnect");
+        command = gIpcModule.createMessage("ServiceConnect");
         if (command
                 && gIpcModule.appendUint(command, pid)
                 && gIpcModule.appendString(command, __progname)
@@ -525,6 +545,7 @@ ilmErrorTypes ilm_init()
 ilmErrorTypes ilm_destroy()
 {
     ilmErrorTypes result = ILM_FAILED;
+    void* threadReturnValue = NULL;
 
     t_ilm_message response = 0;
     t_ilm_message command = gIpcModule.createMessage("ServiceDisconnect");
@@ -537,9 +558,7 @@ ilmErrorTypes ilm_destroy()
     gIpcModule.destroyMessage(response);
     gIpcModule.destroyMessage(command);
 
-    // cancel worker threads
-    void* threadReturnValue = NULL;
-
+    /* cancel worker threads */
     pthread_cancel(gReceiveThread);
     pthread_cancel(gNotificationThread);
 
@@ -1144,7 +1163,7 @@ ilmErrorTypes ilm_layerSetChromaKey(t_ilm_layer layerId, t_ilm_int* pColor)
     {
         t_ilm_bool comResult = ILM_TRUE;
 
-        // Checking pColor has a content, otherwise chromakey is disabled
+        /* Checking pColor has a content, otherwise chromakey is disabled */
         if (pColor)
         {
             const t_ilm_uint number = 3;
@@ -1612,7 +1631,7 @@ ilmErrorTypes ilm_surfaceSetChromaKey(t_ilm_surface surfaceId, t_ilm_int* pColor
     {
         t_ilm_bool comResult = ILM_TRUE;
 
-        // Checking pColor has a content, otherwise chromakey is disabled
+        /* Checking pColor has a content, otherwise chromakey is disabled */
         if (pColor)
         {
             const t_ilm_uint number = 3;
@@ -1828,14 +1847,16 @@ ilmErrorTypes ilm_commitChanges()
 ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc callback)
 {
     ilmErrorTypes returnValue = ILM_FAILED;
+    t_ilm_message response;
+    t_ilm_message command;
 
     if (findLayerCallback(layer))
     {
         return ILM_ERROR_INVALID_ARGUMENTS;
     }
 
-    t_ilm_message response = 0;
-    t_ilm_message command = gIpcModule.createMessage("LayerAddNotification");
+    response = 0;
+    command = gIpcModule.createMessage("LayerAddNotification");
     if (command
         && gIpcModule.appendUint(command, layer)
         && sendAndWaitForResponse(command, &response, gResponseTimeout))
@@ -1851,14 +1872,16 @@ ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc
 ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer)
 {
     ilmErrorTypes returnValue = ILM_FAILED;
+    t_ilm_message response;
+    t_ilm_message command;
 
     if (!findLayerCallback(layer))
     {
         return ILM_ERROR_INVALID_ARGUMENTS;
     }
 
-    t_ilm_message response = 0;
-    t_ilm_message command = gIpcModule.createMessage("LayerRemoveNotification");
+    response = 0;
+    command = gIpcModule.createMessage("LayerRemoveNotification");
     if (command
         && gIpcModule.appendUint(command, layer)
         && sendAndWaitForResponse(command, &response, gResponseTimeout))
@@ -1874,14 +1897,16 @@ ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer)
 ilmErrorTypes ilm_surfaceAddNotification(t_ilm_surface surface, surfaceNotificationFunc callback)
 {
     ilmErrorTypes returnValue = ILM_FAILED;
+    t_ilm_message response;
+    t_ilm_message command;
 
     if (findSurfaceCallback(surface))
     {
         return ILM_ERROR_INVALID_ARGUMENTS;
     }
 
-    t_ilm_message response = 0;
-    t_ilm_message command = gIpcModule.createMessage("SurfaceAddNotification");
+    response = 0;
+    command = gIpcModule.createMessage("SurfaceAddNotification");
     if (command
         && gIpcModule.appendUint(command, surface)
         && sendAndWaitForResponse(command, &response, gResponseTimeout))
@@ -1897,14 +1922,16 @@ ilmErrorTypes ilm_surfaceAddNotification(t_ilm_surface surface, surfaceNotificat
 ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface)
 {
     ilmErrorTypes returnValue = ILM_FAILED;
+    t_ilm_message response;
+    t_ilm_message command;
 
     if (!findSurfaceCallback(surface))
     {
         return ILM_ERROR_INVALID_ARGUMENTS;
     }
 
-    t_ilm_message response = 0;
-    t_ilm_message command = gIpcModule.createMessage("SurfaceRemoveNotification");
+    response = 0;
+    command = gIpcModule.createMessage("SurfaceRemoveNotification");
     if (command
         && gIpcModule.appendUint(command, surface)
         && sendAndWaitForResponse(command, &response, gResponseTimeout))
@@ -1927,7 +1954,7 @@ ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreen
         && command
         && gIpcModule.appendUint(command, screenID)
         && sendAndWaitForResponse(command, &response, gResponseTimeout)
-        && gIpcModule.getUintArray(response, &pScreenProperties->layerIds, &pScreenProperties->layerCount)
+        && gIpcModule.getUintArray(response, &pScreenProperties->layerIds, (int*)(&pScreenProperties->layerCount))
         && gIpcModule.getUint(response, &pScreenProperties->harwareLayerCount)
         && gIpcModule.getUint(response, &pScreenProperties->screenWidth)
         && gIpcModule.getUint(response, &pScreenProperties->screenHeight))
index dbf4cb1..4a9d630 100644 (file)
@@ -309,7 +309,7 @@ t_scene_data getScatteredScene(t_scene_data* pInitialScene);
  * Run a set of effects on the rendered scene depending on the parameter.
  * The function accepts values in range 0-4
  */
-void demo(int mode);
+void demo(t_ilm_uint mode);
 
 
 //=============================================================================
index db9effd..2db1cec 100644 (file)
@@ -51,82 +51,98 @@ template<typename T> string getPrimitiveType(T var)
 
 template<typename T> string getPrimitiveType(T* var)
 {
+    (void) var;//suppress warning: unsued variable
     T var2=0;
     return getPrimitiveType(var2) + "*";
 }
 
 template<> string getPrimitiveType(bool var)
 {
+    (void) var;//suppress warning: unsued variable
     return "bool";
 }
 
 template<> string getPrimitiveType(char var)
 {
+    (void) var;//suppress warning: unsued variable
     return "char";
 }
 
 template<> string getPrimitiveType(signed char var)
 {
+    (void) var;//suppress warning: unsued variable
     return "signed char";
 }
 
 template<> string getPrimitiveType(unsigned char var)
 {
+    (void) var;//suppress warning: unsued variable
     return "unsigned char";
 }
 
 template<> string getPrimitiveType(wchar_t var)
 {
+    (void) var;//suppress warning: unsued variable
     return "wchar_t";
 }
 
 template<> string getPrimitiveType(short int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "short int";
 }
 
 template<> string getPrimitiveType(unsigned short int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "unsigned short int";
 }
 
 template<> string getPrimitiveType(long int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "long int";
 }
 
 template<> string getPrimitiveType(unsigned long int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "unsigned long int";
 }
 
 template<> string getPrimitiveType(int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "int";
 }
 
 template<> string getPrimitiveType(unsigned int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "unsigned int";
 }
 
 template<> string getPrimitiveType(float var)
 {
+    (void) var;//suppress warning: unsued variable
     return "float";
 }
 
 template<> string getPrimitiveType(double var)
 {
+    (void) var;//suppress warning: unsued variable
     return "double";
 }
 
 template<> string getPrimitiveType(long double var)
 {
+    (void) var;//suppress warning: unsued variable
     return "long double";
 }
 
 template<> string getPrimitiveType(string var)
 {
+    (void) var;//suppress warning: unsued variable
     return "string";
 }
 
@@ -134,21 +150,25 @@ template<> string getPrimitiveType(string var)
 #if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L
 template<> string getPrimitiveType(char16_t var)
 {
+    (void) var;//suppress warning: unsued variable
     return "char16_t";
 }
 
 template<> string getPrimitiveType(char32_t var)
 {
+    (void) var;//suppress warning: unsued variable
     return "char32_t";
 }
 
 template<> string getPrimitiveType(long long int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "long long int";
 }
 
 template<> string getPrimitiveType(unsigned long long int var)
 {
+    (void) var;//suppress warning: unsued variable
     return "unsigned long long int";
 }
 #endif
@@ -171,7 +191,7 @@ public:
 
     virtual void fromString(string s)
     {
-
+        (void) s;//suppress warning: unsued variable
     }
 
     virtual string asString()
@@ -181,22 +201,24 @@ public:
 
     virtual void toStringMapTree(StringMapTree* parent)
     {
-
+        (void) parent;//suppress warning: unsued variable
     }
 
     virtual void toGrammarMapTree(StringMapTree* tree)
     {
-
+        (void) tree;//suppress warning: unsued variable
     }
 
     virtual WrapperHelper* tryClone(string type, StringMapTree* tree)
     {
+        (void) type;//suppress warning: unsued variable
+        (void) tree;//suppress warning: unsued variable
         return NULL;
     }
 
     virtual void addToComplexWrapper(WrapperHelper* wrapper)
     {
-
+        (void) wrapper;//suppress warning: unsued variable
     }
 
     virtual string getWrapperPrimitiveType()
@@ -361,10 +383,12 @@ map<int,string> _globalTypeIndexdToType;
 class class_name;\
 ostream& operator<<(ostream& out, class_name& obj )\
 {\
+    (void) obj;\
     return out;\
 }\
 istream& operator>>(istream& in, class_name& obj)\
 {\
+    (void) obj;\
     return in;\
 }\
 class class_name { \
index 71be776..7dd8500 100644 (file)
@@ -107,7 +107,7 @@ int Expression::getInt(string name)
 
     if (!value)
     {
-        sscanf(stringVal.c_str(), "0x%x", &value);
+        sscanf(stringVal.c_str(), "0x%x", (unsigned int*) &value);
     }
     return value;
 }
index a2fab8b..917333f 100644 (file)
@@ -141,7 +141,7 @@ void analyzeSurfaceDimensions(t_ilm_surface targetSurfaceId, t_scene_data& scene
     string tag, flag;
     char description[300] = "";
 
-    t_ilm_int minDimension = 32;
+    t_ilm_uint minDimension = 32;
 
     tag = "Surface dest width";
     if (targetSurfaceProperties.destWidth <= minDimension)
@@ -232,7 +232,7 @@ void analyzeLayerDimensions(t_ilm_surface targetSurfaceId, t_scene_data& scene)
 {
     t_ilm_layer targetSurfaceLayer = scene.surfaceLayer[targetSurfaceId];
     ilmLayerProperties& targetLayerProperties = scene.layerProperties[targetSurfaceLayer];
-    t_ilm_int minDimension = 32;
+    t_ilm_uint minDimension = 32;
 
     string tag, flag;
     char description[300] = "";
index 86a5ca9..b6c09b9 100644 (file)
@@ -410,6 +410,7 @@ COMMAND("destroy surface <surfaceid>")
 COMMAND("get scene")
 //=============================================================================
 {
+    (void) input; //suppress warning: unused parameter
     printScene();
 }
 
@@ -417,7 +418,8 @@ COMMAND("get scene")
 COMMAND("get communicator performance")
 //=============================================================================
 {
-   getCommunicatorPerformance();
+    (void) input; //suppress warning: unused parameter
+    getCommunicatorPerformance();
 }
 
 //=============================================================================
@@ -433,6 +435,7 @@ COMMAND("set surface <surfaceid> keyboard focus")
 COMMAND("get keyboard focus")
 //=============================================================================
 {
+    (void) input; //suppress warning: unused parameter
     getKeyboardFocus();
 }
 
@@ -547,6 +550,7 @@ COMMAND("analyze surface <surfaceid>")
 COMMAND("scatter")
 //=============================================================================
 {
+    (void) input; //suppress warning: unused parameter
     scatter();
 }
 
@@ -554,6 +558,7 @@ COMMAND("scatter")
 COMMAND("scatter all")
 //=============================================================================
 {
+    (void) input; //suppress warning: unused parameter
     scatterAll();
 }
 
@@ -561,7 +566,7 @@ COMMAND("scatter all")
 COMMAND("demo <animation_mode>")
 //=============================================================================
 {
-    int mode = (int) input->getInt("animation_mode");
+    t_ilm_uint mode = (t_ilm_uint) input->getUint("animation_mode");
     demo(mode);
 }
 
index 4df2fdf..30215a7 100644 (file)
@@ -162,7 +162,7 @@ void captureSceneData(t_scene_data* pScene)
     scene.screens = vector<t_ilm_display>(screenArray, screenArray + screenCount);
 
     //layers on each screen
-    for (int i = 0; i < screenCount; ++i)
+    for (unsigned int i = 0; i < screenCount; ++i)
     {
         t_ilm_display screenId = screenArray[i];
 
@@ -431,9 +431,7 @@ void emptyScene(t_scene_data* pScene)
     pScene->layerScreen.clear();
     pScene->layerSurfaces.clear();
     pScene->layers.clear();
-    pScene->screenHeight;
     pScene->screenLayers.clear();
-    pScene->screenWidth;
     pScene->screens.clear();
     pScene->surfaceLayer.clear();
     pScene->surfaceProperties.clear();
@@ -442,7 +440,7 @@ void emptyScene(t_scene_data* pScene)
     t_ilm_uint count;
     t_ilm_display* screenArray;
     ilm_getScreenIDs(&count, &screenArray);
-    for(int i = 0 ; i < count ; ++i)
+    for(t_ilm_uint i = 0 ; i < count ; ++i)
     {
         pScene->screens.push_back(screenArray[i]);
         ilm_getScreenResolution(screenArray[0], & pScene->screenWidth, & pScene->screenHeight);
@@ -597,6 +595,8 @@ static t_scene_data* global_pOriginalScene = NULL;
 
 void interruptSignalRestoreScene(int s)
 {
+    (void) s;
+
     cout<<"LayerManagerControl :Interrupt signal...\n";
     if (global_pOriginalScene != NULL)
     {
index 8de18a6..78c546e 100644 (file)
@@ -44,6 +44,7 @@ bool gBenchmark_running;
 
 void benchmarkSigHandler(int sig)
 {
+    (void) sig;
     gBenchmark_running = false;
 }
 
index 56d2a57..228932d 100644 (file)
@@ -51,6 +51,8 @@ typedef void (*t_pDemoAnimatorFunc)(t_scene_data* pInitialScene, t_scene_data* p
 
 void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo)
 {
+    (void) pInitialScene; //suppress warning: unused varaible
+
     //get rendered surfaces
     vector<t_ilm_surface> renderedSurfaces = getSceneRenderOrder(pDemoScene);
 
@@ -70,9 +72,7 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
     }
 
     //make random speeds (in pixel)
-    t_ilm_int maxSpeed = 6;
     t_ilm_int minSpeed = 2;
-    t_ilm_int rangeSpeed = maxSpeed - minSpeed;
 
     srand((unsigned) time(0));
     map<t_ilm_surface, t_ilm_int> surfaceSpeed;
@@ -112,7 +112,6 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 surfaceProperties.destY + static_cast<int>(surfaceScale[surface] * surfaceProperties.destHeight));
 
         //make random X position to make surfaces spread in the screen
-        int screenWidthMidpoint = pDemoScene->screenWidth / 2;
         int surfaceWidth = coordinates.z - coordinates.x;
 
         //make a random X position so that the surface stays totally displayable inside the screen
@@ -137,7 +136,6 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
             t_ilm_surface surface = *it;
             ilmSurfaceProperties& properties = pDemoScene->surfaceProperties[surface];
             tuple4& coordinates = surfaceCoordinates[surface];
-            int speed = surfaceSpeed[surface];
 
             //if out: get back to screen
             if (coordinates.y >= static_cast<int>(pDemoScene->screenHeight))
@@ -188,6 +186,8 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
 
 void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo)
 {
+    (void) pInitialScene; //suppress warning: unused varaible
+
     //get rendered surfaces
     vector<t_ilm_surface> renderedSurfaces = getSceneRenderOrder(pDemoScene);
 
@@ -206,9 +206,7 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
     }
 
     //make random speeds (in pixel)
-    t_ilm_int maxSpeed = 12;
     t_ilm_int minSpeed = 2;
-    t_ilm_int rangeSpeed = maxSpeed - minSpeed;
 
     srand((unsigned) time(0));
     map<t_ilm_surface, t_ilm_int> surfaceSpeed;
@@ -246,7 +244,6 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
                 surfaceProperties.destY + static_cast<int>(surfaceScale[surface] * surfaceProperties.destHeight));
 
         //make random X position to make surfaces spread in the screen
-        int screenWidthMidpoint = pDemoScene->screenWidth / 2;
         int surfaceWidth = coordinates.z - coordinates.x;
 
         //make a random X position so that the surface stays totally displayable inside the screen
@@ -338,6 +335,8 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
 
 void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo)
 {
+    (void) pInitialScene; //suppress warning: unused varaible
+
     //get rendered surfaces
     vector<t_ilm_surface> renderedSurfaces = getSceneRenderOrder(pDemoScene);
 
@@ -356,9 +355,7 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
     }
 
     //make random speeds (in pixel)
-    t_ilm_int maxSpeed = 12;
     t_ilm_int minSpeed = 2;
-    t_ilm_int rangeSpeed = maxSpeed - minSpeed;
 
     srand((unsigned) time(0));
     map<t_ilm_surface, t_ilm_int> surfaceSpeed;
@@ -396,7 +393,6 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 surfaceProperties.destY + static_cast<int>(surfaceScale[surface] * surfaceProperties.destHeight));
 
         //make random X position to make surfaces spread in the screen
-        int screenWidthMidpoint = pDemoScene->screenWidth / 2;
         int surfaceWidth = coordinates.z - coordinates.x;
 
         //make a random X position so that the surface stays totally displayable inside the screen
@@ -421,7 +417,6 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
             t_ilm_surface surface = *it;
             ilmSurfaceProperties& properties = pDemoScene->surfaceProperties[surface];
             tuple4& coordinates = surfaceCoordinates[surface];
-            int speed = surfaceSpeed[surface];
 
             //if out: get back to screen
             if (coordinates.y >= static_cast<int>(pDemoScene->screenHeight))
@@ -483,6 +478,8 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
 
 void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo)
 {
+    (void) pInitialScene; //suppress warning: unused varaible
+
     //get rendered surfaces
     vector<t_ilm_surface> renderedSurfaces = getSceneRenderOrder(pDemoScene);
 
@@ -568,6 +565,7 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
 
 void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo)
 {
+    (void) pInitialScene; //suppress warning: unused varaible
     //get rendered surfaces
     vector<t_ilm_surface> renderedSurfaces = getSceneRenderOrder(pDemoScene);
 
@@ -576,7 +574,7 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
     int screenHorizontalMidpoint = pDemoScene->screenWidth / 2;
     int screenVerticalMidpoint = pDemoScene->screenHeight / 2;
 
-    for (int i = 0; i < renderedSurfaces.size(); ++i)
+    for (std::size_t i = 0; i < renderedSurfaces.size(); ++i)
     {
         t_ilm_surface surface = renderedSurfaces[i];
         ilmSurfaceProperties& surfaceProperties = pDemoScene->surfaceProperties[surface];
@@ -602,7 +600,7 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
 
     while (!*pStopDemo)
     {
-        for (int i = 0; i < renderedSurfaces.size(); ++i)
+        for (std::size_t i = 0; i < renderedSurfaces.size(); ++i)
         {
             t_ilm_surface surface = renderedSurfaces[i];
             ilmSurfaceProperties& surfaceProperties = pDemoScene->surfaceProperties[surface];
@@ -627,7 +625,7 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
                 ilm_commitChanges();
                 //update render order
                 t_ilm_surface firstSurface = renderedSurfaces[0];
-                for (int j = 1; j < renderedSurfaces.size(); ++j)
+                for (std::size_t j = 1; j < renderedSurfaces.size(); ++j)
                 {
                     renderedSurfaces[j - 1] = renderedSurfaces[j];
                 }
@@ -640,7 +638,7 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
             else
             {
                 //just some fancy function math that gives a special effect
-                scaleFactors[surface] = (1.0125, i + scaleFactors[surface] * 0.5);
+                scaleFactors[surface] = pow(1.2125, i * 0.85 + scaleFactors[surface] * 0.85);
 
                 int change = (int) scaleFactors[surface];
                 surfaceProperties.destX = max(0, (int) surfaceProperties.destX - change);
@@ -664,12 +662,15 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
     }
 }
 
+static vector<t_pDemoAnimatorFunc> animators;
+
 void* demoThreadCallback(void* param)
 {
     //call function on parameters
     map<string,void*>* paramMap = (map<string,void*>*) param;
 
-    t_pDemoAnimatorFunc animator = (t_pDemoAnimatorFunc) paramMap->at("pAnimator");
+    int* pAnimatorIndex = (int*) paramMap->at("pAnimatorIndex");
+    t_pDemoAnimatorFunc animator = animators[*pAnimatorIndex];
     t_scene_data* pInitialScene = (t_scene_data*) paramMap->at("pInitialScene");
     t_scene_data* pDemoScene = (t_scene_data*) paramMap->at("pDemoScene");
     bool*  pStopDemo= (bool*) paramMap->at("pStopDemo");
@@ -682,9 +683,9 @@ void* demoThreadCallback(void* param)
 
 } //end of anonymous namespace
 
-void demo(int mode)
+void demo(t_ilm_uint mode)
 {
-    vector<t_pDemoAnimatorFunc> animators;
+    animators.clear();
     animators.push_back(&demoAnimatorZooming);
     animators.push_back(&demoAnimatorCascadedZooming);
     animators.push_back(&demoAnimatorDownwards);
@@ -692,7 +693,7 @@ void demo(int mode)
     animators.push_back(&demoAnimatorWaterfall);
 
     //if valid mode entered
-    if (mode >= 0 && mode < animators.size())
+    if (mode < animators.size())
     {
         //capture initial scene
         t_scene_data initialScene;
@@ -708,7 +709,7 @@ void demo(int mode)
         volatile bool stopDemo = false;
 
         map<string, void*> paramMap;
-        paramMap["pAnimator"] = (void*) animators[mode];
+        paramMap["pAnimatorIndex"] = (void*) &mode;
         paramMap["pInitialScene"] = (void*) &initialScene;
         paramMap["pDemoScene"] = (void*) &demoScene;
         paramMap["pStopDemo"] = (void*) &stopDemo;
index 2bb22d6..c41e0ef 100644 (file)
@@ -93,7 +93,7 @@ void printScreenProperties(unsigned int screenid, const char* prefix)
 
     cout << prefix << "- layer render order:   ";
 
-    for (int layerIndex = 0; layerIndex < screenProperties.layerCount; ++layerIndex)
+    for (t_ilm_uint layerIndex = 0; layerIndex < screenProperties.layerCount; ++layerIndex)
     {
         t_ilm_layer layerid = screenProperties.layerIds[layerIndex];
         cout << layerid << "(0x" << hex << layerid << dec << "), ";
@@ -297,7 +297,7 @@ void printSurfaceProperties(unsigned int surfaceid, const char* prefix)
     int layerCount = 0;
     unsigned int* layerArray = NULL;
     ilm_getLayerIDs(&layerCount, &layerArray);
-    for (unsigned int layerIndex = 0; layerIndex < layerCount; ++layerIndex)
+    for (int layerIndex = 0; layerIndex < layerCount; ++layerIndex)
     {
         unsigned int layerid = layerArray[layerIndex];
         int surfaceCount = 0;
index 3757473..5c5caad 100644 (file)
@@ -122,7 +122,6 @@ void* scatterThreadCallback(void* param)
 void scatterHandleUserInput(t_scene_data* pOriginalScene, t_scene_data* pScatteredScene)
 {
     int n = pScatteredScene->surfaces.size();
-    int rows = ceil(sqrt(n));
     int cols = ceil(sqrt(n));
 
     //make keys map
index 3011a82..c8faafd 100644 (file)
@@ -187,12 +187,6 @@ void exportSceneToTXTHelper(ostream& stream, StringMapTree* tree, string prefix
     stream << prefix + "}";
 }
 
-void importSceneFromXMLHelper(istream& stream, StringMapTree* node)
-{
-
-}
-
-
 string decodeEscapesequences(string s)
 {
     map<string, string> code;
@@ -416,7 +410,7 @@ void createSceneContentsHelper(IlmLayer* pIlmlayer)
 
 void createSceneContentsHelper(IlmDisplay* pIlmdisplay)
 {
-    t_ilm_display displayId;
+    t_ilm_display displayId = 0xFFFFFFFF;
     pIlmdisplay->get("id", &displayId);
 
     list<IlmLayer*> layerList;
@@ -463,7 +457,7 @@ void createSceneContents(IlmScene* pIlmscene)
 
 void restoreSceneHelper(IlmSurface* pIlmsurface)
 {
-    t_ilm_surface surfaceId;
+    t_ilm_surface surfaceId = 0xFFFFFFFF;
     pIlmsurface->get("id", &surfaceId);
     ilmSurfaceProperties props = getSurfaceProperties(pIlmsurface);
 
@@ -487,7 +481,7 @@ void restoreSceneHelper(IlmSurface* pIlmsurface)
 
 void restoreSceneHelper(IlmLayer* pIlmlayer)
 {
-    t_ilm_layer layerId;
+    t_ilm_layer layerId = 0xFFFFFFFF;
     pIlmlayer->get("id", &layerId);
 
     ilmLayerProperties props = getLayerProperties(pIlmlayer);
@@ -636,8 +630,8 @@ void importSceneFromFile(string filename)
 
         if (extension == ".xml")
         {
-            importSceneFromXMLHelper(stream, &sceneTree);
-            cout << "DONE READING XML" << endl;
+//             importSceneFromXMLHelper(stream, &sceneTree);
+            cout << "READING XML IS NOT SUPPORTED YET" << endl;
         }
         else if (extension == ".txt")
         {
index 1e7f36e..a48acbb 100644 (file)
@@ -61,7 +61,7 @@ string rtrim(string s)
 
 string replaceAll(string s, string a, string b)
 {
-    int index = -b.size();
+    std::size_t index = -b.size();
 
     while ((index = s.find(a, index + b.size())) != string::npos)
     {
@@ -73,8 +73,7 @@ string replaceAll(string s, string a, string b)
 
 string replaceAll(string s, map<string, string> replacements)
 {
-    int index = 0;
-    for (int i = 0; i < s.size(); ++i)
+    for (std::size_t i = 0; i < s.size(); ++i)
     {
         for (map<string, string>::iterator it = replacements.begin(); it != replacements.end(); ++it)
         {
@@ -91,7 +90,7 @@ string replaceAll(string s, map<string, string> replacements)
 
 string replaceAll(string s, char a, char b)
 {
-    int index = -1;
+    std::size_t index = -1;
     while ((index = s.find(a, index + 1)) != string::npos)
     {
         s.replace(index, 1, string(1, b));
@@ -103,12 +102,12 @@ string replaceAll(string s, char a, char b)
 set<string> split(string s, char d)
 {
     set<string> result;
-    int start = 0;
+    std::size_t start = 0;
 
     while (start < s.size() && start != string::npos)
     {
         start = s.find_first_not_of(d, start);
-        int end = s.find(d, start);
+        std::size_t end = s.find(d, start);
         result.insert(s.substr(start, end - start));
 
         start = end;
index 63b0190..1bcd644 100644 (file)
@@ -73,7 +73,7 @@ t_ilm_bool initGlApplication(GLuint width, GLuint height)
 
     if (width <= height)
     {
-        glOrtho(-1.0, 1.0, 1.0 / aspectratio, 1.0 / aspectratio, 1.0, -1.0);
+        glOrtho(-1.0f, 1.0f, 1.0f / aspectratio, 1.0f / aspectratio, 1.0f, -1.0f);
     }
 
     glMatrixMode(GL_MODELVIEW);
@@ -107,8 +107,8 @@ void draw(t_ilm_uint animTime)
             IlmMatrixRotateZ(matrix, currentAngle);
             glLoadMatrixf(&matrix.f[0]);
 
-            float color[4] = { 1.0, 0.0, 1.0, 0.5 + (0.3 / (float) i) };
-            float lineColor[4] = { 0.0, 0.0, 0.0, 0.5 + (0.4 / (float) i) };
+            float color[4] = { 1.0f, 0.0f, 1.0f, 0.5f + (0.3f / (float) i) };
+            float lineColor[4] = { 0.0f, 0.0f, 0.0f, 0.5f + (0.4f / (float) i) };
 
             glBegin(GL_TRIANGLES);
 
index 1fb37a3..52c6ab0 100644 (file)
 #ifndef _DBUSCONFIGURATION_H_
 #define _DBUSCONFIGURATION_H_
 
-//=============================================================================
-// DBUS configuration
-//=============================================================================
+/*
+ * DBUS configuration
+ */
 #define DBUS_SERVICE_PREFIX             "org.genivi.layermanagementservice\0"
-//#define DBUS_SERVICE_OBJECT_PATH        "/org/genivi/layermanagementservice\0"
+/*#define DBUS_SERVICE_OBJECT_PATH        "/org/genivi/layermanagementservice\0" */
 #define DBUS_SERVICE_ERROR              "org.genivi.layermanagementservice.error"
 #define DBUS_RECEIVE_TIMEOUT_IN_MS      500
 
 #define ILM_SERVICE_NAME                "org.genivi.layermanagementservice"
-//#define ILM_PATH_COMPOSITE_SERVICE      "/org/genivi/layermanagementservice"
+/*#define ILM_PATH_COMPOSITE_SERVICE      "/org/genivi/layermanagementservice" */
 #define ILM_PATH_COMPOSITE_SERVICE      "/"
 #define ILM_INTERFACE_COMPOSITE_SERVICE "org.genivi.layermanagementservice"
 #define ILM_INTERFACE_COMPOSITE_CLIENT  "org.genivi.layermanagementclient"
 
 
-#endif // _DBUSCONFIGURATION_H_
+#endif /* _DBUSCONFIGURATION_H_ */
index 13a87e9..761a106 100644 (file)
@@ -23,7 +23,7 @@
 #include <dbus/dbus.h>
 
 
-// message filters
+/* message filters */
 
 DBusHandlerResult filterLogging(DBusConnection *connection, DBusMessage *message, void *data);
 DBusHandlerResult filterNameAcquired(DBusConnection *connection, DBusMessage *message, void *data);
@@ -35,11 +35,11 @@ DBusHandlerResult filterLayerManagerNotifications(DBusConnection *connection, DB
 DBusHandlerResult filterDiscardUnexpected(DBusConnection *connection, DBusMessage *message, void *data);
 
 
-// watches
+/* watches */
 
 dbus_bool_t addWatch(DBusWatch* watch, void* data);
 void removeWatch(DBusWatch* watch, void* data);
 void toggleWatch(DBusWatch* watch, void* data);
 
 
-#endif // _CALLBACKS_H_
+#endif /* _CALLBACKS_H_ */
index 7a273ad..859fc70 100644 (file)
 #include <pthread.h>
 
 
-//=============================================================================
-// data structures
-//=============================================================================
+/*
+ * =============================================================================
+ * data structures
+ * =============================================================================
+ */
 typedef struct
 {
     t_ilm_message_type type;
@@ -57,26 +59,33 @@ typedef struct
     int outgoingSocketsMax;
 } dbus;
 
-//=============================================================================
-// global variables
-//=============================================================================
+
+/*
+ * =============================================================================
+ * global variables
+ * =============================================================================
+ */
 dbus gDbus;
 dbusmessage* gpIncomingMessage;
 
-//=============================================================================
-// prototypes
-//=============================================================================
+/*
+ * =============================================================================
+ * prototypes
+ * =============================================================================
+ */
 void printTypeName(int type);
 void unregisterMessageFunc(DBusConnection* conn, void *user_data);
 t_ilm_bool appendString(t_ilm_message message, const char* value);
 t_ilm_bool getString(t_ilm_message message, char* value);
 t_ilm_bool sendToClients(t_ilm_message message, t_ilm_client_handle* receiverList, int receiverCount);
 
-//=============================================================================
-// callback functions
-//=============================================================================
+/*
+ * =============================================================================
+ * callback functions
+ * =============================================================================
+ */
 void callbackUnregister(DBusConnection *connection, void *user_data);
 DBusHandlerResult callbackMessage(DBusConnection *connection, DBusMessage *message, void *user_data);
 
 
-#endif // __COMMON_H__
+#endif /* __COMMON_H__ */
index 0de5544..39988d4 100644 (file)
@@ -21,7 +21,7 @@
 #include "DBUSConfiguration.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>  // memcpy
+#include <string.h>  /* memcpy */
 
 
 t_ilm_bool appendBool(t_ilm_message message, const t_ilm_bool value)
index 978e618..af70970 100644 (file)
 
 t_ilm_message createResponse(t_ilm_message);
 
-//=============================================================================
-// message filters
-//=============================================================================
-
+/*
+ * =============================================================================
+ * message filters
+ * =============================================================================
+ */
 DBusHandlerResult filterLayerManagerNotifications(DBusConnection *connection, DBusMessage *message, void *data)
 {
+    const char* interfaceName = dbus_message_get_interface(message);
+
+    DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    int messageType = dbus_message_get_type(message);
+
     (void)connection;
     (void)data;
 
-    const char* interfaceName = dbus_message_get_interface(message);
     if (!interfaceName)
     {
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
-    if (strcmp(ILM_INTERFACE_COMPOSITE_SERVICE, interfaceName)) // 0 == equals
+    if (strcmp(ILM_INTERFACE_COMPOSITE_SERVICE, interfaceName)) /* 0 == equals */
     {
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 
-    DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-    int messageType = dbus_message_get_type(message);
-
     if (gDbus.isClient && (messageType == DBUS_MESSAGE_TYPE_SIGNAL))
     {
         gpIncomingMessage->type = IpcMessageTypeNotification;
@@ -64,22 +66,23 @@ DBusHandlerResult filterLayerManagerNotifications(DBusConnection *connection, DB
 
 DBusHandlerResult filterLayerManagerCommands(DBusConnection *connection, DBusMessage *message, void *data)
 {
+    const char* interfaceName = dbus_message_get_interface(message);
+
+    DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    int messageType = dbus_message_get_type(message);
+
     (void)connection;
     (void)data;
 
-    const char* interfaceName = dbus_message_get_interface(message);
     if (!interfaceName)
     {
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
-    if (strcmp(ILM_INTERFACE_COMPOSITE_SERVICE, interfaceName)) // 0 == equals
+    if (strcmp(ILM_INTERFACE_COMPOSITE_SERVICE, interfaceName)) /* 0 == equals */
     {
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 
-    DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-    int messageType = dbus_message_get_type(message);
-
     if ((!gDbus.isClient && (messageType == DBUS_MESSAGE_TYPE_METHOD_CALL))
         || (gDbus.isClient && (messageType == DBUS_MESSAGE_TYPE_METHOD_RETURN)))
     {
@@ -97,22 +100,25 @@ DBusHandlerResult filterLayerManagerCommands(DBusConnection *connection, DBusMes
 
 DBusHandlerResult filterLayerManagerErrors(DBusConnection *connection, DBusMessage *message, void *data)
 {
+    const char* interfaceName = dbus_message_get_interface(message);
+
+    DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    int messageType = dbus_message_get_type(message);
+
+    char errorMsg[256];
+
     (void)connection;
     (void)data;
 
-    const char* interfaceName = dbus_message_get_interface(message);
     if (!interfaceName)
     {
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
-    if (strcmp(ILM_INTERFACE_COMPOSITE_SERVICE, interfaceName)) // 0 == equals
+    if (strcmp(ILM_INTERFACE_COMPOSITE_SERVICE, interfaceName)) /* 0 == equals */
     {
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 
-    DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-    int messageType = dbus_message_get_type(message);
-
     if (messageType == DBUS_MESSAGE_TYPE_ERROR)
     {
         gpIncomingMessage->pMessage = dbus_message_copy(message);
@@ -121,7 +127,6 @@ DBusHandlerResult filterLayerManagerErrors(DBusConnection *connection, DBusMessa
 
         dbus_message_iter_init(gpIncomingMessage->pMessage, &gpIncomingMessage->iter);
 
-        char errorMsg[256];
         getString(gpIncomingMessage, errorMsg);
         printf("DbusIpcModule: LayerManagerService returned error: %s\n", errorMsg);
 
@@ -211,27 +216,33 @@ DBusHandlerResult filterNameOwnerChanged(DBusConnection *connection, DBusMessage
 
 DBusHandlerResult filterIntrospection(DBusConnection *connection, DBusMessage *message, void *data)
 {
+    char introspectionString[65536];
+
+    t_ilm_message introspectionResponse;
+    t_ilm_client_handle sender;
+
     (void)connection;
     (void)data;
 
     if (dbus_message_is_method_call(message, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
     {
         gpIncomingMessage->pMessage = dbus_message_copy(message);
-        gpIncomingMessage->type = IpcMessageTypeNone; // none for client
+        gpIncomingMessage->type = IpcMessageTypeNone; /* none for client */
         gpIncomingMessage->dbusNativeType = DBUS_MESSAGE_TYPE_METHOD_CALL;
         gpIncomingMessage->dbusSerial = dbus_message_get_serial(message);
 
-        // generate introspection response content
-        char introspectionString[65536];
+        /* generate introspection response content */
         memset(introspectionString, 0, sizeof(introspectionString));
         generateIntrospectionString(introspectionString);
 
-        // create and send introspection reply
-        // note: we're in dispatch, so mutex is currently locked in this thread
+        /*
+         * create and send introspection reply
+         * note: we're in dispatch, so mutex is currently locked in this thread
+         */
         pthread_mutex_unlock(&gDbus.mutex);
-        t_ilm_message introspectionResponse = createResponse(gpIncomingMessage);
+        introspectionResponse = createResponse(gpIncomingMessage);
         appendString(introspectionResponse, introspectionString);
-        t_ilm_client_handle sender = (t_ilm_client_handle)dbus_message_get_sender(gpIncomingMessage->pMessage);
+        sender = (t_ilm_client_handle)dbus_message_get_sender(gpIncomingMessage->pMessage);
         sendToClients(introspectionResponse, &sender, 1);
         pthread_mutex_lock(&gDbus.mutex);
 
@@ -241,17 +252,18 @@ DBusHandlerResult filterIntrospection(DBusConnection *connection, DBusMessage *m
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
-//=============================================================================
-// watches
-//=============================================================================
-
+/*
+ * =============================================================================
+ * watches
+ * =============================================================================
+ */
 dbus_bool_t addWatch(DBusWatch* watch, void* data)
 {
-    (void)data;
-
     int sock = dbus_watch_get_unix_fd(watch);
     int flags = dbus_watch_get_flags(watch);
 
+    (void)data;
+
     if (flags & DBUS_WATCH_READABLE)
     {
         gDbus.incomingWatch[sock] = watch;
@@ -281,11 +293,11 @@ dbus_bool_t addWatch(DBusWatch* watch, void* data)
 
 void removeWatch(DBusWatch* watch, void* data)
 {
-    (void)data;
-
     int sock = dbus_watch_get_unix_fd(watch);
     int flags = dbus_watch_get_flags(watch);
 
+    (void)data;
+
     if (flags & DBUS_WATCH_READABLE)
     {
         FD_CLR(sock, &gDbus.incomingSockets);
index 44deebf..c6b325a 100644 (file)
@@ -21,7 +21,7 @@
 #include "DBUSConfiguration.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>  // memcpy
+#include <string.h>  /* memcpy */
 
 
 t_ilm_bool appendDouble(t_ilm_message message, const t_ilm_float value)
index e58c9d9..5745b27 100644 (file)
 #include <dbus/dbus.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h> // memset
+#include <string.h> /* memset */
 
 
-//=============================================================================
-// prototypes
-//=============================================================================
+/*
+ *=============================================================================
+ * prototypes
+ *=============================================================================
+ */
 t_ilm_bool initService();
 t_ilm_bool destroyClient();
 t_ilm_bool destroyService();
 
 
-//=============================================================================
-// setup
-//=============================================================================
+/*
+ *=============================================================================
+ * setup
+ *=============================================================================
+ */
 t_ilm_bool initServiceMode()
 {
+    char* useSessionBus;
+    int ret;
+
+    const char* rule = "type='signal',"
+                           "sender='"DBUS_INTERFACE_DBUS"',"
+                           "interface='"DBUS_INTERFACE_DBUS"',"
+                           "member='NameOwnerChanged'";
+
     memset(&gDbus, 0, sizeof(gDbus));
 
     gDbus.initialized = ILM_FALSE;
@@ -48,7 +60,7 @@ t_ilm_bool initServiceMode()
 
     dbus_error_init(&gDbus.error);
 
-    char* useSessionBus = getenv("LM_USE_SESSION_BUS");
+    useSessionBus = getenv("LM_USE_SESSION_BUS");
     if (useSessionBus && strcmp(useSessionBus, "enable") == 0 )
     {
         gDbus.type = DBUS_BUS_SESSION;
@@ -74,7 +86,7 @@ t_ilm_bool initServiceMode()
     if (!gDbus.isClient)
     {
         printf("DbusIpcmodule: registering dbus address %s\n", DBUS_SERVICE_PREFIX);
-        int ret = dbus_bus_request_name(gDbus.connection, DBUS_SERVICE_PREFIX, DBUS_NAME_FLAG_REPLACE_EXISTING, &gDbus.error);
+        ret = dbus_bus_request_name(gDbus.connection, DBUS_SERVICE_PREFIX, DBUS_NAME_FLAG_REPLACE_EXISTING, &gDbus.error);
 
         if (dbus_error_is_set(&gDbus.error))
         {
@@ -89,11 +101,6 @@ t_ilm_bool initServiceMode()
             gDbus.initialized = ILM_FALSE;
         }
 
-        const char* rule = "type='signal',"
-                           "sender='"DBUS_INTERFACE_DBUS"',"
-                           "interface='"DBUS_INTERFACE_DBUS"',"
-                           "member='NameOwnerChanged'";
-
         dbus_bus_add_match(gDbus.connection, rule, &gDbus.error);
         if (dbus_error_is_set(&gDbus.error))
         {
@@ -164,6 +171,8 @@ t_ilm_bool initServiceMode()
 
 t_ilm_bool initClientMode()
 {
+    char* useSessionBus;
+
     memset(&gDbus, 0, sizeof(gDbus));
 
     gDbus.initialized = ILM_FALSE;
@@ -173,7 +182,7 @@ t_ilm_bool initClientMode()
 
     dbus_error_init(&gDbus.error);
 
-    char* useSessionBus = getenv("LM_USE_SESSION_BUS");
+    useSessionBus = getenv("LM_USE_SESSION_BUS");
     if (useSessionBus && strcmp(useSessionBus, "enable") == 0 )
     {
         gDbus.type = DBUS_BUS_SESSION;
@@ -287,15 +296,24 @@ t_ilm_bool destroy()
 }
 
 
-//=============================================================================
-// service specific
-//=============================================================================
+/*
+ *=============================================================================
+ * service specific
+ *=============================================================================
+ */
 t_ilm_bool destroyService()
 {
     DBusError err;
+    t_ilm_bool errorset;
+
+    const char* rule = "type='signal',"
+                       "sender='"DBUS_INTERFACE_DBUS"',"
+                       "interface='"DBUS_INTERFACE_DBUS"',"
+                       "member='NameOwnerChanged'";
+
     dbus_error_init(&err);
 
-    t_ilm_bool errorset = dbus_error_is_set(&err);
+    errorset = dbus_error_is_set(&err);
     if (errorset)
     {
         printf("DbusIpcmodule: there was an dbus error\n");
@@ -303,28 +321,23 @@ t_ilm_bool destroyService()
 
     dbus_bus_name_has_owner(gDbus.connection, DBUS_SERVICE_PREFIX, &err);
     errorset = dbus_error_is_set(&err);
-    
+
     if (errorset)
     {
         printf("DbusIpcmodule: there was an dbus error\n");
     }
 
     dbus_error_init(&err);
-    
-    const char* rule = "type='signal',"
-                       "sender='"DBUS_INTERFACE_DBUS"',"
-                       "interface='"DBUS_INTERFACE_DBUS"',"
-                       "member='NameOwnerChanged'";
 
     dbus_bus_remove_match(gDbus.connection, rule, &err);
 
     errorset = dbus_error_is_set(&err);
-    
+
     if (errorset)
     {
         printf("DbusIpcmodule: there was an dbus error\n");
     }
-    
+
     dbus_error_init(&err);
     dbus_bus_release_name(gDbus.connection, DBUS_SERVICE_PREFIX, &err);
 
@@ -332,13 +345,14 @@ t_ilm_bool destroyService()
 }
 
 
-//=============================================================================
-// client specific
-//=============================================================================
-
+/*
+ *=============================================================================
+ * client specific
+ *=============================================================================
+ */
 t_ilm_bool destroyClient()
 {
-    // private dbus connection must be closed
+    /* private dbus connection must be closed */
     if (dbus_connection_get_is_connected(gDbus.connection))
     {
         dbus_connection_close(gDbus.connection);
index 75b03a5..c113609 100644 (file)
@@ -21,7 +21,7 @@
 #include "DBUSConfiguration.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>  // memcpy
+#include <string.h>  /* memcpy */
 
 
 t_ilm_bool appendInt(t_ilm_message message, const t_ilm_int value)
@@ -36,10 +36,10 @@ t_ilm_bool appendIntArray(t_ilm_message message, const int* valueArray, int arra
     t_ilm_bool returnValue = ILM_FALSE;
     char signature[2] = { DBUS_TYPE_UINT32, 0 };
     DBusMessageIter arrayIter;
+    t_ilm_int index = 0;
 
     returnValue = dbus_message_iter_open_container(&msg->iter, DBUS_TYPE_ARRAY, signature, &arrayIter);
 
-    t_ilm_int index = 0;
     for (index = 0; index < arraySize; ++index)
     {
         returnValue &= dbus_message_iter_append_basic(&arrayIter, DBUS_TYPE_INT32, &valueArray[index]);
@@ -57,13 +57,13 @@ t_ilm_bool getIntArray(t_ilm_message message, t_ilm_int** valueArray, t_ilm_int*
 
     t_ilm_int type = dbus_message_iter_get_arg_type(&msg->iter);
 
+    DBusMessageIter arrayIter;
+    int index = 0;
+
     if (DBUS_TYPE_ARRAY == type)
     {
         returnValue = ILM_TRUE;
 
-        DBusMessageIter arrayIter;
-        int index = 0;
-
         dbus_message_iter_recurse(&msg->iter, &arrayIter);
 
         while (DBUS_TYPE_INVALID != dbus_message_iter_get_arg_type(&arrayIter))
index 605a3d1..297cc95 100644 (file)
  ****************************************************************************/
 #include "introspection.h"
 #include "DBUSConfiguration.h"
-#include <string.h>  // memset
-#include <stdio.h>  // sprintf
-
-//=============================================================================
-// internal data types
-//=============================================================================
+#include <string.h>  /* memset */
+#include <stdio.h>  /* sprintf */
+
+/*
+ * =============================================================================
+ * internal data types
+ * =============================================================================
+ */
 struct IntrospectionTable
 {
     const char *name;
@@ -32,9 +34,11 @@ struct IntrospectionTable
     const char *reply;
 };
 
-//=============================================================================
-// internal prototypes
-//=============================================================================
+/*
+ * =============================================================================
+ * internal prototypes
+ * =============================================================================
+ */
 void generateString();
 unsigned int addHeader(char* msgBuffer);
 unsigned int openNode(char* msgBuffer, const char* nodename);
@@ -47,12 +51,14 @@ unsigned int closeInterface(char* msgBuffer);
 unsigned int closeNode(char* msgBuffer);
 
 
-//=============================================================================
-// implementation
-//=============================================================================
+/*
+ * =============================================================================
+ * implementation
+ * =============================================================================
+ */
 void generateIntrospectionString(char* msgBuffer)
 {
-    //LOG_DEBUG("DBUSCommunicator", "Generating introspection data");
+    /*LOG_DEBUG("DBUSCommunicator", "Generating introspection data"); */
 
     /* Introspection is a special feature of the DBUS IpcModule, which other
      * IpcModules do (most likely) not have.
@@ -140,6 +146,9 @@ void generateIntrospectionString(char* msgBuffer)
     };
 
     int introspectionInterfaceCount = sizeof(introspectionInterface) / sizeof(struct IntrospectionTable);
+    int index = 0;
+
+    int i = 0;
 
     msgBuffer += addHeader(msgBuffer);
     msgBuffer += openNode(msgBuffer, DBUS_SERVICE_PREFIX);
@@ -150,8 +159,6 @@ void generateIntrospectionString(char* msgBuffer)
     msgBuffer += closeInterface(msgBuffer);
     msgBuffer += openInterface(msgBuffer, DBUS_SERVICE_PREFIX);
 
-    int index = 0;
-
     for (index = 0; index < introspectionInterfaceCount; ++index)
     {
         struct IntrospectionTable* method = &introspectionInterface[index];
@@ -164,7 +171,6 @@ void generateIntrospectionString(char* msgBuffer)
 
         msgBuffer += openMethod(msgBuffer, methodName);
 
-        int i = 0;
         for(i = 0; i < parameterLength; ++i)
         {
             switch (parameter[i])
index 9385abd..f54eee5 100644 (file)
 #include "introspection.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h> // strdup
+#include <string.h> /* strdup */
 #include <errno.h>
 
-//=============================================================================
-// prototypes internal functions
-//=============================================================================
+/*
+ * =============================================================================
+ * prototypes internal functions
+ * =============================================================================
+ */
 void handleWatchesForFds(fd_set in, fd_set out);
 t_ilm_bool dispatchIncomingMessages();
 
 void registerSignalForNotification(dbusmessage* message, char* signalName);
 void unregisterSignalForNotification(dbusmessage* message, char* signalName);
 
-//=============================================================================
-// message handling
-//=============================================================================
+/*
+ * =============================================================================
+ * message handling
+ * =============================================================================
+ */
 t_ilm_message createMessage(t_ilm_const_string name)
 {
+    dbusmessage* newMessage = NULL;
+
     if (!gDbus.initialized)
     {
         return 0;
     }
 
-    dbusmessage* newMessage = (dbusmessage*)malloc(sizeof(dbusmessage));
+    newMessage = (dbusmessage*)malloc(sizeof(dbusmessage));
     newMessage->type = IpcMessageTypeCommand;
     newMessage->dbusNativeType = DBUS_MESSAGE_TYPE_METHOD_CALL;
     pthread_mutex_lock(&gDbus.mutex);
@@ -59,12 +65,17 @@ t_ilm_message createMessage(t_ilm_const_string name)
 
 t_ilm_message createResponse(t_ilm_message message)
 {
+    dbusmessage* receivedMessage;
+    dbusmessage* newResponse;
+    const char* member = NULL;
+    const char* destination = NULL;
+
     if (!gDbus.initialized)
     {
         return NULL;
     }
-    dbusmessage* receivedMessage = (dbusmessage*)message;
-    dbusmessage* newResponse = (dbusmessage*)malloc(sizeof(dbusmessage));
+    receivedMessage = (dbusmessage*)message;
+    newResponse = (dbusmessage*)malloc(sizeof(dbusmessage));
 
     newResponse->type = IpcMessageTypeCommand;
     newResponse->dbusNativeType = DBUS_MESSAGE_TYPE_METHOD_RETURN;
@@ -73,8 +84,8 @@ t_ilm_message createResponse(t_ilm_message message)
     newResponse->pMessage = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
     pthread_mutex_unlock(&gDbus.mutex);
 
-    const char* member = dbus_message_get_member(receivedMessage->pMessage);
-    const char* destination = dbus_message_get_sender(receivedMessage->pMessage);
+    member = dbus_message_get_member(receivedMessage->pMessage);
+    destination = dbus_message_get_sender(receivedMessage->pMessage);
     dbus_message_set_member(newResponse->pMessage, member);
     dbus_message_set_destination(newResponse->pMessage, destination);
     dbus_message_set_reply_serial(newResponse->pMessage, receivedMessage->dbusSerial);
@@ -85,13 +96,18 @@ t_ilm_message createResponse(t_ilm_message message)
 
 t_ilm_message createErrorResponse(t_ilm_message message)
 {
+    dbusmessage* receivedMessage;
+    dbusmessage* newResponse;
+    char member[256];
+    char destination[256];
+
     if (!gDbus.initialized)
     {
         return 0;
     }
 
-    dbusmessage* receivedMessage = (dbusmessage*)message;
-    dbusmessage* newResponse = (dbusmessage*)malloc(sizeof(dbusmessage));
+    receivedMessage = (dbusmessage*)message;
+    newResponse = (dbusmessage*)malloc(sizeof(dbusmessage));
     memset(newResponse, 0, sizeof(dbusmessage));
 
     newResponse->type = IpcMessageTypeError;
@@ -101,8 +117,8 @@ t_ilm_message createErrorResponse(t_ilm_message message)
     newResponse->pMessage = dbus_message_new(DBUS_MESSAGE_TYPE_ERROR);
     pthread_mutex_unlock(&gDbus.mutex);
 
-    const char* member = dbus_message_get_member(receivedMessage->pMessage);
-    const char* destination = dbus_message_get_sender(receivedMessage->pMessage);
+    strcpy(member, dbus_message_get_member(receivedMessage->pMessage));
+    strcpy(destination, dbus_message_get_sender(receivedMessage->pMessage));
     dbus_message_set_member(newResponse->pMessage, member);
     dbus_message_set_destination(newResponse->pMessage, destination);
     dbus_message_set_error_name(newResponse->pMessage, DBUS_SERVICE_ERROR);
@@ -114,12 +130,14 @@ t_ilm_message createErrorResponse(t_ilm_message message)
 
 t_ilm_message createNotification(t_ilm_const_string name)
 {
+    dbusmessage* newNotification;
+
     if (!gDbus.initialized)
     {
         return 0;
     }
 
-    dbusmessage* newNotification = (dbusmessage*)malloc(sizeof(dbusmessage));
+    newNotification = (dbusmessage*)malloc(sizeof(dbusmessage));
 
     newNotification->type = IpcMessageTypeNotification;
     newNotification->dbusNativeType = DBUS_MESSAGE_TYPE_SIGNAL;
@@ -139,6 +157,10 @@ t_ilm_message createNotification(t_ilm_const_string name)
 
 t_ilm_bool sendToClients(t_ilm_message message, t_ilm_client_handle* receiverList, int receiverCount)
 {
+    dbusmessage* messageToSend;
+    t_ilm_uint serial;
+    dbus_bool_t success;
+
     (void)receiverList;
     (void)receiverCount;
 
@@ -147,13 +169,13 @@ t_ilm_bool sendToClients(t_ilm_message message, t_ilm_client_handle* receiverLis
         return ILM_FALSE;
     }
 
-    dbusmessage* messageToSend = (dbusmessage*)message;
-    t_ilm_uint serial = dbus_message_get_serial(messageToSend->pMessage);
+    messageToSend = (dbusmessage*)message;
+    serial = dbus_message_get_serial(messageToSend->pMessage);
 
     dbus_message_set_path(messageToSend->pMessage, ILM_PATH_COMPOSITE_SERVICE);
     dbus_message_set_interface(messageToSend->pMessage, ILM_INTERFACE_COMPOSITE_SERVICE);
     pthread_mutex_lock(&gDbus.mutex);
-    dbus_bool_t success = dbus_connection_send(gDbus.connection, messageToSend->pMessage, &serial);
+    success = dbus_connection_send(gDbus.connection, messageToSend->pMessage, &serial);
     pthread_mutex_unlock(&gDbus.mutex);
     if (!success)
     {
@@ -166,15 +188,20 @@ t_ilm_bool sendToClients(t_ilm_message message, t_ilm_client_handle* receiverLis
 
 t_ilm_bool sendToService(t_ilm_message message)
 {
+    dbusmessage* messageToSend;
+    t_ilm_uint serial;
+    dbus_bool_t success;
+    char msgName[256];
+
     if (!gDbus.isClient)
     {
         return ILM_FALSE;
     }
 
-    dbusmessage* messageToSend = (dbusmessage*)message;
-    t_ilm_uint serial = 1;
+    messageToSend = (dbusmessage*)message;
+    serial = 1;
     pthread_mutex_lock(&gDbus.mutex);
-    dbus_bool_t success = dbus_connection_send(gDbus.connection, messageToSend->pMessage, &serial);
+    success = dbus_connection_send(gDbus.connection, messageToSend->pMessage, &serial);
     pthread_mutex_unlock(&gDbus.mutex);
     if (!success)
     {
@@ -182,7 +209,7 @@ t_ilm_bool sendToService(t_ilm_message message)
         exit(1);
     }
 
-    const char* msgName = dbus_message_get_member(messageToSend->pMessage);
+    strcpy(msgName, dbus_message_get_member(messageToSend->pMessage));
 
     if (0 == strcmp(msgName, "LayerAddNotification"))
     {
@@ -209,6 +236,11 @@ t_ilm_bool sendToService(t_ilm_message message)
 
 t_ilm_message receive(t_ilm_int timeoutInMs)
 {
+    fd_set readFds;
+    fd_set writeFds;
+    int fdMax;
+    int fdsReady;
+
     gpIncomingMessage = (dbusmessage*)malloc(sizeof(dbusmessage));
     memset(gpIncomingMessage, 0, sizeof(dbusmessage));
 
@@ -222,12 +254,12 @@ t_ilm_message receive(t_ilm_int timeoutInMs)
         return (t_ilm_message)gpIncomingMessage;
     }
 
-    fd_set readFds = gDbus.incomingSockets;
-    fd_set writeFds = gDbus.outgoingSockets;
-    int fdMax = (gDbus.incomingSocketsMax > gDbus.outgoingSocketsMax) ?
+    readFds = gDbus.incomingSockets;
+    writeFds = gDbus.outgoingSockets;
+    fdMax = (gDbus.incomingSocketsMax > gDbus.outgoingSocketsMax) ?
                  gDbus.incomingSocketsMax : gDbus.outgoingSocketsMax;
 
-    int fdsReady = 0;
+    fdsReady = 0;
 
     if (timeoutInMs < 0)
     {
@@ -243,15 +275,15 @@ t_ilm_message receive(t_ilm_int timeoutInMs)
 
     switch (fdsReady)
     {
-    case -1: // error: select was cancelled -> shutdown
+    case -1: /* error: select was cancelled -> shutdown */
         gpIncomingMessage->type = IpcMessageTypeShutdown;
         break;
 
-    case 0: // timeout
+    case 0: /* timeout */
         gpIncomingMessage->type = IpcMessageTypeNone;
         break;
 
-    default: // message or shutdown
+    default: /* message or shutdown */
         handleWatchesForFds(readFds, writeFds);
         dispatchIncomingMessages();
         break;
@@ -280,13 +312,13 @@ t_ilm_const_string getSenderName(t_ilm_message message)
 
 t_ilm_client_handle getSenderHandle(t_ilm_message message)
 {
-    t_ilm_uint result = 0;
+    unsigned long result = 0;
 
     const char* sender = getSenderName(message);
     if (sender)
     {
         float f = atof(&sender[1]);
-        result = (t_ilm_uint)(f * 1000000);
+        result = (unsigned long)(f * 1000000);
     };
     return (t_ilm_client_handle)result;
 }
@@ -304,23 +336,28 @@ t_ilm_bool destroyMessage(t_ilm_message message)
     return ILM_TRUE;
 }
 
-//=============================================================================
-// prototypes internal functions
-//=============================================================================
+/*
+ * =============================================================================
+ * prototypes internal functions
+ * =============================================================================
+ */
 void handleWatchesForFds(fd_set in, fd_set out)
 {
     int fd = 0;
+    dbus_bool_t success;
 
     for (fd = 0; fd < gDbus.incomingSocketsMax; ++fd)
     {
+        DBusWatch* activeWatch;
+
         if (FD_ISSET(fd, &in))
         {
-            DBusWatch* activeWatch = gDbus.incomingWatch[fd];
+            activeWatch = gDbus.incomingWatch[fd];
 
             if (activeWatch)
             {
                 pthread_mutex_lock(&gDbus.mutex);
-                dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_READABLE);
+                success = dbus_watch_handle(activeWatch, DBUS_WATCH_READABLE);
                 pthread_mutex_unlock(&gDbus.mutex);
 
                 if (!success)
@@ -337,14 +374,16 @@ void handleWatchesForFds(fd_set in, fd_set out)
 
     for (fd = 0; fd < gDbus.outgoingSocketsMax; ++fd)
     {
+        DBusWatch* activeWatch;
+
         if (FD_ISSET(fd, &out))
         {
-            DBusWatch* activeWatch = gDbus.outgoingWatch[fd];
+            activeWatch = gDbus.outgoingWatch[fd];
 
             if (activeWatch)
             {
                 pthread_mutex_lock(&gDbus.mutex);
-                dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_WRITABLE);
+                success = dbus_watch_handle(activeWatch, DBUS_WATCH_WRITABLE);
                 pthread_mutex_unlock(&gDbus.mutex);
 
                 if (!success)
@@ -388,11 +427,13 @@ void registerSignalForNotification(dbusmessage* message, char* signalName)
             signalName,
             id);
 
-    // do not block here, race condition with receive thread.
-    // according to dbus documentation almost impossible to fail
-    // (only if out of memory)
-    // if result is important, create method call manually
-    // and use main loop for communication
+    /*
+     * do not block here, race condition with receive thread.
+     * according to dbus documentation almost impossible to fail
+     * (only if out of memory)
+     * if result is important, create method call manually
+     * and use main loop for communication
+     */
     pthread_mutex_lock(&gDbus.mutex);
     dbus_bus_add_match(gDbus.connection, rule, NULL);
     pthread_mutex_unlock(&gDbus.mutex);
@@ -414,11 +455,13 @@ void unregisterSignalForNotification(dbusmessage* message, char* signalName)
             signalName,
             id);
 
-    // do not block here, race condition with receive thread.
-    // according to dbus documentation almost impossible to fail
-    // (only if out of memory)
-    // if result is important, create method call manually
-    // and use main loop for communication
+    /*
+     * do not block here, race condition with receive thread.
+     * according to dbus documentation almost impossible to fail
+     * (only if out of memory)
+     * if result is important, create method call manually
+     * and use main loop for communication
+     */
     pthread_mutex_lock(&gDbus.mutex);
     dbus_bus_remove_match(gDbus.connection, rule, NULL);
     pthread_mutex_unlock(&gDbus.mutex);
@@ -426,9 +469,11 @@ void unregisterSignalForNotification(dbusmessage* message, char* signalName)
 
 
 
-//=============================================================================
-// print debug information
-//=============================================================================
+/*
+ * =============================================================================
+ * print debug information
+ * =============================================================================
+ */
 void printTypeName(int type)
 {
     switch (type)
index 68bfbea..590beaa 100644 (file)
@@ -21,7 +21,7 @@
 #include "DBUSConfiguration.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>  // memcpy
+#include <string.h>  /* memcpy */
 
 
 t_ilm_bool appendString(t_ilm_message message, const char* value)
@@ -40,9 +40,10 @@ t_ilm_bool getString(t_ilm_message message, char* value)
     if (DBUS_TYPE_STRING == type)
     {
         char* tmp = NULL;
+        int len;
         dbus_message_iter_get_basic(&msg->iter, &tmp);
         dbus_message_iter_next(&msg->iter);
-        int len = strlen(tmp);
+        len = strlen(tmp);
         strncpy(value, tmp, len);
         value[len] = '\0';
         returnValue = ILM_TRUE;
index dc515ec..330aa46 100644 (file)
@@ -21,7 +21,7 @@
 #include "DBUSConfiguration.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>  // memcpy
+#include <string.h>  /* memcpy */
 
 t_ilm_bool appendUint(t_ilm_message message, const t_ilm_uint value)
 {
@@ -35,10 +35,10 @@ t_ilm_bool appendUintArray(t_ilm_message message, const t_ilm_uint* valueArray,
     t_ilm_bool returnValue = ILM_FALSE;
     char signature[2] = { DBUS_TYPE_UINT32, 0 };
     DBusMessageIter arrayIter;
+    t_ilm_int index = 0;
 
     returnValue = dbus_message_iter_open_container(&msg->iter, DBUS_TYPE_ARRAY, signature, &arrayIter);
 
-    t_ilm_int index = 0;
     for (index = 0; index < arraySize; ++index)
     {
         returnValue &= dbus_message_iter_append_basic(&arrayIter, DBUS_TYPE_UINT32, &valueArray[index]);
@@ -58,17 +58,17 @@ t_ilm_bool getUintArray(t_ilm_message message, t_ilm_uint** valueArray, t_ilm_in
 
     if (DBUS_TYPE_ARRAY == type)
     {
-        returnValue = ILM_TRUE;
+        t_ilm_uint* dbusArrayPointer = NULL;
 
         DBusMessageIter arrayIter;
+        returnValue = ILM_TRUE;
 
         dbus_message_iter_recurse(&msg->iter, &arrayIter);
 
-        // get pointer to dbus internal array data (zero copy)
-        t_ilm_uint* dbusArrayPointer = NULL;
+        /* get pointer to dbus internal array data (zero copy) */
         dbus_message_iter_get_fixed_array(&arrayIter, &dbusArrayPointer, arraySize);
 
-        // create callers buffer, copy data to buffer
+        /* create callers buffer, copy data to buffer */
         *valueArray = malloc(sizeof(t_ilm_uint) * (*arraySize));
         memcpy(*valueArray, dbusArrayPointer, sizeof(t_ilm_uint) * (*arraySize));
 
index 0ce9095..e176fc6 100644 (file)
@@ -65,7 +65,7 @@ bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
                     int count = surface->OriginalSourceWidth*surface->OriginalSourceHeight;
                     for (int j=0;j<count; j++)
                     {
-                        xim->data[j*4+3]=255;
+                        xim->data[j*4+3] = (char)255;
                     }
                 }
             } else {
index 253ba2e..fcc1d5d 100644 (file)
@@ -74,8 +74,8 @@ void writeBitmap(std::string FileName, char* imagedataRGB, int width, int height
     header.color2 = 0;
 
     // make sure parent directory exists
-    uint currentPos = 0;
-    uint lastPos = FileName.find_first_of("/",currentPos);
+    std::size_t currentPos = 0;
+    std::size_t lastPos = FileName.find_first_of("/",currentPos);
     while (lastPos != std::string::npos)
     {
         std::string directory = FileName.substr(0,lastPos);
index e2997f3..1575559 100644 (file)
@@ -229,6 +229,11 @@ void Log::unregisterDiagnosticInjectionCallback( unsigned int module_id )
 
 
 #ifdef WITH_DLT    
+
+// DLT macros will fail using -pedantic with
+// warning: ISO C++ forbids braced-groups within expressions
+#pragma GCC diagnostic ignored "-pedantic"
+
 void Log::LogToDltDaemon(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output)
 {
     
index a393939..0aed1e9 100644 (file)
@@ -39,10 +39,10 @@ endif (WITH_STATIC_LIBRARIES)
 #==============================================================================
 # default compiler flags
 #==============================================================================
-set (COMPILER_FLAGS_3RDPARTY "-fPIC")
-set (COMPILER_FLAGS_TEST     "-fPIC")
+set (COMPILER_FLAGS_3RDPARTY "-fPIC -Wno-variadic-macros -Wno-sign-compare")
+set (COMPILER_FLAGS_TEST     "-fPIC -Wno-variadic-macros -Wno-sign-compare")
 set (COMPILER_FLAGS_EXAMPLE  "-fPIC -Wall -Wextra")
-set (COMPILER_FLAGS_PLUGIN   "-fPIC -Wall -Wextra -pedantic -Wno-long-long")
+set (COMPILER_FLAGS_PLUGIN   "-fPIC -Wall -Wextra -pedantic -Wno-long-long -Wno-unused-function")
 set (COMPILER_FLAGS_CORE     "-fPIC -Wall -Wextra -pedantic -Wno-long-long -Wno-unused-function")