[PATCH] Fix compilation: in C++, enums don't have operator++
Thiago Macieira
thiago at macieira.org
Sat Apr 13 00:41:14 PDT 2013
To use ++, we need to declare the variable as int. But then we need to
cast to the enum type.
This is using C-style casts because this is still C-like code.
Signed-off-by: Thiago Macieira <thiago at macieira.org>
---
qt-gui.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/qt-gui.cpp b/qt-gui.cpp
index e667e97..e0545e2 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -757,14 +757,14 @@ static void pick_default_file(GtkWidget *w, GtkButton *button)
#if HAVE_OSM_GPS_MAP
static GtkWidget * map_provider_widget()
{
- OsmGpsMapSource_t i;
+ int i;
#if GTK_CHECK_VERSION(2,24,0)
GtkWidget *combobox = gtk_combo_box_text_new();
/* several of the providers seem to be redundant or non-functional;
* we may have to skip more than just the last three eventually */
for (i = OSM_GPS_MAP_SOURCE_OPENSTREETMAP; i < OSM_GPS_MAP_SOURCE_LAST; i++)
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), osm_gps_map_source_get_friendly_name(i));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), osm_gps_map_source_get_friendly_name((OsmGpsMapSource_t)i));
#else
GtkWidget *combobox = gtk_combo_box_new_text();
for (i = OSM_GPS_MAP_SOURCE_OPENSTREETMAP; i < OSM_GPS_MAP_SOURCE_LAST; i++)
@@ -1091,14 +1091,14 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
}
#if HAVE_OSM_GPS_MAP
/* get the map provider selected */
- OsmGpsMapSource_t i;
+ int i;
#if GTK_CHECK_VERSION(2,24,0)
char *provider = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(map_provider));
#else
char *provider = gtk_combo_box_get_active_text(GTK_COMBO_BOX(map_provider));
#endif
for (i = OSM_GPS_MAP_SOURCE_OPENSTREETMAP; i <= OSM_GPS_MAP_SOURCE_YAHOO_STREET; i++)
- if (!strcmp(provider,osm_gps_map_source_get_friendly_name(i))) {
+ if (!strcmp(provider,osm_gps_map_source_get_friendly_name((OsmGpsMapSource_t)i))) {
prefs.map_provider = i;
break;
}
--
1.7.11.7
More information about the subsurface
mailing list