diff options
author | mvglasow <michael -at- vonglasow.com> | 2018-08-18 23:25:23 +0200 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2018-08-18 23:25:23 +0200 |
commit | 3f8d6584a4fa6b0ddfabfb444294d51655ca49ea (patch) | |
tree | 2ec3240f926c2cbf9e7b90ea791a951880c0ceb0 /navit | |
parent | ee0e24cd7c34aa908de4e9b4ccef8a4b664d0a8f (diff) | |
download | navit-3f8d6584a4fa6b0ddfabfb444294d51655ca49ea.tar.gz |
Fix:traffic:Process bidirectional locations correctly
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Diffstat (limited to 'navit')
-rw-r--r-- | navit/traffic.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/navit/traffic.c b/navit/traffic.c index 7c23b0421..a755edf87 100644 --- a/navit/traffic.c +++ b/navit/traffic.c @@ -2284,12 +2284,15 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m /* Delay for the current segment */ int delay; - /* Number of segments */ - int count; + /* Number of new segments and existing segments */ + int count = 0, prev_count; /* Length of location */ int len; + /* The message's previous list of items */ + struct item ** prev_items; + /* The next item in the message's list of items */ struct item ** next_item; @@ -2629,6 +2632,7 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m dbg(lvl_error, "no segments"); /* count segments and calculate length */ + prev_count = count; count = 0; len = 0; dbg(lvl_debug, "*****checkpoint ADD-4.4"); @@ -2651,12 +2655,16 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m p_iter = p_start; if (this_->priv->items) { - dbg(lvl_error, "internal error: message should not yet have any linked items at this point"); + prev_items = this_->priv->items; + this_->priv->items = g_new0(struct item *, count + prev_count + 1); + memcpy(this_->priv->items, prev_items, sizeof(struct item *) * prev_count); + next_item = this_->priv->items + prev_count; + g_free(prev_items); + } else { + this_->priv->items = g_new0(struct item *, count + 1); + next_item = this_->priv->items; } - this_->priv->items = g_new0(struct item *, count + 1); - next_item = this_->priv->items; - dbg(lvl_debug, "*****checkpoint ADD-4.6 (loop start)"); while (s) { ccnt = item_coord_get_within_range(&s->data.item, ca, 2047, &s->start->c, &s->end->c); |