kuuko pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=6db1f9d0d63aef18db49a5d73636cc50cd7287b9
commit 6db1f9d0d63aef18db49a5d73636cc50cd7287b9 Author: Kai Huuhko <[email protected]> Date: Sun Dec 15 15:08:57 2013 +0200 Use uintptr_t instead of long or unsigned long for handling pointers. --- efl/ecore/efl.ecore.pyx | 1 + efl/ecore/efl.ecore_events.pxi | 4 ++-- efl/ecore/efl.ecore_exe.pxi | 14 +++++++------- efl/ecore/efl.ecore_fd_handler.pxi | 4 ++-- efl/ecore/efl.ecore_file_download.pxi | 4 ++-- efl/ecore/efl.ecore_file_monitor.pxi | 2 +- efl/edje/efl.edje.pyx | 1 + efl/edje/efl.edje_edit_part_state.pxi | 2 +- efl/edje/efl.edje_external.pxi | 2 +- efl/elementary/actionslider.pyx | 3 ++- efl/elementary/colorselector.pyx | 3 ++- efl/elementary/diskselector.pyx | 3 ++- efl/elementary/entry.pyx | 7 ++++--- efl/elementary/fileselector.pyx | 3 ++- efl/elementary/fileselector_button.pyx | 3 ++- efl/elementary/fileselector_entry.pyx | 3 ++- efl/elementary/flipselector.pyx | 3 ++- efl/elementary/general.pyx | 1 + efl/elementary/gengrid.pyx | 3 ++- efl/elementary/gengrid_item.pxi | 4 ++-- efl/elementary/gengrid_item_class.pxi | 4 ++-- efl/elementary/genlist.pyx | 3 ++- efl/elementary/genlist_item.pxi | 4 ++-- efl/elementary/genlist_item_class.pxi | 4 ++-- efl/elementary/hoversel.pyx | 3 ++- efl/elementary/image.pyx | 7 ++++--- efl/elementary/index.pyx | 3 ++- efl/elementary/list.pyx | 7 ++++--- efl/elementary/multibuttonentry.pyx | 5 +++-- efl/elementary/object.pyx | 5 +++-- efl/elementary/object_item.pyx | 5 +++-- efl/elementary/photocam.pyx | 5 +++-- efl/elementary/popup.pyx | 5 +++-- efl/elementary/segment_control.pyx | 3 ++- efl/elementary/slideshow.pyx | 11 ++++++----- efl/elementary/theme.pyx | 3 ++- efl/elementary/web.pyx | 11 ++++++----- efl/emotion/efl.emotion.pyx | 3 ++- efl/eo/efl.eo.pyx | 13 +++++++------ efl/evas/efl.evas.pyx | 1 + efl/evas/efl.evas_canvas.pxi | 6 +++--- efl/evas/efl.evas_object_smart.pxi | 2 +- efl/evas/smart_object_metaclass.pxi | 9 +++++---- 43 files changed, 111 insertions(+), 81 deletions(-) diff --git a/efl/ecore/efl.ecore.pyx b/efl/ecore/efl.ecore.pyx index 270b08f..7f0b90d 100644 --- a/efl/ecore/efl.ecore.pyx +++ b/efl/ecore/efl.ecore.pyx @@ -200,6 +200,7 @@ File monitor events """ +from libc.stdint cimport uintptr_t import traceback from efl.eo cimport Eo, PY_REFCOUNT from efl.utils.conversions cimport _ctouni diff --git a/efl/ecore/efl.ecore_events.pxi b/efl/ecore/efl.ecore_events.pxi index 2ebe259..53fb143 100644 --- a/efl/ecore/efl.ecore_events.pxi +++ b/efl/ecore/efl.ecore_events.pxi @@ -90,9 +90,9 @@ cdef class EventHandler(object): def __repr__(self): return ("%s(%#x, type=%d, func=%s, args=%s, kargs=%s, event_cls=%s, " "Ecore_Event_Handler=%#x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long><void *>self, + (self.__class__.__name__, <uintptr_t><void *>self, self.type, self.func, self.args, self.kargs, self.event_cls, - <unsigned long>self.obj, PY_REFCOUNT(self)) + <uintptr_t>self.obj, PY_REFCOUNT(self)) def __dealloc__(self): if self.obj != NULL: diff --git a/efl/ecore/efl.ecore_exe.pxi b/efl/ecore/efl.ecore_exe.pxi index 0c317d1..963a602 100644 --- a/efl/ecore/efl.ecore_exe.pxi +++ b/efl/ecore/efl.ecore_exe.pxi @@ -330,7 +330,7 @@ cdef class Exe(object): Py_INCREF(self) self.exe = exe ecore_exe_callback_pre_free_set(exe, _ecore_exe_pre_free_cb) - _ecore_exe_event_mapping[<long><void *>exe] = self + _ecore_exe_event_mapping[<uintptr_t><void *>exe] = self return 1 cdef int _unset_obj(self) except 0: @@ -339,7 +339,7 @@ cdef class Exe(object): filter.delete() self.__callbacks = None - _ecore_exe_event_mapping.pop(<long><void *>self.exe) + _ecore_exe_event_mapping.pop(<uintptr_t><void *>self.exe) self.exe = NULL Py_DECREF(self) return 1 @@ -357,8 +357,8 @@ cdef class Exe(object): data = None return ("<%s(%#x, Ecore_Exe=%#x, refcount=%d, pid=%s, cmd=%r, " "flags=[%s], data=%r)>") % \ - (self.__class__.__name__, <unsigned long><void *>self, - <unsigned long>self.exe, PY_REFCOUNT(self), + (self.__class__.__name__, <uintptr_t><void *>self, + <uintptr_t>self.exe, PY_REFCOUNT(self), pid, cmd, flags, data) def delete(self): @@ -779,7 +779,7 @@ cdef class EventExeAdd(Event): cdef int _set_obj(self, void *o) except 0: cdef Ecore_Exe_Event_Add *obj obj = <Ecore_Exe_Event_Add*>o - self.exe = _ecore_exe_event_mapping.get(<long>obj.exe) + self.exe = _ecore_exe_event_mapping.get(<uintptr_t>obj.exe) if self.exe is None: return -1 return 1 @@ -801,7 +801,7 @@ cdef class EventExeDel(Event): cdef int _set_obj(self, void *o) except 0: cdef Ecore_Exe_Event_Del *obj obj = <Ecore_Exe_Event_Del*>o - self.exe = _ecore_exe_event_mapping.get(<long>obj.exe) + self.exe = _ecore_exe_event_mapping.get(<uintptr_t>obj.exe) if self.exe is None: return -1 self.pid = obj.pid @@ -841,7 +841,7 @@ cdef class EventExeData(Event): cdef Ecore_Exe_Event_Data *obj cdef int i obj = <Ecore_Exe_Event_Data*>o - self.exe = _ecore_exe_event_mapping.get(<long>obj.exe) + self.exe = _ecore_exe_event_mapping.get(<uintptr_t>obj.exe) if self.exe is None: return -1 self.data = PyUnicode_FromStringAndSize(<char*>obj.data, obj.size) diff --git a/efl/ecore/efl.ecore_fd_handler.pxi b/efl/ecore/efl.ecore_fd_handler.pxi index d9deeb9..f92bc01 100644 --- a/efl/ecore/efl.ecore_fd_handler.pxi +++ b/efl/ecore/efl.ecore_fd_handler.pxi @@ -124,9 +124,9 @@ cdef class FdHandler(object): flags = flags2str(self.active_get(7)) return ("%s(%#x, func=%s, args=%s, kargs=%s, fd=%s, flags=[%s], " "Ecore_Fd_Handler=%#x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long><void *>self, + (self.__class__.__name__, <uintptr_t><void *>self, self.func, self.args, self.kargs, fd, flags, - <unsigned long>self.obj, PY_REFCOUNT(self)) + <uintptr_t>self.obj, PY_REFCOUNT(self)) def __dealloc__(self): if self.obj != NULL: diff --git a/efl/ecore/efl.ecore_file_download.pxi b/efl/ecore/efl.ecore_file_download.pxi index 6ecd82c..d883496 100644 --- a/efl/ecore/efl.ecore_file_download.pxi +++ b/efl/ecore/efl.ecore_file_download.pxi @@ -109,9 +109,9 @@ cdef class FileDownload(object): def __repr__(self): return ("%s(%#x, completion_cb=%s, progress_cb=%s, args=%s, kargs=%s, " "Ecore_File_Download_Job=%#x, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long><void *>self, + (self.__class__.__name__, <uintptr_t><void *>self, self.completion_cb, self.progress_cb, self.args, self.kargs, - <unsigned long>self.job, PY_REFCOUNT(self)) + <uintptr_t>self.job, PY_REFCOUNT(self)) def __dealloc__(self): if self.job != NULL: diff --git a/efl/ecore/efl.ecore_file_monitor.pxi b/efl/ecore/efl.ecore_file_monitor.pxi index ee05af8..55e4c1a 100644 --- a/efl/ecore/efl.ecore_file_monitor.pxi +++ b/efl/ecore/efl.ecore_file_monitor.pxi @@ -95,7 +95,7 @@ cdef class FileMonitor(object): def __repr__(self): return ("%s(%#x, monitor_cb=%s, args=%s, kargs=%s, refcount=%d)") % \ - (self.__class__.__name__, <unsigned long><void *>self, + (self.__class__.__name__, <uintptr_t><void *>self, self.monitor_cb, self.args, self.kargs, PY_REFCOUNT(self)) cdef object _exec_monitor(self, Ecore_File_Event event, const_char *path): diff --git a/efl/edje/efl.edje.pyx b/efl/edje/efl.edje.pyx index 0970f86..10de817 100644 --- a/efl/edje/efl.edje.pyx +++ b/efl/edje/efl.edje.pyx @@ -20,6 +20,7 @@ import warnings from cpython cimport PyMem_Malloc, PyMem_Free, PyUnicode_AsUTF8String cimport libc.stdlib +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance, \ _register_decorated_callbacks diff --git a/efl/edje/efl.edje_edit_part_state.pxi b/efl/edje/efl.edje_edit_part_state.pxi index 5ac1063..f8a2b48 100644 --- a/efl/edje/efl.edje_edit_part_state.pxi +++ b/efl/edje/efl.edje_edit_part_state.pxi @@ -525,7 +525,7 @@ cdef class State: lst = edje_edit_state_external_params_list_get(self.edje.obj, self.part, self.name, self.value) while lst: - p = c_edje._ExternalParam_from_ptr(<long>lst.data) + p = c_edje._ExternalParam_from_ptr(<uintptr_t>lst.data) if p is not None: ret.append(p) lst = lst.next diff --git a/efl/edje/efl.edje_external.pxi b/efl/edje/efl.edje_external.pxi index 60a7fc3..e73886e 100644 --- a/efl/edje/efl.edje_external.pxi +++ b/efl/edje/efl.edje_external.pxi @@ -78,7 +78,7 @@ cdef ExternalParam ExternalParam_from_ptr(Edje_External_Param *param): # XXX: this should be C-only, but it would require edje_edit # XXX: being able to use it. -def _ExternalParam_from_ptr(long ptr): +def _ExternalParam_from_ptr(uintptr_t ptr): return ExternalParam_from_ptr(<Edje_External_Param *>ptr) diff --git a/efl/elementary/actionslider.pyx b/efl/elementary/actionslider.pyx index 601e0ff..ba23dd5 100644 --- a/efl/elementary/actionslider.pyx +++ b/efl/elementary/actionslider.pyx @@ -88,6 +88,7 @@ Actionslider positions from cpython cimport PyUnicode_AsUTF8String from libc.string cimport const_char +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -102,7 +103,7 @@ ELM_ACTIONSLIDER_CENTER = enums.ELM_ACTIONSLIDER_CENTER ELM_ACTIONSLIDER_RIGHT = enums.ELM_ACTIONSLIDER_RIGHT ELM_ACTIONSLIDER_ALL = enums.ELM_ACTIONSLIDER_ALL -def _cb_string_conv(long addr): +def _cb_string_conv(uintptr_t addr): cdef const_char *s = <const_char *>addr return _ctouni(s) if s is not NULL else None diff --git a/efl/elementary/colorselector.pyx b/efl/elementary/colorselector.pyx index 140e7cf..b4a185c 100644 --- a/efl/elementary/colorselector.pyx +++ b/efl/elementary/colorselector.pyx @@ -68,6 +68,7 @@ Colorselector modes """ from cpython cimport PyUnicode_AsUTF8String, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -81,7 +82,7 @@ ELM_COLORSELECTOR_PALETTE = enums.ELM_COLORSELECTOR_PALETTE ELM_COLORSELECTOR_COMPONENTS = enums.ELM_COLORSELECTOR_COMPONENTS ELM_COLORSELECTOR_BOTH = enums.ELM_COLORSELECTOR_BOTH -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/diskselector.pyx b/efl/elementary/diskselector.pyx index b9a8542..a6cb4f1 100644 --- a/efl/elementary/diskselector.pyx +++ b/efl/elementary/diskselector.pyx @@ -72,6 +72,7 @@ using multiple inheritance, for example:: """ from cpython cimport PyUnicode_AsUTF8String, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -84,7 +85,7 @@ from efl.utils.deprecated cimport DEPRECATED from scroller cimport elm_scroller_policy_get, elm_scroller_policy_set, \ elm_scroller_bounce_get, elm_scroller_bounce_set, Elm_Scroller_Policy -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/entry.pyx b/efl/elementary/entry.pyx index 0983cb9..71d00a0 100644 --- a/efl/elementary/entry.pyx +++ b/efl/elementary/entry.pyx @@ -468,6 +468,7 @@ Icon types from libc.string cimport strdup from libc.stdlib cimport free +from libc.stdint cimport uintptr_t from cpython cimport PyUnicode_AsUTF8String, Py_INCREF from efl.eo cimport _object_mapping_register, object_from_instance @@ -753,7 +754,7 @@ class EntryAnchorHoverInfo(object): self.hover_top = False self.hover_bottom = False -def _entryanchor_conv(long addr): +def _entryanchor_conv(uintptr_t addr): cdef Elm_Entry_Anchor_Info *ei = <Elm_Entry_Anchor_Info *>addr eai = EntryAnchorInfo() eai.name = _ctouni(ei.name) @@ -764,10 +765,10 @@ def _entryanchor_conv(long addr): eai.h = ei.h return eai -def _entryanchorhover_conv(long addr): +def _entryanchorhover_conv(uintptr_t addr): cdef Elm_Entry_Anchor_Hover_Info *ehi = <Elm_Entry_Anchor_Hover_Info *>addr eahi = EntryAnchorHoverInfo() - eahi.anchor_info = _entryanchor_conv(<long><void *>ehi.anchor_info) + eahi.anchor_info = _entryanchor_conv(<uintptr_t><void *>ehi.anchor_info) eahi.hover = object_from_instance(ehi.hover) eahi.hover_parent = (ehi.hover_parent.x, ehi.hover_parent.y, ehi.hover_parent.w, ehi.hover_parent.h) diff --git a/efl/elementary/fileselector.pyx b/efl/elementary/fileselector.pyx index 5e9df35..6ba429d 100644 --- a/efl/elementary/fileselector.pyx +++ b/efl/elementary/fileselector.pyx @@ -85,6 +85,7 @@ Fileselector modes """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni, eina_list_strings_to_python_list @@ -96,7 +97,7 @@ cimport enums ELM_FILESELECTOR_LIST = enums.ELM_FILESELECTOR_LIST ELM_FILESELECTOR_GRID = enums.ELM_FILESELECTOR_GRID -def _cb_string_conv(long addr): +def _cb_string_conv(uintptr_t addr): cdef const_char *s = <const_char *>addr return _ctouni(s) if s is not NULL else None diff --git a/efl/elementary/fileselector_button.pyx b/efl/elementary/fileselector_button.pyx index dd47954..5dbeb4f 100644 --- a/efl/elementary/fileselector_button.pyx +++ b/efl/elementary/fileselector_button.pyx @@ -61,6 +61,7 @@ for are: """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -68,7 +69,7 @@ from efl.evas cimport Object as evasObject cimport enums -def _cb_string_conv(long addr): +def _cb_string_conv(uintptr_t addr): cdef const_char *s = <const_char *>addr return _ctouni(s) if s is not NULL else None diff --git a/efl/elementary/fileselector_entry.pyx b/efl/elementary/fileselector_entry.pyx index 3e8ab16..ea42cfb 100644 --- a/efl/elementary/fileselector_entry.pyx +++ b/efl/elementary/fileselector_entry.pyx @@ -77,6 +77,7 @@ are: """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -85,7 +86,7 @@ from layout_class cimport LayoutClass cimport enums -def _cb_string_conv(long addr): +def _cb_string_conv(uintptr_t addr): cdef const_char *s = <const_char *>addr return _ctouni(s) if s is not NULL else None diff --git a/efl/elementary/flipselector.pyx b/efl/elementary/flipselector.pyx index b6d4976..9c562ba 100644 --- a/efl/elementary/flipselector.pyx +++ b/efl/elementary/flipselector.pyx @@ -57,6 +57,7 @@ Default text parts of the flipselector items that you can use for are: """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -65,7 +66,7 @@ from object cimport Object from object_item cimport _object_item_to_python, _object_item_callback, \ _object_item_list_to_python, _object_item_callback2 -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/general.pyx b/efl/elementary/general.pyx index a1e7fad..b43855f 100644 --- a/efl/elementary/general.pyx +++ b/efl/elementary/general.pyx @@ -121,6 +121,7 @@ Possible values for the #ELM_POLICY_THROTTLE policy. from cpython cimport PyObject, Py_INCREF, Py_DECREF, PyUnicode_AsUTF8String, \ PyMem_Malloc, PyMem_Free +from libc.stdint cimport uintptr_t from efl.evas cimport Object as evasObject diff --git a/efl/elementary/gengrid.pyx b/efl/elementary/gengrid.pyx index 4e8f939..16b9011 100644 --- a/efl/elementary/gengrid.pyx +++ b/efl/elementary/gengrid.pyx @@ -279,6 +279,7 @@ Items' scroll to types include "tooltips.pxi" from libc.string cimport strdup +from libc.stdint cimport uintptr_t from cpython cimport Py_INCREF, Py_DECREF, PyUnicode_AsUTF8String from efl.eo cimport object_from_instance, _object_mapping_register, PY_REFCOUNT from efl.utils.conversions cimport _ctouni, _touni @@ -302,7 +303,7 @@ ELM_GENLIST_ITEM_SCROLLTO_IN = enums.ELM_GENLIST_ITEM_SCROLLTO_IN ELM_GENLIST_ITEM_SCROLLTO_TOP = enums.ELM_GENLIST_ITEM_SCROLLTO_TOP ELM_GENLIST_ITEM_SCROLLTO_MIDDLE = enums.ELM_GENLIST_ITEM_SCROLLTO_MIDDLE -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/gengrid_item.pxi b/efl/elementary/gengrid_item.pxi index f5a876e..835e5c5 100644 --- a/efl/elementary/gengrid_item.pxi +++ b/efl/elementary/gengrid_item.pxi @@ -55,9 +55,9 @@ cdef class GengridItem(ObjectItem): return ("<%s(%#x, refcount=%d, Elm_Object_Item=%#x, " "item_class=%s, func=%s, item_data=%r)>") % \ (type(self).__name__, - <unsigned long><void*>self, + <uintptr_t><void*>self, PY_REFCOUNT(self), - <unsigned long>self.item, + <uintptr_t>self.item, type(self.item_class).__name__, self.cb_func, self.item_data) diff --git a/efl/elementary/gengrid_item_class.pxi b/efl/elementary/gengrid_item_class.pxi index 3918caa..050cbf1 100644 --- a/efl/elementary/gengrid_item_class.pxi +++ b/efl/elementary/gengrid_item_class.pxi @@ -119,9 +119,9 @@ cdef class GengridItemClass: "item_style=%r, text_get_func=%s, content_get_func=%s, " "state_get_func=%s, del_func=%s)>") % \ (type(self).__name__, - <unsigned long><void *>self, + <uintptr_t><void *>self, PY_REFCOUNT(self), - <unsigned long>self.cls, + <uintptr_t>self.cls, _ctouni(self.cls.item_style), self._text_get_func, self._content_get_func, diff --git a/efl/elementary/genlist.pyx b/efl/elementary/genlist.pyx index c38841e..9148eb1 100644 --- a/efl/elementary/genlist.pyx +++ b/efl/elementary/genlist.pyx @@ -507,6 +507,7 @@ Selection modes include "tooltips.pxi" from cpython cimport PyUnicode_AsUTF8String, Py_DECREF, Py_INCREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, PY_REFCOUNT from efl.utils.conversions cimport _ctouni @@ -569,7 +570,7 @@ ELM_SEL_TYPE_SECONDARY = enums.ELM_SEL_TYPE_SECONDARY ELM_SEL_TYPE_XDND = enums.ELM_SEL_TYPE_XDND ELM_SEL_TYPE_CLIPBOARD = enums.ELM_SEL_TYPE_CLIPBOARD -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/genlist_item.pxi b/efl/elementary/genlist_item.pxi index e2b175a..a0d8d63 100644 --- a/efl/elementary/genlist_item.pxi +++ b/efl/elementary/genlist_item.pxi @@ -81,9 +81,9 @@ cdef class GenlistItem(ObjectItem): return ("<%s(%#x, refcount=%d, Elm_Object_Item=%#x, " "item_class=%s, func=%s, item_data=%r)>") % ( type(self).__name__, - <unsigned long><void*>self, + <uintptr_t><void*>self, PY_REFCOUNT(self), - <unsigned long>self.item, + <uintptr_t>self.item, type(self.item_class).__name__, self.cb_func, self.item_data diff --git a/efl/elementary/genlist_item_class.pxi b/efl/elementary/genlist_item_class.pxi index 349508a..584a8ee 100644 --- a/efl/elementary/genlist_item_class.pxi +++ b/efl/elementary/genlist_item_class.pxi @@ -132,9 +132,9 @@ cdef class GenlistItemClass(object): "item_style=%r, text_get_func=%s, content_get_func=%s, " "state_get_func=%s, del_func=%s)>") % \ (type(self).__name__, - <unsigned long><void *>self, + <uintptr_t><void *>self, PY_REFCOUNT(self), - <unsigned long>self.cls, + <uintptr_t>self.cls, _ctouni(self.cls.item_style), self._text_get_func, self._content_get_func, diff --git a/efl/elementary/hoversel.pyx b/efl/elementary/hoversel.pyx index ebd1cbe..a6795c7 100644 --- a/efl/elementary/hoversel.pyx +++ b/efl/elementary/hoversel.pyx @@ -73,6 +73,7 @@ Icon types """ from cpython cimport PyUnicode_AsUTF8String, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance from efl.utils.conversions cimport _ctouni @@ -87,7 +88,7 @@ ELM_ICON_NONE = enums.ELM_ICON_NONE ELM_ICON_FILE = enums.ELM_ICON_FILE ELM_ICON_STANDARD = enums.ELM_ICON_STANDARD -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/image.pyx b/efl/elementary/image.pyx index f24683d..ca05494 100644 --- a/efl/elementary/image.pyx +++ b/efl/elementary/image.pyx @@ -95,6 +95,7 @@ Image manipulation types """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance from efl.utils.conversions cimport _ctouni @@ -111,7 +112,7 @@ ELM_IMAGE_FLIP_VERTICAL = enums.ELM_IMAGE_FLIP_VERTICAL ELM_IMAGE_FLIP_TRANSPOSE = enums.ELM_IMAGE_FLIP_TRANSPOSE ELM_IMAGE_FLIP_TRANSVERSE = enums.ELM_IMAGE_FLIP_TRANSVERSE -def _cb_string_conv(long addr): +def _cb_string_conv(uintptr_t addr): cdef const_char *s = <const_char *>addr return _ctouni(s) if s is not NULL else None @@ -131,7 +132,7 @@ class ImageProgressInfo(object): self.now = 0 self.total = 0 -def _image_download_progress_conv(long addr): +def _image_download_progress_conv(uintptr_t addr): cdef Elm_Image_Progress *ip = <Elm_Image_Progress *>addr ipi = ImageProgressInfo() ipi.now = ip.now @@ -154,7 +155,7 @@ class ImageErrorInfo(object): self.status = 0 self.open_error = False -def _image_download_error_conv(long addr): +def _image_download_error_conv(uintptr_t addr): cdef Elm_Image_Error *ie = <Elm_Image_Error *>addr iei = ImageErrorInfo() iei.status = ie.status diff --git a/efl/elementary/index.pyx b/efl/elementary/index.pyx index 3e9119e..2522fa7 100644 --- a/efl/elementary/index.pyx +++ b/efl/elementary/index.pyx @@ -67,6 +67,7 @@ reported. """ from cpython cimport PyUnicode_AsUTF8String, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -78,7 +79,7 @@ from object_item cimport _object_item_callback, _object_item_to_python, \ import traceback -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/list.pyx b/efl/elementary/list.pyx index 52bf738..f1ad3cf 100644 --- a/efl/elementary/list.pyx +++ b/efl/elementary/list.pyx @@ -159,6 +159,7 @@ Selection modes """ from cpython cimport PyUnicode_AsUTF8String, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT from efl.utils.conversions cimport _ctouni @@ -188,7 +189,7 @@ ELM_SCROLLER_POLICY_AUTO = enums.ELM_SCROLLER_POLICY_AUTO ELM_SCROLLER_POLICY_ON = enums.ELM_SCROLLER_POLICY_ON ELM_SCROLLER_POLICY_OFF = enums.ELM_SCROLLER_POLICY_OFF -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) @@ -238,9 +239,9 @@ cdef class ListItem(ObjectItem): "callback=%r, cb_data=%r, " "args=%r, kargs=%r)>") % ( type(self).__name__, - <unsigned long><void *>self, + <uintptr_t><void *>self, PY_REFCOUNT(self), - <unsigned long><void *>self.item, + <uintptr_t><void *>self.item, self.text, getattr(self.part_content_get("icon"), "file", None), getattr(self.part_content_get("end"), "file", None), diff --git a/efl/elementary/multibuttonentry.pyx b/efl/elementary/multibuttonentry.pyx index 0097c3c..6200506 100644 --- a/efl/elementary/multibuttonentry.pyx +++ b/efl/elementary/multibuttonentry.pyx @@ -61,6 +61,7 @@ Default text parts of the multibuttonentry items that you can use for are: """ from cpython cimport PyUnicode_AsUTF8String, Py_DECREF, Py_INCREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT from efl.utils.conversions cimport _ctouni @@ -113,8 +114,8 @@ cdef class MultiButtonEntryItem(ObjectItem): def __repr__(self): return ("<%s(%#x, refcount=%d, Elm_Object_Item=%#x, " "label=%r, callback=%r, args=%r, kargs=%s)>") % \ - (self.__class__.__name__, <unsigned long><void *>self, - PY_REFCOUNT(self), <unsigned long><void *>self.item, + (self.__class__.__name__, <uintptr_t><void *>self, + PY_REFCOUNT(self), <uintptr_t><void *>self.item, self.text_get(), self.cb_func, self.args, self.kwargs) def append_to(self, MultiButtonEntry mbe not None): diff --git a/efl/elementary/object.pyx b/efl/elementary/object.pyx index f5407e7..363da9a 100644 --- a/efl/elementary/object.pyx +++ b/efl/elementary/object.pyx @@ -198,6 +198,7 @@ Defines the kind of action associated with the drop data if for XDND from cpython cimport PyObject, Py_INCREF, Py_DECREF, PyObject_GetAttr, \ PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyObject_CheckBuffer, \ PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni, eina_list_objects_to_python_list @@ -263,7 +264,7 @@ cdef void _object_callback(void *data, if event_conv is None: func(obj, *args, **kargs) else: - ei = event_conv(<long>event_info) + ei = event_conv(<uintptr_t>event_info) func(obj, ei, *args, **kargs) except: traceback.print_exc() @@ -1757,7 +1758,7 @@ cdef class Object(evasObject): :return: Address of saved Evas_Object """ - return <long>self.obj + return <uintptr_t>self.obj # # Copy and Paste diff --git a/efl/elementary/object_item.pyx b/efl/elementary/object_item.pyx index fdd4ab1..e4fe9ee 100644 --- a/efl/elementary/object_item.pyx +++ b/efl/elementary/object_item.pyx @@ -16,6 +16,7 @@ # along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. from cpython cimport PyUnicode_AsUTF8String, Py_DECREF, Py_INCREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT from efl.utils.conversions cimport _ctouni @@ -144,8 +145,8 @@ cdef class ObjectItem(object): def __repr__(self): return ("<%s object (ObjectItem) at %#x (obj=%#x, refcount=%d, widget=%s)>") % ( type(self).__name__, - <unsigned long><void *>self, - <unsigned long>self.item, + <uintptr_t><void *>self, + <uintptr_t>self.item, PY_REFCOUNT(self), repr(object_from_instance(elm_object_item_widget_get(self.item))) ) diff --git a/efl/elementary/photocam.pyx b/efl/elementary/photocam.pyx index eac1088..5e7b849 100644 --- a/efl/elementary/photocam.pyx +++ b/efl/elementary/photocam.pyx @@ -98,6 +98,7 @@ Photocam zoom modes """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni @@ -135,7 +136,7 @@ class PhotocamProgressInfo(object): self.now = 0 self.total = 0 -def _photocam_download_progress_conv(long addr): +def _photocam_download_progress_conv(uintptr_t addr): cdef Elm_Photocam_Progress *pp = <Elm_Photocam_Progress *>addr ppi = PhotocamProgressInfo() ppi.now = pp.now @@ -158,7 +159,7 @@ class PhotocamErrorInfo(object): self.status = 0 self.open_error = False -def _photocam_download_error_conv(long addr): +def _photocam_download_error_conv(uintptr_t addr): cdef Elm_Photocam_Error *pe = <Elm_Photocam_Error *>addr pei = PhotocamErrorInfo() pei.status = pe.status diff --git a/efl/elementary/popup.pyx b/efl/elementary/popup.pyx index c0ac1b2..4cd73df 100644 --- a/efl/elementary/popup.pyx +++ b/efl/elementary/popup.pyx @@ -172,6 +172,7 @@ Wrap modes """ from cpython cimport PyUnicode_AsUTF8String, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, PY_REFCOUNT from efl.utils.conversions cimport _ctouni @@ -255,9 +256,9 @@ cdef class PopupItem(ObjectItem): return ("<%s(%#x, refcount=%d, Elm_Object_Item=%#x, " "item_class=%s, func=%s, item_data=%r)>") % \ (self.__class__.__name__, - <unsigned long><void*>self, + <uintptr_t><void*>self, PY_REFCOUNT(self), - <unsigned long>self.item, + <uintptr_t>self.item, self.cb_func, self.args) diff --git a/efl/elementary/segment_control.pyx b/efl/elementary/segment_control.pyx index c6e4a6d..93c5417 100644 --- a/efl/elementary/segment_control.pyx +++ b/efl/elementary/segment_control.pyx @@ -54,6 +54,7 @@ Default text parts of the segment control items that you can use for are: """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance from efl.utils.conversions cimport _ctouni @@ -62,7 +63,7 @@ from layout_class cimport LayoutClass from object_item cimport _object_item_to_python -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) diff --git a/efl/elementary/slideshow.pyx b/efl/elementary/slideshow.pyx index 641ab21..6ea1c9d 100644 --- a/efl/elementary/slideshow.pyx +++ b/efl/elementary/slideshow.pyx @@ -79,6 +79,7 @@ This widget emits the following signals, besides the ones sent from """ from cpython cimport PyUnicode_AsUTF8String, Py_INCREF, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT from efl.utils.conversions cimport _ctouni @@ -90,7 +91,7 @@ from layout_class cimport LayoutClass import traceback from object_item cimport _object_item_to_python, _object_item_list_to_python -def _cb_object_item_conv(long addr): +def _cb_object_item_conv(uintptr_t addr): cdef Elm_Object_Item *it = <Elm_Object_Item *>addr return _object_item_to_python(it) @@ -211,9 +212,9 @@ cdef class SlideshowItemClass (object): return ("<%s(%#x, refcount=%d, Elm_Slideshow_Item_Class=%#x, " "get_func=%s, del_func=%s)>") % \ (type(self).__name__, - <unsigned long><void *>self, + <uintptr_t><void *>self, PY_REFCOUNT(self), - <unsigned long>&self.obj, + <uintptr_t>&self.obj, self._get_func, self._del_func) @@ -255,9 +256,9 @@ cdef class SlideshowItem(ObjectItem): return ("<%s(%#x, refcount=%d, Elm_Object_Item=%#x, " "item_class=%s, item_data=%r)>") % \ (type(self).__name__, - <unsigned long><void*>self, + <uintptr_t><void*>self, PY_REFCOUNT(self), - <unsigned long>self.obj, + <uintptr_t>self.obj, type(self.cls).__name__, self.args) diff --git a/efl/elementary/theme.pyx b/efl/elementary/theme.pyx index 66f2cfb..b2fb8ea 100644 --- a/efl/elementary/theme.pyx +++ b/efl/elementary/theme.pyx @@ -86,6 +86,7 @@ overlays. Don't use this unless you really know what you are doing. """ from cpython cimport PyUnicode_AsUTF8String, Py_INCREF, Py_DECREF +from libc.stdint cimport uintptr_t from efl.eo cimport PY_REFCOUNT from efl.utils.conversions cimport _ctouni, eina_list_strings_to_python_list @@ -101,7 +102,7 @@ cdef class Theme(object): def __repr__(self): return "<%s object at %#x (refcount=%d, order=%s, overlay_list=%s, extension_list=%s)>" % ( type(self).__name__, - <unsigned long>self.th, + <uintptr_t>self.th, PY_REFCOUNT(self), _ctouni(elm_theme_get(self.th)), eina_list_strings_to_python_list(elm_theme_overlay_list_get(self.th)), diff --git a/efl/elementary/web.pyx b/efl/elementary/web.pyx index d73c2d4..d1b5349 100644 --- a/efl/elementary/web.pyx +++ b/efl/elementary/web.pyx @@ -146,6 +146,7 @@ Web zoom modes """ from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport _object_mapping_register, object_from_instance from efl.utils.deprecated cimport DEPRECATED @@ -168,23 +169,23 @@ ELM_WEB_ZOOM_MODE_MANUAL = enums.ELM_WEB_ZOOM_MODE_MANUAL ELM_WEB_ZOOM_MODE_AUTO_FIT = enums.ELM_WEB_ZOOM_MODE_AUTO_FIT ELM_WEB_ZOOM_MODE_AUTO_FILL = enums.ELM_WEB_ZOOM_MODE_AUTO_FILL -def _cb_string_conv(long addr): +def _cb_string_conv(uintptr_t addr): cdef const_char *s = <const_char *>addr return _ctouni(s) if s is not NULL else None -def _cb_bool_conv(long addr): +def _cb_bool_conv(uintptr_t addr): cdef Eina_Bool *info = <Eina_Bool *>addr if info == NULL: return None return info[0] -def _web_double_conv(long addr): +def _web_double_conv(uintptr_t addr): cdef double *info = <double *>addr if info == NULL: return None return info[0] -def _web_load_frame_error_conv(long addr): +def _web_load_frame_error_conv(uintptr_t addr): cdef Elm_Web_Frame_Load_Error *err = <Elm_Web_Frame_Load_Error *>addr if err == NULL: return None @@ -200,7 +201,7 @@ def _web_load_frame_error_conv(long addr): return ret -def _web_link_hover_in_conv(long addr): +def _web_link_hover_in_conv(uintptr_t addr): cdef char **info = <char **>addr if info == NULL: url = title = None diff --git a/efl/emotion/efl.emotion.pyx b/efl/emotion/efl.emotion.pyx index 0ea0224..aa32943 100644 --- a/efl/emotion/efl.emotion.pyx +++ b/efl/emotion/efl.emotion.pyx @@ -16,6 +16,7 @@ # along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t from efl.eo cimport object_from_instance, _object_mapping_register, \ _register_decorated_callbacks @@ -226,7 +227,7 @@ cdef class Emotion(evasObject): return ("<%s(%#x, type=%r, name=%r, " "file=%r, geometry=(%d, %d, %d, %d), " "color=(%d, %d, %d, %d), layer=%s, clip=%r, visible=%s) %s>") % \ - (self.__class__.__name__, <unsigned long><void *>self, + (self.__class__.__name__, <uintptr_t><void *>self, self.type_get(), self.name_get(), self.file_get(), x, y, w, h, r, g, b, a, self.layer_get(), self.clip_get(), self.visible_get(), diff --git a/efl/eo/efl.eo.pyx b/efl/eo/efl.eo.pyx index 9162a90..cca01e0 100644 --- a/efl/eo/efl.eo.pyx +++ b/efl/eo/efl.eo.pyx @@ -18,6 +18,7 @@ from cpython cimport PyObject, Py_INCREF, Py_DECREF, PyUnicode_AsUTF8String from libc.stdlib cimport malloc, free from libc.string cimport memcpy, strdup +from libc.stdint cimport uintptr_t from efl.eina cimport Eina_Bool, const_Eina_List, eina_list_append, const_void, \ Eina_Hash, eina_hash_string_superfast_new, eina_hash_add, eina_hash_del, \ eina_hash_find, EINA_LOG_DOM_DBG, EINA_LOG_DOM_INFO @@ -122,7 +123,7 @@ cdef object object_from_instance(cEo *obj): if cls_name == NULL: raise ValueError( - "Eo object at %#x does not have a type!" % <unsigned long>obj) + "Eo object at %#x does not have a type!" % <uintptr_t>obj) cls_ret = eina_hash_find(object_mapping, cls_name) @@ -130,7 +131,7 @@ cdef object object_from_instance(cEo *obj): # TODO: Add here a last ditch effort to import the class from a module raise ValueError( "Eo object at %#x of type %s does not have a mapping!" % ( - <unsigned long>obj, cls_name) + <uintptr_t>obj, cls_name) ) cls = <type>cls_ret @@ -138,7 +139,7 @@ cdef object object_from_instance(cEo *obj): if cls is None: raise ValueError( "Mapping for Eo object at %#x, type %s, contains None!" % ( - <unsigned long>obj, cls_name)) + <uintptr_t>obj, cls_name)) EINA_LOG_DOM_DBG(PY_EFL_EO_LOG_DOMAIN, "Constructing a Python object from Eo of type %s.", cls_name) @@ -219,9 +220,9 @@ cdef class Eo(object): eo_do(self.obj, eo_parent_get(&parent)) return ("<%s object (Eo) at %#x (obj=%#x, parent=%#x, refcount=%d)>") % ( type(self).__name__, - <unsigned long><void *>self, - <unsigned long>self.obj, - <unsigned long>parent, + <uintptr_t><void *>self, + <uintptr_t>self.obj, + <uintptr_t>parent, PY_REFCOUNT(self)) def __nonzero__(self): diff --git a/efl/evas/efl.evas.pyx b/efl/evas/efl.evas.pyx index 63d7761..60dc98f 100644 --- a/efl/evas/efl.evas.pyx +++ b/efl/evas/efl.evas.pyx @@ -17,6 +17,7 @@ import traceback from cpython cimport PyUnicode_AsUTF8String +from libc.stdint cimport uintptr_t #from efl.eina cimport * from efl.eo cimport Eo, object_from_instance, _object_mapping_register from efl.utils.conversions cimport _ctouni, _touni diff --git a/efl/evas/efl.evas_canvas.pxi b/efl/evas/efl.evas_canvas.pxi index e9eb65f..93cb1fb 100644 --- a/efl/evas/efl.evas_canvas.pxi +++ b/efl/evas/efl.evas_canvas.pxi @@ -154,7 +154,7 @@ cdef class Canvas(Eo): def __get__(self): return self.output_method_get() - def engine_info_set(self, unsigned long ptr): + def engine_info_set(self, uintptr_t ptr): """Set the engine information pointer. Note that given value is a pointer, usually acquired with @@ -182,10 +182,10 @@ cdef class Canvas(Eo): If in doubt, don't mess with it. - :return: pointer as integer (unsigned long). + :return: pointer as integer (uintptr_t). """ - return <unsigned long><void *>evas_engine_info_get(self.obj) + return <uintptr_t><void *>evas_engine_info_get(self.obj) property engine_info: def __set__(self, ptr): diff --git a/efl/evas/efl.evas_object_smart.pxi b/efl/evas/efl.evas_object_smart.pxi index e0d249c..e06ff58 100644 --- a/efl/evas/efl.evas_object_smart.pxi +++ b/efl/evas/efl.evas_object_smart.pxi @@ -396,7 +396,7 @@ cdef class SmartObject(Object): self._smart_callbacks = None def __init__(self, Canvas canvas not None, **kwargs): - cdef long addr + cdef uintptr_t addr if type(self) is SmartObject: raise TypeError("Must not instantiate SmartObject, but subclasses") if self.obj == NULL: diff --git a/efl/evas/smart_object_metaclass.pxi b/efl/evas/smart_object_metaclass.pxi index 455b67d..31e5673 100644 --- a/efl/evas/smart_object_metaclass.pxi +++ b/efl/evas/smart_object_metaclass.pxi @@ -16,8 +16,9 @@ # along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. from cpython cimport PyMem_Malloc +from libc.stdint cimport uintptr_t -cdef long _smart_object_class_new(name) except 0: +cdef uintptr_t _smart_object_class_new(name) except 0: cdef Evas_Smart_Class *cls_def cdef Evas_Smart *cls @@ -27,7 +28,7 @@ cdef long _smart_object_class_new(name) except 0: if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name) - #_smart_classes.append(<long>cls_def) + #_smart_classes.append(<uintptr_t>cls_def) cls_def.name = name cls_def.version = EVAS_SMART_CLASS_VERSION cls_def.add = NULL # use python constructor @@ -48,7 +49,7 @@ cdef long _smart_object_class_new(name) except 0: cls_def.data = NULL cls = evas_smart_class_new(cls_def); - return <long>cls + return <uintptr_t>cls #class EvasSmartObjectMeta(EvasObjectMeta): class EvasSmartObjectMeta(type): @@ -61,7 +62,7 @@ class EvasSmartObjectMeta(type): if "__evas_smart_class__" in cls.__dict__: return - cdef long addr + cdef uintptr_t addr addr = _smart_object_class_new(cls.__name__) cls.__evas_smart_class__ = addr --
