[cheese/cheese-next] Move variable declaratione before code in C source



commit d40f1ca5aff4085e416477b221212a0cc1770ec1
Author: David King <amigadave amigadave com>
Date:   Fri Mar 9 17:50:52 2012 +0000

    Move variable declaratione before code in C source
    
    This allows compilation to succeed with
    â-Wdeclaration-after-statement -Werror=declaration-after-statementâ
    passed to GCC.

 configure.ac                             |    2 +-
 libcheese/cheese-camera-device-monitor.c |   11 ++++++-----
 libcheese/cheese-camera-device.c         |    6 ++++--
 libcheese/cheese-camera.c                |   22 +++++++++++++---------
 libcheese/cheese-fileutil.c              |    4 ++--
 libcheese/cheese-flash.c                 |    3 ++-
 6 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9602cce..43d895e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ LT_INIT([disable-static])
 
 PKG_PROG_PKG_CONFIG([0.24])
 
-AC_SUBST([CHEESE_WFLAGS], ["-Wall -DGSEAL_ENABLE"])
+AC_SUBST([CHEESE_WFLAGS], ["-Wall -Wdeclaration-after-statement -DGSEAL_ENABLE"])
 
 GNOME_MAINTAINER_MODE_DEFINES
 GNOME_COMPILE_WARNINGS([maximum])
diff --git a/libcheese/cheese-camera-device-monitor.c b/libcheese/cheese-camera-device-monitor.c
index a0c6e82..d8b5a10 100644
--- a/libcheese/cheese-camera-device-monitor.c
+++ b/libcheese/cheese-camera-device-monitor.c
@@ -120,6 +120,7 @@ cheese_camera_device_monitor_set_up_device (GUdevDevice *udevice)
   gint        vendor_id   = 0;
   gint        product_id  = 0;
   gint        v4l_version = 0;
+  CheeseCameraDevice *device;
 
   const gchar *devpath = g_udev_device_get_property (udevice, "DEVPATH");
 
@@ -187,11 +188,11 @@ cheese_camera_device_monitor_set_up_device (GUdevDevice *udevice)
     g_assert_not_reached ();
   }
 
-  CheeseCameraDevice *device = cheese_camera_device_new (devpath,
-                                                         device_file,
-                                                         product_name,
-                                                         v4l_version,
-                                                         &error);
+  device = cheese_camera_device_new (devpath,
+                                     device_file,
+                                     product_name,
+                                     v4l_version,
+                                     &error);
 
   if (device == NULL)
     GST_WARNING ("Device initialization for %s failed: %s ",
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
index 7a7ae3d..9b977a4 100644
--- a/libcheese/cheese-camera-device.c
+++ b/libcheese/cheese-camera-device.c
@@ -773,10 +773,12 @@ cheese_camera_device_get_device_node (CheeseCameraDevice *device)
 CheeseVideoFormat *
 cheese_camera_device_get_best_format (CheeseCameraDevice *device)
 {
+  CheeseVideoFormat *format;
+
   g_return_val_if_fail (CHEESE_IS_CAMERA_DEVICE (device), NULL);
 
-  CheeseVideoFormat *format = g_boxed_copy (CHEESE_TYPE_VIDEO_FORMAT,
-                                            cheese_camera_device_get_format_list (device)->data);
+  format = g_boxed_copy (CHEESE_TYPE_VIDEO_FORMAT,
+                         cheese_camera_device_get_format_list (device)->data);
 
   GST_INFO ("%dx%d", format->width, format->height);
   return format;
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index 050364a..cb5eccd 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -667,13 +667,14 @@ void
 cheese_camera_switch_camera_device (CheeseCamera *camera)
 {
   CheeseCameraPrivate *priv;
+  gboolean pipeline_was_playing;
 
   g_return_if_fail (CHEESE_IS_CAMERA (camera));
 
   priv = camera->priv;
 
   /* gboolean was_recording        = FALSE; */
-  gboolean pipeline_was_playing = FALSE;
+  pipeline_was_playing = FALSE;
 
   if (priv->is_recording)
   {
@@ -919,15 +920,15 @@ void
 cheese_camera_connect_effect_texture (CheeseCamera *camera, CheeseEffect *effect, ClutterTexture *texture)
 {
   CheeseCameraPrivate *priv;
-
-  g_return_if_fail (CHEESE_IS_CAMERA (camera));
-
-  priv = camera->priv;
   GstElement *effect_filter;
   GstElement *display_element;
   GstElement *display_queue;
   GstElement *control_valve;
-  gboolean    ok = TRUE;
+  gboolean ok;
+  g_return_if_fail (CHEESE_IS_CAMERA (camera));
+
+  priv = camera->priv;
+  ok = TRUE;
 
   g_object_set (G_OBJECT (priv->effects_valve), "drop", TRUE, NULL);
 
@@ -1203,9 +1204,10 @@ static void
 cheese_camera_finalize (GObject *object)
 {
   CheeseCamera *camera;
+  CheeseCameraPrivate *priv;
 
   camera = CHEESE_CAMERA (object);
-  CheeseCameraPrivate *priv = camera->priv;
+  priv = camera->priv;
 
   cheese_camera_stop (camera);
 
@@ -1230,9 +1232,10 @@ cheese_camera_get_property (GObject *object, guint prop_id, GValue *value,
                             GParamSpec *pspec)
 {
   CheeseCamera *self;
+  CheeseCameraPrivate *priv;
 
   self = CHEESE_CAMERA (object);
-  CheeseCameraPrivate *priv = self->priv;
+  priv = self->priv;
 
   switch (prop_id)
   {
@@ -1259,9 +1262,10 @@ cheese_camera_set_property (GObject *object, guint prop_id, const GValue *value,
                             GParamSpec *pspec)
 {
   CheeseCamera *self;
+  CheeseCameraPrivate *priv;
 
   self = CHEESE_CAMERA (object);
-  CheeseCameraPrivate *priv = self->priv;
+  priv = self->priv;
 
   switch (prop_id)
   {
diff --git a/libcheese/cheese-fileutil.c b/libcheese/cheese-fileutil.c
index 06dad01..53c1f32 100644
--- a/libcheese/cheese-fileutil.c
+++ b/libcheese/cheese-fileutil.c
@@ -250,11 +250,11 @@ cheese_fileutil_init (CheeseFileUtil *fileutil)
 {
   CheeseFileUtilPrivate *priv = fileutil->priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
 
+  GSettings *settings;
+
   priv->burst_count    = 0;
   priv->burst_raw_name = "";
 
-  GSettings *settings;
-
   settings = g_settings_new ("org.gnome.Cheese");
 
   g_settings_get (settings, "video-path", "s", &priv->video_path);
diff --git a/libcheese/cheese-flash.c b/libcheese/cheese-flash.c
index 5b7addc..48e4110 100644
--- a/libcheese/cheese-flash.c
+++ b/libcheese/cheese-flash.c
@@ -389,6 +389,7 @@ cheese_flash_fire (CheeseFlash *flash)
   GdkScreen          *screen;
   GdkRectangle        rect;
   int                 monitor;
+  GtkWindow *flash_window;
 
   g_return_if_fail (CHEESE_IS_FLASH (flash));
 
@@ -396,7 +397,7 @@ cheese_flash_fire (CheeseFlash *flash)
 
   g_return_if_fail (flash_priv->parent != NULL);
 
-  GtkWindow *flash_window = GTK_WINDOW (flash);
+  flash_window = GTK_WINDOW (flash);
 
   if (flash_priv->flash_timeout_tag > 0)
     g_source_remove (flash_priv->flash_timeout_tag);



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