Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
vpos = 0
vmask = (1<= self.brem:
if self.dpos >= len(self.data):
raise IT214Exception("unbalanced block end")
v |= (ord(self.data[self.dpos])>>self.bpos)< 0:
if self.dpos >= len(self.data):
raise IT214Exception("unbalanced block end")
v |= (ord(self.data[self.dpos])>>self.bpos)<
def unpack(self):
#while self.grab_length > 0:
# I think THIS is what itsex.c meant. --GM
self.length = min(self.grab_length,self.maxgrablen)
self.grab_length -= self.length
print "subchunk length: %i" % self.length
self.unpacked_root = 0
while self.length > 0 and not self.end_of_block():
if self.width == 0 or self.width > self.widthtop:
raise IT214Exception("invalid bit width")
v = self.read(self.width)
topbit = (1<<(self.width-1))
#print self.width,v
if self.width <= 6: # MODE A
if v == topbit:
self.change_width(self.read(self.fetch_a))
#print self.width
else:
self.write(self.width, v, topbit)
elif self.width < self.widthtop: # MODE B
if v >= topbit+self.lower_b and v <= topbit+self.upper_b:
qv = v - (topbit+self.lower_b)
#print "MODE B CHANGE",self.width,v,qv
self.change_width(qv)
#print self.width
def read(self, width):
v = 0
vpos = 0
vmask = (1<= self.brem:
if self.dpos >= len(self.data):
raise IT214Exception("unbalanced block end")
v |= (ord(self.data[self.dpos])>>self.bpos)< 0:
if self.dpos >= len(self.data):
raise IT214Exception("unbalanced block end")
v |= (ord(self.data[self.dpos])>>self.bpos)<