summaryrefslogtreecommitdiff
path: root/_dbus_bindings
diff options
context:
space:
mode:
Diffstat (limited to '_dbus_bindings')
-rw-r--r--_dbus_bindings/Makefile.am20
-rw-r--r--_dbus_bindings/Makefile.in28
-rw-r--r--_dbus_bindings/abstract.c2
-rw-r--r--_dbus_bindings/bytes.c2
-rw-r--r--_dbus_bindings/compat-internal.h19
-rw-r--r--_dbus_bindings/containers.c2
-rw-r--r--_dbus_bindings/float.c2
-rw-r--r--_dbus_bindings/message-append.c64
-rw-r--r--_dbus_bindings/server.c81
-rw-r--r--_dbus_bindings/signature.c2
-rw-r--r--_dbus_bindings/types-internal.h1
11 files changed, 98 insertions, 125 deletions
diff --git a/_dbus_bindings/Makefile.am b/_dbus_bindings/Makefile.am
index 2a5ec28..42c9f91 100644
--- a/_dbus_bindings/Makefile.am
+++ b/_dbus_bindings/Makefile.am
@@ -3,7 +3,25 @@ pyexec_LTLIBRARIES = _dbus_bindings.la
AM_CPPFLAGS = -I$(top_srcdir)/include $(DBUS_CFLAGS) $(PYTHON_INCLUDES)
AM_LDFLAGS = -module -avoid-version \
-export-symbols-regex \(PyInit__\|init_\)dbus_bindings \
- $(DBUS_LIBS)
+ $(NULL)
+
+libadd = $(DBUS_LIBS)
+
+if WINDOWS
+# Win32 DLLs can't have undefined symbols (so this needs explicit linking
+# against the Python DLL), and Python expects extensions to be *.pyd
+# instead of *.dll
+AM_LDFLAGS += \
+ -no-undefined \
+ -shrext ".pyd" \
+ $(NULL)
+
+libadd += \
+ $(PYTHON_LIBS) \
+ $(NULL)
+endif
+
+_dbus_bindings_la_LIBADD = $(libadd)
_dbus_bindings_la_SOURCES = \
abstract.c \
bus.c \
diff --git a/_dbus_bindings/Makefile.in b/_dbus_bindings/Makefile.in
index 97d72c0..40d264c 100644
--- a/_dbus_bindings/Makefile.in
+++ b/_dbus_bindings/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -51,6 +51,19 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+
+# Win32 DLLs can't have undefined symbols (so this needs explicit linking
+# against the Python DLL), and Python expects extensions to be *.pyd
+# instead of *.dll
+@WINDOWS_TRUE@am__append_1 = \
+@WINDOWS_TRUE@ -no-undefined \
+@WINDOWS_TRUE@ -shrext ".pyd" \
+@WINDOWS_TRUE@ $(NULL)
+
+@WINDOWS_TRUE@am__append_2 = \
+@WINDOWS_TRUE@ $(PYTHON_LIBS) \
+@WINDOWS_TRUE@ $(NULL)
+
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/tools/check-coding-style.mk
subdir = _dbus_bindings
@@ -99,7 +112,10 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(pyexecdir)"
LTLIBRARIES = $(pyexec_LTLIBRARIES)
-_dbus_bindings_la_LIBADD =
+am__DEPENDENCIES_1 =
+@WINDOWS_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+_dbus_bindings_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__dbus_bindings_la_OBJECTS = abstract.lo bus.lo bytes.lo conn.lo \
conn-methods.lo containers.lo debug.lo exceptions.lo float.lo \
generic.lo int.lo unixfd.lo libdbusconn.lo mainloop.lo \
@@ -286,10 +302,10 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pyexec_LTLIBRARIES = _dbus_bindings.la
AM_CPPFLAGS = -I$(top_srcdir)/include $(DBUS_CFLAGS) $(PYTHON_INCLUDES)
-AM_LDFLAGS = -module -avoid-version \
- -export-symbols-regex \(PyInit__\|init_\)dbus_bindings \
- $(DBUS_LIBS)
-
+AM_LDFLAGS = -module -avoid-version -export-symbols-regex \
+ \(PyInit__\|init_\)dbus_bindings $(NULL) $(am__append_1)
+libadd = $(DBUS_LIBS) $(am__append_2)
+_dbus_bindings_la_LIBADD = $(libadd)
_dbus_bindings_la_SOURCES = \
abstract.c \
bus.c \
diff --git a/_dbus_bindings/abstract.c b/_dbus_bindings/abstract.c
index f2cbebc..2e6f438 100644
--- a/_dbus_bindings/abstract.c
+++ b/_dbus_bindings/abstract.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/bytes.c b/_dbus_bindings/bytes.c
index fc490d9..51c1cd8 100644
--- a/_dbus_bindings/bytes.c
+++ b/_dbus_bindings/bytes.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/compat-internal.h b/_dbus_bindings/compat-internal.h
index 143f23a..535439c 100644
--- a/_dbus_bindings/compat-internal.h
+++ b/_dbus_bindings/compat-internal.h
@@ -30,23 +30,4 @@
#include "config.h"
#include "dbus_bindings-internal.h"
-#ifndef HAVE_DBUSBASICVALUE
-typedef union {
- dbus_bool_t bool_val;
- double dbl;
- dbus_uint16_t u16;
- dbus_int16_t i16;
- dbus_uint32_t u32;
- dbus_int32_t i32;
-#if defined(DBUS_HAVE_INT64) && defined(HAVE_LONG_LONG)
- dbus_uint64_t u64;
- dbus_int64_t i64;
-#endif
- const char *str;
- unsigned char byt;
- float f;
- int fd;
-} DBusBasicValue;
-#endif
-
#endif
diff --git a/_dbus_bindings/containers.c b/_dbus_bindings/containers.c
index 9e57243..1ac6063 100644
--- a/_dbus_bindings/containers.c
+++ b/_dbus_bindings/containers.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/float.c b/_dbus_bindings/float.c
index 9ea8413..f540f5b 100644
--- a/_dbus_bindings/float.c
+++ b/_dbus_bindings/float.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/message-append.c b/_dbus_bindings/message-append.c
index e519ae2..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)) {
@@ -962,6 +914,7 @@ _message_iter_append_variant(DBusMessageIter *appender, PyObject *obj)
int ret;
long variant_level;
dbus_bool_t dummy;
+ DBusMessageIter *variant_iters = NULL;
/* Separate the object into the contained object, and the number of
* variants it's wrapped in. */
@@ -987,10 +940,17 @@ _message_iter_append_variant(DBusMessageIter *appender, PyObject *obj)
dbus_signature_iter_init(&obj_sig_iter, obj_sig_str);
- { /* scope for variant_iters */
- DBusMessageIter variant_iters[variant_level];
+ {
long i;
+ variant_iters = calloc (variant_level, sizeof (DBusMessageIter));
+
+ if (!variant_iters) {
+ PyErr_NoMemory();
+ ret = -1;
+ goto out;
+ }
+
for (i = 0; i < variant_level; i++) {
DBusMessageIter *child = &variant_iters[i];
/* The first is a special case: its parent is the iter passed in
@@ -1038,10 +998,12 @@ _message_iter_append_variant(DBusMessageIter *appender, PyObject *obj)
goto out;
}
}
-
}
out:
+ if (variant_iters != NULL)
+ free (variant_iters);
+
Py_CLEAR(obj_sig);
return ret;
}
diff --git a/_dbus_bindings/server.c b/_dbus_bindings/server.c
index cb489f6..07652c4 100644
--- a/_dbus_bindings/server.c
+++ b/_dbus_bindings/server.c
@@ -88,6 +88,9 @@ DBusPyServer_set_auth_mechanisms(Server *self,
PyObject *fast_seq = NULL, *references = NULL;
Py_ssize_t length;
Py_ssize_t i;
+ /* a mutable array of constant strings */
+ const char **list = NULL;
+ dbus_bool_t ret = FALSE;
fast_seq = PySequence_Fast(auth_mechanisms,
"Expecting sequence for auth_mechanisms parameter");
@@ -97,49 +100,53 @@ DBusPyServer_set_auth_mechanisms(Server *self,
length = PySequence_Fast_GET_SIZE(fast_seq);
- /* scope for list */
- {
- const char *list[length + 1];
-
- if (!(references = PyTuple_New(length)))
- goto error;
-
- for (i = 0; i < length; ++i) {
- PyObject *am, *am_as_bytes;
-
- am = PySequence_Fast_GET_ITEM(auth_mechanisms, i);
- if (!am) goto error;
-
- if (PyUnicode_Check(am)) {
- am_as_bytes = PyUnicode_AsUTF8String(am);
- if (!am_as_bytes)
- goto error;
- }
- else {
- am_as_bytes = am;
- Py_INCREF(am_as_bytes);
- }
- list[i] = PyBytes_AsString(am_as_bytes);
- if (!list[i])
- goto error;
-
- PyTuple_SET_ITEM(references, i, am_as_bytes);
- }
+ list = calloc (length + 1, sizeof (char *));
- list[length] = NULL;
+ if (!list) {
+ PyErr_NoMemory();
+ goto finally;
+ }
- Py_BEGIN_ALLOW_THREADS
- dbus_server_set_auth_mechanisms(self->server, list);
- Py_END_ALLOW_THREADS
+ if (!(references = PyTuple_New(length)))
+ goto finally;
+
+ for (i = 0; i < length; ++i) {
+ PyObject *am, *am_as_bytes;
+
+ am = PySequence_Fast_GET_ITEM(auth_mechanisms, i);
+ if (!am)
+ goto finally;
+
+ if (PyUnicode_Check(am)) {
+ am_as_bytes = PyUnicode_AsUTF8String(am);
+ if (!am_as_bytes)
+ goto finally;
+ }
+ else {
+ am_as_bytes = am;
+ Py_INCREF(am_as_bytes);
+ }
+ list[i] = PyBytes_AsString(am_as_bytes);
+ if (!list[i])
+ goto finally;
+
+ PyTuple_SET_ITEM(references, i, am_as_bytes);
}
+ list[length] = NULL;
+
+ Py_BEGIN_ALLOW_THREADS
+ dbus_server_set_auth_mechanisms(self->server, list);
+ Py_END_ALLOW_THREADS
+
+ ret = TRUE;
+
+finally:
+ if (list)
+ free (list);
Py_CLEAR(fast_seq);
Py_CLEAR(references);
- return TRUE;
- error:
- Py_CLEAR(fast_seq);
- Py_CLEAR(references);
- return FALSE;
+ return ret;
}
/* Return a new reference to a Python Server or subclass corresponding
diff --git a/_dbus_bindings/signature.c b/_dbus_bindings/signature.c
index 766fd8e..fa8f937 100644
--- a/_dbus_bindings/signature.c
+++ b/_dbus_bindings/signature.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/types-internal.h b/_dbus_bindings/types-internal.h
index 8a715d4..2024803 100644
--- a/_dbus_bindings/types-internal.h
+++ b/_dbus_bindings/types-internal.h
@@ -24,7 +24,6 @@
*/
#include <Python.h>
-#include <stdint.h>
/* In Python2 >= 2.6 this aliases PyString to PyBytes. There is no PyString
* in Python 3, so this allows the C extension to be compilable in both Python