summaryrefslogtreecommitdiff
path: root/apps/talk.c
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-15 10:05:47 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-15 10:05:47 +0000
commit77ec4b301b32bf1676987fab098194bc23fdf75a (patch)
tree0d2384c050a63f26376c9c4048a8477043f8a4a9 /apps/talk.c
parent3c74d20462ae2495e3b94955d586e78af10f11af (diff)
talk_init() : don't try to load the voice file if it won't fit in memory
now playback still works if voicing is enabled on the clipv1 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26047 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/talk.c')
-rw-r--r--apps/talk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 9f31645ca5..c327487962 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -540,7 +540,9 @@ void talk_init(void)
reset_state(); /* use this for most of our inits */
filehandle = open_voicefile();
- has_voicefile = (filehandle >= 0); /* test if we can open it */
+ size_t audiobufsz = audiobufend - audiobuf;
+ /* test if we can open and if it fits in the audiobuffer */
+ has_voicefile = filehandle >= 0 && filesize(filehandle) > (off_t)audiobufsz;
voicefile_size = 0;
if (has_voicefile)