hal/hald device_info.c,1.16,1.17 hald_dbus.c,1.16,1.17
David Zeuthen
david at freedesktop.org
Mon Dec 13 18:57:50 PST 2004
Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv31002/hald
Modified Files:
device_info.c hald_dbus.c
Log Message:
2004-12-13 David Zeuthen <davidz at redhat.com>
Merged all changes from the stable branch so HEAD is on par.
Index: device_info.c
===================================================================
RCS file: /cvs/hal/hal/hald/device_info.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- device_info.c 14 Oct 2004 18:37:28 -0000 1.16
+++ device_info.c 14 Dec 2004 02:57:48 -0000 1.17
@@ -532,6 +532,48 @@
else
return TRUE;
}
+ } else if (strcmp (attr[2], "contains") == 0) {
+ const char *needle;
+ dbus_bool_t contains = FALSE;
+
+ needle = attr[3];
+
+ if (hal_device_property_get_type (d, prop_to_check) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ if (hal_device_has_property (d, prop_to_check)) {
+ const char *haystack;
+
+ haystack = hal_device_property_get_string (d, prop_to_check);
+ if (needle != NULL && haystack != NULL && strstr (haystack, needle)) {
+ contains = TRUE;
+ }
+
+ }
+ return contains;
+ } else if (strcmp (attr[2], "contains_ncase") == 0) {
+ const char *needle;
+ dbus_bool_t contains_ncase = FALSE;
+
+ needle = attr[3];
+
+ if (hal_device_property_get_type (d, prop_to_check) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ if (hal_device_has_property (d, prop_to_check)) {
+ char *needle_lowercase;
+ char *haystack_lowercase;
+
+ needle_lowercase = g_utf8_strdown (needle, -1);
+ haystack_lowercase = g_utf8_strdown (hal_device_property_get_string (d, prop_to_check), -1);
+ if (needle_lowercase != NULL && haystack_lowercase != NULL && strstr (haystack_lowercase, needle_lowercase)) {
+ contains_ncase = TRUE;
+ }
+
+ g_free (needle_lowercase);
+ g_free (haystack_lowercase);
+ }
+ return contains_ncase;
} else if (strcmp (attr[2], "compare_lt") == 0) {
dbus_int64_t result;
if (!match_compare_property (d, prop_to_check, attr[3], &result)) {
Index: hald_dbus.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- hald_dbus.c 14 Oct 2004 19:16:30 -0000 1.16
+++ hald_dbus.c 14 Dec 2004 02:57:48 -0000 1.17
@@ -1339,7 +1339,7 @@
char **capsv, **iter;
capsv = g_strsplit (caps, " ", 0);
- for (iter = capsv; iter != NULL; iter++) {
+ for (iter = capsv; *iter != NULL; iter++) {
if (strcmp (*iter, capability) == 0) {
rc = TRUE;
break;
More information about the hal-commit
mailing list