summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garrett <jeff@jgarrett.org>2008-01-27 01:53:18 -0600
committerJeff Garrett <jeff@jgarrett.org>2008-01-27 01:53:18 -0600
commit96b33d083c1bce10ae76300debdc6ba6de43a69f (patch)
treeca78ee9c6d02d85b9808d2a6baa49f929940b666
parentba508646c5c9aa456da919dc3c4d71f36b0cd9f8 (diff)
Compile-time warning fixes
Will now compile with -Werror
-rw-r--r--src/db.h1
-rw-r--r--src/downloadmanager.c6
-rw-r--r--src/import_tiger.c46
-rw-r--r--src/location.c2
-rw-r--r--src/locationeditwindow.c2
-rw-r--r--src/map.c2
-rw-r--r--src/map.h2
-rw-r--r--src/map_draw_cairo.c6
-rw-r--r--src/map_history.c5
-rw-r--r--src/map_hittest.c13
-rw-r--r--src/map_math.c3
-rw-r--r--src/map_style.c34
-rw-r--r--src/map_tilemanager.c4
-rw-r--r--src/mapinfowindow.c6
-rw-r--r--src/scenemanager.c2
-rw-r--r--src/scenemanager.h2
-rw-r--r--src/search_coordinate.c6
-rw-r--r--src/search_location.c4
-rw-r--r--src/search_road.c2
-rw-r--r--src/test_poly.c1
-rw-r--r--src/tiger.c2
-rw-r--r--src/tiger.h2
-rw-r--r--src/tiger_dialog.c17
-rw-r--r--src/util.c2
-rw-r--r--src/util.h2
25 files changed, 104 insertions, 70 deletions
diff --git a/src/db.h b/src/db.h
index b6e12fc..898723b 100644
--- a/src/db.h
+++ b/src/db.h
@@ -82,6 +82,7 @@ void db_disable_keys(void);
gboolean db_insert_city(const gchar* pszName, gint nStateID, gint* pnReturnCityID);
gboolean db_insert_road(gint nLOD, gint nRoadNameID, gint nLayerType, gint nAddressLeftStart, gint nAddressLeftEnd, gint nAddressRightStart, gint nAddressRightEnd, gint nCityLeftID, gint nCityRightID, const gchar* pszZIPCodeLeft, const gchar* pszZIPCodeRight, GArray* pPointsArray, gint* pReturnID);
+gboolean db_insert_state(const gchar* pszName, const gchar* pszCode, gint nCountryID, gint* pnReturnStateID);
gboolean db_city_get_id(const gchar* pszName, gint nStateID, gint* pnReturnID);
gboolean db_state_get_id(const gchar* pszName, gint* pnReturnID);
diff --git a/src/downloadmanager.c b/src/downloadmanager.c
index 19e81c8..babf8c3 100644
--- a/src/downloadmanager.c
+++ b/src/downloadmanager.c
@@ -152,6 +152,8 @@ static gint _downloadmanager_gnome_vfs_progress_callback(GnomeVFSAsyncHandle *pH
static gboolean _downloadmanager_begin_download(download_t* pDownload)
{
+ GList *pSrcList = NULL, *pDestList = NULL;
+
g_assert(pDownload != NULL);
//g_print("downloader: beginning download of %s\n", pDownload->pszRemoteFilePath);
@@ -167,10 +169,10 @@ static gboolean _downloadmanager_begin_download(download_t* pDownload)
//g_print("downloader: using temp file '%s'\n", pDownload->pszLocalFilePath);
GnomeVFSURI* pSrcURI = gnome_vfs_uri_new(pDownload->pszRemoteFilePath);
- GList* pSrcList = g_list_prepend(pSrcList, pSrcURI);
+ pSrcList = g_list_prepend(pSrcList, pSrcURI);
GnomeVFSURI* pDestURI = gnome_vfs_uri_new(pDownload->pszLocalFilePath);
- GList* pDestList = g_list_prepend(pDestList, pDestURI);
+ pDestList = g_list_prepend(pDestList, pDestURI);
GnomeVFSResult res = gnome_vfs_async_xfer(&(pDownload->pGnomeVFSHandle),
pSrcList, pDestList,
diff --git a/src/import_tiger.c b/src/import_tiger.c
index dceeb8b..dfb965a 100644
--- a/src/import_tiger.c
+++ b/src/import_tiger.c
@@ -26,7 +26,11 @@
#include <string.h>
+#include <glib.h>
+#include <gdk/gdk.h>
+#include "db.h"
#include "main.h"
+#include "map_math.h"
#include "util.h"
#include "import_tiger.h"
#include "importwindow.h"
@@ -262,7 +266,7 @@ gdouble object_type_tolerance_at_lod(gint nRecordType, gint nLOD)
// }
// }
-static gboolean import_tiger_read_lat(gint8* pBuffer, gdouble* pValue)
+static gboolean import_tiger_read_lat(char* pBuffer, gdouble* pValue)
{
// 0,1,2,3
// - 1 2 . 1 2 3 4 5 6
@@ -304,9 +308,9 @@ static gboolean import_tiger_read_lon(char* pBuffer, gdouble* pValue)
}
-static gboolean import_tiger_read_int(gint8* pBuffer, gint nLen, gint32* pValue)
+static gboolean import_tiger_read_int(char* pBuffer, gint nLen, gint32* pValue)
{
- gint8 buffer[11];
+ char buffer[11];
g_assert(nLen <= 10);
memcpy(buffer, pBuffer, nLen);
buffer[nLen] = '\0';
@@ -315,9 +319,9 @@ static gboolean import_tiger_read_int(gint8* pBuffer, gint nLen, gint32* pValue)
return TRUE;
}
-static gboolean import_tiger_read_address(gint8* pBuffer, gint nLen, gint32* pValue)
+static gboolean import_tiger_read_address(char* pBuffer, gint nLen, gint32* pValue)
{
- gint8 buffer[15];
+ char buffer[15];
g_assert(nLen <= 14);
memcpy(buffer, pBuffer, nLen);
buffer[nLen] = '\0';
@@ -351,7 +355,7 @@ static gboolean import_tiger_read_string(char* pBuffer, gint nLen, char* pValue)
// trim whitespace
nLen--;
- gint8* p = &pValue[nLen]; // last non-null char
+ char* p = &pValue[nLen]; // last non-null char
while(nLen >= 0 && *p == ' ') {
*p = '\0';
p--;
@@ -362,7 +366,7 @@ static gboolean import_tiger_read_string(char* pBuffer, gint nLen, char* pValue)
// NOTE: This function can return MAP_OBJECT_TYPE_NONE. Lines of this type shouldn't be saved, but they
// might be used for polygons, so we have to keep them in memory.
-static gboolean import_tiger_read_layer_type(gint8* pBuffer, gint* pValue)
+static gboolean import_tiger_read_layer_type(char* pBuffer, gint* pValue)
{
//g_print("%c%c%c\n", *(pBuffer), *(pBuffer+1), *(pBuffer+2));
gchar chFeatureClass = *(pBuffer+0);
@@ -626,7 +630,7 @@ if(achType[0] != '\0' && pRecord->nRoadNameSuffixID == ROAD_SUFFIX_NONE) {
return TRUE;
}
-static gboolean import_tiger_parse_table_2(gint8* pBuffer, gint nLength, GHashTable *pTable)
+static gboolean import_tiger_parse_table_2(char* pBuffer, gint nLength, GHashTable *pTable)
{
gint i;
for(i=0 ; i<=(nLength-TIGER_RT2_LINE_LENGTH) ; i+=TIGER_RT2_LINE_LENGTH) {
@@ -665,7 +669,7 @@ static gboolean import_tiger_parse_table_2(gint8* pBuffer, gint nLength, GHashTa
return TRUE;
}
-static gboolean import_tiger_parse_table_7(gint8* pBuffer, gint nLength, GHashTable *pTable)
+static gboolean import_tiger_parse_table_7(char* pBuffer, gint nLength, GHashTable *pTable)
{
gint i;
for(i=0 ; i<=(nLength-TIGER_RT7_LINE_LENGTH) ; i+=TIGER_RT7_LINE_LENGTH) {
@@ -699,7 +703,7 @@ static gboolean import_tiger_parse_table_7(gint8* pBuffer, gint nLength, GHashTa
return TRUE;
}
-static gboolean import_tiger_parse_table_8(gint8* pBuffer, gint nLength, GHashTable *pTable)
+static gboolean import_tiger_parse_table_8(char* pBuffer, gint nLength, GHashTable *pTable)
{
gint i;
for(i=0 ; i<=(nLength-TIGER_RT8_LINE_LENGTH) ; i+=TIGER_RT8_LINE_LENGTH) {
@@ -724,7 +728,7 @@ static gboolean import_tiger_parse_table_8(gint8* pBuffer, gint nLength, GHashTa
return TRUE;
}
-static gboolean import_tiger_parse_table_c(gint8* pBuffer, gint nLength, GHashTable *pTable)
+static gboolean import_tiger_parse_table_c(char* pBuffer, gint nLength, GHashTable *pTable)
{
gint i;
for(i=0 ; i<=(nLength-TIGER_RTc_LINE_LENGTH) ; i+=TIGER_RTc_LINE_LENGTH) {
@@ -752,7 +756,7 @@ g_print("record c: FIPS55=%d NAME=%s\n", pRecord->nFIPS55, pRecord->achName);
}
-static gboolean import_tiger_parse_table_i(gint8* pBuffer, gint nLength, GHashTable *pTable)
+static gboolean import_tiger_parse_table_i(char* pBuffer, gint nLength, GHashTable *pTable)
{
//
// Gather RTi records (chainID,TZID-A,TZID-B) and index them by POLYGON ID in the given hash table
@@ -1178,7 +1182,7 @@ static void callback_save_rti_polygons(gpointer key, gpointer value, gpointer us
//
//
static gboolean import_tiger_from_directory(const gchar* pszDirectoryPath, gint nTigerSetNumber);
-static gboolean import_tiger_from_buffers(gint8* pBufferMET, gint nLengthMET, gint8* pBufferRT1, gint nLengthRT1, gint8* pBufferRT2, gint nLengthRT2, gint8* pBufferRT7, gint nLengthRT7, gint8* pBufferRT8, gint nLengthRT8, gint8* pBufferRTc, gint nLengthRTc, gint8* pBufferRTi, gint nLengthRTi);
+static gboolean import_tiger_from_buffers(char* pBufferMET, gint nLengthMET, char* pBufferRT1, gint nLengthRT1, char* pBufferRT2, gint nLengthRT2, char* pBufferRT7, gint nLengthRT7, char* pBufferRT8, gint nLengthRT8, char* pBufferRTc, gint nLengthRTc, char* pBufferRTi, gint nLengthRTi);
gboolean import_tiger_from_uri(const gchar* pszURI, gint nTigerSetNumber)
{
@@ -1252,7 +1256,7 @@ static gboolean import_tiger_from_directory(const gchar* pszDirectoryPath, gint
gchar* pszFilePath;
gchar* apszExtensions[7] = {"MET", "RT1", "RT2", "RT7", "RT8", "RTC", "RTI"};
- gint8* apBuffers[G_N_ELEMENTS(apszExtensions)] = {0};
+ char* apBuffers[G_N_ELEMENTS(apszExtensions)] = {0};
gint nSizes[G_N_ELEMENTS(apszExtensions)] = {0};
// open, read, and delete (unlink) each file
@@ -1294,13 +1298,13 @@ static gboolean import_tiger_from_directory(const gchar* pszDirectoryPath, gint
}
static gboolean import_tiger_from_buffers(
- gint8* pBufferMET, gint nLengthMET,
- gint8* pBufferRT1, gint nLengthRT1,
- gint8* pBufferRT2, gint nLengthRT2,
- gint8* pBufferRT7, gint nLengthRT7,
- gint8* pBufferRT8, gint nLengthRT8,
- gint8* pBufferRTc, gint nLengthRTc,
- gint8* pBufferRTi, gint nLengthRTi)
+ char* pBufferMET, gint nLengthMET,
+ char* pBufferRT1, gint nLengthRT1,
+ char* pBufferRT2, gint nLengthRT2,
+ char* pBufferRT7, gint nLengthRT7,
+ char* pBufferRT8, gint nLengthRT8,
+ char* pBufferRTc, gint nLengthRTc,
+ char* pBufferRTi, gint nLengthRTi)
{
// g_hash_table_lookup
// g_assert(func_progress_callback != NULL);
diff --git a/src/location.c b/src/location.c
index 6cf5799..0d3a524 100644
--- a/src/location.c
+++ b/src/location.c
@@ -176,7 +176,7 @@ gboolean location_load(gint nLocationID, mappoint_t* pReturnCoordinates, gint* p
*pnReturnLocationSetID = atoi(aRow[0]);
}
if(pReturnCoordinates != NULL) {
- db_parse_wkb_point(aRow[1], pReturnCoordinates);
+ db_parse_wkb_point((gint8 *)aRow[1], pReturnCoordinates);
}
db_free_result(pResultSet);
return TRUE;
diff --git a/src/locationeditwindow.c b/src/locationeditwindow.c
index 8e03a48..f8b0920 100644
--- a/src/locationeditwindow.c
+++ b/src/locationeditwindow.c
@@ -90,7 +90,7 @@ static void callback_install_insert_text_callback_on_entry(GtkCellRenderer *pCel
// Save the results of in-place cell editing
static void callback_store_attribute_editing(GtkCellRendererText *pCell, const gchar *pszTreePath, const gchar *pszNewValue, gpointer *pUserData)
{
- gint nColumn = (gint)(pUserData);
+ gint nColumn = GPOINTER_TO_INT(pUserData);
GtkTreeIter iter;
GtkTreePath* pPath = gtk_tree_path_new_from_string(pszTreePath);
diff --git a/src/map.c b/src/map.c
index e3b6b4c..38fc26f 100644
--- a/src/map.c
+++ b/src/map.c
@@ -74,7 +74,7 @@
static void map_init_location_hash(map_t* pMap);
//static void map_store_location(map_t* pMap, location_t* pLocation, gint nLocationSetID);
-gdouble map_get_straight_line_distance_in_degrees(mappoint_t* p1, mappoint_t* p2);
+gdouble map_get_straight_line_distance_in_degrees(const mappoint_t* p1, const mappoint_t* p2);
// Each zoomlevel has a scale (XXX: this should really be in an XML file)
zoomlevel_t g_sZoomLevels[NUM_ZOOM_LEVELS] = {
diff --git a/src/map.h b/src/map.h
index 23a49e1..e3f506f 100644
--- a/src/map.h
+++ b/src/map.h
@@ -295,7 +295,7 @@ void map_set_dimensions(map_t* pMap, const dimensions_t* pDimensions);
void map_windowpoint_to_mappoint(map_t* pMap, screenpoint_t* pScreenPoint, mappoint_t* pMapPoint);
gdouble map_distance_in_units_to_degrees(map_t* pMap, gdouble fDistance, gint nDistanceUnit);
gdouble map_get_distance_in_meters(mappoint_t* pA, mappoint_t* pB);
-gdouble map_get_straight_line_distance_in_degrees(mappoint_t* p1, mappoint_t* p2);
+gdouble map_get_straight_line_distance_in_degrees(const mappoint_t* p1, const mappoint_t* p2);
gdouble map_pixels_to_degrees(const map_t* pMap, gint16 nPixels, guint16 uZoomLevel);
gdouble map_degrees_to_pixels(map_t* pMap, gdouble fDegrees, guint16 uZoomLevel);
diff --git a/src/map_draw_cairo.c b/src/map_draw_cairo.c
index af24166..fef596b 100644
--- a/src/map_draw_cairo.c
+++ b/src/map_draw_cairo.c
@@ -73,7 +73,7 @@ static void map_draw_cairo_layer_polygon_labels(map_t* pMap, cairo_t* pCairo, re
static void map_draw_cairo_layer_fill(map_t* pMap, cairo_t* pCairo, rendermetrics_t* pRenderMetrics, maplayerstyle_t* pLayerStyle);
// Draw labels for a single line/polygon
-static void map_draw_cairo_road_label(map_t* pMap, cairo_t *pCairo, maplayerstyle_t* pLayerStyle, rendermetrics_t* pRenderMetrics, GArray* pMapPointsArray, const gchar* pszLabel);
+static void map_draw_cairo_road_label(map_t* pMap, cairo_t *pCairo, maplayerstyle_t* pLayerStyle, rendermetrics_t* pRenderMetrics, GArray* pMapPointsArray, gchar* pszLabel);
static void map_draw_cairo_polygon_label(map_t* pMap, cairo_t *pCairo, maplayerstyle_t* pLayerStyle, rendermetrics_t* pRenderMetrics, GArray* pMapPointsArray, maprect_t* pBoundingRect, const gchar* pszLabel);
// Draw map extras
@@ -530,7 +530,7 @@ typedef struct labelposition {
//
// Draw a label along a 2-point line
//
-static void map_draw_cairo_road_label_one_segment(map_t* pMap, cairo_t *pCairo, maplayerstyle_t* pLayerStyle, rendermetrics_t* pRenderMetrics, GArray* pMapPointsArray, const gchar* pszLabel)
+static void map_draw_cairo_road_label_one_segment(map_t* pMap, cairo_t *pCairo, maplayerstyle_t* pLayerStyle, rendermetrics_t* pRenderMetrics, GArray* pMapPointsArray, gchar* pszLabel)
{
// get permission to draw this label
if(FALSE == scenemanager_can_draw_label_at(pMap->pSceneManager, pszLabel, NULL, SCENEMANAGER_FLAG_PARTLY_ON_SCREEN)) {
@@ -687,7 +687,7 @@ static gint map_draw_cairo_road_label_position_sort(gconstpointer pA, gconstpoin
*/
#endif
-static void map_draw_cairo_road_label(map_t* pMap, cairo_t *pCairo, maplayerstyle_t* pLayerStyle, rendermetrics_t* pRenderMetrics, GArray* pMapPointsArray, const gchar* pszLabel)
+static void map_draw_cairo_road_label(map_t* pMap, cairo_t *pCairo, maplayerstyle_t* pLayerStyle, rendermetrics_t* pRenderMetrics, GArray* pMapPointsArray, gchar* pszLabel)
{
if(pMapPointsArray->len < 2) return;
diff --git a/src/map_history.c b/src/map_history.c
index e770714..0a5f6c5 100644
--- a/src/map_history.c
+++ b/src/map_history.c
@@ -22,6 +22,7 @@
*/
#include <gtk/gtk.h>
+#include <string.h>
#include "main.h"
#include "map.h"
#include "map_history.h"
@@ -94,6 +95,8 @@ gboolean map_history_go_forward(maphistory_t* pHistory)
map_history_debug_print(pHistory);
return TRUE;
}
+
+ return FALSE;
}
gboolean map_history_go_back(maphistory_t* pHistory)
@@ -103,6 +106,8 @@ gboolean map_history_go_back(maphistory_t* pHistory)
map_history_debug_print(pHistory);
return TRUE;
}
+
+ return FALSE;
}
void map_history_get_current(maphistory_t* pHistory, mappoint_t* pReturnPoint, gint* pnReturnZoomLevel)
diff --git a/src/map_hittest.c b/src/map_hittest.c
index 7844059..64bde92 100644
--- a/src/map_hittest.c
+++ b/src/map_hittest.c
@@ -23,6 +23,7 @@
#include <gtk/gtk.h>
#include <math.h>
+#include <stdlib.h>
#include "map.h"
#include "map_hittest.h"
#include "map_math.h"
@@ -33,8 +34,8 @@
static gboolean map_hittest_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pHitPoint, gdouble fMaxDistance, mappoint_t* pReturnClosestPoint, gdouble* pfReturnPercentAlongLine);
static ESide map_hittest_side_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pClosestPointOnLine, mappoint_t* pHitPoint);
-static gboolean map_hittest_locations(map_t* pMap, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationsArray, mappoint_t* pHitPoint, maphit_t** ppReturnStruct);
-static gboolean map_hittest_locationsets(map_t* pMap, rendermetrics_t* pRenderMetrics, mappoint_t* pHitPoint, maphit_t** ppReturnStruct);
+//static gboolean map_hittest_locations(map_t* pMap, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationsArray, mappoint_t* pHitPoint, maphit_t** ppReturnStruct);
+//static gboolean map_hittest_locationsets(map_t* pMap, rendermetrics_t* pRenderMetrics, mappoint_t* pHitPoint, maphit_t** ppReturnStruct);
static gboolean map_hittest_layer_lines(GPtrArray* pRoadsArray, gdouble fMaxDistance, mappoint_t* pHitPoint, maphit_t** ppReturnStruct);
static gboolean map_hittest_layer_polygons(GPtrArray* pMapObjectArray, mappoint_t* pHitPoint, maphit_t** ppReturnStruct);
@@ -276,9 +277,10 @@ static ESide map_hittest_side_test_line(mappoint_t* pPoint1, mappoint_t* pPoint2
}
// hit test all locations
+#if 0
static gboolean map_hittest_locationsets(map_t* pMap, rendermetrics_t* pRenderMetrics, mappoint_t* pHitPoint, maphit_t** ppReturnStruct)
{
- gdouble fMaxDistance = map_math_pixels_to_degrees_at_scale(1, map_get_scale(pMap)) * 3; // XXX: don't hardcode distance :)
+ //gdouble fMaxDistance = map_math_pixels_to_degrees_at_scale(1, map_get_scale(pMap)) * 3; // XXX: don't hardcode distance :)
const GPtrArray* pLocationSetsArray = locationset_get_array();
gint i;
@@ -302,8 +304,10 @@ static gboolean map_hittest_locationsets(map_t* pMap, rendermetrics_t* pRenderMe
}
return FALSE;
}
+#endif
// hit-test an array of locations
+#if 0
static gboolean map_hittest_locations(map_t* pMap, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationsArray, mappoint_t* pHitPoint, maphit_t** ppReturnStruct)
{
gint i;
@@ -351,7 +355,9 @@ static gboolean map_hittest_locations(map_t* pMap, rendermetrics_t* pRenderMetri
}
return FALSE;
}
+#endif
+#if 0
static gboolean map_hittest_locationselections(map_t* pMap, rendermetrics_t* pRenderMetrics, GPtrArray* pLocationSelectionArray, mappoint_t* pHitPoint, maphit_t** ppReturnStruct)
{
screenpoint_t screenpoint;
@@ -406,6 +412,7 @@ static gboolean map_hittest_locationselections(map_t* pMap, rendermetrics_t* pRe
}
return FALSE;
}
+#endif
static gboolean map_hittest_line(mappoint_t* pPoint1, mappoint_t* pPoint2, mappoint_t* pHitPoint, gdouble fMaxDistance, mappoint_t* pReturnClosestPoint, gdouble* pfReturnPercentAlongLine)
diff --git a/src/map_math.c b/src/map_math.c
index 72b3ff6..e90aa14 100644
--- a/src/map_math.c
+++ b/src/map_math.c
@@ -22,6 +22,7 @@
*/
#include <gtk/gtk.h>
+#include <stdlib.h>
#include "map.h"
#include "map_math.h"
@@ -158,7 +159,7 @@ gdouble map_get_distance_in_meters(mappoint_t* pA, mappoint_t* pB)
return fAOB_Rad * RADIUS_OF_WORLD_IN_METERS;
}
-gdouble map_get_straight_line_distance_in_degrees(mappoint_t* p1, mappoint_t* p2)
+gdouble map_get_straight_line_distance_in_degrees(const mappoint_t* p1, const mappoint_t* p2)
{
gdouble fDeltaX = ((p2->fLongitude) - (p1->fLongitude));
gdouble fDeltaY = ((p2->fLatitude) - (p1->fLatitude));
diff --git a/src/map_style.c b/src/map_style.c
index f1b7bdf..536a4eb 100644
--- a/src/map_style.c
+++ b/src/map_style.c
@@ -26,9 +26,11 @@
#include <cairo.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
+#include <string.h>
#include "main.h"
#include "glyph.h"
#include "map_style.h"
+#include "util.h"
#define MIN_STYLE_LEVEL (1)
#define MAX_STYLE_LEVEL (10)
@@ -46,8 +48,8 @@ static void map_style_parse_layer(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode)
static void map_style_parse_layer_property(map_t* pMap, xmlDocPtr pDoc, maplayer_t *pLayer, xmlNodePtr pNode);
// Debugging
-static void map_style_print_layer(maplayer_t *layer);
-static void map_style_print_color(color_t *color);
+//static void map_style_print_layer(maplayer_t *layer);
+//static void map_style_print_color(color_t *color);
//
// Functions
@@ -213,7 +215,7 @@ static gchar* get_attribute_value(const xmlDocPtr pDoc, const xmlAttrPtr pAttrib
g_assert(pAttribute != NULL);
// allocate a new glib string for this value. free xmllib string.
- gchar* pszTmp = xmlNodeListGetString(pDoc, pAttribute->xmlChildrenNode, 1);
+ gchar* pszTmp = (char *)xmlNodeListGetString(pDoc, pAttribute->xmlChildrenNode, 1);
gchar* pszValue = g_strdup((pszTmp) ? pszTmp : "");
xmlFree(pszTmp);
return pszValue;
@@ -269,7 +271,7 @@ static void map_style_parse_file(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pParent
if(pParentNode->type == XML_ELEMENT_NODE) {
xmlNodePtr pChildNode = NULL;
for(EACH_CHILD_OF_NODE(pChildNode, pParentNode)) {
- if(strcmp(pChildNode->name, "layers") == 0) {
+ if(strcmp((char *)pChildNode->name, "layers") == 0) {
map_style_parse_layers(pMap, pDoc, pChildNode);
}
}
@@ -288,7 +290,7 @@ static void map_style_parse_layers(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pPare
// iterate over "layer" objects
for(EACH_CHILD_OF_NODE(pChildNode, pParentNode)) {
//for(pChildNode = pParentNode->children; pChildNode != NULL; pChildNode = pChildNode->next) {
- if(pChildNode->type == XML_ELEMENT_NODE && strcmp(pChildNode->name, "layer") == 0) {
+ if(pChildNode->type == XML_ELEMENT_NODE && strcmp((char *)pChildNode->name, "layer") == 0) {
map_style_parse_layer(pMap, pDoc, pChildNode);
}
}
@@ -301,22 +303,22 @@ static void map_style_parse_layer(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode)
g_assert(pNode != NULL);
xmlAttrPtr pAttribute = NULL;
- gint i;
+ //gint i;
// create new layer
maplayer_t *pLayer = map_style_new_layer();
// read attributes of the 'layer' node
for(EACH_ATTRIBUTE_OF_NODE(pAttribute, pNode)) {
- if(strcmp(pAttribute->name, "data-source") == 0) {
- gchar* pszDataSource = xmlNodeListGetString(pDoc, pAttribute->xmlChildrenNode, 1);
+ if(strcmp((char *)pAttribute->name, "data-source") == 0) {
+ gchar* pszDataSource = (char *)xmlNodeListGetString(pDoc, pAttribute->xmlChildrenNode, 1);
if(!map_object_type_atoi(pszDataSource, &(pLayer->nDataSource))) {
g_error("bad data source name %s\n", pszDataSource);
}
}
- else if(strcmp(pAttribute->name, "draw-type") == 0) {
- gchar* pszDrawType = xmlNodeListGetString(pDoc, pAttribute->xmlChildrenNode, 1);
+ else if(strcmp((char *)pAttribute->name, "draw-type") == 0) {
+ gchar* pszDrawType = (char *)xmlNodeListGetString(pDoc, pAttribute->xmlChildrenNode, 1);
if(!map_layer_render_type_atoi(pszDrawType, &(pLayer->nDrawType))) {
g_error("bad layer draw type name %s\n", pszDrawType);
@@ -327,7 +329,7 @@ static void map_style_parse_layer(map_t* pMap, xmlDocPtr pDoc, xmlNodePtr pNode)
// read children of the 'layer' node
xmlNodePtr pChild = NULL;
for(EACH_CHILD_OF_NODE(pChild, pNode)) {
- if(strcmp(pChild->name, "property") == 0) {
+ if(strcmp((char *)pChild->name, "property") == 0) {
map_style_parse_layer_property(pMap, pDoc, pLayer, pChild);
}
}
@@ -351,15 +353,15 @@ static void map_style_parse_layer_property(map_t* pMap, xmlDocPtr pDoc, maplayer
// Read 'name', 'value', and 'level' attributes of this property
xmlAttrPtr pAttribute = NULL;
for(EACH_ATTRIBUTE_OF_NODE(pAttribute, pNode)) {
- if(strcmp(pAttribute->name, "name") == 0) {
+ if(strcmp((char *)pAttribute->name, "name") == 0) {
g_free(pszName);
pszName = get_attribute_value(pDoc, pAttribute);
}
- else if(strcmp(pAttribute->name, "value") == 0) {
+ else if(strcmp((char *)pAttribute->name, "value") == 0) {
g_free(pszValue);
pszValue = get_attribute_value(pDoc, pAttribute);
}
- else if((strcmp(pAttribute->name, "zoom-level") == 0) || (strcmp(pAttribute->name, "zoom-levels") == 0)) {
+ else if((strcmp((char *)pAttribute->name, "zoom-level") == 0) || (strcmp((char *)pAttribute->name, "zoom-levels") == 0)) {
g_free(pszZoomLevel);
pszZoomLevel = get_attribute_value(pDoc, pAttribute);
}
@@ -471,11 +473,13 @@ static void map_style_parse_layer_property(map_t* pMap, xmlDocPtr pDoc, maplayer
/******************************************************************
* map_style_print_* functions for debugging
*****************************************************************/
+#if 0
static void map_style_print_color(color_t* pColor)
{
g_assert(pColor != NULL);
g_print("color: %3.2f, %3.2f, %3.2f, %3.2f\n", pColor->fRed, pColor->fGreen, pColor->fBlue, pColor->fAlpha);
}
+#endif
/*
color_t clrPrimary; // Color used for polygon fill or line stroke
@@ -496,6 +500,7 @@ static void map_style_print_color(color_t* pColor)
color_t clrHalo;
*/
+#if 0
static void map_style_print_layer(maplayer_t *pLayer)
{
g_assert(pLayer != NULL);
@@ -512,3 +517,4 @@ static void map_style_print_layer(maplayer_t *pLayer)
//g_print(" dash style: %d\n", pStyle->nDashStyle);
}
}
+#endif
diff --git a/src/map_tilemanager.c b/src/map_tilemanager.c
index 996f3ac..1506663 100644
--- a/src/map_tilemanager.c
+++ b/src/map_tilemanager.c
@@ -28,6 +28,8 @@ Purpose of map_tilemanager.c:
*/
#include <gtk/gtk.h>
+#include <stdlib.h>
+#include <string.h>
#include "util.h"
#include "map_tilemanager.h"
#include "map_math.h"
@@ -298,7 +300,7 @@ static void _map_tilemanager_tile_load_map_objects(maptile_t* pTile, maprect_t*
// XXX: perhaps let the wkb parser create the array (at the perfect size)
GArray* pPointsArray = g_array_new(FALSE, FALSE, sizeof(mappoint_t));
maprect_t rcBoundingBox;
- db_parse_wkb_linestring(aRow[2], pPointsArray, &rcBoundingBox);
+ db_parse_wkb_linestring((gint8*)aRow[2], pPointsArray, &rcBoundingBox);
gint nRoadNameID = atoi(aRow[1]);
diff --git a/src/mapinfowindow.c b/src/mapinfowindow.c
index 7b79513..e495df0 100644
--- a/src/mapinfowindow.c
+++ b/src/mapinfowindow.c
@@ -182,7 +182,7 @@ static void mapinfowindow_load_countries()
gint nID = 1;
GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszCountryName));
- g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_country_chosen, (gpointer)nID);
+ g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_country_chosen, GINT_TO_POINTER(nID));
gtk_menu_shell_append(GTK_MENU_SHELL(g_MapInfoWindow.pCountryMenu), GTK_WIDGET(pNewMenuItem));
}
@@ -218,7 +218,7 @@ static void mapinfowindow_load_states(gint nCountryID)
// Add new menu item
GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszName));
- g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_state_chosen, (gpointer)nID);
+ g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_state_chosen, GINT_TO_POINTER(nID));
gtk_menu_shell_append(GTK_MENU_SHELL(g_MapInfoWindow.pStateMenu), GTK_WIDGET(pNewMenuItem));
}
db_free_result(pResultSet);
@@ -254,7 +254,7 @@ static void mapinfowindow_load_cities(gint nStateID)
// Add new menu item
GtkMenuItem* pNewMenuItem = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic(pszName));
- g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_city_chosen, (gpointer)nCityID);
+ g_signal_connect(G_OBJECT(pNewMenuItem), "activate", (GCallback)mapinfowindow_on_city_chosen, GINT_TO_POINTER(nCityID));
gtk_menu_shell_append(GTK_MENU_SHELL(g_MapInfoWindow.pCityMenu), GTK_WIDGET(pNewMenuItem));
}
db_free_result(pResultSet);
diff --git a/src/scenemanager.c b/src/scenemanager.c
index 5b4be63..b3dfb1d 100644
--- a/src/scenemanager.c
+++ b/src/scenemanager.c
@@ -145,7 +145,7 @@ gboolean scenemanager_can_draw_rectangle(scenemanager_t* pSceneManager, GdkRecta
return bOK;
}
-void scenemanager_claim_label(scenemanager_t* pSceneManager, const gchar* pszLabel)
+void scenemanager_claim_label(scenemanager_t* pSceneManager, gchar* pszLabel)
{
#ifdef ENABLE_NO_DUPLICATE_LABELS
g_assert(pSceneManager != NULL);
diff --git a/src/scenemanager.h b/src/scenemanager.h
index 831058a..0f4ae9d 100644
--- a/src/scenemanager.h
+++ b/src/scenemanager.h
@@ -45,7 +45,7 @@ gboolean scenemanager_can_draw_label_at(scenemanager_t* pSceneManager, const gch
gboolean scenemanager_can_draw_polygon(scenemanager_t* pSceneManager, GdkPoint *pPoints, gint nNumPoints, gint nFlags);
gboolean scenemanager_can_draw_rectangle(scenemanager_t* pSceneManager, GdkRectangle* pRect, gint nFlags);
-void scenemanager_claim_label(scenemanager_t* pSceneManager, const gchar* pszLabel);
+void scenemanager_claim_label(scenemanager_t* pSceneManager, gchar* pszLabel);
void scenemanager_claim_polygon(scenemanager_t* pSceneManager, GdkPoint *pPoints, gint nNumPoints);
void scenemanager_claim_rectangle(scenemanager_t* pSceneManager, GdkRectangle* pRect);
diff --git a/src/search_coordinate.c b/src/search_coordinate.c
index 39e5399..6119bd8 100644
--- a/src/search_coordinate.c
+++ b/src/search_coordinate.c
@@ -36,12 +36,12 @@
#define FORMAT_COORDINATE_RESULT ("<b>Lat:</b> %10.5f\n<b>Lon:</b> %10.5f")
-static GList *search_coordinate_add_result(const mappoint_t* pPoint, GList *ret);
+//static GList *search_coordinate_add_result(const mappoint_t* pPoint, GList *ret);
//
// globals
//
-static glyph_t* g_SearchResultTypeCoordinateGlyph = NULL;
+//static glyph_t* g_SearchResultTypeCoordinateGlyph = NULL;
//
// Public API
@@ -78,6 +78,7 @@ GList *search_coordinate_execute(const gchar* pszSentence)
//
// Private
//
+#if 0
static GList *search_coordinate_add_result(const mappoint_t* pPoint, GList *ret)
{
if (!g_SearchResultTypeCoordinateGlyph)
@@ -103,3 +104,4 @@ static GList *search_coordinate_add_result(const mappoint_t* pPoint, GList *ret)
return ret;
}
+#endif
diff --git a/src/search_location.c b/src/search_location.c
index 935d05c..c7cba94 100644
--- a/src/search_location.c
+++ b/src/search_location.c
@@ -172,7 +172,7 @@ GList *search_location_on_words(gchar** aWords, gint nWordCount, GList *ret)
gint nLocationSetID = atoi(aRow[1]);
gchar* pszLocationName = aRow[2];
gchar* pszLocationAddress = aRow[3];
- db_parse_wkb_point(aRow[4], &pt); // Parse coordinates
+ db_parse_wkb_point((gint8 *)aRow[4], &pt); // Parse coordinates
ret = search_location_filter_result(nLocationID, nLocationSetID, pszLocationName, pszLocationAddress, &pt, ret);
}
@@ -212,7 +212,7 @@ GList *search_location_filter_result(gint nLocationID, gint nLocationSetID, cons
.type = SEARCH_RESULT_TYPE_LOCATION,
.text = pszResultText,
.glyph = pGlyph,
- .point = pCoordinates,
+ .point = point,
.zoom_level = LOCATION_RESULT_SUGGESTED_ZOOMLEVEL,
};
diff --git a/src/search_road.c b/src/search_road.c
index 14bfa00..1b8bba2 100644
--- a/src/search_road.c
+++ b/src/search_road.c
@@ -358,7 +358,7 @@ GList *search_road_on_roadsearch_struct(const roadsearch_t* pRoadSearch, GList *
GArray* pMapPointsArray = g_array_new(FALSE, FALSE, sizeof(mappoint_t));
maprect_t r;
- db_parse_wkb_linestring(aRow[3], pMapPointsArray, &r);
+ db_parse_wkb_linestring((gint8 *)aRow[3], pMapPointsArray, &r);
ret = search_road_filter_result(aRow[1], pRoadSearch->nNumber, atoi(aRow[2]), atoi(aRow[4]), atoi(aRow[5]), atoi(aRow[6]), atoi(aRow[7]), aRow[8], aRow[9], aRow[10], aRow[11], aRow[12], aRow[13], pMapPointsArray, ret);
//g_print("%03d: Road.ID='%s' RoadName.Name='%s', Suffix=%s, L:%s-%s, R:%s-%s\n", nCount, aRow[0], aRow[1], aRow[3], aRow[4], aRow[5], aRow[6], aRow[7]);
diff --git a/src/test_poly.c b/src/test_poly.c
index 1dfaa64..34c8b87 100644
--- a/src/test_poly.c
+++ b/src/test_poly.c
@@ -30,6 +30,7 @@ Purpose of test_poly.c:
# include <config.h>
#endif
+#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <cairo.h>
diff --git a/src/tiger.c b/src/tiger.c
index 85c9b1f..26e886d 100644
--- a/src/tiger.c
+++ b/src/tiger.c
@@ -70,7 +70,7 @@ GSList *tiger_get_states()
return state_list;
}
-GSList *tiger_get_counties(gchar *state_abbrev)
+GSList *tiger_get_counties(const char *state_abbrev)
{
gchar *contents, **lines, **iter, **tokens;
diff --git a/src/tiger.h b/src/tiger.h
index f2ba85e..6593d00 100644
--- a/src/tiger.h
+++ b/src/tiger.h
@@ -39,6 +39,6 @@ struct tiger_county {
GSList *tiger_get_states();
-GSList *tiger_get_counties(gchar *state_abbrev);
+GSList *tiger_get_counties(const char *state_abbrev);
#endif
diff --git a/src/tiger_dialog.c b/src/tiger_dialog.c
index 04cf899..1b38ca1 100644
--- a/src/tiger_dialog.c
+++ b/src/tiger_dialog.c
@@ -63,7 +63,7 @@ void tiger_dialog_comboinit(GtkComboBox *combobox, gpointer user_data)
gtk_combo_box_set_model(combobox, GTK_TREE_MODEL(liststore));
/* Set up the cell renderers */
- GtkCellRendererText *cell = gtk_cell_renderer_text_new();
+ GtkCellRenderer *cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox),
GTK_CELL_RENDERER(cell), TRUE);
/* Column 0 of the list is the state name */
@@ -92,18 +92,18 @@ void tiger_dialog_selectstate(gpointer user_data, GtkComboBox *combobox)
GValue abbrev = {0};
gtk_tree_model_get_value(model, &iter, 2, &abbrev);
- gchar *state_abbrev = g_value_get_string(&abbrev);
+ const gchar *state_abbrev = g_value_get_string(&abbrev);
GSList *counties = tiger_get_counties(state_abbrev);
- GtkListStore *store = gtk_tree_view_get_model(county_view);
+ GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(county_view));
if (!store)
{
store = gtk_list_store_new(3, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model(county_view, GTK_TREE_MODEL(store));
- GtkCellRendererText *cell = gtk_cell_renderer_text_new();
+ GtkCellRenderer *cell = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(county_view, 0, "County", cell, "text", 0, NULL);
GtkTreeSelection *sel = gtk_tree_view_get_selection(county_view);
@@ -137,12 +137,12 @@ void tiger_dialog_import(gpointer user_data, gint response, GtkDialog *dialog)
GtkTreeSelection *sel = gtk_tree_view_get_selection(county_view);
GtkTreeModel *model;
- GSList *paths = gtk_tree_selection_get_selected_rows(sel, &model);
+ GList *paths = gtk_tree_selection_get_selected_rows(sel, &model);
- for (; paths; paths = g_slist_next(paths))
+ for (; paths; paths = g_list_next(paths))
{
GtkTreeIter iter;
- gtk_tree_model_get_iter(model, &iter, g_slist_nth_data(paths, 0));
+ gtk_tree_model_get_iter(model, &iter, g_list_nth_data(paths, 0));
GValue tmp = {0};
@@ -158,4 +158,7 @@ void tiger_dialog_import(gpointer user_data, gint response, GtkDialog *dialog)
g_warning("Import from %s", uri);
import_from_uri(uri);
}
+
+ g_list_foreach(paths, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free(paths);
}
diff --git a/src/util.c b/src/util.c
index b9ccc1d..c75f580 100644
--- a/src/util.c
+++ b/src/util.c
@@ -685,7 +685,7 @@ gboolean util_load_array_of_string_vectors(const gchar* pszPath, GArray** ppRetu
return TRUE;
}
-gboolean util_find_string_in_string_vector(const gchar* pszSearch, const gchar** apszVector, gint* pnReturnIndex)
+gboolean util_find_string_in_string_vector(const gchar* pszSearch, gchar** apszVector, gint* pnReturnIndex)
{
g_assert(pszSearch != NULL);
g_assert(apszVector != NULL);
diff --git a/src/util.h b/src/util.h
index aae45eb..52829b0 100644
--- a/src/util.h
+++ b/src/util.h
@@ -67,7 +67,7 @@ gboolean util_gtk_range_instant_set_on_value_changing_callback(GtkRange *range,
const gchar* util_gtk_menu_item_get_label_text(GtkMenuItem* pMenuItem);
gboolean util_load_array_of_string_vectors(const gchar* pszPath, GArray** ppReturnArray, gint nMinNamesPerRow);
-gboolean util_find_string_in_string_vector(const gchar* pszSearch, const gchar** apszVector, gint* pnReturnIndex);
+gboolean util_find_string_in_string_vector(const gchar* pszSearch, gchar** apszVector, gint* pnReturnIndex);
// if glib < 2.6
#if(!GLIB_CHECK_VERSION(2,6,0))