Commits

Mikhail Korobov  committed 38f8c9c Merge

Merge pull request #7 from makielab/fix_descriptors

Fix descriptors

  • Participants
  • Parent commits 680ffb6, cb80bfd

Comments (0)

Files changed (3)

File src/psd_tools/constants.py

     Action descriptor type
     """
     REFERENCE = b'obj '
-    DESCRIPTOR = b'ObjC'
+    DESCRIPTOR = b'Objc'
     LIST = b'VlLs'
     DOUBLE = b'doub'
     UNIT_FLOAT = b'UntF'

File src/psd_tools/decoder/actions.py

     }.get(ostype, None)
 
 
-def decode_descriptor(fp):
+def decode_descriptor(_, fp):
     name = read_unicode_string(fp)
     classID_length = read_fmt("I", fp)[0]
     classID = fp.read(classID_length or 4)
     return Property(name, classID, keyID)
 
 def decode_unit_float(key, fp):
-    unit_key = read_fmt("I", fp)
+    unit_key = fp.read(4)
 
     if UnitFloatType.is_known(unit_key):
         value = read_fmt("d", fp)

File src/psd_tools/decoder/tagged_blocks.py

     fp = io.BytesIO(data)
     version = read_fmt("I", fp)
     try:
-        data = decode_descriptor(fp)
+        data = decode_descriptor(None, fp)
         return SolidColorSettings(version, data)
     except UnknownOSType as e:
         warnings.warn("Ignoring solid color tagged block (%s)" % e)
         return
 
     try:
-        text_data = decode_descriptor(fp)
+        text_data = decode_descriptor(None, fp)
     except UnknownOSType as e:
         warnings.warn("Ignoring type setting tagged block (%s)" % e)
         return
         return
 
     try:
-        warp_data = decode_descriptor(fp)
+        warp_data = decode_descriptor(None, fp)
     except UnknownOSType as e:
         warnings.warn("Ignoring type setting tagged block (%s)" % e)
         return