summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author¨Andreas <¨andreas.dachsberger@gmail.com¨>2018-09-10 11:38:36 +0200
committer¨Andreas <¨andreas.dachsberger@gmail.com¨>2018-09-10 11:38:36 +0200
commit734ce1caf3d02b297b93092ecd91a8f2c4c16de1 (patch)
tree6412e786368278e444ec64dd8fce73006d8331c9
parent52bb72fa7e27a2d14129d64f939a0bdf013c272f (diff)
downloadtftpy-734ce1caf3d02b297b93092ecd91a8f2c4c16de1.tar.gz
Solved some 2 to 3 issues
-rw-r--r--tftpy/TftpPacketTypes.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/tftpy/TftpPacketTypes.py b/tftpy/TftpPacketTypes.py
index 7f9bafb..0479ccb 100644
--- a/tftpy/TftpPacketTypes.py
+++ b/tftpy/TftpPacketTypes.py
@@ -62,10 +62,8 @@ class TftpPacketWithOptions(object):
# Count the nulls in the buffer. Each one terminates a string.
log.debug("about to iterate options buffer counting nulls")
length = 0
- for c in buffer:
- if sys.version_info[0] <= 2:
- c = ord(c)
- if c == 0:
+ for i in range(len(buffer)):
+ if ord(buffer[i:i+1]) == 0:
log.debug("found a null at length %d", length)
if length > 0:
fmt += b"%dsx" % length
@@ -177,10 +175,8 @@ class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
nulls = length = tlength = 0
log.debug("in decode: about to iterate buffer counting nulls")
subbuf = self.buffer[2:]
- for c in subbuf:
- if sys.version_info[0] <= 2:
- c = ord(c)
- if c == 0:
+ for i in range(len(subbuf)):
+ if ord(subbuf[i:i+1]) == 0:
nulls += 1
log.debug("found a null at length %d, now have %d", length, nulls)
fmt += b"%dsx" % length