From 79c72b7c76486ee02737fe5d636f63a7ebd25799 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 30 Apr 2009 13:58:10 +0000 Subject: [PATCH] Terminate the string to be spoken (via espeak) with two NULs. (The last parts of some strings are mis-spoken; seems to be length-dependent.) git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2152 127b21dd-08f5-0310-b4b7-95ae10353056 --- src/Core/Universe.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Core/Universe.m b/src/Core/Universe.m index 9198ba5f..c22dc9e2 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -7998,8 +7998,10 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context) text = [frags componentsJoinedByString:@""]; #endif size_t length = [text length]; - const char *ctext = [text cString]; - espeak_Synth(ctext, length + 1 /* inc. NUL */, 0, POS_CHARACTER, length, espeakCHARS_UTF8 | espeakPHONEMES | espeakENDPAUSE, NULL, NULL); + char *ctext = malloc (length + 2); + sprintf (ctext, "%s%c", [text cString], 0); // extra NUL; working around an apparent misrendering bug... + espeak_Synth(ctext, length + 2 /* inc. NULs */, 0, POS_CHARACTER, length, espeakCHARS_UTF8 | espeakPHONEMES | espeakENDPAUSE, NULL, NULL); + free (ctext); } - (void) stopSpeaking