diff options
author | bjasspa <bjasspa@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-07-01 07:58:00 +0000 |
---|---|---|
committer | bjasspa <bjasspa@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2012-07-01 07:58:00 +0000 |
commit | 8f65647892debd04292454db3162a12b7806d65d (patch) | |
tree | 4a4f3d38ce93ed66f3cc2b5d9a053f99c7888a15 /navit | |
parent | b87f98ff8b12319eddb55f714f962a10f6625996 (diff) | |
download | navit-8f65647892debd04292454db3162a12b7806d65d.tar.gz |
Simple fixes to get navit compiling with MSVC
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5165 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/config_.c | 2 | ||||
-rw-r--r-- | navit/event_glib.c | 1 | ||||
-rw-r--r-- | navit/font/freetype/font_freetype.c | 12 | ||||
-rw-r--r-- | navit/graphics/win32/graphics_win32.c | 6 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal.c | 121 | ||||
-rw-r--r-- | navit/map/csv/quadtree.c | 2 | ||||
-rw-r--r-- | navit/maptool/boundaries.c | 3 | ||||
-rw-r--r-- | navit/search.c | 2 | ||||
-rw-r--r-- | navit/util.c | 3 | ||||
-rw-r--r-- | navit/xmlconfig.c | 13 |
10 files changed, 68 insertions, 97 deletions
diff --git a/navit/config_.c b/navit/config_.c index 224f476ab..ff2f354cf 100644 --- a/navit/config_.c +++ b/navit/config_.c @@ -72,11 +72,13 @@ config_new_int(void) #ifndef HAVE_API_WIN32_CE signal(SIGTERM, config_terminate); #ifndef HAVE_API_WIN32 +#ifndef _MSC_VER #ifndef __MINGW32__ signal(SIGPIPE, SIG_IGN); #endif /* __MINGW32__ */ #endif #endif +#endif } int diff --git a/navit/event_glib.c b/navit/event_glib.c index 136f54df6..ced4f9a79 100644 --- a/navit/event_glib.c +++ b/navit/event_glib.c @@ -183,6 +183,7 @@ static struct event_methods event_glib_methods = { }; struct event_priv { + int data; }; static struct event_priv* diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c index 4a3317df5..504cc55c0 100644 --- a/navit/font/freetype/font_freetype.c +++ b/navit/font/freetype/font_freetype.c @@ -64,6 +64,7 @@ struct font_freetype_font { }; struct font_priv { + int data; }; static struct font_priv dummy; @@ -89,10 +90,11 @@ font_freetype_get_text_bbox(struct graphics_priv *gr, FT_Glyph glyph; FT_Matrix matrix; FT_Vector pen; - pen.x = 0 * 64; - pen.y = 0 * 64; int i; struct point pt; + int n, len, x = 0, y = 0; + pen.x = 0 * 64; + pen.y = 0 * 64; #if 0 matrix.xx = dx; matrix.xy = dy; @@ -104,7 +106,6 @@ font_freetype_get_text_bbox(struct graphics_priv *gr, matrix.yx = 0; matrix.yy = 0x10000; #endif - int n, len, x = 0, y = 0; len = g_utf8_strlen(text, -1); if (estimate) { @@ -122,8 +123,8 @@ font_freetype_get_text_bbox(struct graphics_priv *gr, FT_BBox glyph_bbox; #if USE_CACHING FTC_Node anode = NULL; - glyph_index = FTC_CMapCache_Lookup(charmap_cache, font->scaler.face_id, font->charmap_index, g_utf8_get_char(p)); FT_Glyph cached_glyph; + glyph_index = FTC_CMapCache_Lookup(charmap_cache, font->scaler.face_id, font->charmap_index, g_utf8_get_char(p)); #if HAVE_LOOKUP_SCALER FTC_ImageCache_LookupScaler(image_cache, &font->scaler, FT_LOAD_DEFAULT, glyph_index, &cached_glyph, &anode); #else @@ -384,8 +385,6 @@ font_freetype_font_new(struct graphics_priv *gr, { struct font_freetype_font *font = g_new(struct font_freetype_font, 1); - - *meth = font_methods; int exact, found=0; char **family, **family_sav; #if USE_CACHING @@ -395,6 +394,7 @@ font_freetype_font_new(struct graphics_priv *gr, #ifndef HAVE_FONTCONFIG char *name; #endif + *meth = font_methods; if (!library_init) { FT_Init_FreeType(&library); diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c index 0a9c32037..7222b2c14 100644 --- a/navit/graphics/win32/graphics_win32.c +++ b/navit/graphics/win32/graphics_win32.c @@ -80,8 +80,8 @@ struct graphics_priv HBITMAP hOldPrebuildBitmap; FP_AlphaBlend AlphaBlend; FP_SetStretchBltMode SetStretchBltMode; - BOOL WINAPI (*ChangeWindowMessageFilter)(UINT message, DWORD dwFlag); - BOOL WINAPI (*ChangeWindowMessageFilterEx)( HWND hWnd, UINT message, DWORD action, void *pChangeFilterStruct); + BOOL (WINAPI *ChangeWindowMessageFilter)(UINT message, DWORD dwFlag); + BOOL (WINAPI *ChangeWindowMessageFilterEx)( HWND hWnd, UINT message, DWORD action, void *pChangeFilterStruct); HANDLE hCoreDll; HANDLE hUser32Dll; HANDLE hGdi32Dll; @@ -1179,7 +1179,7 @@ pngdecode(struct graphics_priv *gr, char *name, struct graphics_image_priv *img) /* expand images to bit-depth 8 (only applicable for grayscale images) */ if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA && bit_depth < 8) - png_set_gray_1_2_4_to_8(png_ptr); + png_set_gray_1_2_4_to_8(png_ptr); /* Expand grayscale to rgb */ if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index fbcad7fef..fa2630065 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -39,6 +39,8 @@ #endif #ifndef _MSC_VER #include <sys/time.h> +#else +#define snprintf sprintf_s #endif /* _MSC_VER */ #include "item.h" #include "file.h" @@ -2526,82 +2528,47 @@ get_direction(char *buffer, int angle, int mode) static void gui_internal_cmd_position(struct gui_priv *this, struct widget *wm, void *data); -#ifndef _MSC_VER -//MSVC doesn't supports this style of initialization and i'm not sure -//how to fix it struct selector { char *icon; char *name; enum item_type *types; }; +static enum item_type selectors_BankTypes[]={type_poi_bank,type_poi_bank, type_poi_atm,type_poi_atm, type_none}; +static enum item_type selectors_FuelTypes[]={type_poi_fuel,type_poi_fuel,type_none}; +static enum item_type selectors_HotelTypes[]={type_poi_hotel,type_poi_camp_rv,type_poi_camping,type_poi_camping, + type_poi_resort,type_poi_resort,type_poi_motel,type_poi_hostel,type_none}; +static enum item_type selectors_RestaurantTypes[]={type_poi_bar,type_poi_picnic,type_poi_burgerking,type_poi_fastfood, + type_poi_restaurant,type_poi_restaurant,type_poi_cafe,type_poi_cafe,type_poi_pub,type_poi_pub,type_none}; +static enum item_type selectors_ShoppingTypes[]={type_poi_mall,type_poi_mall,type_poi_shop_grocery,type_poi_shop_grocery, + type_poi_shopping,type_poi_shopping,type_poi_shop_butcher,type_poi_shop_baker,type_poi_shop_fruit, + type_poi_shop_fruit,type_poi_shop_beverages,type_poi_shop_beverages,type_none}; +static enum item_type selectors_ServiceTypes[]={type_poi_marina,type_poi_marina,type_poi_hospital,type_poi_hospital, + type_poi_public_utilities,type_poi_public_utilities,type_poi_police,type_poi_autoservice,type_poi_information, + type_poi_information,type_poi_pharmacy,type_poi_pharmacy,type_poi_personal_service,type_poi_repair_service, + type_poi_restroom,type_poi_restroom,type_none}; +static enum item_type selectors_ParkingTypes[]={type_poi_car_parking,type_poi_car_parking,type_none}; +static enum item_type selectors_LandFeaturesTypes[]={type_poi_land_feature,type_poi_rock,type_poi_dam,type_poi_dam, + type_poi_peak,type_poi_peak,type_none}; +static enum item_type selectors_OtherTypes[]={type_point_unspecified,type_poi_land_feature-1,type_poi_rock+1,type_poi_fuel-1, + type_poi_marina+1,type_poi_shopping-1,type_poi_shopping+1,type_poi_car_parking-1,type_poi_car_parking+1, + type_poi_bar-1,type_poi_bank+1,type_poi_dam-1,type_poi_dam+1,type_poi_information-1,type_poi_information+1, + type_poi_mall-1,type_poi_mall+1,type_poi_personal_service-1,type_poi_pharmacy+1,type_poi_repair_service-1, + type_poi_repair_service+1,type_poi_restaurant-1,type_poi_restaurant+1,type_poi_restroom-1,type_poi_restroom+1, + type_poi_shop_grocery-1,type_poi_shop_grocery+1,type_poi_peak-1,type_poi_peak+1,type_poi_motel-1,type_poi_hostel+1, + type_poi_shop_butcher-1,type_poi_shop_baker+1,type_poi_shop_fruit-1,type_poi_shop_fruit+1,type_poi_shop_beverages-1, + type_poi_shop_beverages+1,type_poi_pub-1,type_poi_atm+1,type_line-1,type_none}; +/*static enum item_type selectors_UnknownTypes[]={type_point_unkn,type_point_unkn,type_none};*/ struct selector selectors[]={ - {"bank","Bank",(enum item_type []){ - type_poi_bank,type_poi_bank, - type_poi_atm,type_poi_atm, - type_none}}, - {"fuel","Fuel",(enum item_type []){type_poi_fuel,type_poi_fuel,type_none}}, - {"hotel","Hotel",(enum item_type []) { - type_poi_hotel,type_poi_camp_rv, - type_poi_camping,type_poi_camping, - type_poi_resort,type_poi_resort, - type_poi_motel,type_poi_hostel, - type_none}}, - {"restaurant","Restaurant",(enum item_type []) { - type_poi_bar,type_poi_picnic, - type_poi_burgerking,type_poi_fastfood, - type_poi_restaurant,type_poi_restaurant, - type_poi_cafe,type_poi_cafe, - type_poi_pub,type_poi_pub, - type_none}}, - {"shopping","Shopping",(enum item_type []) { - type_poi_mall,type_poi_mall, - type_poi_shop_grocery,type_poi_shop_grocery, - type_poi_shopping,type_poi_shopping, - type_poi_shop_butcher,type_poi_shop_baker, - type_poi_shop_fruit,type_poi_shop_fruit, - type_poi_shop_beverages,type_poi_shop_beverages, - type_none}}, - {"hospital","Service",(enum item_type []) { - type_poi_marina,type_poi_marina, - type_poi_hospital,type_poi_hospital, - type_poi_public_utilities,type_poi_public_utilities, - type_poi_police,type_poi_autoservice, - type_poi_information,type_poi_information, - type_poi_pharmacy,type_poi_pharmacy, - type_poi_personal_service,type_poi_repair_service, - type_poi_restroom,type_poi_restroom, - type_none}}, - {"parking","Parking",(enum item_type []){type_poi_car_parking,type_poi_car_parking,type_none}}, - {"peak","Land Features",(enum item_type []){ - type_poi_land_feature,type_poi_rock, - type_poi_dam,type_poi_dam, - type_poi_peak,type_poi_peak, - type_none}}, - {"unknown","Other",(enum item_type []){ - type_point_unspecified,type_poi_land_feature-1, - type_poi_rock+1,type_poi_fuel-1, - type_poi_marina+1,type_poi_shopping-1, - type_poi_shopping+1,type_poi_car_parking-1, - type_poi_car_parking+1,type_poi_bar-1, - type_poi_bank+1,type_poi_dam-1, - type_poi_dam+1,type_poi_information-1, - type_poi_information+1,type_poi_mall-1, - type_poi_mall+1,type_poi_personal_service-1, - type_poi_pharmacy+1,type_poi_repair_service-1, - type_poi_repair_service+1,type_poi_restaurant-1, - type_poi_restaurant+1,type_poi_restroom-1, - type_poi_restroom+1,type_poi_shop_grocery-1, - type_poi_shop_grocery+1,type_poi_peak-1, - type_poi_peak+1, type_poi_motel-1, - type_poi_hostel+1,type_poi_shop_butcher-1, - type_poi_shop_baker+1,type_poi_shop_fruit-1, - type_poi_shop_fruit+1,type_poi_shop_beverages-1, - type_poi_shop_beverages+1,type_poi_pub-1, - type_poi_atm+1,type_line-1, - type_none}}, -/* {"unknown","Unknown",(enum item_type []){ - type_point_unkn,type_point_unkn, - type_none}},*/ + {"bank","Bank",selectors_BankTypes}, + {"fuel","Fuel",selectors_FuelTypes}, + {"hotel","Hotel",selectors_HotelTypes}, + {"restaurant","Restaurant",selectors_RestaurantTypes}, + {"shopping","Shopping",selectors_ShoppingTypes}, + {"hospital","Service",selectors_ServiceTypes}, + {"parking","Parking",selectors_ParkingTypes}, + {"peak","Land Features",selectors_LandFeaturesTypes}, + {"unknown","Other",selectors_OtherTypes}, +/* {"unknown","Unknown",selectors_UnknownTypes},*/ }; @@ -3111,6 +3078,9 @@ gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data) struct fibheap* fh = fh_makekeyheap(); int cnt = 0; struct table_data *td; + struct widget *wl,*wt; + char buffer[32]; + struct poi_param *paramnew; if(data) { param = data; @@ -3241,9 +3211,6 @@ gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data) free(items); // Add an entry for more POI - struct widget *wl,*wt; - char buffer[32]; - struct poi_param *paramnew; row = gui_internal_widget_table_row_new(this, gravity_left | flags_fill @@ -3318,7 +3285,6 @@ gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data) if(param_free) g_free(param); } -#endif /* _MSC_VER */ static void gui_internal_cmd_view_on_map(struct gui_priv *this, struct widget *wm, void *data) @@ -3561,10 +3527,11 @@ gui_internal_cmd_results_to_map(struct gui_priv *this, struct widget *wm, void * struct widget *wr=l->data; if(wr->type==widget_table_row) { struct widget *wi=wr->children->data; + struct item* it; if(wi->name==NULL) continue; dbg(0,"%s\n",wi->name); - struct item* it=map_rect_create_item(mr,type_found_item); + it=map_rect_create_item(mr,type_found_item); if(it) { struct coord c; struct attr a; @@ -4389,6 +4356,7 @@ gui_internal_search_idle(struct gui_priv *this, char *wm_name, struct widget *se GList *l; static char possible_keys[256]=""; struct widget *wi=NULL; + struct widget *wr; res=search_list_get_result(this->sl); if (res) { @@ -4482,7 +4450,6 @@ gui_internal_search_idle(struct gui_priv *this, char *wm_name, struct widget *se text2=town_str(res, 3, 0); } dbg(1,"res->country->flag=%s\n", res->country->flag); - struct widget *wr; wr=gui_internal_widget_table_row_new(this, gravity_left|orientation_horizontal|flags_fill); if (!text2) { @@ -5681,7 +5648,7 @@ gui_internal_cmd2_setting_vehicle(struct gui_priv *this, char *function, struct struct widget *w,*wb,*wl; struct attr_iter *iter; struct attr active_vehicle; - + iter=navit_attr_iter_new(); if (navit_get_attr(this->nav, attr_vehicle, &attr, iter) && !navit_get_attr(this->nav, attr_vehicle, &attr2, iter)) { vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL); diff --git a/navit/map/csv/quadtree.c b/navit/map/csv/quadtree.c index 4c82de3f6..1becab7ce 100644 --- a/navit/map/csv/quadtree.c +++ b/navit/map/csv/quadtree.c @@ -622,8 +622,8 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter) while(iter->iter_nodes) { struct quadtree_node *nodes[4]; - iter_node=iter->iter_nodes->data; int i; + iter_node=iter->iter_nodes->data; if(iter_node->is_leaf) { /* Try to find undeleted item in the current node */ diff --git a/navit/maptool/boundaries.c b/navit/maptool/boundaries.c index ed8b90ce3..85e484c55 100644 --- a/navit/maptool/boundaries.c +++ b/navit/maptool/boundaries.c @@ -230,12 +230,13 @@ process_boundaries_finish(GList *boundaries_list) } if (boundary->country) { if (!coord_is_equal(*gs->first,*gs->last)) { + struct item_bin *ib; if (!fu) { char *name=g_strdup_printf("country_%s_broken",boundary->iso2); fu=tempfile("",name,1); g_free(name); } - struct item_bin *ib=item_bin; + ib=item_bin; item_bin_init(ib, type_selected_point); item_bin_add_coord(ib, gs->first, 1); item_bin_write(ib, fu); diff --git a/navit/search.c b/navit/search.c index a74862001..984df4634 100644 --- a/navit/search.c +++ b/navit/search.c @@ -195,8 +195,8 @@ search_split_phrases(char *str) { char *s,*d; int wordcount=0; - s=str; GList *ret=NULL; + s=str; do { d=s; wordcount=0; diff --git a/navit/util.c b/navit/util.c index 86054b139..1599fce45 100644 --- a/navit/util.c +++ b/navit/util.c @@ -30,6 +30,9 @@ #include <sys/types.h> #include <sys/wait.h> #endif +#ifdef _MSC_VER +typedef int ssize_t ; +#endif #include "util.h" #include "debug.h" #include "config.h" diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c index df50b984c..e355644f7 100644 --- a/navit/xmlconfig.c +++ b/navit/xmlconfig.c @@ -52,6 +52,11 @@ #include "config_.h" #include "xmlconfig.h" +#if (defined __MINGW32__) || (defined _MSC_VER) +/* This only works if a is a string constant, i.e. "name" */ +#define unsetenv(a) putenv(a "=") +#endif + #ifdef HAVE_GLIB #define ATTR_DISTANCE 1 const int xml_attr_distance=1; @@ -1123,19 +1128,11 @@ parse_file(struct xmldocument *document, xmlerror **error) if (xmldir) setenv("XMLDIR",xmldir,1); else -#ifndef __MINGW32__ unsetenv("XMLDIR"); -#else - putenv("XMLDIR="); -#endif /* __MINGW32__ */ if (xmlfile) setenv("XMLFILE",xmlfile,1); else -#ifndef __MINGW32__ unsetenv("XMLFILE"); -#else - putenv("XMLFILE="); -#endif /* __MINGW32__ */ g_free(newxmldir); g_free(newxmlfile); dbg(1,"return %d\n", result); |