From: Pierre-Luc Beaudoin Date: Fri, 3 Oct 2008 18:42:17 +0000 (-0400) Subject: Check given parameters to public API X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13b776e4a1717a59be74d84245003e5348cc33c9;p=libchamplain Check given parameters to public API --- diff --git a/champlain/champlainmarker.c b/champlain/champlainmarker.c index 1ff15a5..8c95930 100644 --- a/champlain/champlainmarker.c +++ b/champlain/champlainmarker.c @@ -190,6 +190,8 @@ champlain_marker_new () void champlain_marker_set_position (ChamplainMarker *champlainMarker, gdouble latitude, gdouble longitude) { + g_return_if_fail(CHAMPLAIN_IS_MARKER(champlainMarker)); + ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER_GET_PRIVATE (champlainMarker); priv->lon = longitude; diff --git a/champlain/champlainview.c b/champlain/champlainview.c index 874660d..5be05a6 100644 --- a/champlain/champlainview.c +++ b/champlain/champlainview.c @@ -578,8 +578,10 @@ viewport_x_changed_cb(GObject *gobject, GParamSpec *arg1, ChamplainView *view) } void -champlain_view_set_size (ChamplainView *view, gint width, gint height) +champlain_view_set_size (ChamplainView *view, guint width, guint height) { + g_return_if_fail(CHAMPLAIN_IS_VIEW(view)); + ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); priv->viewport_size.width = width; @@ -669,6 +671,8 @@ champlain_view_new (ChamplainViewMode mode) void champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitude) { + g_return_if_fail(CHAMPLAIN_IS_VIEW(view)); + ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); if(!priv->map) @@ -737,6 +741,8 @@ champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitu void champlain_view_zoom_in (ChamplainView *view) { + g_return_if_fail(CHAMPLAIN_IS_VIEW(view)); + ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); ClutterActor *group = priv->map->current_level->group; gdouble lon = viewport_get_current_longitude(priv); @@ -764,6 +770,8 @@ champlain_view_zoom_in (ChamplainView *view) void champlain_view_zoom_out (ChamplainView *view) { + g_return_if_fail(CHAMPLAIN_IS_VIEW(view)); + ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); ClutterActor *group = priv->map->current_level->group; gdouble lon = viewport_get_current_longitude(priv); @@ -792,6 +800,9 @@ champlain_view_zoom_out (ChamplainView *view) void champlain_view_add_layer (ChamplainView *view, ClutterActor *layer) { + g_return_if_fail(CHAMPLAIN_IS_VIEW(view)); + g_return_if_fail(CLUTTER_IS_ACTOR(layer)); + ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); clutter_container_add(CLUTTER_CONTAINER(priv->user_layers), layer, NULL); clutter_actor_raise_top(layer); diff --git a/champlain/champlainview.h b/champlain/champlainview.h index 6035505..c98a8dd 100644 --- a/champlain/champlainview.h +++ b/champlain/champlainview.h @@ -89,6 +89,6 @@ void champlain_view_zoom_out (ChamplainView *champlainView); void champlain_view_add_layer (ChamplainView *champlainView, ClutterActor *layer); -void champlain_view_set_size (ChamplainView *view, gint width, gint height); +void champlain_view_set_size (ChamplainView *view, guint width, guint height); #endif