Control: tags -1 - moreinfo

Niels Thykier, le Thu 06 Nov 2014 17:14:18 +0100, a écrit :
> Please remember to check the return value of asprintf, which can return
> -1 on failure.

Right.  Better try to do something sensible rather than crash.  Here is
an updated version.

Samuel
diff --git a/debian/changelog b/debian/changelog
index e6a0fa8..f85afc3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+espeakup (1:0.71-17) UNRELEASED; urgency=medium
+
+  * patches/spell: Fix spelling keystrokes and char-by-char echo
+    (Closes: #767595)
+
+ -- Samuel Thibault <[email protected]>  Sat, 01 Nov 2014 12:35:08 +0100
+
 espeakup (1:0.71-16) unstable; urgency=medium
 
   * po/el.po: Greek translation (Closes: #685552)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..da3f5a7
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+spell
diff --git a/debian/patches/spell b/debian/patches/spell
new file mode 100644
index 0000000..09faadc
--- /dev/null
+++ b/debian/patches/spell
@@ -0,0 +1,34 @@
+--- a/synth.c
++++ b/synth.c
+@@ -121,7 +121,29 @@ espeak_ERROR speak_text(struct synth_t *
+ {
+       espeak_ERROR rc;
+ 
+-      rc = espeak_Synth(s->buf, s->len + 1, 0, POS_CHARACTER, 0, 0, NULL,
+-                                        NULL);
++      if (s->len == 1)
++      {
++              char *buf;
++              int n;
++              n = asprintf(&buf, "<say-as 
interpret-as=\"tts:char\">%c</say-as>", s->buf[0]);
++              if (n == -1)
++              {
++                      /* D'oh.  Not much to do on allocation failure.
++                       * Perhaps espeak will happen to say the character */
++                      rc = espeak_Synth(s->buf, s->len + 1, 0, POS_CHARACTER, 
0, 0, NULL,
++                                                        NULL);
++              }
++              else
++              {
++                      rc = espeak_Synth(buf, n + 1, 0, POS_CHARACTER, 0, 
espeakSSML, NULL,
++                                                        NULL);
++                      free(buf);
++              }
++      }
++      else
++      {
++              rc = espeak_Synth(s->buf, s->len + 1, 0, POS_CHARACTER, 0, 0, 
NULL,
++                                                NULL);
++      }
+       return rc;
+ }

Reply via email to