[libchamplain] Get rid of some warnings reported by clang static analysis tool
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Get rid of some warnings reported by clang static analysis tool
- Date: Fri, 14 May 2010 00:21:13 +0000 (UTC)
commit abe0bba689b1ca354a6ded6e64b3a71b17dc02c0
Author: JiÅ?Ã Techet <techet gmail com>
Date: Wed May 12 23:28:16 2010 +0200
Get rid of some warnings reported by clang static analysis tool
Signed-off-by: JiÅ?Ã Techet <techet gmail com>
champlain-gtk/gtk-champlain-embed.c | 3 --
champlain/champlain-base-marker.c | 5 +---
champlain/champlain-file-cache.c | 4 +-
demos/launcher.c | 1 -
demos/local-rendering.c | 3 +-
demos/polygons.c | 1 -
demos/url-marker.c | 3 +-
tidy/tidy-scroll-view.c | 48 ++++++++++++++++------------------
8 files changed, 29 insertions(+), 39 deletions(-)
---
diff --git a/champlain-gtk/gtk-champlain-embed.c b/champlain-gtk/gtk-champlain-embed.c
index 06b50e6..5a417f0 100644
--- a/champlain-gtk/gtk-champlain-embed.c
+++ b/champlain-gtk/gtk-champlain-embed.c
@@ -152,9 +152,6 @@ gtk_champlain_embed_dispose (GObject *object)
static void
gtk_champlain_embed_finalize (GObject *object)
{
- GtkChamplainEmbed *embed = GTK_CHAMPLAIN_EMBED (object);
- GtkChamplainEmbedPrivate *priv = embed->priv;
-
G_OBJECT_CLASS (gtk_champlain_embed_parent_class)->finalize (object);
}
diff --git a/champlain/champlain-base-marker.c b/champlain/champlain-base-marker.c
index 1f395d8..6681932 100644
--- a/champlain/champlain-base-marker.c
+++ b/champlain/champlain-base-marker.c
@@ -347,7 +347,6 @@ void
champlain_base_marker_animate_in_with_delay (ChamplainBaseMarker *marker,
guint delay)
{
- ClutterAnimation *animation;
ClutterTimeline *timeline;
gfloat y;
@@ -361,10 +360,9 @@ champlain_base_marker_animate_in_with_delay (ChamplainBaseMarker *marker,
timeline = clutter_timeline_new (1000);
clutter_timeline_set_delay (timeline, delay);
- animation = clutter_actor_animate_with_timeline (CLUTTER_ACTOR (marker),
+ clutter_actor_animate_with_timeline (CLUTTER_ACTOR (marker),
CLUTTER_EASE_OUT_BOUNCE, timeline, "opacity", 255, "y", y,
"scale-x", 1.0, "scale-y", 1.0, NULL);
- timeline = clutter_animation_get_timeline (animation);
}
/**
@@ -429,7 +427,6 @@ champlain_base_marker_animate_out_with_delay (ChamplainBaseMarker *marker,
animation = clutter_actor_animate_with_timeline (CLUTTER_ACTOR (marker),
CLUTTER_EASE_IN_BACK, timeline, "opacity", 0, "y", y - 100,
"scale-x", 2.0, "scale-y", 2.0, NULL);
- timeline = clutter_animation_get_timeline (animation);
g_signal_connect (animation, "completed",
G_CALLBACK (on_animation_completed), marker);
}
diff --git a/champlain/champlain-file-cache.c b/champlain/champlain-file-cache.c
index 84a3232..c5eb1af 100644
--- a/champlain/champlain-file-cache.c
+++ b/champlain/champlain-file-cache.c
@@ -1032,7 +1032,7 @@ champlain_file_cache_purge (ChamplainFileCache *file_cache)
rc = sqlite3_step (stmt);
while (rc == SQLITE_ROW && current_size > priv->size_limit)
{
- const char *filename = sqlite3_column_text (stmt, 0);
+ const char *filename;
guint size;
filename = sqlite3_column_text (stmt, 0);
@@ -1072,7 +1072,7 @@ delete_dir_recursive (GFile *parent)
GFile *child;
enumerator = g_file_enumerate_children (parent, "*",
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, NULL);
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error);
if (!enumerator)
{
diff --git a/demos/launcher.c b/demos/launcher.c
index c369afa..32775ac 100644
--- a/demos/launcher.c
+++ b/demos/launcher.c
@@ -118,7 +118,6 @@ main (int argc,
clutter_actor_set_reactive (button, TRUE);
clutter_actor_set_position (button, total_width, 0);
clutter_actor_get_size (button, &width, NULL);
- total_width += width + PADDING;
g_signal_connect (button, "button-release-event",
G_CALLBACK (zoom_out),
actor);
diff --git a/demos/local-rendering.c b/demos/local-rendering.c
index 07e1c09..79fcfd8 100644
--- a/demos/local-rendering.c
+++ b/demos/local-rendering.c
@@ -803,7 +803,6 @@ main (int argc,
GtkWidget *tree_view, *scrolled;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
- GtkTreeSelection *selection;
store = gtk_list_store_new (1, G_TYPE_STRING);
@@ -816,7 +815,7 @@ main (int argc,
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(tree_view));
+ gtk_tree_view_get_selection (GTK_TREE_VIEW(tree_view));
g_signal_connect (tree_view, "row-activated", G_CALLBACK(list_item_selected_cb), view);
scrolled = gtk_scrolled_window_new (NULL, NULL);
diff --git a/demos/polygons.c b/demos/polygons.c
index 23d63b3..e4bda82 100644
--- a/demos/polygons.c
+++ b/demos/polygons.c
@@ -100,7 +100,6 @@ main (int argc,
clutter_actor_set_reactive (button, TRUE);
clutter_actor_set_position (button, total_width, 0);
clutter_actor_get_size (button, &width, NULL);
- total_width += width + PADDING;
g_signal_connect (button, "button-release-event",
G_CALLBACK (zoom_out),
actor);
diff --git a/demos/url-marker.c b/demos/url-marker.c
index f975c78..56af5d1 100644
--- a/demos/url-marker.c
+++ b/demos/url-marker.c
@@ -193,7 +193,8 @@ image_downloaded_cb (SoupSession *session,
clutter_actor_show_all (marker);
cleanup:
- g_object_unref (marker_data->layer);
+ if (marker_data)
+ g_object_unref (marker_data->layer);
g_free (marker_data);
g_free (url);
diff --git a/tidy/tidy-scroll-view.c b/tidy/tidy-scroll-view.c
index 2714a3d..82487b5 100644
--- a/tidy/tidy-scroll-view.c
+++ b/tidy/tidy-scroll-view.c
@@ -76,10 +76,10 @@ static void
tidy_scroll_view_dispose (GObject *object)
{
TidyScrollViewPrivate *priv = TIDY_SCROLL_VIEW (object)->priv;
-
+
if (priv->child)
clutter_container_remove_actor (CLUTTER_CONTAINER (object), priv->child);
-
+
G_OBJECT_CLASS (tidy_scroll_view_parent_class)->dispose (object);
}
@@ -93,7 +93,7 @@ static void
tidy_scroll_view_paint (ClutterActor *actor)
{
TidyScrollViewPrivate *priv = TIDY_SCROLL_VIEW (actor)->priv;
-
+
if (priv->child && CLUTTER_ACTOR_IS_VISIBLE (priv->child))
clutter_actor_paint (priv->child);
}
@@ -103,7 +103,7 @@ tidy_scroll_view_pick (ClutterActor *actor, const ClutterColor *color)
{
/* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (tidy_scroll_view_parent_class)->pick (actor, color);
-
+
/* Trigger pick on children */
tidy_scroll_view_paint (actor);
}
@@ -116,17 +116,17 @@ tidy_scroll_view_get_preferred_width (ClutterActor *actor,
{
TidyScrollViewPrivate *priv = TIDY_SCROLL_VIEW (actor)->priv;
-
+
if (!priv->child)
return;
-
+
/* Our natural width is the natural width of the child */
clutter_actor_get_preferred_width (priv->child,
for_height,
NULL,
natural_width_p);
-
+
}
static void
@@ -137,10 +137,10 @@ tidy_scroll_view_get_preferred_height (ClutterActor *actor,
{
TidyScrollViewPrivate *priv = TIDY_SCROLL_VIEW (actor)->priv;
-
+
if (!priv->child)
return;
-
+
/* Our natural height is the natural height of the child */
clutter_actor_get_preferred_height (priv->child,
@@ -192,13 +192,13 @@ tidy_scroll_view_class_init (TidyScrollViewClass *klass)
object_class->set_property = tidy_scroll_view_set_property;
object_class->dispose= tidy_scroll_view_dispose;
object_class->finalize = tidy_scroll_view_finalize;
-
+
actor_class->paint = tidy_scroll_view_paint;
actor_class->pick = tidy_scroll_view_pick;
actor_class->get_preferred_width = tidy_scroll_view_get_preferred_width;
actor_class->get_preferred_height = tidy_scroll_view_get_preferred_height;
actor_class->allocate = tidy_scroll_view_allocate;
-
+
g_object_class_install_property (object_class,
PROP_CHILD,
g_param_spec_object ("child",
@@ -211,8 +211,7 @@ tidy_scroll_view_class_init (TidyScrollViewClass *klass)
static void
tidy_scroll_view_init (TidyScrollView *self)
{
- TidyScrollViewPrivate *priv = self->priv = SCROLL_VIEW_PRIVATE (self);
-
+ self->priv = SCROLL_VIEW_PRIVATE (self);
}
static void
@@ -221,7 +220,7 @@ tidy_scroll_view_add_actor (ClutterContainer *container,
{
TidyScrollView *self = TIDY_SCROLL_VIEW (container);
TidyScrollViewPrivate *priv = self->priv;
-
+
if (priv->child)
{
g_warning ("Attempting to add an actor of type %s to "
@@ -236,19 +235,18 @@ tidy_scroll_view_add_actor (ClutterContainer *container,
{
priv->child = actor;
clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));
-
+
/* Notify that child has been set */
g_signal_emit_by_name (container, "actor-added", priv->child);
g_object_notify (G_OBJECT (container), "child");
-
+
clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
}
else
{
- g_warning ("Attempting to add an actor of type %s to "
+ g_warning ("Attempting to add an actor to "
"a TidyScrollView, but the actor does "
- "not implement TidyScrollable.",
- g_type_name (G_OBJECT_TYPE (actor)));
+ "not implement TidyScrollable.");
}
}
}
@@ -258,12 +256,12 @@ tidy_scroll_view_remove_actor (ClutterContainer *container,
ClutterActor *actor)
{
TidyScrollViewPrivate *priv = TIDY_SCROLL_VIEW (container)->priv;
-
+
if (actor == priv->child)
{
g_object_ref (priv->child);
-
-
+
+
clutter_actor_unparent (priv->child);
g_signal_emit_by_name (container, "actor-removed", priv->child);
@@ -332,10 +330,10 @@ ClutterActor *
tidy_scroll_view_get_child (TidyScrollView *scroll)
{
TidyScrollViewPrivate *priv;
-
+
g_return_val_if_fail (TIDY_IS_SCROLL_VIEW (scroll), NULL);
-
+
priv = scroll->priv;
-
+
return priv->child;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]