bug fixed
This commit is contained in:
@@ -377,7 +377,11 @@ class CompositeType(Type):
|
||||
@param s: Stream
|
||||
'''
|
||||
for name in self._typeName:
|
||||
s.readType(self.__dict__[name])
|
||||
try:
|
||||
s.readType(self.__dict__[name])
|
||||
except Exception as e:
|
||||
print "Error during read %s::%s"%(self.__class__, name)
|
||||
raise e
|
||||
|
||||
def __write__(self, s):
|
||||
'''
|
||||
@@ -385,11 +389,15 @@ class CompositeType(Type):
|
||||
@param s: Stream
|
||||
'''
|
||||
for name in self._typeName:
|
||||
s.writeType(self.__dict__[name])
|
||||
try:
|
||||
s.writeType(self.__dict__[name])
|
||||
except Exception as e:
|
||||
print "Error during write %s::%s"%(self.__class__, name)
|
||||
raise e
|
||||
|
||||
def __sizeof__(self):
|
||||
'''
|
||||
call sizeof on each subtype$
|
||||
call sizeof on each subtype
|
||||
@return: sum of sizeof of each public type attributes
|
||||
'''
|
||||
size = 0
|
||||
@@ -733,7 +741,7 @@ class ArrayType(Type):
|
||||
but in read mode it can be dynamic
|
||||
readLen may be dynamic
|
||||
'''
|
||||
def __init__(self, typeFactory, init = [], readLen = UInt8(), conditional = lambda:True, optional = False, constant = False):
|
||||
def __init__(self, typeFactory, init = None, readLen = UInt8(), conditional = lambda:True, optional = False, constant = False):
|
||||
'''
|
||||
constructor
|
||||
@param typeFactory: class use to init new element on read
|
||||
@@ -745,7 +753,9 @@ class ArrayType(Type):
|
||||
Type.__init__(self, conditional, optional, constant)
|
||||
self._typeFactory = typeFactory
|
||||
self._readLen = readLen
|
||||
self._array = init
|
||||
self._array = []
|
||||
if not init is None:
|
||||
self._array = init
|
||||
|
||||
def __read__(self, s):
|
||||
'''
|
||||
|
||||
@@ -335,15 +335,15 @@ class OrderCapability(CompositeType):
|
||||
'''
|
||||
def __init__(self, conditional = lambda:True):
|
||||
CompositeType.__init__(self, conditional = conditional)
|
||||
self.terminalDescriptor = String("\x00" * 16)
|
||||
self.terminalDescriptor = String("\x00" * 16, readLen = UInt8(16))
|
||||
self.pad4octetsA = UInt32Le(0)
|
||||
self.desktopSaveXGranularity = UInt16Le(1)
|
||||
self.desktopSaveYGranularity = UInt16Le(20)
|
||||
self.pad2octetsA = UInt16Le(0)
|
||||
self.maximumOrderLevel = UInt16Le(1)
|
||||
self.numberFonts = UInt16Le(0)
|
||||
self.orderFlags = UInt16Le(0)
|
||||
self.orderSupport = ArrayType(UInt8, [0 for i in range(0,31)])
|
||||
self.orderFlags = UInt16Le(OrderFlag.NEGOTIATEORDERSUPPORT)
|
||||
self.orderSupport = ArrayType(UInt8, readLen = UInt8(32))
|
||||
self.textFlags = UInt16Le()
|
||||
self.orderSupportExFlags = UInt16Le()
|
||||
self.pad4octetsB = UInt32Le()
|
||||
|
||||
Reference in New Issue
Block a user