X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-string.c;h=e2eb93b9008db249340e56743bd169b3011b4355;hb=dbecdeabb20e0ce11121819c63373f0afba57c58;hp=62a6460981e4e5900c1bb70f6d0380cbf6ee338c;hpb=e1c31c73074513d96fa22b5c0355107c42720597;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c index 62a6460..e2eb93b 100644 --- a/dbus/dbus-string.c +++ b/dbus/dbus-string.c @@ -22,6 +22,7 @@ * */ +#include #include "dbus-internals.h" #include "dbus-string.h" /* we allow a system header here, for speed/convenience */ @@ -2760,6 +2761,68 @@ _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; + } +} + +/** + * Converts the given range of the string to upper case. + * + * @param str the string + * @param start first byte index to convert + * @param len number of bytes to convert + */ +void +_dbus_string_toupper_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,