Merge pull request #1160 from radarhere/health

Further health fixes
This commit is contained in:
Alex Clark 2015-04-01 06:06:47 -04:00
commit b9fb9449fb
3 changed files with 88 additions and 90 deletions

View File

@ -69,8 +69,8 @@ def bdf_char(f):
bitmap.append(s[:-1]) bitmap.append(s[:-1])
bitmap = b"".join(bitmap) bitmap = b"".join(bitmap)
[x, y, l, d] = [int(s) for s in props["BBX"].split()] [x, y, l, d] = [int(p) for p in props["BBX"].split()]
[dx, dy] = [int(s) for s in props["DWIDTH"].split()] [dx, dy] = [int(p) for p in props["DWIDTH"].split()]
bbox = (dx, dy), (l, -d-y, x+l, -d), (0, 0, x, y) bbox = (dx, dy), (l, -d-y, x+l, -d), (0, 0, x, y)

View File

@ -19,8 +19,8 @@
__version__ = "0.1" __version__ = "0.1"
from PIL import Image, ImageFile, OleFileIO from PIL import Image, ImageFile
from PIL.OleFileIO import i8, i32, MAGIC from PIL.OleFileIO import i8, i32, MAGIC, OleFileIO
# we map from colour field tuples to (mode, rawmode) descriptors # we map from colour field tuples to (mode, rawmode) descriptors

View File

@ -1243,7 +1243,7 @@ class OleFileIO:
debug( "Number of sectors in the file: %d" % self.nb_sect ) debug( "Number of sectors in the file: %d" % self.nb_sect )
# file clsid (probably never used, so we don't store it) # file clsid (probably never used, so we don't store it)
clsid = _clsid(header[8:24]) #clsid = _clsid(header[8:24])
self.sectorsize = self.SectorSize #1 << i16(header, 30) self.sectorsize = self.SectorSize #1 << i16(header, 30)
self.minisectorsize = self.MiniSectorSize #1 << i16(header, 32) self.minisectorsize = self.MiniSectorSize #1 << i16(header, 32)
self.minisectorcutoff = self.MiniSectorCutoff # i32(header, 56) self.minisectorcutoff = self.MiniSectorCutoff # i32(header, 56)
@ -1561,7 +1561,7 @@ class OleFileIO:
## break ## break
## self.direntries.append(_OleDirectoryEntry(entry, sid, self)) ## self.direntries.append(_OleDirectoryEntry(entry, sid, self))
# load root entry: # load root entry:
root_entry = self._load_direntry(0) self._load_direntry(0)
# Root entry is the first entry: # Root entry is the first entry:
self.root = self.direntries[0] self.root = self.direntries[0]
# read and build all storage trees, starting from the root: # read and build all storage trees, starting from the root:
@ -1786,7 +1786,7 @@ class OleFileIO:
:returns: True if object exist, else False. :returns: True if object exist, else False.
""" """
try: try:
sid = self._find(filename) self._find(filename)
return True return True
except: except:
return False return False
@ -1842,11 +1842,11 @@ class OleFileIO:
try: try:
# header # header
s = fp.read(28) s = fp.read(28)
clsid = _clsid(s[8:24]) #clsid = _clsid(s[8:24])
# format id # format id
s = fp.read(20) s = fp.read(20)
fmtid = _clsid(s[:16]) #fmtid = _clsid(s[:16])
fp.seek(i32(s, 16)) fp.seek(i32(s, 16))
# get section # get section
@ -1983,8 +1983,6 @@ class OleFileIO:
if __name__ == "__main__": if __name__ == "__main__":
import sys
# [PL] display quick usage info if launched from command-line # [PL] display quick usage info if launched from command-line
if len(sys.argv) <= 1: if len(sys.argv) <= 1:
print(__doc__) print(__doc__)
@ -2001,7 +1999,7 @@ Options:
check_streams = False check_streams = False
for filename in sys.argv[1:]: for filename in sys.argv[1:]:
## try: #try:
# OPTIONS: # OPTIONS:
if filename == '-d': if filename == '-d':
# option to switch debug mode on: # option to switch debug mode on: