Skip to content

Commit

Permalink
metar: fix searching for string to parse
Browse files Browse the repository at this point in the history
it needs correction after c1b7189
  • Loading branch information
monsta committed Apr 29, 2018
1 parent e059ca3 commit 4f556e0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libmateweather/weather-metar.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
{
WeatherInfo *info = (WeatherInfo *)data;
WeatherLocation *loc;
const gchar *p, *eoln;
const gchar *p, *endtag;
gchar *searchkey, *metar;
gboolean success = FALSE;

Expand All @@ -514,10 +514,10 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
p = strstr (msg->response_body->data, searchkey);
g_free (searchkey);
if (p) {
p += WEATHER_LOCATION_CODE_LEN + 2;
eoln = strchr(p, '\n');
if (eoln)
metar = g_strndup (p, eoln - p);
p += WEATHER_LOCATION_CODE_LEN + 11;
endtag = strstr (p, "</raw_text>");
if (endtag)
metar = g_strndup (p, endtag - p);
else
metar = g_strdup (p);
success = metar_parse (metar, info);
Expand Down

0 comments on commit 4f556e0

Please sign in to comment.