Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Rings:2-TestDVD
libgweather
libgweather-LocationEntry-fix-database.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libgweather-LocationEntry-fix-database.patch of Package libgweather
From d9433617c7cd069d1f29993b34936a6fec843fe7 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna <gcampagna@src.gnome.org> Date: Thu, 16 Apr 2015 17:45:26 -0700 Subject: LocationEntry: fix database matching in the presence of whitespace Trailing whitespace should prevent prefix matches but not cause matching failures altoghether (trying to call find_word with a length of 0) diff --git a/libgweather/location-entry.c b/libgweather/location-entry.c index d92d9dc..9994ea2 100644 --- a/libgweather/location-entry.c +++ b/libgweather/location-entry.c @@ -679,6 +679,9 @@ match_compare_name (const char *key, const char *name) gboolean is_first_word = TRUE; int len; + /* Ignore whitespace before the string */ + key += strspn (key, " "); + /* All but the last word in KEY must match a full word from NAME, * in order (but possibly skipping some words from NAME). */ @@ -699,7 +702,13 @@ match_compare_name (const char *key, const char *name) } /* The last word in KEY must match a prefix of a following word in NAME */ - return find_word (name, key, strlen (key), FALSE, is_first_word) != NULL; + if (len == 0) { + return TRUE; + } else { + // if we get here, key[len] == 0, so... + g_assert (len == strlen(key)); + return find_word (name, key, len, FALSE, is_first_word) != NULL; + } } static gboolean -- cgit v0.10.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor