summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authorJoseph Herlant <aerostitch@users.noreply.github.com>2018-08-21 10:04:26 -0700
committerjkoan <jkoan@users.noreply.github.com>2018-08-21 19:04:26 +0200
commit704679b9066e160063ce5e2118b88ea0ed01f6ad (patch)
treeb8f9216d6a1be5843bd19e6dd1920c681c7d5934 /navit
parent0d3efc0c9f7416d493b75ab8bc68ca5a1d9e3fb2 (diff)
downloadnavit-704679b9066e160063ce5e2118b88ea0ed01f6ad.tar.gz
cleanup:maptool: use g_strcmp0 instead of strcmp (#434)
Diffstat (limited to 'navit')
-rw-r--r--navit/maptool/boundaries.c14
-rw-r--r--navit/maptool/google/protobuf-c/protobuf-c.c12
-rw-r--r--navit/maptool/itembin.c4
-rw-r--r--navit/maptool/maptool.c4
-rw-r--r--navit/maptool/osm.c162
-rw-r--r--navit/maptool/osm_protobuf.c4
-rw-r--r--navit/maptool/osm_protobufdb.c6
-rw-r--r--navit/maptool/osm_psql.c6
-rw-r--r--navit/maptool/osm_xml.c6
-rw-r--r--navit/maptool/tile.c8
10 files changed, 113 insertions, 113 deletions
diff --git a/navit/maptool/boundaries.c b/navit/maptool/boundaries.c
index 4f5967ae8..e7dc90123 100644
--- a/navit/maptool/boundaries.c
+++ b/navit/maptool/boundaries.c
@@ -79,10 +79,10 @@ static GList *process_boundaries_setup(FILE *boundaries, struct relations *relat
if(!iso)
iso=osm_tag_value(ib, "iso3166-1:alpha2");
- if (admin_level && !strcmp(admin_level, "2")) {
+ if (!g_strcmp0(admin_level, "2")) {
if(!iso) {
char *int_name=osm_tag_value(ib,"int_name");
- if(int_name && !strcmp(int_name,"France"))
+ if(!g_strcmp0(int_name,"France"))
iso="FR";
}
if (iso) {
@@ -111,17 +111,17 @@ static GList *process_boundaries_setup(FILE *boundaries, struct relations *relat
rolestr=member+read;
if(member_type==rel_member_node) {
- if(!strcmp(rolestr,"admin_centre") || !strcmp(rolestr,"admin_center"))
+ if(!g_strcmp0(rolestr,"admin_centre") || !g_strcmp0(rolestr,"admin_center"))
boundary->admin_centre=osm_id;
}
if(member_type==rel_member_way) {
enum geom_poly_segment_type role;
- if (!strcmp(rolestr,"outer") || !strcmp(rolestr,"exclave")) {
+ if (!g_strcmp0(rolestr,"outer") || !g_strcmp0(rolestr,"exclave")) {
has_outer_ways=1;
role=geom_poly_segment_type_way_outer;
- } else if (!strcmp(rolestr,"inner") || !strcmp(rolestr,"enclave"))
+ } else if (!g_strcmp0(rolestr,"inner") || !g_strcmp0(rolestr,"enclave"))
role=geom_poly_segment_type_way_inner;
- else if (!strcmp(rolestr,""))
+ else if (!g_strcmp0(rolestr,""))
role=geom_poly_segment_type_way_unknown;
else {
osm_warning("relation",item_bin_get_relationid(ib),0,"Unknown role %s in member ",rolestr);
@@ -131,7 +131,7 @@ static GList *process_boundaries_setup(FILE *boundaries, struct relations *relat
relations_add_relation_member_entry(relations, relations_func, boundary, (gpointer)role, rel_member_way, osm_id);
}
if(member_type==rel_member_relation) {
- if (!strcmp(rolestr,"outer") || !strcmp(rolestr,"exclave") || !strcmp(rolestr,"inner") || !strcmp(rolestr,"enclave"))
+ if (!g_strcmp0(rolestr,"outer") || !g_strcmp0(rolestr,"exclave") || !g_strcmp0(rolestr,"inner") || !g_strcmp0(rolestr,"enclave"))
has_subrelations++;
}
}
diff --git a/navit/maptool/google/protobuf-c/protobuf-c.c b/navit/maptool/google/protobuf-c/protobuf-c.c
index ab0b31e5a..a7a8516f2 100644
--- a/navit/maptool/google/protobuf-c/protobuf-c.c
+++ b/navit/maptool/google/protobuf-c/protobuf-c.c
@@ -2192,7 +2192,7 @@ protobuf_c_enum_descriptor_get_value_by_name
unsigned start = 0, count = desc->n_value_names;
while (count > 1) {
unsigned mid = start + count / 2;
- int rv = strcmp (desc->values_by_name[mid].name, name);
+ int rv = g_strcmp0(desc->values_by_name[mid].name, name);
if (rv == 0)
return desc->values + desc->values_by_name[mid].index;
else if (rv < 0) {
@@ -2203,7 +2203,7 @@ protobuf_c_enum_descriptor_get_value_by_name
}
if (count == 0)
return NULL;
- if (strcmp (desc->values_by_name[start].name, name) == 0)
+ if (g_strcmp0(desc->values_by_name[start].name, name) == 0)
return desc->values + desc->values_by_name[start].index;
return NULL;
}
@@ -2227,7 +2227,7 @@ protobuf_c_message_descriptor_get_field_by_name
unsigned mid = start + count / 2;
int rv;
field = desc->fields + desc->fields_sorted_by_name[mid];
- rv = strcmp (field->name, name);
+ rv = g_strcmp0(field->name, name);
if (rv == 0)
return field;
else if (rv < 0) {
@@ -2239,7 +2239,7 @@ protobuf_c_message_descriptor_get_field_by_name
if (count == 0)
return NULL;
field = desc->fields + desc->fields_sorted_by_name[start];
- if (strcmp (field->name, name) == 0)
+ if (g_strcmp0(field->name, name) == 0)
return field;
return NULL;
}
@@ -2265,7 +2265,7 @@ protobuf_c_service_descriptor_get_method_by_name
unsigned mid = start + count / 2;
unsigned mid_index = desc->method_indices_by_name[mid];
const char *mid_name = desc->methods[mid_index].name;
- int rv = strcmp (mid_name, name);
+ int rv = g_strcmp0(mid_name, name);
if (rv == 0)
return desc->methods + desc->method_indices_by_name[mid];
if (rv < 0) {
@@ -2277,7 +2277,7 @@ protobuf_c_service_descriptor_get_method_by_name
}
if (count == 0)
return NULL;
- if (strcmp (desc->methods[desc->method_indices_by_name[start]].name, name) == 0)
+ if (g_strcmp0(desc->methods[desc->method_indices_by_name[start]].name, name) == 0)
return desc->methods + desc->method_indices_by_name[start];
return NULL;
}
diff --git a/navit/maptool/itembin.c b/navit/maptool/itembin.c
index a0c40138b..6f1328355 100644
--- a/navit/maptool/itembin.c
+++ b/navit/maptool/itembin.c
@@ -458,7 +458,7 @@ static int item_bin_sort_compare(const void *p1, const void *p2) {
if(attr1&&attr2) {
s1=(char *)(attr1+1);
s2=(char *)(attr2+1);
- ret=strcmp(s1,s2);
+ ret=g_strcmp0(s1,s2);
if(ret)
return ret;
}
@@ -475,7 +475,7 @@ static int item_bin_sort_compare(const void *p1, const void *p2) {
s1=linguistics_casefold(s1);
s2=linguistics_casefold(s2);
- ret=strcmp(s1, s2);
+ ret=g_strcmp0(s1, s2);
g_free(s1);
g_free(s2);
diff --git a/navit/maptool/maptool.c b/navit/maptool/maptool.c
index 492deb1ac..422bc96bf 100644
--- a/navit/maptool/maptool.c
+++ b/navit/maptool/maptool.c
@@ -755,7 +755,7 @@ static void maptool_generate_tiles(struct maptool_params *p, char *suffix, char
}
zipnum=zip_get_zipnum(zip_info);
tilesdir=tempfile(suffix,"tilesdir",1);
- if (!strcmp(suffix,ch_suffix)) { /* Makes compiler happy due to bug 35903 in gcc */
+ if (!g_strcmp0(suffix,ch_suffix)) { /* Makes compiler happy due to bug 35903 in gcc */
ch_generate_tiles(suffix0,suffix,tilesdir,zip_info);
} else {
for (f = 0 ; f < filename_count ; f++)
@@ -795,7 +795,7 @@ static void maptool_assemble_map(struct maptool_params *p, char *suffix, char **
}
index_init(zip_info, 1);
}
- if (!strcmp(suffix,ch_suffix)) { /* Makes compiler happy due to bug 35903 in gcc */
+ if (!g_strcmp0(suffix,ch_suffix)) { /* Makes compiler happy due to bug 35903 in gcc */
ch_assemble_map(suffix0,suffix,zip_info);
} else {
for (f = 0 ; f < filename_count ; f++) {
diff --git a/navit/maptool/osm.c b/navit/maptool/osm.c
index dc0e49d58..e36234775 100644
--- a/navit/maptool/osm.c
+++ b/navit/maptool/osm.c
@@ -979,29 +979,29 @@ static int node_is_tagged;
static void relation_add_tag(char *k, char *v);
static int access_value(char *v) {
- if (!strcmp(v,"1"))
+ if (!g_strcmp0(v,"1"))
return 1;
- if (!strcmp(v,"yes"))
+ if (!g_strcmp0(v,"yes"))
return 1;
- if (!strcmp(v,"designated"))
+ if (!g_strcmp0(v,"designated"))
return 1;
- if (!strcmp(v,"official"))
+ if (!g_strcmp0(v,"official"))
return 1;
- if (!strcmp(v,"permissive"))
+ if (!g_strcmp0(v,"permissive"))
return 1;
- if (!strcmp(v,"0"))
+ if (!g_strcmp0(v,"0"))
return 2;
- if (!strcmp(v,"no"))
+ if (!g_strcmp0(v,"no"))
return 2;
- if (!strcmp(v,"agricultural"))
+ if (!g_strcmp0(v,"agricultural"))
return 2;
- if (!strcmp(v,"forestry"))
+ if (!g_strcmp0(v,"forestry"))
return 2;
- if (!strcmp(v,"private"))
+ if (!g_strcmp0(v,"private"))
return 2;
- if (!strcmp(v,"delivery"))
+ if (!g_strcmp0(v,"delivery"))
return 2;
- if (!strcmp(v,"destination"))
+ if (!g_strcmp0(v,"destination"))
return 2;
return 3;
}
@@ -1014,31 +1014,31 @@ void osm_add_tag(char *k, char *v) {
relation_add_tag(k,v);
return;
}
- if (! strcmp(k,"ele")) {
+ if (! g_strcmp0(k,"ele")) {
attr_strings_save(attr_string_label, v);
level=9;
}
- if (! strcmp(k,"time"))
+ if (! g_strcmp0(k,"time"))
level=9;
- if (! strcmp(k,"created_by"))
+ if (! g_strcmp0(k,"created_by"))
level=9;
- if (! strncmp(k,"tiger:",6) || !strcmp(k,"AND_nodes"))
+ if (! strncmp(k,"tiger:",6) || !g_strcmp0(k,"AND_nodes"))
level=9;
- if (! strcmp(k,"converted_by") || ! strcmp(k,"source"))
+ if (! g_strcmp0(k,"converted_by") || ! g_strcmp0(k,"source"))
level=8;
if (! strncmp(k,"osmarender:",11) || !strncmp(k,"svg:",4))
level=8;
- if (! strcmp(k,"layer"))
+ if (! g_strcmp0(k,"layer"))
level=7;
if (! strcasecmp(v,"true") || ! strcasecmp(v,"yes"))
v="1";
if (! strcasecmp(v,"false") || ! strcasecmp(v,"no"))
v="0";
- if (! strcmp(k,"oneway")) {
- if (!strcmp(v,"1")) {
+ if (! g_strcmp0(k,"oneway")) {
+ if (!g_strcmp0(v,"1")) {
flags[0] |= AF_ONEWAY | AF_ROUNDABOUT_VALID;
}
- if (! strcmp(v,"-1")) {
+ if (! g_strcmp0(v,"-1")) {
flags[0] |= AF_ONEWAYREV | AF_ROUNDABOUT_VALID;
}
if (!in_way)
@@ -1046,11 +1046,11 @@ void osm_add_tag(char *k, char *v) {
else
level=5;
}
- if (! strcmp(k,"junction")) {
- if (! strcmp(v,"roundabout"))
+ if (! g_strcmp0(k,"junction")) {
+ if (! g_strcmp0(v,"roundabout"))
flags[0] |= AF_ONEWAY | AF_ROUNDABOUT | AF_ROUNDABOUT_VALID;
}
- if (! strcmp(k,"maxspeed")) {
+ if (! g_strcmp0(k,"maxspeed")) {
if (strstr(v, "mph")) {
maxspeed_attr_value = (int)floor(atof(v) * 1.609344);
} else {
@@ -1060,183 +1060,183 @@ void osm_add_tag(char *k, char *v) {
flags[0] |= AF_SPEED_LIMIT;
level=5;
}
- if (! strcmp(k,"toll")) {
- if (!strcmp(v,"1")) {
+ if (! g_strcmp0(k,"toll")) {
+ if (!g_strcmp0(v,"1")) {
flags[0] |= AF_TOLL;
}
}
- if (! strcmp(k,"access")) {
- if (strcmp(v,"destination"))
+ if (! g_strcmp0(k,"access")) {
+ if (g_strcmp0(v,"destination"))
flagsa[access_value(v)] |=
AF_DANGEROUS_GOODS|AF_EMERGENCY_VEHICLES|AF_TRANSPORT_TRUCK|AF_DELIVERY_TRUCK|AF_PUBLIC_BUS|AF_TAXI|AF_HIGH_OCCUPANCY_CAR|AF_CAR|AF_MOTORCYCLE|AF_MOPED|AF_HORSE|AF_BIKE|AF_PEDESTRIAN;
else
flags[0] |= AF_THROUGH_TRAFFIC_LIMIT;
- if (! strcmp(v,"hov"))
+ if (! g_strcmp0(v,"hov"))
flags[0] |= AF_HIGH_OCCUPANCY_CAR_ONLY;
level=5;
}
- if (! strcmp(k,"vehicle")) {
+ if (! g_strcmp0(k,"vehicle")) {
flags[access_value(v)] |=
AF_DANGEROUS_GOODS|AF_EMERGENCY_VEHICLES|AF_TRANSPORT_TRUCK|AF_DELIVERY_TRUCK|AF_PUBLIC_BUS|AF_TAXI|AF_HIGH_OCCUPANCY_CAR|AF_CAR|AF_MOTORCYCLE|AF_MOPED|AF_BIKE;
level=5;
}
- if (! strcmp(k,"motor_vehicle")) {
+ if (! g_strcmp0(k,"motor_vehicle")) {
flags[access_value(v)] |=
AF_DANGEROUS_GOODS|AF_EMERGENCY_VEHICLES|AF_TRANSPORT_TRUCK|AF_DELIVERY_TRUCK|AF_PUBLIC_BUS|AF_TAXI|AF_HIGH_OCCUPANCY_CAR|AF_CAR|AF_MOTORCYCLE|AF_MOPED;
level=5;
}
- if (! strcmp(k,"bicycle")) {
+ if (! g_strcmp0(k,"bicycle")) {
flags[access_value(v)] |= AF_BIKE;
level=5;
}
- if (! strcmp(k,"foot")) {
+ if (! g_strcmp0(k,"foot")) {
flags[access_value(v)] |= AF_PEDESTRIAN;
level=5;
}
- if (! strcmp(k,"horse")) {
+ if (! g_strcmp0(k,"horse")) {
flags[access_value(v)] |= AF_HORSE;
level=5;
}
- if (! strcmp(k,"moped")) {
+ if (! g_strcmp0(k,"moped")) {
flags[access_value(v)] |= AF_MOPED;
level=5;
}
- if (! strcmp(k,"motorcycle")) {
+ if (! g_strcmp0(k,"motorcycle")) {
flags[access_value(v)] |= AF_MOTORCYCLE;
level=5;
}
- if (! strcmp(k,"motorcar")) {
+ if (! g_strcmp0(k,"motorcar")) {
flags[access_value(v)] |= AF_CAR;
level=5;
}
- if (! strcmp(k,"hov")) {
+ if (! g_strcmp0(k,"hov")) {
flags[access_value(v)] |= AF_HIGH_OCCUPANCY_CAR;
level=5;
}
- if (! strcmp(k,"bus")) {
+ if (! g_strcmp0(k,"bus")) {
flags[access_value(v)] |= AF_PUBLIC_BUS;
level=5;
}
- if (! strcmp(k,"taxi")) {
+ if (! g_strcmp0(k,"taxi")) {
flags[access_value(v)] |= AF_TAXI;
level=5;
}
- if (! strcmp(k,"goods")) {
+ if (! g_strcmp0(k,"goods")) {
flags[access_value(v)] |= AF_DELIVERY_TRUCK;
level=5;
}
- if (! strcmp(k,"hgv")) {
+ if (! g_strcmp0(k,"hgv")) {
flags[access_value(v)] |= AF_TRANSPORT_TRUCK;
level=5;
}
- if (! strcmp(k,"emergency")) {
+ if (! g_strcmp0(k,"emergency")) {
flags[access_value(v)] |= AF_EMERGENCY_VEHICLES;
level=5;
}
- if (! strcmp(k,"hazmat")) {
+ if (! g_strcmp0(k,"hazmat")) {
flags[access_value(v)] |= AF_DANGEROUS_GOODS;
level=5;
}
- if (! strcmp(k,"tunnel") && !strcmp(v,"1")) {
+ if (! g_strcmp0(k,"tunnel") && !g_strcmp0(v,"1")) {
flags[0] |= AF_UNDERGROUND;
}
- if (! strcmp(k,"note"))
+ if (! g_strcmp0(k,"note"))
level=5;
- if (! strcmp(k,"name")) {
+ if (! g_strcmp0(k,"name")) {
attr_strings_save(attr_string_label, v);
level=5;
}
- if (! strcmp(k,"addr:email")) {
+ if (! g_strcmp0(k,"addr:email")) {
attr_strings_save(attr_string_email, v);
level=5;
}
- if (! strcmp(k,"addr:suburb")) {
+ if (! g_strcmp0(k,"addr:suburb")) {
attr_strings_save(attr_string_district_name, v);
level=5;
}
- if (! strcmp(k,"addr:housenumber")) {
+ if (! g_strcmp0(k,"addr:housenumber")) {
attr_strings_save(attr_string_house_number, v);
level=5;
}
- if (! strcmp(k,"addr:street")) {
+ if (! g_strcmp0(k,"addr:street")) {
attr_strings_save(attr_string_street_name, v);
level=5;
}
- if (! strcmp(k,"phone")) {
+ if (! g_strcmp0(k,"phone")) {
attr_strings_save(attr_string_phone, v);
level=5;
}
- if (! strcmp(k,"fax")) {
+ if (! g_strcmp0(k,"fax")) {
attr_strings_save(attr_string_fax, v);
level=5;
}
- if (! strcmp(k,"postal_code")) {
+ if (! g_strcmp0(k,"postal_code")) {
attr_strings_save(attr_string_postal, v);
level=5;
}
- if (! strcmp(k,"addr:postcode") && !attr_strings[attr_string_postal]) {
+ if (! g_strcmp0(k,"addr:postcode") && !attr_strings[attr_string_postal]) {
attr_strings_save(attr_string_postal, v);
level=5;
}
- if (! strcmp(k,"openGeoDB:postal_codes") && !attr_strings[attr_string_postal]) {
+ if (! g_strcmp0(k,"openGeoDB:postal_codes") && !attr_strings[attr_string_postal]) {
attr_strings_save(attr_string_postal, v);
level=5;
}
- if (! strcmp(k,"population")) {
+ if (! g_strcmp0(k,"population")) {
attr_strings_save(attr_string_population, v);
level=5;
}
- if (! strcmp(k,"openGeoDB:population") && !attr_strings[attr_string_population]) {
+ if (! g_strcmp0(k,"openGeoDB:population") && !attr_strings[attr_string_population]) {
attr_strings_save(attr_string_population, v);
level=5;
}
- if ((! strcmp(k,"ref")) || (! strcmp(k,"destination:ref"))) {
+ if ((! g_strcmp0(k,"ref")) || (! g_strcmp0(k,"destination:ref"))) {
if (in_way)
attr_strings_save(attr_string_street_name_systematic, v);
/* for exit number of highway_exit poi */
else attr_strings_save(attr_string_ref, v);
level=5;
}
- if (! strcmp(k,"nat_ref")) {
+ if (! g_strcmp0(k,"nat_ref")) {
if (in_way)
attr_strings_save(attr_string_street_name_systematic_nat, v);
level=5;
}
- if (! strcmp(k,"int_ref")) {
+ if (! g_strcmp0(k,"int_ref")) {
if (in_way)
attr_strings_save(attr_string_street_name_systematic_int, v);
level=5;
}
- if (! strcmp(k,"destination")) {
+ if (! g_strcmp0(k,"destination")) {
if (in_way)
attr_strings_save(attr_string_street_destination, v);
level=5;
}
- if (! strcmp(k,"destination:forward")) {
+ if (! g_strcmp0(k,"destination:forward")) {
if (in_way)
attr_strings_save(attr_string_street_destination_forward, v);
level=5;
}
- if (! strcmp(k,"destination:backward")) {
+ if (! g_strcmp0(k,"destination:backward")) {
if (in_way)
attr_strings_save(attr_string_street_destination_backward, v);
level=5;
}
- if (! strcmp(k,"exit_to")) {
+ if (! g_strcmp0(k,"exit_to")) {
attr_strings_save(attr_string_exit_to, v);
level=5;
}
- if (! strcmp(k,"openGeoDB:is_in")) {
+ if (! g_strcmp0(k,"openGeoDB:is_in")) {
if (!is_in_buffer[0])
g_strlcpy(is_in_buffer, v, sizeof(is_in_buffer));
level=5;
}
- if (! strcmp(k,"is_in")) {
+ if (! g_strcmp0(k,"is_in")) {
if (!is_in_buffer[0])
g_strlcpy(is_in_buffer, v, sizeof(is_in_buffer));
level=5;
}
- if (! strcmp(k,"is_in:country")) {
+ if (! g_strcmp0(k,"is_in:country")) {
/**
* Sometimes there is no is_in tag, only is_in:country.
* I put this here so it can be overwritten by the previous if clause if there IS an is_in tag.
@@ -1244,7 +1244,7 @@ void osm_add_tag(char *k, char *v) {
g_strlcpy(is_in_buffer, v, sizeof(is_in_buffer));
level=5;
}
- if (! strcmp(k,"place_county")) {
+ if (! g_strcmp0(k,"place_county")) {
/**
* Ireland uses the place_county OSM tag to describe what county a town is in.
* This would be equivalent to is_in: Town; Locality; Country
@@ -1256,7 +1256,7 @@ void osm_add_tag(char *k, char *v) {
attr_strings_save(attr_string_county_name, v);
level=5;
}
- if (! strcmp(k,"gnis:ST_alpha")) {
+ if (! g_strcmp0(k,"gnis:ST_alpha")) {
/* assume a gnis tag means it is part of the USA:
http://en.wikipedia.org/wiki/Geographic_Names_Information_System
many US towns do not have is_in tags
@@ -1264,7 +1264,7 @@ void osm_add_tag(char *k, char *v) {
g_strlcpy(is_in_buffer, "USA", sizeof(is_in_buffer));
level=5;
}
- if (! strcmp(k,"lanes")) {
+ if (! g_strcmp0(k,"lanes")) {
level=5;
}
if (attr_debug_level >= level) {
@@ -1619,15 +1619,15 @@ void osm_end_relation(struct maptool_osm *osm) {
} else
type=type_none;
- if ((!strcmp(relation_type, "multipolygon") || !strcmp(relation_type, "boundary")) && (boundary || type!=type_none)) {
+ if ((!g_strcmp0(relation_type, "multipolygon") || !g_strcmp0(relation_type, "boundary")) && (boundary || type!=type_none)) {
item_bin_write(tmp_item_bin, osm->boundaries);
}
- if (!strcmp(relation_type, "restriction") && (tmp_item_bin->type == type_street_turn_restriction_no
+ if (!g_strcmp0(relation_type, "restriction") && (tmp_item_bin->type == type_street_turn_restriction_no
|| tmp_item_bin->type == type_street_turn_restriction_only))
item_bin_write(tmp_item_bin, osm->turn_restrictions);
- if (!strcmp(relation_type, "associatedStreet") )
+ if (!g_strcmp0(relation_type, "associatedStreet") )
item_bin_write(tmp_item_bin, osm->associated_streets);
attr_longest_match_clear();
@@ -1645,10 +1645,10 @@ void osm_add_member(enum relation_member_type type, osmid ref, char *role) {
static void relation_add_tag(char *k, char *v) {
int add_tag=1;
- if (!strcmp(k,"type")) {
+ if (!g_strcmp0(k,"type")) {
g_strlcpy(relation_type, v, sizeof(relation_type));
add_tag=0;
- } else if (!strcmp(k,"restriction")) {
+ } else if (!g_strcmp0(k,"restriction")) {
if (!strncmp(v,"no_",3)) {
tmp_item_bin->type=type_street_turn_restriction_no;
add_tag=0;
@@ -1659,11 +1659,11 @@ static void relation_add_tag(char *k, char *v) {
tmp_item_bin->type=type_none;
osm_warning("relation", osmid_attr_value, 0, "Unknown restriction %s\n",v);
}
- } else if (!strcmp(k,"boundary")) {
- if (!strcmp(v,"administrative") || !strcmp(v,"postal_code")) {
+ } else if (!g_strcmp0(k,"boundary")) {
+ if (!g_strcmp0(v,"administrative") || !g_strcmp0(v,"postal_code")) {
boundary=1;
}
- } else if (!strcmp(k,"ISO3166-1") || !strcmp(k,"ISO3166-1:alpha2")) {
+ } else if (!g_strcmp0(k,"ISO3166-1") || !g_strcmp0(k,"ISO3166-1:alpha2")) {
g_strlcpy(iso_code, v, sizeof(iso_code));
}
if (add_tag) {
@@ -2294,7 +2294,7 @@ static int search_relation_member(struct item_bin *ib, char *role, struct relati
while ((str=item_bin_get_attr(ib, attr_osm_member, str))) {
parse_relation_member_string(str, memb);
count++;
- if (!strcmp(memb->role, role) && (!min_count || *min_count < count)) {
+ if (!g_strcmp0(memb->role, role) && (!min_count || *min_count < count)) {
if (min_count)
*min_count=count;
return 1;
@@ -3276,7 +3276,7 @@ void write_countrydir(struct zip_info *zip_info, int max_index_size) {
- adding new tile would make index part too big, or
- item just read belongs to a different tile than the previous one,
then close existing output file, put reference to the country index tile.*/
- if(out && (!r || (partsize && ((partsize+ibsize)>max_index_size)) || strcmp(tileprev,tilecur)) ) {
+ if(out && (!r || (partsize && ((partsize+ibsize)>max_index_size)) || g_strcmp0(tileprev,tilecur)) ) {
partsize=ftello(out);
fclose(out);
out=NULL;
diff --git a/navit/maptool/osm_protobuf.c b/navit/maptool/osm_protobuf.c
index 9ee8c18f3..b6af3adef 100644
--- a/navit/maptool/osm_protobuf.c
+++ b/navit/maptool/osm_protobuf.c
@@ -267,9 +267,9 @@ int map_collect_data_osm_protobuf(FILE *in, struct maptool_osm *osm) {
while ((header=read_header(in))) {
blob=read_blob(header, in, buffer);
data=uncompress_blob(blob);
- if (!strcmp(header->type,"OSMHeader")) {
+ if (!g_strcmp0(header->type,"OSMHeader")) {
process_osmheader(blob, data);
- } else if (!strcmp(header->type,"OSMData")) {
+ } else if (!g_strcmp0(header->type,"OSMData")) {
process_osmdata(blob, data, osm);
} else {
printf("skipping fileblock of unknown type '%s'\n", header->type);
diff --git a/navit/maptool/osm_protobufdb.c b/navit/maptool/osm_protobufdb.c
index 0edafe62d..79897eafb 100644
--- a/navit/maptool/osm_protobufdb.c
+++ b/navit/maptool/osm_protobufdb.c
@@ -638,11 +638,11 @@ static int osm_protobufdb_parse_member(struct osm_protobufdb_context *ctx, char
return 0;
if (!osm_xml_get_attribute(str, "role", role_buffer, BUFFER_SIZE))
return 0;
- if (!strcmp(type_buffer,"node"))
+ if (!g_strcmp0(type_buffer,"node"))
type=0;
- else if (!strcmp(type_buffer,"way"))
+ else if (!g_strcmp0(type_buffer,"way"))
type=1;
- else if (!strcmp(type_buffer,"relation"))
+ else if (!g_strcmp0(type_buffer,"relation"))
type=2;
if (ctx->in_relation) {
r->roles_sid=g_realloc(r->roles_sid, (r->n_roles_sid+1)*sizeof(r->roles_sid[0]));
diff --git a/navit/maptool/osm_psql.c b/navit/maptool/osm_psql.c
index 554341fde..a8dac6914 100644
--- a/navit/maptool/osm_psql.c
+++ b/navit/maptool/osm_psql.c
@@ -233,13 +233,13 @@ int map_collect_data_osm_db(char *dbstr, struct maptool_osm *osm) {
long member_relation_id=atol(PQgetvalue(member, k, 0));
if (member_relation_id == id) {
int relmember_type=0; //type unknown
- if (!strcmp(PQgetvalue(member,k, 2),"W")) {
+ if (!g_strcmp0(PQgetvalue(member,k, 2),"W")) {
relmember_type=2;
} else {
- if (!strcmp(PQgetvalue(member,k, 2),"N")) {
+ if (!g_strcmp0(PQgetvalue(member,k, 2),"N")) {
relmember_type=1;
} else {
- if (!strcmp(PQgetvalue(member,k, 2),"R")) {
+ if (!g_strcmp0(PQgetvalue(member,k, 2),"R")) {
relmember_type=3;
}
}
diff --git a/navit/maptool/osm_xml.c b/navit/maptool/osm_xml.c
index db909a599..6cef06493 100644
--- a/navit/maptool/osm_xml.c
+++ b/navit/maptool/osm_xml.c
@@ -141,11 +141,11 @@ static int parse_member(char *p) {
return 0;
if (!osm_xml_get_attribute(p, "role", role_buffer, BUFFER_SIZE))
return 0;
- if (!strcmp(type_buffer,"node"))
+ if (!g_strcmp0(type_buffer,"node"))
type=rel_member_node;
- else if (!strcmp(type_buffer,"way"))
+ else if (!g_strcmp0(type_buffer,"way"))
type=rel_member_way;
- else if (!strcmp(type_buffer,"relation"))
+ else if (!g_strcmp0(type_buffer,"relation"))
type=rel_member_relation;
else {
fprintf(stderr,"Unknown type '%s'\n",type_buffer);
diff --git a/navit/maptool/tile.c b/navit/maptool/tile.c
index 96d32129c..f0d10332a 100644
--- a/navit/maptool/tile.c
+++ b/navit/maptool/tile.c
@@ -246,7 +246,7 @@ static int merge_tile(char *base, char *sub) {
}
static gint get_tiles_list_cmp(gconstpointer s1, gconstpointer s2) {
- return strcmp((char *)s1, (char *)s2);
+ return g_strcmp0((char *)s1, (char *)s2);
}
static void get_tiles_list_func(char *key, struct tile_head *th, GList **list) {
@@ -348,7 +348,7 @@ int add_aux_tile(struct zip_info *zip_info, char *name, char *filename, int size
l=aux_tile_list;
while (l) {
at=l->data;
- if (!strcmp(at->name, name)) {
+ if (!g_strcmp0(at->name, name)) {
return -1;
}
l=g_list_next(l);
@@ -455,7 +455,7 @@ void load_tilesdir(FILE *in) {
last=&tile_head_root;
while (fscanf(in,"%[^:]:%d",tile,&size) == 2) {
struct tile_head *th=g_malloc(sizeof(struct tile_head));
- if (!strcmp(tile,"index"))
+ if (!g_strcmp0(tile,"index"))
tile[0]='\0';
th->num_subtiles=0;
th->total_size=size;
@@ -549,7 +549,7 @@ void merge_tiles(struct tile_info *info) {
do {
tiles_list_sorted=get_tiles_list();
fprintf(stderr,"PROGRESS: sorting %d tiles\n", g_list_length(tiles_list_sorted));
- tiles_list_sorted=g_list_sort(tiles_list_sorted, (GCompareFunc)strcmp);
+ tiles_list_sorted=g_list_sort(tiles_list_sorted, (GCompareFunc)g_strcmp0);
fprintf(stderr,"PROGRESS: sorting %d tiles done\n", g_list_length(tiles_list_sorted));
last=g_list_last(tiles_list_sorted);
zip_size=0;