Skip to content

Commit

Permalink
minor optimization, read code and length in one chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
jason committed Apr 20, 2006
1 parent 68ce028 commit 6bcf233
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions daap.py
Expand Up @@ -268,14 +268,8 @@ def encode(self):
return data

def processData(self, str):

# first we need 4 bytes for the code
self.code = str.read(4)

# now we need the length of the objects data
# this is another 4 bytes
code = str.read(4)
self.length = struct.unpack('!I', code)[0]
# read 4 bytes for the code and 4 bytes for the length of the objects data
self.code, self.length = struct.unpack('!4sI', str.read(8))

# now we need to find out what type of object it is
if self.code == None or not dmapCodeTypes.has_key(self.code):
Expand Down

0 comments on commit 6bcf233

Please sign in to comment.