summaryrefslogtreecommitdiff
path: root/dbus/dbus-string.c
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2010-02-28 20:56:42 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2010-02-28 21:03:16 +0100
commita06c771d2b931f0e5ae600d22a3e07208f16b0a3 (patch)
treeb7980a521dcbd8fea67954aaf7d19fa962090741 /dbus/dbus-string.c
parent46df8b52d970d7c4ec3a61b5c696a05d0cb55f5d (diff)
downloaddbus-a06c771d2b931f0e5ae600d22a3e07208f16b0a3.tar.gz
_dbus_string_tolower_ascii(): new function, reviewed by Colin Walters.
Diffstat (limited to 'dbus/dbus-string.c')
-rw-r--r--dbus/dbus-string.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c
index 62a64609..6a307b82 100644
--- a/dbus/dbus-string.c
+++ b/dbus/dbus-string.c
@@ -2760,6 +2760,37 @@ _dbus_string_validate_ascii (const DBusString *str,
}
/**
+ * Converts the given range of the string to lower case.
+ *
+ * @param str the string
+ * @param start first byte index to convert
+ * @param len number of bytes to convert
+ */
+void
+_dbus_string_tolower_ascii (const DBusString *str,
+ int start,
+ int len)
+{
+ unsigned char *s;
+ unsigned char *end;
+ DBUS_STRING_PREAMBLE (str);
+ _dbus_assert (start >= 0);
+ _dbus_assert (start <= real->len);
+ _dbus_assert (len >= 0);
+ _dbus_assert (len <= real->len - start);
+
+ s = real->str + start;
+ end = s + len;
+
+ while (s != end)
+ {
+ if (*s >= 'A' && *s <= 'Z')
+ *s += 'a' - 'A';
+ ++s;
+ }
+}
+
+/**
* Checks that the given range of the string is valid UTF-8. If the
* given range is not entirely contained in the string, returns
* #FALSE. If the string contains any nul bytes in the given range,