[libgweather] GWeatherLocationEntry: fix matching with parenthesis
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] GWeatherLocationEntry: fix matching with parenthesis
- Date: Wed, 6 Dec 2017 00:49:28 +0000 (UTC)
commit 8a5d5bb17fde41fca854506f709babfc23dbd05d
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Dec 5 09:25:15 2017 -0800
GWeatherLocationEntry: fix matching with parenthesis
Treat ( as the start of a new "subname" for the location, like ","
does
https://bugzilla.gnome.org/show_bug.cgi?id=791066
libgweather/gweather-location-entry.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/libgweather/gweather-location-entry.c b/libgweather/gweather-location-entry.c
index 82d6a2f..26725da 100644
--- a/libgweather/gweather-location-entry.c
+++ b/libgweather/gweather-location-entry.c
@@ -612,13 +612,16 @@ find_word (const char *full_name, const char *word, int word_len,
/* If we're matching the first word of the key, it has to
* match the first word of the location, city, state, or
- * country. Eg, it either matches the start of the string
+ * country, or the abbreviation (in parenthesis).
+ * Eg, it either matches the start of the string
* (which we already know it doesn't at this point) or
- * it is preceded by the string ", " (which isn't actually
+ * it is preceded by the string ", " or "(" (which isn't actually
* a perfect test. FIXME)
*/
if (is_first_word) {
- if (prev == (char *)full_name || strncmp (prev - 1, ", ", 2) != 0)
+ if (prev == (char *)full_name ||
+ ((prev - 1 <= full_name && strncmp (prev - 1, ", ", 2) != 0)
+ && *prev != '('))
continue;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]