[libdmapsharing] Fix _dmap_share_build_filter to support commas in values Signed-off-by: W. Michael Petullo <mike fly



commit 4d448a7dfc049e9695aa580319c73c26411b799a
Author: W. Michael Petullo <mike flyn org>
Date:   Sun Oct 24 21:39:44 2010 -0500

    Fix _dmap_share_build_filter to support commas in values
    Signed-off-by: W. Michael Petullo <mike flyn org>

 ChangeLog                   |    4 ++++
 libdmapsharing/dmap-share.c |   34 +++++++++++++++++++++++++---------
 2 files changed, 29 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8788079..22c8142 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+24 October 2010 W. Michael Petullo <mike flyn org>
+
+	* Fix _dmap_share_build_filter to support commas in values.
+
 23 October 2010 W. Michael Petullo <mike flyn org>
 
 	* Provide a configuration-time warning if libsoup < 2.32; this
diff --git a/libdmapsharing/dmap-share.c b/libdmapsharing/dmap-share.c
index 1c714df..ac11db3 100644
--- a/libdmapsharing/dmap-share.c
+++ b/libdmapsharing/dmap-share.c
@@ -1245,10 +1245,18 @@ _dmap_share_build_filter (gchar *filterstr)
 		} else {
 			switch (*next_char) {
 				case '(':
-					parentheses_count++;
+					if (is_value) {
+						accept = TRUE;
+					} else {
+						parentheses_count++;
+					}
 					break;
 				case ')':
-					parentheses_count--;
+					if (is_value) {
+						accept = TRUE;
+					} else {
+						parentheses_count--;
+					}
 					break;
 				case '\'':
 					if (quotes_count > 0) {
@@ -1258,7 +1266,7 @@ _dmap_share_build_filter (gchar *filterstr)
 					}
 					break;
 				case ' ':
-					if (quotes_count > 0) {
+					if (is_value) {
 						accept = TRUE;
 					} else {
 						new_group = TRUE;
@@ -1274,18 +1282,26 @@ _dmap_share_build_filter (gchar *filterstr)
 						is_value = TRUE;
 					}
 					break;
+				case '!':
+					if (is_value) {
+						accept = TRUE;
+					} else if (is_key && value) {
+						negate = TRUE;
+					}
+					break;
 				case ',':
 				case '+':
+					// Accept these characters only if inside quotes
+					if (is_value) {
+						accept = TRUE;
+					}
+					break;
 				case '\0':
-					// Don't accept these caracters
+					// Never accept
 					break;
-				case '!':
-					if (is_key && value) {
-						negate = TRUE;
-						break;
-					}
 				default:
 					accept = TRUE;
+					break;
 			}
 		}
 		//g_debug ("Char: %c, Accept: %s", *next_char, accept?"TRUE":"FALSE");



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