diff options
author | mvglasow <michael -at- vonglasow.com> | 2018-09-29 19:46:17 +0300 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2018-09-29 19:46:17 +0300 |
commit | d0210eb1536b5072abecde26254bd32a6546102d (patch) | |
tree | 6ce5b2c90ff03b93d9a83ef3b2b18b2de87d58a7 | |
parent | 53c4864ffbe38945fd288dc62dd5c48ba01b45f0 (diff) | |
download | navit-d0210eb1536b5072abecde26254bd32a6546102d.tar.gz |
Refactor:core:Make indentation compliant with style guide
Signed-off-by: mvglasow <michael -at- vonglasow.com>
-rw-r--r-- | navit/binding/dbus/binding_dbus.c | 19 | ||||
-rw-r--r-- | navit/route.c | 27 | ||||
-rw-r--r-- | navit/traffic.c | 50 | ||||
-rw-r--r-- | navit/util.c | 2 | ||||
-rw-r--r-- | navit/xmlconfig.c | 6 |
5 files changed, 51 insertions, 53 deletions
diff --git a/navit/binding/dbus/binding_dbus.c b/navit/binding/dbus/binding_dbus.c index 82de15e78..aa776db10 100644 --- a/navit/binding/dbus/binding_dbus.c +++ b/navit/binding/dbus/binding_dbus.c @@ -1228,11 +1228,11 @@ static DBusHandlerResult request_navit_traffic_export_gpx(DBusConnection *connec struct coord_geo g; char *header = "<?xml version='1.0' encoding='UTF-8'?>\n" - "<gpx version='1.1' creator='Navit http://navit.sourceforge.net'\n" - " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n" - " xmlns:navit='http://www.navit-project.org/schema/navit'\n" - " xmlns='http://www.topografix.com/GPX/1/1'\n" - " xsi:schemaLocation='http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'>\n"; + "<gpx version='1.1' creator='Navit http://navit.sourceforge.net'\n" + " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n" + " xmlns:navit='http://www.navit-project.org/schema/navit'\n" + " xmlns='http://www.topografix.com/GPX/1/1'\n" + " xsi:schemaLocation='http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'>\n"; char *trailer = "</gpx>\n"; navit = object_get_from_message(message, "navit"); @@ -1256,7 +1256,7 @@ static DBusHandlerResult request_navit_traffic_export_gpx(DBusConnection *connec fp = fopen(filename, "w"); if (!fp) { return dbus_error(connection, message, DBUS_ERROR_FAILED, - "could not open file for writing"); + "could not open file for writing"); } fprintf(fp, "%s", header); @@ -1341,8 +1341,7 @@ static DBusHandlerResult request_navit_traffic_export_gpx(DBusConnection *connec * @param message The DBusMessage including the `filename` parameter * @returns An empty reply if everything went right, otherwise `DBUS_HANDLER_RESULT_NOT_YET_HANDLED` */ -static DBusHandlerResult -request_navit_traffic_inject(DBusConnection *connection, DBusMessage *message) { +static DBusHandlerResult request_navit_traffic_inject(DBusConnection *connection, DBusMessage *message) { char * filename; struct navit *navit; DBusMessageIter iter; @@ -1481,7 +1480,7 @@ static DBusHandlerResult request_navit_route_export_gpx(DBusConnection *connecti if (!fp) { map_rect_destroy(mr); return dbus_error(connection, message, DBUS_ERROR_FAILED, - "could not open file for writing"); + "could not open file for writing"); } fprintf(fp, "%s", header); @@ -1565,7 +1564,7 @@ static DBusHandlerResult request_navit_route_export_geojson(DBusConnection *conn fp = fopen(filename,"w"); if (!fp) { return dbus_error(connection, message, DBUS_ERROR_FAILED, - "could not open file for writing"); + "could not open file for writing"); } fprintf(fp, "%s", header); diff --git a/navit/route.c b/navit/route.c index 8cb63a30c..f25895654 100644 --- a/navit/route.c +++ b/navit/route.c @@ -1300,7 +1300,7 @@ struct route_graph_point *route_graph_get_point_next(struct route_graph *this, s * @return The point at the specified coordinates or NULL if not found */ struct route_graph_point * route_graph_get_point(struct route_graph *this, struct coord *c) { - return route_graph_get_point_next(this, c, NULL); + return route_graph_get_point_next(this, c, NULL); } /** @@ -1538,7 +1538,7 @@ static int route_segment_data_size(int flags) { * @param data The data for the segment */ int route_graph_segment_is_duplicate(struct route_graph_point *start, struct route_graph_segment_data *data) { - struct route_graph_segment *s; + struct route_graph_segment *s; s=start->start; while (s) { if (item_is_equal(*data->item, s->data.item)) { @@ -1567,7 +1567,7 @@ int route_graph_segment_is_duplicate(struct route_graph_point *start, struct rou * @param maxspeed The maximum speed allowed on this segment in km/h. -1 if not known. */ void route_graph_add_segment(struct route_graph *this, struct route_graph_point *start, - struct route_graph_point *end, struct route_graph_segment_data *data) { + struct route_graph_point *end, struct route_graph_segment_data *data) { struct route_graph_segment *s; int size; @@ -1947,7 +1947,7 @@ static int route_time_seg(struct vehicleprofile *profile, struct route_segment_d * @return true if a traffic distortion was found, 0 if not */ static int route_get_traffic_distortion(struct route_graph_segment *seg, int dir, struct vehicleprofile *profile, - struct route_traffic_distortion *ret) { + struct route_traffic_distortion *ret) { struct route_graph_point *start=seg->start; struct route_graph_point *end=seg->end; struct route_graph_segment *tmp,*found=NULL; @@ -2203,7 +2203,7 @@ static void route_graph_compute_shortest_path(struct route_graph * graph, struct continue; else if (route_value_seg(profile, NULL, s, 2) != INT_MAX) route_graph_point_update(profile, s->start, graph->heap); - } + } if (cb) callback_call_0(cb); } @@ -2256,8 +2256,8 @@ static void route_graph_set_traffic_distortion(struct route_graph *this, struct * @param item The item to add, must be of {@code type_traffic_distortion} * @param update Whether to update the point (true for LPA*, false for Dijkstra) */ -static void route_graph_add_traffic_distortion(struct route_graph *this, struct vehicleprofile *profile, struct item *item, - int update) { +static void route_graph_add_traffic_distortion(struct route_graph *this, struct vehicleprofile *profile, + struct item *item, int update) { struct route_graph_point *s_pnt,*e_pnt; struct coord c,l; struct attr flags_attr, delay_attr, maxspeed_attr; @@ -2328,9 +2328,8 @@ static void route_graph_remove_traffic_distortion(struct route_graph *this, stru for (curr = s_pnt->start; curr; curr = curr->start_next) { if ((curr->end == e_pnt) && item_is_equal(curr->data.item, *item)) curr->data.item.type = type_none; - else - if (curr->data.item.type == type_traffic_distortion) - s_pnt->flags |= RP_TRAFFIC_DISTORTION; + else if (curr->data.item.type == type_traffic_distortion) + s_pnt->flags |= RP_TRAFFIC_DISTORTION; } e_pnt->flags &= ~RP_TRAFFIC_DISTORTION; @@ -2396,7 +2395,7 @@ static void route_graph_remove_traffic_distortion(struct route_graph *this, stru } size = sizeof(struct route_graph_segment) - sizeof(struct route_segment_data) - + route_segment_data_size(found->data.flags); + + route_segment_data_size(found->data.flags); g_slice_free1(size, found); #endif @@ -3928,13 +3927,13 @@ static struct item *rm_get_item(struct map_rect_priv *mr) { id=route->pos; break; } - /* FALLTHRU */ + /* FALLTHRU */ case type_route_start: case type_route_start_reverse: mr->seg=NULL; mr->dest=mr->mpriv->route->destinations; - /* FALLTHRU */ + /* FALLTHRU */ default: if (mr->item.type == type_waypoint) mr->dest=g_list_next(mr->dest); @@ -3971,7 +3970,7 @@ static struct item *rm_get_item(struct map_rect_priv *mr) { id=&(mr->mpriv->route->destinations); if (mr->mpriv->route->destinations) break; - /* FALLTHRU */ + /* FALLTHRU */ case type_route_end: return NULL; } diff --git a/navit/traffic.c b/navit/traffic.c index 56d3115a0..318ef7baf 100644 --- a/navit/traffic.c +++ b/navit/traffic.c @@ -266,7 +266,7 @@ static struct route_graph * traffic_location_get_route_graph(struct traffic_loca struct mapset * ms); static int traffic_location_match_attributes(struct traffic_location * this_, struct item *item); static int traffic_message_add_segments(struct traffic_message * this_, struct mapset * ms, struct seg_data * data, - struct map *map, struct route * route); + struct map *map, struct route * route); static void traffic_location_populate_route_graph(struct traffic_location * this_, struct route_graph * rg, struct mapset * ms); static void traffic_dump_messages_to_xml(struct traffic * this_); @@ -2612,7 +2612,7 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m else p_start = traffic_route_flood_graph(rg, pcoords[2], pcoords[1], NULL); if ((this_->location->fuzziness == location_fuzziness_low_res) - || this_->location->at || this_->location->not_via) { + || this_->location->at || this_->location->not_via) { /* extend start to next junction */ start_new = traffic_route_prepend(rg, p_start); if (start_new) @@ -2709,7 +2709,7 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m minval = val; p_to = p_iter; dbg(lvl_debug, "candidate end point found, point %p, value %d (score %d)", - p_iter, val, score); + p_iter, val, score); } } @@ -2749,7 +2749,7 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m struct coord_geo wgs; transform_to_geo(projection_mg, &(p_start->c), &wgs); dbg(lvl_debug, "*****checkpoint ADD-4.2.6, p_start=%p\nhttps://www.openstreetmap.org?mlat=%f&mlon=%f/#map=13", - p_start, wgs.lat, wgs.lng); + p_start, wgs.lat, wgs.lng); if (point_pairs == 1) { /* extend start to next junction (if we have more than two points, this has already been done) */ start_new = traffic_route_prepend(rg, p_start); @@ -2763,7 +2763,7 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m while (p_iter) { transform_to_geo(projection_mg, &(p_iter->c), &wgs); dbg(lvl_debug, "*****checkpoint ADD-4.2.7, p_iter=%p (value=%d)\nhttps://www.openstreetmap.org?mlat=%f&mlon=%f/#map=13", - p_iter, p_iter->value, wgs.lat, wgs.lng); + p_iter, p_iter->value, wgs.lat, wgs.lng); if (!s_prev || !p_iter->seg) /* the first and last points are always candidates */ is_candidate = 1; @@ -2801,7 +2801,7 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m minval = val; p_from = p_iter; dbg(lvl_debug, "candidate start point found, point %p, value %d (score %d)", - p_iter, val, score); + p_iter, val, score); } } @@ -2899,7 +2899,7 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m dbg(lvl_debug, "*****checkpoint ADD-4.4"); while (s) { dbg(lvl_debug, "*****checkpoint ADD-4.4.1 (#%d, p_iter=%p, s=%p, next %p)", - count, p_iter, s, (s->start == p_iter) ? s->end : s->start); + count, p_iter, s, (s->start == p_iter) ? s->end : s->start); count++; len += s->data.len; if (s->start == p_iter) @@ -3122,23 +3122,23 @@ static void traffic_message_dump_to_stderr(struct traffic_message * this_) { /* dump location */ if (this_->location) { dbg(lvl_debug, " Location: road_type='%s', road_ref='%s', road_name='%s'", - item_to_name(this_->location->road_type), this_->location->road_ref, - this_->location->road_name); + item_to_name(this_->location->road_type), this_->location->road_ref, + this_->location->road_name); dbg(lvl_debug, " directionality=%d, destination='%s', direction='%s'", - this_->location->directionality, this_->location->destination, this_->location->direction); + this_->location->directionality, this_->location->destination, this_->location->direction); dbg(lvl_debug, " fuzziness=%s, ramps=%s, tmc_table='%s', tmc_direction=%+d", - location_fuzziness_to_string(this_->location->fuzziness), - location_ramps_to_string(this_->location->ramps), this_->location->tmc_table, - this_->location->tmc_direction); + location_fuzziness_to_string(this_->location->fuzziness), + location_ramps_to_string(this_->location->ramps), this_->location->tmc_table, + this_->location->tmc_direction); for (i = 0; i < 5; i++) { if (points[i]) { dbg(lvl_debug, " %s: lat=%.5f, lng=%.5f", - point_names[i], points[i]->coord.lat, points[i]->coord.lng); + point_names[i], points[i]->coord.lat, points[i]->coord.lng); dbg(lvl_debug, " junction_name='%s', junction_ref='%s', tmc_id='%s'", - points[i]->junction_name, points[i]->junction_ref, points[i]->tmc_id); + points[i]->junction_name, points[i]->junction_ref, points[i]->tmc_id); } else { dbg(lvl_debug, " %s: (null)", - point_names[i]); + point_names[i]); } } } else { @@ -3849,7 +3849,7 @@ static void traffic_loop(struct traffic * this_) { if (this_->idle_cb) callback_destroy(this_->idle_cb); this_->idle_cb = callback_new_2(callback_cast(traffic_process_messages_int), - this_, PROCESS_MESSAGES_PURGE_EXPIRED); + this_, PROCESS_MESSAGES_PURGE_EXPIRED); this_->idle_ev = event_add_idle(50, this_->idle_cb); } else traffic_process_messages_int(this_, PROCESS_MESSAGES_PURGE_EXPIRED); @@ -4205,13 +4205,13 @@ static void traffic_xml_end(xml_context *dummy, const char *tag_name, void *data length = traffic_xml_get_attr("length", el->names, el->values); speed = traffic_xml_get_attr("speed", el->names, el->values); event = traffic_event_new(event_class_new(traffic_xml_get_attr("class", el->names, el->values)), - event_type_new(traffic_xml_get_attr("type", el->names, el->values)), - length ? atoi(length) : -1, - speed ? atoi(speed) : INT_MAX, - /* TODO quantifier */ - NULL, - count, - (struct traffic_suppl_info **) children); + event_type_new(traffic_xml_get_attr("type", el->names, el->values)), + length ? atoi(length) : -1, + speed ? atoi(speed) : INT_MAX, + /* TODO quantifier */ + NULL, + count, + (struct traffic_suppl_info **) children); g_free(children); g_list_free(state->si); state->si = NULL; @@ -5069,7 +5069,7 @@ struct map * traffic_get_map(struct traffic *this_) { if (this_->shared->message_queue) { if (!this_->idle_cb) this_->idle_cb = callback_new_2(callback_cast(traffic_process_messages_int), - this_, PROCESS_MESSAGES_NO_DUMP_STORE); + this_, PROCESS_MESSAGES_NO_DUMP_STORE); if (!this_->idle_ev) this_->idle_ev = event_add_idle(50, this_->idle_cb); } diff --git a/navit/util.c b/navit/util.c index 7e4182f27..9398e316c 100644 --- a/navit/util.c +++ b/navit/util.c @@ -327,7 +327,7 @@ int compare_name_systematic(const char *s1, const char *s2) { ret = ((elements - matches) * MAX_MISMATCH) / elements; dbg(lvl_debug, "'%s' %s '%s', ret=%d", - s1, ret ? (ret == MAX_MISMATCH ? "does NOT match" : "PARTIALLY matches") : "matches", s2, ret); + s1, ret ? (ret == MAX_MISMATCH ? "does NOT match" : "PARTIALLY matches") : "matches", s2, ret); return ret; } diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c index fc3c5ec90..451a308e2 100644 --- a/navit/xmlconfig.c +++ b/navit/xmlconfig.c @@ -1077,9 +1077,9 @@ int xml_parse_file(char *filename, void *data, * @return True on success, false on failure. */ int xml_parse_text(const char *document, void *data, - void (*start)(xml_context *, const char *, const char **, const char **, void *, GError **), - void (*end)(xml_context *, const char *, void *, GError **), - void (*text)(xml_context *, const char *, gsize, void *, GError **)) { + void (*start)(xml_context *, const char *, const char **, const char **, void *, GError **), + void (*end)(xml_context *, const char *, void *, GError **), + void (*text)(xml_context *, const char *, gsize, void *, GError **)) { #if !USE_EZXML GMarkupParser parser = { start, end, text, NULL, NULL}; xml_context *context; |