From: Pierre-Luc Beaudoin Date: Wed, 15 Oct 2008 22:32:51 +0000 (-0400) Subject: Fix compile warnings X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc0db9f48730f062c409ae320ab0627a31b268de;p=libchamplain Fix compile warnings --- diff --git a/champlain/champlain_defines.h b/champlain/champlain_defines.h index b5981e1..c0f6533 100644 --- a/champlain/champlain_defines.h +++ b/champlain/champlain_defines.h @@ -28,8 +28,6 @@ typedef struct _ChamplainViewClass ChamplainViewClass; typedef struct _ChamplainMarker ChamplainMarker; typedef struct _ChamplainMarkerClass ChamplainMarkerClass; -typedef struct _Map Map; - #define CHAMPLAIN_PARAM_READABLE \ (G_PARAM_READABLE | \ G_PARAM_STATIC_NICK | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB) diff --git a/champlain/champlain_private.h b/champlain/champlain_private.h index 6f6eb45..328f1ce 100644 --- a/champlain/champlain_private.h +++ b/champlain/champlain_private.h @@ -23,6 +23,9 @@ #define CHAMPLAIN_MARKER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerPrivate)) +typedef struct _Map Map; +typedef struct _Tile Tile; + typedef struct { gint x; diff --git a/champlain/champlainlayer.c b/champlain/champlainlayer.c index 25a0b02..4aec98e 100644 --- a/champlain/champlainlayer.c +++ b/champlain/champlainlayer.c @@ -49,7 +49,7 @@ layer_add_cb (ClutterGroup *layer, ClutterActor *marker, gpointer data) g_object_get(G_OBJECT(prev_marker), "latitude", &tmp_y, NULL); tmp_y = 90 - tmp_y; - if (prev_marker == marker) + if (prev_marker == (ChamplainMarker*) marker) continue; if (y < tmp_y && tmp_y < low_y) @@ -74,7 +74,7 @@ layer_add_cb (ClutterGroup *layer, ClutterActor *marker, gpointer data) ChamplainLayer * champlain_layer_new () { - ClutterGroup *layer; + ClutterActor *layer; layer = clutter_group_new(); g_signal_connect_after(G_OBJECT(layer), "actor-added", G_CALLBACK(layer_add_cb), NULL); diff --git a/champlain/champlainmarker.c b/champlain/champlainmarker.c index 8efbeba..84877b7 100644 --- a/champlain/champlainmarker.c +++ b/champlain/champlainmarker.c @@ -28,6 +28,7 @@ #include "zoomlevel.h" #include +#include #include #include #include @@ -48,7 +49,7 @@ enum PROP_ANCHOR_Y, }; -static guint champlain_marker_signals[LAST_SIGNAL] = { 0, }; +//static guint champlain_marker_signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE (ChamplainMarker, champlain_marker, CLUTTER_TYPE_GROUP); @@ -99,8 +100,8 @@ champlain_marker_set_property(GObject *object, guint prop_id, const GValue *valu static void champlain_marker_finalize (GObject *object) { - ChamplainMarker *marker = CHAMPLAIN_MARKER (object); - ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER_GET_PRIVATE (marker); + //ChamplainMarker *marker = CHAMPLAIN_MARKER (object); + //ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER_GET_PRIVATE (marker); G_OBJECT_CLASS (champlain_marker_parent_class)->finalize (object); } @@ -171,7 +172,7 @@ champlain_marker_new () ChamplainMarker *marker; marker = CHAMPLAIN_MARKER (g_object_new (CHAMPLAIN_TYPE_MARKER, NULL)); - ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER_GET_PRIVATE (marker); + //ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER_GET_PRIVATE (marker); return CLUTTER_ACTOR (marker); } @@ -218,7 +219,6 @@ champlain_marker_new_with_label (const gchar *label, ClutterColor *marker_color) { ChamplainMarker *champlainMarker = CHAMPLAIN_MARKER(champlain_marker_new ()); - ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER_GET_PRIVATE (champlainMarker); ClutterColor default_text_color = { 0x22, 022, 0x22, 0xFF }, default_marker_color = { 0x2A, 0xB1, 0x26, 0xEE }, darker_color; @@ -244,7 +244,7 @@ champlain_marker_new_with_label (const gchar *label, point = (text_height + 2 * padding) / 4.0; bg = clutter_cairo_new (text_width, text_height + point); - cr = clutter_cairo_create (bg); + cr = clutter_cairo_create (CLUTTER_CAIRO (bg)); cairo_set_source_rgb (cr, 0, 0, 0); cairo_move_to (cr, 0, 0); @@ -276,6 +276,6 @@ champlain_marker_new_with_label (const gchar *label, clutter_actor_set_anchor_point (CLUTTER_ACTOR(champlainMarker), 0, text_height + point); - return champlainMarker; + return CLUTTER_ACTOR (champlainMarker); } diff --git a/champlain/champlainview.c b/champlain/champlainview.c index 9068984..743ec23 100644 --- a/champlain/champlainview.c +++ b/champlain/champlainview.c @@ -54,7 +54,7 @@ enum PROP_DECEL_RATE, }; -static guint champlain_view_signals[LAST_SIGNAL] = { 0, }; +// static guint champlain_view_signals[LAST_SIGNAL] = { 0, }; #define CHAMPLAIN_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_VIEW, ChamplainViewPrivate)) @@ -165,7 +165,8 @@ scroll_event (ClutterActor *actor, ClutterScrollEvent *event, ChamplainView *vie g_object_notify(G_OBJECT(view), "zoom-level"); } - + + return success; } static void @@ -391,7 +392,7 @@ champlain_view_set_property(GObject *object, guint prop_id, const GValue *value, gdouble lat = viewport_get_current_latitude(priv); gdouble lon = viewport_get_current_longitude(priv); if (priv->map) { - gint currentLevel = priv->map->current_level->level; + guint currentLevel = priv->map->current_level->level; map_free(priv->map); priv->map = map_new(priv->map_source); @@ -430,8 +431,8 @@ champlain_view_set_property(GObject *object, guint prop_id, const GValue *value, static void champlain_view_finalize (GObject *object) { - ChamplainView *view = CHAMPLAIN_VIEW (object); - ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); + //ChamplainView *view = CHAMPLAIN_VIEW (object); + //ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); G_OBJECT_CLASS (champlain_view_parent_class)->finalize (object); } @@ -600,9 +601,7 @@ champlain_view_set_size (ChamplainView *view, guint width, guint height) ClutterActor * champlain_view_new (ChamplainViewMode mode) { - ClutterColor stage_color = { 0x34, 0x39, 0x39, 0xff }; ChamplainView *view; - ClutterActor *stage; view = CHAMPLAIN_VIEW (g_object_new (CHAMPLAIN_TYPE_VIEW, NULL)); ChamplainViewPrivate *priv = CHAMPLAIN_VIEW_GET_PRIVATE (view); @@ -709,7 +708,7 @@ champlain_view_center_on (ChamplainView *view, gdouble latitude, gdouble longitu anchor->y = 0; } - int i; + guint i; for (i = 0; i < priv->map->current_level->tiles->len; i++) { Tile *tile = g_ptr_array_index(priv->map->current_level->tiles, i); diff --git a/champlain/map.c b/champlain/map.c index e8de03e..74fda79 100644 --- a/champlain/map.c +++ b/champlain/map.c @@ -20,9 +20,8 @@ #include "zoomlevel.h" #include "sources/osm_mapnik.h" #include "sources/mff_relief.h" -#include "sources/google_sat.h" -#include "sources/google_map.h" -#include "sources/google_terrain.h" +#include "sources/oam.h" +#include "sources/debugmap.h" #include Map* @@ -44,6 +43,10 @@ map_new (ChamplainMapSource source) case CHAMPLAIN_MAP_SOURCE_MAPSFORFREE_RELIEF: mff_relief_init(map); break; + case CHAMPLAIN_MAP_SOURCE_COUNT: + default: + g_warning("Unsupported map source"); + break; } map->previous_level = NULL; @@ -89,7 +92,8 @@ map_load_visible_tiles (Map *map, ChamplainRectangle viewport, gboolean offline) //g_print("Tiles: %d, %d to %d, %d\n", x_first, y_first, x_count, y_count); - int i, j, k; + int i, j; + guint k; // Get rid of old tiles first for (k = 0; k < map->current_level->tiles->len; k++) @@ -127,7 +131,7 @@ map_load_visible_tiles (Map *map, ChamplainRectangle viewport, gboolean offline) gboolean map_zoom_in (Map *map) { - gint new_level = map->current_level->level + 1; + guint new_level = map->current_level->level + 1; if(new_level <= map->zoom_levels) { map_load_level(map, new_level); @@ -157,8 +161,7 @@ map_free (Map *map) gboolean map_zoom_to (Map *map, guint zoomLevel) { - if(zoomLevel >= 0 && - zoomLevel<= map->zoom_levels) + if (zoomLevel<= map->zoom_levels) { map_load_level(map, zoomLevel); return TRUE; diff --git a/champlain/map.h b/champlain/map.h index cfedf93..487844c 100644 --- a/champlain/map.h +++ b/champlain/map.h @@ -21,17 +21,16 @@ #include "champlain.h" #include "champlainview.h" -#include "champlain_defines.h" +#include "champlain_private.h" #include "zoomlevel.h" #include "tile.h" #include #include - struct _Map { - int zoom_levels; + guint zoom_levels; const gchar *name; int tile_size; @@ -58,6 +57,12 @@ void map_load_visible_tiles (Map *map, ChamplainRectangle viewport, gboolean off void map_free (Map *map); +gboolean map_zoom_in (Map *map); + +gboolean map_zoom_out (Map *map); + gboolean map_zoom_to (Map *map, guint zoomLevel); +void map_load_level(Map *map, gint zoom_level); + #endif diff --git a/champlain/sources/google_map.c b/champlain/sources/google_map.c index 10d43d7..3f5e1f9 100644 --- a/champlain/sources/google_map.c +++ b/champlain/sources/google_map.c @@ -103,5 +103,5 @@ gchar *google_map_get_tile_filename(Map *map, Tile *tile) gchar *google_map_get_tile_uri(Map *map, Tile *tile) { - return g_strdup_printf("http://mt.google.com/mt?n=404&v=w2.99&x=%d&y=%d&zoom=%d", tile->x, tile->y, map->zoom_levels + 1 - tile->level, NULL); + return g_strdup_printf("http://mt.google.com/mt?n=404&v=w2.99&x=%d&y=%d&zoom=%d", tile->x, tile->y, map->zoom_levels + 1 - tile->level); } diff --git a/champlain/sources/google_sat.c b/champlain/sources/google_sat.c index 63d7e8d..8290eba 100644 --- a/champlain/sources/google_sat.c +++ b/champlain/sources/google_sat.c @@ -103,5 +103,5 @@ gchar *google_sat_get_tile_filename(Map *map, Tile *tile) gchar *google_sat_get_tile_uri(Map *map, Tile *tile) { - return g_strdup_printf("http://mt.google.com/mt?n=404&v=w2.99&x=%d&y=%d&zoom=%d", tile->x, tile->y, map->zoom_levels + 1 - tile->level, NULL); + return g_strdup_printf("http://mt.google.com/mt?n=404&v=w2.99&x=%d&y=%d&zoom=%d", tile->x, tile->y, map->zoom_levels + 1 - tile->level); } diff --git a/champlain/sources/google_terrain.c b/champlain/sources/google_terrain.c index 5ef427f..8d1937b 100644 --- a/champlain/sources/google_terrain.c +++ b/champlain/sources/google_terrain.c @@ -103,5 +103,5 @@ gchar *google_terrain_get_tile_filename(Map *map, Tile *tile) gchar *google_terrain_get_tile_uri(Map *map, Tile *tile) { - return g_strdup_printf("http://tile.openstreetmap.org/%d/%d/%d.png", tile->level, tile->x, tile->y, NULL); + return g_strdup_printf("http://tile.openstreetmap.org/%d/%d/%d.png", tile->level, tile->x, tile->y); } diff --git a/champlain/sources/mff_relief.c b/champlain/sources/mff_relief.c index 54c38b3..89dee58 100644 --- a/champlain/sources/mff_relief.c +++ b/champlain/sources/mff_relief.c @@ -101,5 +101,5 @@ gchar *mff_relief_get_tile_filename(Map *map, Tile *tile) gchar *mff_relief_get_tile_uri(Map *map, Tile *tile) { - return g_strdup_printf("http://maps-for-free.com/layer/relief/z%d/row%d/%d_%d-%d.jpg", tile->level, tile->y, tile->level, tile->x, tile->y, NULL); + return g_strdup_printf("http://maps-for-free.com/layer/relief/z%d/row%d/%d_%d-%d.jpg", tile->level, tile->y, tile->level, tile->x, tile->y); } diff --git a/champlain/sources/oam.c b/champlain/sources/oam.c index fa0412c..9cb0e88 100644 --- a/champlain/sources/oam.c +++ b/champlain/sources/oam.c @@ -98,5 +98,5 @@ gchar *oam_get_tile_filename(Map *map, Tile *tile) gchar *oam_get_tile_uri(Map *map, Tile *tile) { - return g_strdup_printf("http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/%d/%d/%d.jpg", tile->level, tile->x, tile->y, NULL); + return g_strdup_printf("http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/%d/%d/%d.jpg", tile->level, tile->x, tile->y); } diff --git a/champlain/sources/osm_mapnik.c b/champlain/sources/osm_mapnik.c index 491da17..5899089 100644 --- a/champlain/sources/osm_mapnik.c +++ b/champlain/sources/osm_mapnik.c @@ -101,5 +101,5 @@ gchar *osm_mapnik_get_tile_filename(Map *map, Tile *tile) gchar *osm_mapnik_get_tile_uri(Map *map, Tile *tile) { - return g_strdup_printf("http://tile.openstreetmap.org/%d/%d/%d.png", tile->level, tile->x, tile->y, NULL); + return g_strdup_printf("http://tile.openstreetmap.org/%d/%d/%d.png", tile->level, tile->x, tile->y); } diff --git a/champlain/tile.h b/champlain/tile.h index 2728827..b473f96 100644 --- a/champlain/tile.h +++ b/champlain/tile.h @@ -21,8 +21,9 @@ #include #include +#include -typedef struct +struct _Tile { ClutterActor* actor; int x; @@ -32,8 +33,12 @@ typedef struct gboolean loading; // TRUE when a callback exist to load the tile, FALSE otherwise gboolean to_destroy; // TRUE when a tile struct should be deleted when loading is done, FALSE otherwise -} Tile; +}; void tile_free(Tile* tile); +void tile_set_position(Map* map, Tile* tile); + +Tile* tile_load (Map* map, guint zoom_level, guint x, guint y, gboolean offline); + #endif diff --git a/champlain/zoomlevel.c b/champlain/zoomlevel.c index 97b058a..899912d 100644 --- a/champlain/zoomlevel.c +++ b/champlain/zoomlevel.c @@ -46,7 +46,7 @@ zoom_level_new(gint zoom_level, gint row, gint column, gint tile_size) void zoom_level_free(ZoomLevel *level) { - int i; + guint i; for (i = 0; i < level->tiles->len; i++) { Tile *tile = g_ptr_array_index(level->tiles, i);