From 4613ffae8a9e2d4281c169078c1d7847536f9f9c Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 3 Jun 2012 16:47:16 +0200 Subject: [PATCH] Remove unnecessary variable and simplify voice-only counting. Voice-only strings are identified when reading the strings, so there is no reason to first store that information and then count them later. Change-Id: Ie6bd2c4bbf5736630e58d06a20739ef527e3cd69 --- tools/voicefont.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tools/voicefont.c b/tools/voicefont.c index 546d0052f4..3b67e97436 100644 --- a/tools/voicefont.c +++ b/tools/voicefont.c @@ -91,15 +91,13 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output) char mp3filename2[1024]; char* mp3filename; FILE* pMp3File; - int target_id; int do_bitswap_audio = 0; /* We bitswap the voice file only SH based archos players, target IDs - equal to or lower than 8. See the target_id line for each target in - configure */ - target_id = targetnum; - if (target_id <= 8) + equal to or lower than 8. See the "Target id:" line in rockbox-info.txt + or the target_id value in configure. */ + if (targetnum <= 8) do_bitswap_audio = 1; memset(voiceonly, 0, sizeof(voiceonly)); @@ -112,10 +110,13 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output) fields = sscanf(line, " id: %s", name); if (fields == 1) { - count++; /* next entry started */ - strcpy(names[count-1], name); + strcpy(names[count], name); if (strncmp("VOICE_", name, 6) == 0) /* voice-only id? */ - voiceonly[count-1] = 1; + { + count_voiceonly++; + voiceonly[count] = 1; + } + count++; /* next entry started */ continue; } } @@ -125,9 +126,6 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output) for (i=0; i