[clutter-box2d] examples: Fix compiler warnings



commit fe7ea3afae279eede6c7d08cf51a8b2f0b1becc0
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Wed May 25 09:14:32 2011 +0100

    examples: Fix compiler warnings

 examples/actor-manipulator.c    |   28 ++++++++++++++--------------
 examples/blockbox.c             |    5 +++++
 examples/popup.c                |    7 ++-----
 examples/scene-distance-joint.c |    6 +-----
 4 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/examples/actor-manipulator.c b/examples/actor-manipulator.c
index 3ada3f1..5253c03 100644
--- a/examples/actor-manipulator.c
+++ b/examples/actor-manipulator.c
@@ -8,14 +8,14 @@
 
 typedef enum
 {
-  None,
-  Direct
+  NONE,
+  DIRECT
 #ifdef BOX2D_MANIPULATION
-  , Box2D
+  , BOX2D
 #endif
 } ManipulationMode;
 
-static ManipulationMode  mode              = None;
+static ManipulationMode  mode              = NONE;
 static ClutterActor     *manipulated_actor = NULL;
 static gfloat       orig_x, orig_y;
 static gfloat       start_x, start_y;
@@ -375,7 +375,7 @@ actor_manipulator_press (ClutterActor *stage,
     &start_x, &start_y);
 
 
-  mode = Direct;
+  mode = DIRECT;
 
 
 #ifdef BOX2D_MANIPULATION
@@ -400,7 +400,7 @@ actor_manipulator_press (ClutterActor *stage,
                                                          manipulated_actor,
                                                          &target);
 #endif
-            mode = None; /*Box2D;*/
+            mode = NONE; /*Box2D;*/
             manipulated_actor = NULL;
             return FALSE;
         }
@@ -437,7 +437,7 @@ actor_manipulator_motion (ClutterActor *stage,
       switch (mode)
         {
 #ifdef BOX2D_MANIPULATION
-          case Box2D:
+          case BOX2D:
           {
             ClutterVertex target = { x, y };
             clutter_box2d_mouse_joint_update_target (mouse_joint, &target);
@@ -445,7 +445,7 @@ actor_manipulator_motion (ClutterActor *stage,
           }
 #endif
 
-          case Direct:
+          case DIRECT:
             if (clutter_event_get_state (event) & CLUTTER_BUTTON1_MASK)
               {
                 x = orig_x + dx;
@@ -460,7 +460,7 @@ actor_manipulator_motion (ClutterActor *stage,
               }
             break;
 
-          case None:
+          case NONE:
             g_print ("we shouldn't be doing %s in None mode\n", G_STRLOC);
             return FALSE;
         }
@@ -481,7 +481,7 @@ actor_manipulator_release (ClutterActor *stage,
       switch (mode)
         {
 #ifdef BOX2D_MANIPULATION
-          case Box2D:
+          case BOX2D:
           {
             if (mouse_joint)
               clutter_box2d_joint_destroy (mouse_joint);
@@ -490,13 +490,13 @@ actor_manipulator_release (ClutterActor *stage,
           }
 #endif
 
-          case Direct:
-          case None:
-            mode  = None;
+          case DIRECT:
+          case NONE:
+            mode  = NONE;
             return FALSE;
             break;
         }
-      mode              = None;
+      mode              = NONE;
     }
   return TRUE;
 }
diff --git a/examples/blockbox.c b/examples/blockbox.c
index 80243e8..472fb8b 100644
--- a/examples/blockbox.c
+++ b/examples/blockbox.c
@@ -123,7 +123,12 @@ main (int   argc,
   ClutterActor *stage;
   ClutterColor  stage_color = { 0x00, 0x00, 0x00, 0x00 };
 
+#if CLUTTER_CHECK_VERSION (1, 7, 1)
+  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
+    return EXIT_FAILURE;
+#else
   clutter_init (&argc, &argv);
+#endif
 
   stage = clutter_stage_get_default ();
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
diff --git a/examples/popup.c b/examples/popup.c
index 5ff5b90..ec9830d 100644
--- a/examples/popup.c
+++ b/examples/popup.c
@@ -177,9 +177,7 @@ slider_motion (ClutterActor *slider,
                                                 (ey),
                                                &xu2, &yu2))
         {
-          gint x, y;
-          x =  (xu2);
-          y =  (yu2);
+          gint x = xu2;
 
           gfloat width = clutter_actor_get_width (slider);
           gfloat value = (x / width) * (data->max - data->min) + data->min;
@@ -288,8 +286,7 @@ popup_add_slider (const gchar *name,
   clutter_actor_animate (group, CLUTTER_LINEAR, 500, "opacity", 0xff, NULL);
 
   {
-    gint w, h;
-    w = clutter_actor_get_width (label);
+    gint h;
     h = clutter_actor_get_height (label);
     clutter_actor_set_size (rectangle, width, h + 10);
     clutter_actor_set_position (rectangle, 0, 0);
diff --git a/examples/scene-distance-joint.c b/examples/scene-distance-joint.c
index af015ab..0bab86c 100644
--- a/examples/scene-distance-joint.c
+++ b/examples/scene-distance-joint.c
@@ -8,7 +8,6 @@ scene_distance_joint (Scene *scene)
   ClutterActor     *ground;
   ClutterActor     *group;
   ClutterActor     *prev_hand  = NULL;
-  ClutterActor     *first_hand = NULL;
   ClutterActor     *stage;
   gint              i;
 
@@ -54,10 +53,7 @@ scene_distance_joint (Scene *scene)
                                               &anchor1, &anchor2,
                                               200.0, 5, 0.0);
           }
-        else
-          {
-            first_hand = hand;
-          }
+
         prev_hand = hand;
       }
   }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]