26 #include "dbus-internals.h"
27 #include "dbus-string.h"
32 #define DBUS_CAN_USE_DBUS_STRING_PRIVATE 1
33 #include "dbus-string-private.h"
34 #include "dbus-marshal-basic.h"
38 #include "dbus-sysdeps.h"
81 unsigned char *aligned;
82 unsigned char *real_block;
83 unsigned int old_align_offset;
89 real_block = real->
str - old_align_offset;
91 aligned = _DBUS_ALIGN_ADDRESS (real_block, 8);
100 real_block + old_align_offset,
149 real->
str =
dbus_malloc (_DBUS_STRING_ALLOCATION_PADDING + allocate_size);
153 real->
allocated = _DBUS_STRING_ALLOCATION_PADDING + allocate_size;
155 real->
str[real->
len] =
'\0';
162 fixup_alignment (real);
223 real->
str = (
unsigned char*) value;
225 real->
allocated = real->
len + _DBUS_STRING_ALLOCATION_PADDING;
266 unsigned char *new_str;
270 waste = real->
allocated - (real->
len + _DBUS_STRING_ALLOCATION_PADDING);
272 if (waste <= max_waste)
275 new_allocated = real->
len + _DBUS_STRING_ALLOCATION_PADDING;
278 if (_DBUS_UNLIKELY (new_str ==
NULL))
283 fixup_alignment (real);
288 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
312 compact (real, MAX_WASTE);
321 unsigned char *new_str;
338 #if defined (DBUS_ENABLE_EMBEDDED_TESTS) && !defined (DBUS_DISABLE_ASSERT)
345 new_allocated = MAX (new_allocated,
346 new_length + _DBUS_STRING_ALLOCATION_PADDING);
350 if (_DBUS_UNLIKELY (new_str ==
NULL))
355 fixup_alignment (real);
377 return compact (real, max_waste);
389 else if (new_length > (real->
allocated - _DBUS_STRING_ALLOCATION_PADDING) &&
390 _DBUS_UNLIKELY (!reallocate_for_length (real, new_length)))
394 real->
len = new_length;
395 real->
str[new_length] =
'\0';
411 if (!set_length (dest, dest->
len + len))
414 memmove (dest->
str + insert_at + len,
415 dest->
str + insert_at,
416 dest->
len - len - insert_at);
421 #ifndef _dbus_string_get_data
438 return (
char*) real->
str;
443 #ifndef _dbus_string_get_const_data
451 _dbus_string_get_const_data (
const DBusString *str)
455 return (
const char*) real->
str;
483 return (
char*) real->
str + start;
487 #ifndef _dbus_string_get_const_data_len
497 _dbus_string_get_const_data_len (
const DBusString *str,
507 return (
const char*) real->
str + start;
512 #ifndef _dbus_string_set_byte
534 #ifndef _dbus_string_get_byte
552 return real->
str[start];
580 if (!open_gap (n_bytes, real, i))
583 memset (real->
str + i, byte, n_bytes);
605 if (!open_gap (1, real, i))
630 undo_alignment (real);
632 *data_return = (
char*) real->
str;
638 real->
str = (
unsigned char*) *data_return;
640 fixup_alignment (real);
662 if (*data_return ==
NULL)
665 memcpy (*data_return, real->
str, real->
len + 1);
689 memcpy (buffer, real->
str, real->
len);
711 memcpy (buffer, real->
str, real->
len+1);
715 #ifndef _dbus_string_get_length
722 _dbus_string_get_length (
const DBusString *str)
744 int additional_length)
752 return set_length (real,
753 real->
len + additional_length);
764 int length_to_remove)
771 real->
len - length_to_remove);
791 return set_length (real, length);
795 align_insert_point_then_open_gap (
DBusString *str,
800 unsigned long new_len;
801 unsigned long gap_pos;
808 insert_at = *insert_at_p;
812 gap_pos = _DBUS_ALIGN_VALUE (insert_at, alignment);
813 new_len = real->
len + (gap_pos - insert_at) + gap_size;
818 delta = new_len - real->
len;
823 _dbus_assert (((
unsigned long) *insert_at_p) == gap_pos);
827 if (_DBUS_UNLIKELY (!open_gap (new_len - real->
len,
832 if (gap_size < delta)
834 memset (&real->
str[insert_at],
'\0',
835 gap_pos - insert_at);
838 *insert_at_p = gap_pos;
846 int then_lengthen_by)
850 insert_at = _dbus_string_get_length (str);
852 return align_insert_point_then_open_gap (str,
854 alignment, then_lengthen_by);
869 return align_length_then_lengthen (str, alignment, 0);
903 memcpy (real->
str + (real->
len - buffer_len),
921 unsigned long buffer_len;
926 buffer_len = strlen (buffer);
927 if (buffer_len > (
unsigned long) _DBUS_STRING_MAX_LENGTH)
930 return append (real, buffer, buffer_len);
934 #define ASSIGN_2_OCTETS(p, octets) \
935 *((dbus_uint16_t*)(p)) = *((dbus_uint16_t*)(octets));
938 #define ASSIGN_4_OCTETS(p, octets) \
939 *((dbus_uint32_t*)(p)) = *((dbus_uint32_t*)(octets));
942 #define ASSIGN_8_OCTETS(p, octets) \
943 *((dbus_uint64_t*)(p)) = *((dbus_uint64_t*)(octets));
957 const unsigned char octets[2])
961 if (!align_insert_point_then_open_gap (str, &insert_at, 2, 2))
981 const unsigned char octets[4])
985 if (!align_insert_point_then_open_gap (str, &insert_at, 4, 4))
1005 const unsigned char octets[8])
1009 if (!align_insert_point_then_open_gap (str, &insert_at, 8, 8))
1012 _dbus_assert (_DBUS_ALIGN_VALUE (insert_at, 8) == (
unsigned) insert_at);
1037 if (!align_insert_point_then_open_gap (str, insert_at, alignment, 0))
1040 _dbus_assert (_DBUS_ALIGN_VALUE (*insert_at, alignment) == (
unsigned) *insert_at);
1064 DBUS_VA_COPY (args_copy, args);
1079 vsprintf ((
char*) (real->
str + (real->
len - len)),
1103 va_start (args, format);
1127 return append (real, buffer, len);
1144 if (!set_length (real, real->
len + 1))
1147 real->
str[real->
len-1] = byte;
1160 memmove (real->
str + start, real->
str + start + len, real->
len - (start + len));
1162 real->
str[real->
len] =
'\0';
1185 delete (real, start, len);
1198 if (!open_gap (len, dest, insert_at))
1201 memmove (dest->
str + insert_at,
1202 source->
str + start,
1217 #define DBUS_STRING_COPY_PREAMBLE(source, start, dest, insert_at) \
1218 DBusRealString *real_source = (DBusRealString*) source; \
1219 DBusRealString *real_dest = (DBusRealString*) dest; \
1220 _dbus_assert ((source) != (dest)); \
1221 DBUS_GENERIC_STRING_PREAMBLE (real_source); \
1222 DBUS_GENERIC_STRING_PREAMBLE (real_dest); \
1223 _dbus_assert (!real_dest->constant); \
1224 _dbus_assert (!real_dest->locked); \
1225 _dbus_assert ((start) >= 0); \
1226 _dbus_assert ((start) <= real_source->len); \
1227 _dbus_assert ((insert_at) >= 0); \
1228 _dbus_assert ((insert_at) <= real_dest->len)
1250 real_source->
len - start,
1272 return copy (real_source, start,
1273 real_source->len - start,
1306 else if (start == 0 &&
1307 len == real_source->len &&
1308 real_dest->len == 0)
1316 #define ASSIGN_DATA(a, b) do { \
1317 (a)->str = (b)->str; \
1318 (a)->len = (b)->len; \
1319 (a)->allocated = (b)->allocated; \
1320 (a)->align_offset = (b)->align_offset; \
1325 ASSIGN_DATA (&tmp, real_source);
1326 ASSIGN_DATA (real_source, real_dest);
1327 ASSIGN_DATA (real_dest, &tmp);
1333 if (!copy (real_source, start, len,
1338 delete (real_source, start,
1368 return copy (real_source, start, len,
1399 _dbus_assert (replace_len <= real_dest->len - replace_at);
1401 if (len == replace_len)
1403 memmove (real_dest->str + replace_at,
1404 real_source->str + start, len);
1406 else if (len < replace_len)
1408 memmove (real_dest->str + replace_at,
1409 real_source->str + start, len);
1410 delete (real_dest, replace_at + len,
1419 diff = len - replace_len;
1425 if (!copy (real_source, start + replace_len, diff,
1426 real_dest, replace_at + replace_len))
1429 memmove (real_dest->str + replace_at,
1430 real_source->str + start, replace_len);
1454 char byte_string[2] =
"";
1458 byte_string[0] = (char) byte;
1463 head_length = byte_position;
1464 tail_length = _dbus_string_get_length (source) - head_length - 1;
1487 #define UTF8_COMPUTE(Char, Mask, Len) \
1493 else if ((Char & 0xe0) == 0xc0) \
1498 else if ((Char & 0xf0) == 0xe0) \
1503 else if ((Char & 0xf8) == 0xf0) \
1508 else if ((Char & 0xfc) == 0xf8) \
1513 else if ((Char & 0xfe) == 0xfc) \
1528 #define UTF8_LENGTH(Char) \
1529 ((Char) < 0x80 ? 1 : \
1530 ((Char) < 0x800 ? 2 : \
1531 ((Char) < 0x10000 ? 3 : \
1532 ((Char) < 0x200000 ? 4 : \
1533 ((Char) < 0x4000000 ? 5 : 6)))))
1544 #define UTF8_GET(Result, Chars, Count, Mask, Len) \
1545 (Result) = (Chars)[0] & (Mask); \
1546 for ((Count) = 1; (Count) < (Len); ++(Count)) \
1548 if (((Chars)[(Count)] & 0xc0) != 0x80) \
1554 (Result) |= ((Chars)[(Count)] & 0x3f); \
1567 #define UNICODE_VALID(Char) \
1568 ((Char) < 0x110000 && \
1569 (((Char) & 0xFFFFF800) != 0xD800))
1621 while (i < real->len)
1623 if (real->
str[i] ==
'\r')
1625 if ((i+1) < real->
len && real->
str[i+1] ==
'\n')
1642 else if (real->
str[i] ==
'\n')
1695 if (*substr ==
'\0')
1705 if (real->
str[i] == substr[0])
1711 if (substr[j - i] ==
'\0')
1713 else if (real->
str[j] != substr[j - i])
1719 if (substr[j - i] ==
'\0')
1757 while (i < real->len)
1759 if (real->
str[i] ==
' ' ||
1760 real->
str[i] ==
'\t')
1795 while (i < real->len)
1829 while (i < real->len)
1902 _dbus_assert (eol == _dbus_string_get_length (source));
1928 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
1936 _dbus_string_delete_first_word (
DBusString *str)
1947 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
1954 _dbus_string_delete_leading_blanks (
DBusString *str)
1998 const unsigned char *ap;
1999 const unsigned char *bp;
2000 const unsigned char *a_end;
2006 if (real_a->
len != real_b->
len)
2011 a_end = real_a->
str + real_a->
len;
2042 const unsigned char *ap;
2043 const unsigned char *bp;
2044 const unsigned char *a_end;
2050 if (real_a->
len != real_b->
len &&
2051 (real_a->
len < len || real_b->
len < len))
2056 a_end = real_a->
str + MIN (real_a->
len, len);
2092 const unsigned char *ap;
2093 const unsigned char *bp;
2094 const unsigned char *a_end;
2106 if (a_len > real_b->
len - b_start)
2109 ap = real_a->
str + a_start;
2110 bp = real_b->
str + b_start;
2137 const unsigned char *ap;
2138 const unsigned char *bp;
2139 const unsigned char *a_end;
2145 bp = (
const unsigned char*) c_str;
2146 a_end = real_a->
str + real_a->
len;
2147 while (ap != a_end && *bp)
2156 if (ap != a_end || *bp)
2173 const unsigned char *ap;
2174 const unsigned char *bp;
2175 const unsigned char *a_end;
2181 bp = (
const unsigned char*) c_str;
2182 a_end = real_a->
str + real_a->
len;
2183 while (ap != a_end && *bp)
2210 const char hexdigits[16] = {
2211 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
2212 'a',
'b',
'c',
'd',
'e',
'f'
2216 hexdigits[(byte >> 4)]))
2220 hexdigits[(byte & 0x0f)]))
2223 _dbus_string_get_length (str) - 1);
2247 const unsigned char *p;
2248 const unsigned char *end;
2251 _dbus_assert (start <= _dbus_string_get_length (source));
2258 p = (
const unsigned char*) _dbus_string_get_const_data (source);
2259 end = p + _dbus_string_get_length (source);
2298 const unsigned char *p;
2299 const unsigned char *end;
2303 _dbus_assert (start <= _dbus_string_get_length (source));
2311 p = (
const unsigned char*) _dbus_string_get_const_data (source);
2312 end = p + _dbus_string_get_length (source);
2390 len = _dbus_string_get_length (&result);
2392 b = _dbus_string_get_byte (&result, len - 1);
2396 _dbus_string_set_byte (&result, len - 1, b);
2399 high_bits = !high_bits;
2409 *end_return = p - (
const unsigned char*) _dbus_string_get_const_data (source);
2436 const unsigned char *s;
2437 const unsigned char *end;
2443 if (len > real->
len - start)
2446 s = real->
str + start;
2450 if (_DBUS_UNLIKELY (!_DBUS_ISASCII (*s)))
2479 s = real->
str + start;
2484 if (*s >=
'A' && *s <=
'Z')
2510 s = real->
str + start;
2515 if (*s >=
'a' && *s <=
'z')
2541 const unsigned char *p;
2542 const unsigned char *end;
2556 if (_DBUS_UNLIKELY (len > real->
len - start))
2559 p = real->
str + start;
2564 int i, mask, char_len;
2565 dbus_unichar_t result;
2585 if (_DBUS_UNLIKELY (char_len == 0))
2589 if (_DBUS_UNLIKELY ((end - p) < char_len))
2592 UTF8_GET (result, p, i, mask, char_len);
2595 if (_DBUS_UNLIKELY (
UTF8_LENGTH (result) != char_len))
2599 if (_DBUS_UNLIKELY (result == (dbus_unichar_t)-1))
2615 if (_DBUS_UNLIKELY (p != end))
2639 const unsigned char *s;
2640 const unsigned char *end;
2646 if (len > real->
len - start)
2649 s = real->
str + start;
2653 if (_DBUS_UNLIKELY (*s !=
'\0'))
#define DBUS_IS_ASCII_WHITE(c)
Checks for ASCII whitespace byte.
dbus_bool_t _dbus_string_insert_bytes(DBusString *str, int i, int n_bytes, unsigned char byte)
Inserts a number of bytes of a given value at the given position.
dbus_bool_t _dbus_string_append(DBusString *str, const char *buffer)
Appends a nul-terminated C-style string to a DBusString.
void _dbus_string_copy_to_buffer(const DBusString *str, char *buffer, int avail_len)
Copies the contents of a DBusString into a different buffer.
#define NULL
A null pointer, defined appropriately for C or C++.
#define DBUS_STRING_COPY_PREAMBLE(source, start, dest, insert_at)
Checks assertions for two strings we're copying a segment between, and declares real_source/real_dest...
dbus_bool_t _dbus_string_equal(const DBusString *a, const DBusString *b)
Tests two DBusString for equality.
dbus_bool_t _dbus_string_find_eol(const DBusString *str, int start, int *found, int *found_len)
Finds end of line ("\r\n" or "\n") in the string, returning TRUE and filling in the byte index where ...
dbus_bool_t _dbus_string_lengthen(DBusString *str, int additional_length)
Makes a string longer by the given number of bytes.
void * dbus_realloc(void *memory, size_t bytes)
Resizes a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
#define ASSIGN_4_OCTETS(p, octets)
assign 4 bytes from one string to another
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
void _dbus_string_copy_to_buffer_with_nul(const DBusString *str, char *buffer, int avail_len)
Copies the contents of a DBusString into a different buffer.
dbus_bool_t _dbus_string_hex_encode(const DBusString *source, int start, DBusString *dest, int insert_at)
Encodes a string in hex, the way MD5 and SHA-1 are usually encoded.
#define ASSIGN_8_OCTETS(p, octets)
assign 8 bytes from one string to another
dbus_bool_t _dbus_string_starts_with_c_str(const DBusString *a, const char *c_str)
Checks whether a string starts with the given C string.
void _dbus_string_chop_white(DBusString *str)
Deletes leading and trailing whitespace.
dbus_bool_t _dbus_string_insert_8_aligned(DBusString *str, int insert_at, const unsigned char octets[8])
Inserts 8 bytes aligned on an 8 byte boundary with any alignment padding initialized to 0...
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
void _dbus_string_tolower_ascii(const DBusString *str, int start, int len)
Converts the given range of the string to lower case.
unsigned int invalid
DBusString is invalid (e.g.
#define DBUS_CONST_STRING_PREAMBLE(str)
Checks assertions about a string that may be const or locked.
char * _dbus_string_get_data_len(DBusString *str, int start, int len)
Gets a sub-portion of the raw character buffer from the string.
#define _DBUS_STRING_MAX_LENGTH
The maximum length of a DBusString.
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
dbus_bool_t _dbus_string_append_printf_valist(DBusString *str, const char *format, va_list args)
Appends a printf-style formatted string to the DBusString.
void _dbus_string_shorten(DBusString *str, int length_to_remove)
Makes a string shorter by the given number of bytes.
dbus_bool_t _dbus_string_copy(const DBusString *source, int start, DBusString *dest, int insert_at)
Like _dbus_string_move(), but does not delete the section of the source string that's copied to the d...
#define UTF8_GET(Result, Chars, Count, Mask, Len)
Gets a UTF-8 value.
dbus_bool_t _dbus_string_find(const DBusString *str, int start, const char *substr, int *found)
Finds the given substring in the string, returning TRUE and filling in the byte index where the subst...
void _dbus_string_skip_white(const DBusString *str, int start, int *end)
Skips whitespace from start, storing the first non-whitespace in *end.
#define ASSIGN_2_OCTETS(p, octets)
assign 2 bytes from one string to another
dbus_bool_t _dbus_string_move(DBusString *source, int start, DBusString *dest, int insert_at)
Moves the end of one string into another string.
void * dbus_malloc(size_t bytes)
Allocates the given number of bytes, as with standard malloc().
#define UNICODE_VALID(Char)
Check whether a Unicode (5.2) char is in a valid range.
dbus_bool_t _dbus_string_equal_c_str(const DBusString *a, const char *c_str)
Checks whether a string is equal to a C string.
dbus_bool_t _dbus_string_compact(DBusString *str, int max_waste)
Compacts the string to avoid wasted memory.
dbus_bool_t _dbus_string_copy_data(const DBusString *str, char **data_return)
Copies the data from the string into a char*.
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
#define DBUS_GENERIC_STRING_PREAMBLE(real)
Checks a bunch of assertions about a string object.
dbus_bool_t _dbus_string_replace_len(const DBusString *source, int start, int len, DBusString *dest, int replace_at, int replace_len)
Replaces a segment of dest string with a segment of source string.
#define DBUS_STRING_PREAMBLE(str)
Checks assertions about a string object that needs to be modifiable - may not be locked or const...
void _dbus_string_skip_blank(const DBusString *str, int start, int *end)
Skips blanks from start, storing the first non-blank in *end (blank is space or tab).
#define UTF8_LENGTH(Char)
computes length of a unicode character in UTF-8
dbus_bool_t _dbus_string_pop_line(DBusString *source, DBusString *dest)
Assigns a newline-terminated or \r\n-terminated line from the front of the string to the given dest s...
void _dbus_string_delete(DBusString *str, int start, int len)
Deletes a segment of a DBusString with length len starting at start.
dbus_bool_t _dbus_string_init_preallocated(DBusString *str, int allocate_size)
Initializes a string that can be up to the given allocation size before it has to realloc...
int len
Length without nul.
dbus_bool_t _dbus_string_append_printf(DBusString *str, const char *format,...)
Appends a printf-style formatted string to the DBusString.
void _dbus_string_zero(DBusString *str)
Clears all allocated bytes in the string to zero.
dbus_bool_t _dbus_string_validate_utf8(const DBusString *str, int start, int len)
Checks that the given range of the string is valid UTF-8.
dbus_bool_t _dbus_string_align_length(DBusString *str, int alignment)
Align the length of a string to a specific alignment (typically 4 or 8) by appending nul bytes to the...
dbus_bool_t _dbus_string_equal_substring(const DBusString *a, int a_start, int a_len, const DBusString *b, int b_start)
Tests two sub-parts of two DBusString for equality.
dbus_bool_t _dbus_string_equal_len(const DBusString *a, const DBusString *b, int len)
Tests two DBusString for equality up to the given length.
unsigned int locked
DBusString has been locked and can't be changed.
dbus_bool_t _dbus_string_insert_byte(DBusString *str, int i, unsigned char byte)
Inserts a single byte at the given position.
dbus_bool_t _dbus_string_append_byte(DBusString *str, unsigned char byte)
Appends a single byte to the string, returning FALSE if not enough memory.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init().
#define TRUE
Expands to "1".
#define _dbus_assert_not_reached(explanation)
Aborts with an error message if called.
int allocated
Allocated size of data.
#define DBUS_IS_ASCII_BLANK(c)
Checks for ASCII blank byte.
dbus_bool_t _dbus_string_find_blank(const DBusString *str, int start, int *found)
Finds a blank (space or tab) in the string.
dbus_bool_t _dbus_string_alloc_space(DBusString *str, int extra_bytes)
Preallocate extra_bytes such that a future lengthening of the string by extra_bytes is guaranteed to ...
dbus_bool_t _dbus_string_hex_decode(const DBusString *source, int start, int *end_return, DBusString *dest, int insert_at)
Decodes a string from hex encoding.
unsigned int align_offset
str - align_offset is the actual malloc block
dbus_bool_t _dbus_string_append_byte_as_hex(DBusString *str, unsigned char byte)
Appends a two-character hex digit to a string, where the hex digit has the value of the given byte...
dbus_bool_t _dbus_string_append_len(DBusString *str, const char *buffer, int len)
Appends block of bytes with the given length to a DBusString.
dbus_bool_t _dbus_string_find_to(const DBusString *str, int start, int end, const char *substr, int *found)
Finds the given substring in the string, up to a certain position, returning TRUE and filling in the ...
unsigned char * str
String data, plus nul termination.
dbus_bool_t _dbus_string_validate_nul(const DBusString *str, int start, int len)
Checks that the given range of the string is all nul bytes.
#define FALSE
Expands to "0".
dbus_bool_t _dbus_string_insert_4_aligned(DBusString *str, int insert_at, const unsigned char octets[4])
Inserts 4 bytes aligned on a 4 byte boundary with any alignment padding initialized to 0...
void _dbus_string_skip_white_reverse(const DBusString *str, int end, int *start)
Skips whitespace from end, storing the start index of the trailing whitespace in *start.
#define DBUS_LOCKED_STRING_PREAMBLE(str)
Checks assertions about a string object that may be locked but can't be const.
dbus_bool_t _dbus_string_set_length(DBusString *str, int length)
Sets the length of a string.
dbus_bool_t _dbus_string_insert_2_aligned(DBusString *str, int insert_at, const unsigned char octets[2])
Inserts 2 bytes aligned on a 2 byte boundary with any alignment padding initialized to 0...
dbus_bool_t _dbus_string_copy_len(const DBusString *source, int start, int len, DBusString *dest, int insert_at)
Like _dbus_string_copy(), but can copy a segment from the middle of the source string.
int _dbus_printf_string_upper_bound(const char *format, va_list args)
Measure the length of the given format string and arguments, not including the terminating nul...
dbus_bool_t _dbus_string_steal_data(DBusString *str, char **data_return)
Like _dbus_string_get_data(), but removes the gotten data from the original string.
void _dbus_string_toupper_ascii(const DBusString *str, int start, int len)
Converts the given range of the string to upper case.
#define UTF8_COMPUTE(Char, Mask, Len)
computes length and mask of a unicode character
dbus_bool_t _dbus_string_insert_alignment(DBusString *str, int *insert_at, int alignment)
Inserts padding at *insert_at such to align it to the given boundary.
dbus_bool_t _dbus_string_validate_ascii(const DBusString *str, int start, int len)
Checks that the given range of the string is valid ASCII with no nul bytes.
void _dbus_string_init_const_len(DBusString *str, const char *value, int len)
Initializes a constant string with a length.
dbus_bool_t _dbus_string_move_len(DBusString *source, int start, int len, DBusString *dest, int insert_at)
Like _dbus_string_move(), but can move a segment from the middle of the source string.
unsigned int constant
String data is not owned by DBusString.
dbus_bool_t _dbus_string_split_on_byte(DBusString *source, unsigned char byte, DBusString *tail)
Looks for the first occurance of a byte, deletes that byte, and moves everything after the byte to th...