1. Rune Halvorsen
  2. pblight

Commits

Rune Halvorsen  committed bea0cd0

Fixed bugs with the fixed types

  • Participants
  • Parent commits 202dff7
  • Branches default

Comments (0)

Files changed (1)

File pblight.py

View file
     datatype = "fixed64"
 
     def from_wiretype(self, data):
-        return struct.unpack("<Q", data)
+        return struct.unpack("<Q", data)[0]
 
     def to_wiretype(self, value):
         return struct.pack("<Q", value)
     datatype = "sfixed64"
 
     def from_wiretype(self, data):
-        return struct.unpack("<q", data)
+        return struct.unpack("<q", data)[0]
 
     def to_wiretype(self, value):
         return struct.pack("<q", value)
     datatype = "double"
 
     def from_wiretype(self, data):
-        return struct.unpack("d", data)
+        return struct.unpack("d", data)[0]
 
     def to_wiretype(self, value):
         return struct.pack("d", value)
     datatype = "fixed32"
 
     def from_wiretype(self, data):
-        return struct.unpack("<I", data)
+        return struct.unpack("<I", data)[0]
 
     def to_wiretype(self, value):
         return struct.pack("<I", value)
 
+#    def check_type(self, value):
+ #       print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+
 
 class SFixed32Field(FixedField):
     wiretype = 5
     datatype = "sfixed32"
 
     def from_wiretype(self, data):
-        return struct.unpack("<i", data)
+        return struct.unpack("<i", data)[0]
 
     def to_wiretype(self, value):
         return struct.pack("<i", value)
     datatype = "float"
 
     def from_wiretype(self, data):
-        return struct.unpack("f", data)
+        return struct.unpack("f", data)[0]
 
     def to_wiretype(self, value):
         return struct.pack("f", value)