summaryrefslogtreecommitdiff
path: root/efl/ecore
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2014-04-06 01:50:29 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2014-04-06 01:50:29 +0300
commitb547ff2aa2064b98021d6f458cfc3d44a9936544 (patch)
tree4d974345bef5b05e4cfc3f94a56755d6a15b5166 /efl/ecore
parent75c8351fdf8594bffdc82fb92f6715324c15111e (diff)
Remove Python -> C string hacks
Diffstat (limited to 'efl/ecore')
-rw-r--r--efl/ecore/efl.ecore_exe.pxi6
-rw-r--r--efl/ecore/efl.ecore_file_download.pxi5
-rw-r--r--efl/ecore/efl.ecore_file_monitor.pxi4
3 files changed, 0 insertions, 15 deletions
diff --git a/efl/ecore/efl.ecore_exe.pxi b/efl/ecore/efl.ecore_exe.pxi
index 96bbea4..125803b 100644
--- a/efl/ecore/efl.ecore_exe.pxi
+++ b/efl/ecore/efl.ecore_exe.pxi
@@ -15,8 +15,6 @@
15# You should have received a copy of the GNU Lesser General Public License 15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. 16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17 17
18from cpython cimport PyUnicode_AsUTF8String
19
20cdef extern from "Python.h": 18cdef extern from "Python.h":
21 object PyUnicode_FromStringAndSize(char *s, Py_ssize_t len) 19 object PyUnicode_FromStringAndSize(char *s, Py_ssize_t len)
22 int PyObject_GetBuffer(obj, Py_buffer *view, int flags) 20 int PyObject_GetBuffer(obj, Py_buffer *view, int flags)
@@ -312,7 +310,6 @@ cdef class Exe(object):
312 if flags is None: 310 if flags is None:
313 flags = 0 311 flags = 0
314 312
315 if isinstance(exe_cmd, unicode): exe_cmd = PyUnicode_AsUTF8String(exe_cmd)
316 self._set_obj(exe_cmd, flags) 313 self._set_obj(exe_cmd, flags)
317 self.__data = data 314 self.__data = data
318 self.__callbacks = {} 315 self.__callbacks = {}
@@ -399,9 +396,6 @@ cdef class Exe(object):
399 Py_buffer buf_view 396 Py_buffer buf_view
400 bint ret 397 bint ret
401 398
402 if isinstance(buf, unicode):
403 buf = PyUnicode_AsUTF8String(buf)
404
405 PyObject_GetBuffer(buf, &buf_view, 0) 399 PyObject_GetBuffer(buf, &buf_view, 0)
406 400
407 if size <= 0: 401 if size <= 0:
diff --git a/efl/ecore/efl.ecore_file_download.pxi b/efl/ecore/efl.ecore_file_download.pxi
index 63592ea..125ebd5 100644
--- a/efl/ecore/efl.ecore_file_download.pxi
+++ b/efl/ecore/efl.ecore_file_download.pxi
@@ -15,8 +15,6 @@
15# You should have received a copy of the GNU Lesser General Public License 15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. 16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17 17
18from cpython cimport PyUnicode_AsUTF8String
19
20cdef void _completion_cb(void *data, const char *file, int status) with gil: 18cdef void _completion_cb(void *data, const char *file, int status) with gil:
21 obj = <FileDownload>data 19 obj = <FileDownload>data
22 try: 20 try:
@@ -89,8 +87,6 @@ cdef class FileDownload(object):
89 self.args = args 87 self.args = args
90 self.kargs = kargs 88 self.kargs = kargs
91 89
92 if isinstance(url, unicode): url = PyUnicode_AsUTF8String(url)
93 if isinstance(dst, unicode): dst = PyUnicode_AsUTF8String(dst)
94 if not ecore_file_download( 90 if not ecore_file_download(
95 <const char *>url if url is not None else NULL, 91 <const char *>url if url is not None else NULL,
96 <const char *>dst if dst is not None else NULL, 92 <const char *>dst if dst is not None else NULL,
@@ -183,6 +179,5 @@ def file_download_protocol_available(protocol):
183 :return: True if the protocol is supported 179 :return: True if the protocol is supported
184 :rtype: bool 180 :rtype: bool
185 """ 181 """
186 if isinstance(protocol, unicode): protocol = PyUnicode_AsUTF8String(protocol)
187 return bool(ecore_file_download_protocol_available( 182 return bool(ecore_file_download_protocol_available(
188 <const char *>protocol if protocol is not None else NULL)) 183 <const char *>protocol if protocol is not None else NULL))
diff --git a/efl/ecore/efl.ecore_file_monitor.pxi b/efl/ecore/efl.ecore_file_monitor.pxi
index 10df57e..8859ee6 100644
--- a/efl/ecore/efl.ecore_file_monitor.pxi
+++ b/efl/ecore/efl.ecore_file_monitor.pxi
@@ -15,9 +15,6 @@
15# You should have received a copy of the GNU Lesser General Public License 15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. 16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17 17
18from cpython cimport PyUnicode_AsUTF8String
19
20
21cdef void _file_monitor_cb(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) with gil: 18cdef void _file_monitor_cb(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) with gil:
22 obj = <FileMonitor>data 19 obj = <FileMonitor>data
23 try: 20 try:
@@ -72,7 +69,6 @@ cdef class FileMonitor(object):
72 self.args = args 69 self.args = args
73 self.kargs = kargs 70 self.kargs = kargs
74 71
75 if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
76 self.mon = ecore_file_monitor_add( 72 self.mon = ecore_file_monitor_add(
77 <const char *>path if path is not None else NULL, 73 <const char *>path if path is not None else NULL,
78 _file_monitor_cb, <void *>self) 74 _file_monitor_cb, <void *>self)