Commit fee17a9e authored by Martin Cejp's avatar Martin Cejp

dmt/A_mappers/Stubs.py: python3 compat

parent d92c4275
......@@ -23,12 +23,16 @@ from __future__ import absolute_import
import os
import re
import copy
import sys
import DV_Types # pylint: disable=import-error
from ctypes import (
cdll, c_void_p, c_ubyte, c_double, c_uint,
c_longlong, c_bool, c_int, c_long, c_char
)
if sys.version_info > (3,):
long = int
# load the *getset.so in this folder
script_path = os.path.dirname(os.path.realpath(__file__))
soFileNames = [
......@@ -102,12 +106,20 @@ class DataStream(object):
def GetPyString(self):
# print "Reading",
msg = ""
pData = c_void_p(GetBitstreamBuffer(self._bs))
for i in range(0, GetStreamCurrentLength(self._bs)):
b = GetBufferByte(pData, i)
msg += chr(b)
# print b, ",",
if sys.version_info > (3,):
msg = b""
pData = c_void_p(GetBitstreamBuffer(self._bs))
for i in range(0, GetStreamCurrentLength(self._bs)):
b = GetBufferByte(pData, i)
msg += bytes([b])
# print b, ",",
else:
msg = ""
pData = c_void_p(GetBitstreamBuffer(self._bs))
for i in range(0, GetStreamCurrentLength(self._bs)):
b = GetBufferByte(pData, i)
msg += chr(b)
# print b, ",",
# print "EOF"
return msg
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment