patch from pietvo.

git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@190 1aa58f4a-7d42-0410-adbc-911cccaed67c
pull/1/head
yusuke.shinyama.dummy 2010-03-22 04:46:59 +00:00
parent fa13122f09
commit a6523d1a9a
1 changed files with 3 additions and 2 deletions

View File

@ -242,16 +242,17 @@ class PSBaseParser(object):
pos = self.fp.tell() pos = self.fp.tell()
buf = '' buf = ''
while 0 < pos: while 0 < pos:
prevpos = pos
pos = max(0, pos-self.BUFSIZ) pos = max(0, pos-self.BUFSIZ)
self.fp.seek(pos) self.fp.seek(pos)
s = self.fp.read(self.BUFSIZ) s = self.fp.read(prevpos-pos)
if not s: break if not s: break
while 1: while 1:
n = max(s.rfind('\r'), s.rfind('\n')) n = max(s.rfind('\r'), s.rfind('\n'))
if n == -1: if n == -1:
buf = s + buf buf = s + buf
break break
yield buf+s[n:] yield s[n:]+buf
s = s[:n] s = s[:n]
buf = '' buf = ''
return return