diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-04-22 15:44:57 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-04-22 15:44:57 +0100 |
commit | 121c294b1853a280b01e0504eb1828c6d0e07bbc (patch) | |
tree | d6d7d7a079875bf229bff330e089279d8cbc7f52 /_dbus_bindings/message-append.c | |
parent | c57c4d281369589b636aee928238b7cf6e42e00f (diff) | |
download | dbus-python-121c294b1853a280b01e0504eb1828c6d0e07bbc.tar.gz |
Require D-Bus 1.6, drop fallback paths
Diffstat (limited to '_dbus_bindings/message-append.c')
-rw-r--r-- | _dbus_bindings/message-append.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/_dbus_bindings/message-append.c b/_dbus_bindings/message-append.c index 27522bf..89ca746 100644 --- a/_dbus_bindings/message-append.c +++ b/_dbus_bindings/message-append.c @@ -569,60 +569,12 @@ _message_iter_append_string(DBusMessageIter *appender, return -1; /* Validate UTF-8, strictly */ -#ifdef HAVE_DBUS_VALIDATE_UTF8 if (!dbus_validate_utf8(s, NULL)) { PyErr_SetString(PyExc_UnicodeError, "String parameters " "to be sent over D-Bus must be valid UTF-8 " "with no noncharacter code points"); return -1; } -#else - { - PyObject *back_to_unicode; - PyObject *utf32; - Py_ssize_t i; - - /* This checks for syntactically valid UTF-8, but does not check - * for noncharacters (U+nFFFE, U+nFFFF for any n, or U+FDD0..U+FDEF). - */ - back_to_unicode = PyUnicode_DecodeUTF8(s, PyBytes_GET_SIZE(utf8), - "strict"); - - if (!back_to_unicode) { - return -1; - } - - utf32 = PyUnicode_AsUTF32String(back_to_unicode); - Py_CLEAR(back_to_unicode); - - if (!utf32) { - return -1; - } - - for (i = 0; i < PyBytes_GET_SIZE(utf32) / 4; i++) { - dbus_uint32_t *p; - - p = (dbus_uint32_t *) (PyBytes_AS_STRING(utf32)) + i; - - if (/* noncharacters U+nFFFE, U+nFFFF */ - (*p & 0xFFFF) == 0xFFFE || - (*p & 0xFFFF) == 0xFFFF || - /* noncharacters U+FDD0..U+FDEF */ - (*p >= 0xFDD0 && *p <= 0xFDEF) || - /* surrogates U+D800..U+DBFF (low), U+DC00..U+DFFF (high) */ - (*p >= 0xD800 && *p <= 0xDFFF) || - (*p >= 0x110000)) { - Py_CLEAR(utf32); - PyErr_SetString(PyExc_UnicodeError, "String parameters " - "to be sent over D-Bus must be valid UTF-8 " - "with no noncharacter code points"); - return -1; - } - } - - Py_CLEAR(utf32); - } -#endif DBG("Performing actual append: string (from unicode) %s", s); if (!dbus_message_iter_append_basic(appender, sig_type, &s)) { |