From fbde6baab59d7c8d047ef267884373d6d9f9e59d Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 22 Aug 2011 10:23:11 +0000 Subject: Move stuff a bit down to fix red on TALK_PARTIAL_LOAD. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30339 a1c6a512-1295-4272-9138-f99709370657 --- apps/talk.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'apps') diff --git a/apps/talk.c b/apps/talk.c index 2f15ebce49..0c3b769d82 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -354,14 +354,6 @@ static void load_voicefile(bool probe, char* buf, size_t bufsize) logf("Incompatible voice file"); goto load_err; } - p_thumbnail = voicebuf.buf + file_size; - p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */ - size_for_thumbnail = voicebuf.buf + bufsize - p_thumbnail; -#if CONFIG_CODEC == SWCODEC - size_for_thumbnail = MIN(size_for_thumbnail, MAX_THUMBNAIL_BUFSIZE); -#endif - if (size_for_thumbnail <= 0) - p_thumbnail = NULL; } else goto load_err; @@ -403,11 +395,26 @@ static void load_voicefile(bool probe, char* buf, size_t bufsize) #ifdef TALK_PARTIAL_LOAD alloc_size += silence_len + QUEUE_SIZE; +#else + /* allocate for the entire file, TALK_PROGRESSIVE_LOAD doesn't + * load everything just yet */ + alloc_size = file_size; #endif + if (alloc_size > bufsize) goto load_err; return; + /* now move p_thumbnail behind the voice clip buffer */ + p_thumbnail = voicebuf.buf + alloc_size; + p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */ + size_for_thumbnail = voicebuf.buf + bufsize - p_thumbnail; +#if CONFIG_CODEC == SWCODEC + size_for_thumbnail = MIN(size_for_thumbnail, MAX_THUMBNAIL_BUFSIZE); +#endif + if (size_for_thumbnail <= 0) + p_thumbnail = NULL; + load_err: p_voicefile = NULL; has_voicefile = false; /* don't try again */ -- cgit v1.2.3