Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def flush(self):
if self.zeros > 0:
chunks = self.zeros // 0xFF
rest = self.zeros % 0xFF
for i in range(chunks):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, 0xFF)
if (rest != 0):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, rest)
self.zeros = 0
FixedAllocBuffers.flush(self)
def flush(self):
if self.zeros > 0:
chunks = self.zeros // 0xFF
rest = self.zeros % 0xFF
for i in range(chunks):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, 0xFF)
if (rest != 0):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, rest)
self.zeros = 0
FixedAllocBuffers.flush(self)
def flush(self):
if self.zeros > 0:
chunks = self.zeros // 0xFF
rest = self.zeros % 0xFF
for i in range(chunks):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, 0xFF)
if (rest != 0):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, rest)
self.zeros = 0
FixedAllocBuffers.flush(self)
def flush(self):
if self.zeros > 0:
chunks = self.zeros // 0xFF
rest = self.zeros % 0xFF
for i in range(chunks):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, 0xFF)
if (rest != 0):
FixedAllocBuffers.write(self, 0)
FixedAllocBuffers.write(self, rest)
self.zeros = 0
FixedAllocBuffers.flush(self)
def write(self, data):
if data == 0:
self.zeros += 1
return 1
else:
self.flush()
return FixedAllocBuffers.write(self, data)