targets/typemapping.py
changeset 1767 c74815729afd
parent 1758 845ca626db09
child 1768 691083b5682a
equal deleted inserted replaced
1766:c1e5b9f19483 1767:c74815729afd
    98     buffoffset = 0
    98     buffoffset = 0
    99     buffsize = len(buff)
    99     buffsize = len(buff)
   100     buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value
   100     buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value
   101     for iectype in indexes:
   101     for iectype in indexes:
   102         c_type, unpack_func, pack_func = \
   102         c_type, unpack_func, pack_func = \
   103             TypeTranslator.get(iectype,
   103             TypeTranslator.get(iectype, (None, None, None))
   104                                     (None, None, None))
       
   105         if c_type is not None and buffoffset < buffsize:
   104         if c_type is not None and buffoffset < buffsize:
   106             cursor = c_void_p(buffptr + buffoffset)
   105             cursor = c_void_p(buffptr + buffoffset)
   107             value = unpack_func(cast(cursor,
   106             value = unpack_func(cast(cursor,
   108                          POINTER(c_type)).contents)
   107                          POINTER(c_type)).contents)
   109             buffoffset += sizeof(c_type) if iectype != "STRING" else len(value)+1
   108             buffoffset += sizeof(c_type) if iectype != "STRING" else len(value)+1