speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patch]: Speechd-Up changes.


From: Chris Brannon
Subject: [Patch]: Speechd-Up changes.
Date: Thu, 02 Oct 2008 16:53:03 -0500

Hello,
I made some changes to the file speechd-up.c from Speechd-Up.

1. We have these two lines:
ssml_text = malloc(strlen(utf8_text)+16);
snprintf(ssml_text, strlen(text)+16, "%s", utf8_text);
The problem is that text will be smaller than utf8_text if there are
non-ASCII characters present.  Part of the message will be lost.  I
compute the buffer size, store it in a variable, and use that variable
in both the call to malloc and the call to snprintf.

The next change involves the escaping of characters special to SSML.  If
you're running Speakup and Speechd-Up, try typing the following at the
shell:
echo "<speak>hi</speak>"
You won't hear the tags, unless you've altered Speakup's punctuation
tables.
If Speakup generates text containing ampersand, angle brackets,
or quotes, then those characters should be replaced with XML entities.

The above doesn't apply when sending the SSIP protocol's char message.
I.E.,
char &
char <
char >
...
don't require escapes.

Next, I added a NULL pointer check to the recode() function.  iconv
might detect the presence of a NULL pointer, so this check could be
superfluous.  Better safe than sorry.

Finally, I reorganized the code a bit.  The block of statements that
transmit a string containing more than one character were moved into their own
function.  This block became a little more complex because of the call
that escapes special characters.

Hope that this diff doesn't contain too many unrelated changes.

Regards,
-- Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: speechd-up-ssml.diff
Type: text/x-patch
Size: 5292 bytes
Desc: not available
URL: 
<http://lists.freebsoft.org/pipermail/speechd/attachments/20081002/00dccb5b/attachment.bin>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]