[gssdp] Create proper regex if target is an UUID



commit 60067f3435da2532c66646fd16498b5cbe01b011
Author: Jens Georg <mail jensge org>
Date:   Wed Nov 16 14:04:06 2011 +0100

    Create proper regex if target is an UUID
    
    This patch only appends the version regex if:
     - the target doesn't start with "uuid:"
     - the target starts with "uuid:", but has another colon later on
     - the string after the colon consists of numbers
    
    The matching was changed to match numbers starting after the colon, not
    just somewhere after the column.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664177

 libgssdp/gssdp-resource-browser.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libgssdp/gssdp-resource-browser.c b/libgssdp/gssdp-resource-browser.c
index 1199a25..0a9621b 100644
--- a/libgssdp/gssdp-resource-browser.c
+++ b/libgssdp/gssdp-resource-browser.c
@@ -460,7 +460,12 @@ gssdp_resource_browser_set_target (GSSDPResourceBrowser *resource_browser,
 
         version = g_strrstr (pattern, ":");
         if (version != NULL &&
-            g_regex_match_simple (version_pattern, version + 1, 0, 0)) {
+            (g_strstr_len (pattern, -1, "uuid:") != pattern ||
+             version != g_strstr_len (pattern, -1, ":")) &&
+            g_regex_match_simple (version_pattern,
+                                  version + 1,
+                                  G_REGEX_MATCH_ANCHORED,
+                                  0)) {
                 strcpy (version + 1, version_pattern);
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]