summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>1993-01-29 12:01:00 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>1993-01-29 12:01:00 (GMT)
commit8d733a00f00c98f5627a977150c85bfa9bed6d28 (patch)
treeed1b98940f516c9fa79302670c94d09bb2ab5128 /Lib
parent772eca639cc32d55bafbc1156917f6cbd297fe2c (diff)
downloadcpython-8d733a00f00c98f5627a977150c85bfa9bed6d28.zip
cpython-8d733a00f00c98f5627a977150c85bfa9bed6d28.tar.gz
cpython-8d733a00f00c98f5627a977150c85bfa9bed6d28.tar.bz2
added kludge for buggy soundfiler from SGI; when reading 0 frames,
just set file pointer correctly instead of returning the complete file.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/aifc.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py
index 0849bd7..706bba8 100644
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -379,7 +379,16 @@ class Aifc_read():
self._comm_chunk_read = 0
while formlength > 0:
self._ssnd_seek_needed = 1
- chunk = Chunk().init(self._file)
+ #DEBUG: SGI's soundfiler has a bug. There should
+ # be no need to check for EOF here.
+ try:
+ chunk = Chunk().init(self._file)
+ except EOFError:
+ if formlength == 8:
+ print 'Warning: FORM chunk size too large'
+ formlength = 0
+ break
+ raise EOFError # different error, raise exception
formlength = formlength - 8 - chunk.chunksize
if chunk.chunksize & 1:
formlength = formlength - 1
@@ -495,6 +504,8 @@ class Aifc_read():
if pos:
self._ssnd_chunk.setpos(pos + 8)
self._ssnd_seek_needed = 0
+ if nframes == 0:
+ return ''
size = nframes * self._nchannels * self._sampwidth
if self._decomp:
if self._comptype in ('ULAW', 'ALAW'):