summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2018-04-26 15:39:02 +0300
committermonsta <[email protected]>2018-04-29 14:46:56 +0300
commit4f556e03434386b1514090201bd8a6bfd02921e7 (patch)
tree8d3d5602adcfe9886a88292a0df6f92a5b61478d
parente059ca36165634eddd8143946dd7b8093f3c5eb6 (diff)
downloadlibmateweather-4f556e03434386b1514090201bd8a6bfd02921e7.tar.bz2
libmateweather-4f556e03434386b1514090201bd8a6bfd02921e7.tar.xz
metar: fix searching for string to parse
it needs correction after c1b71893ec34a2d0ea8f85ce7f30f536f8582123
-rw-r--r--libmateweather/weather-metar.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libmateweather/weather-metar.c b/libmateweather/weather-metar.c
index 89a1eb7..1185037 100644
--- a/libmateweather/weather-metar.c
+++ b/libmateweather/weather-metar.c
@@ -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;
@@ -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);