From a4eca79304f5164922679a1b51b1850f8694aef8 Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sat, 3 Mar 2018 23:31:13 +0200 Subject: [PATCH] moved attrcopy_utf8() --- src/libespeak-ng/readclause.c | 21 --------------------- src/libespeak-ng/ssml.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/libespeak-ng/readclause.c b/src/libespeak-ng/readclause.c index ed9448c8..85d87c39 100644 --- a/src/libespeak-ng/readclause.c +++ b/src/libespeak-ng/readclause.c @@ -807,27 +807,6 @@ static wchar_t *GetSsmlAttribute(wchar_t *pw, const char *name) return NULL; } -static int attrcopy_utf8(char *buf, const wchar_t *pw, int len) -{ - // Convert attribute string into utf8, write to buf, and return its utf8 length - unsigned int c; - int ix = 0; - int n; - int prev_c = 0; - - if (pw != NULL) { - while ((ix < (len-4)) && ((c = *pw++) != 0)) { - if ((c == '"') && (prev_c != '\\')) - break; // " indicates end of attribute, unless preceded by backstroke - n = utf8_out(c, &buf[ix]); - ix += n; - prev_c = c; - } - } - buf[ix] = 0; - return ix; -} - static int attr_prosody_value(int param_type, const wchar_t *pw, int *value_out) { int sign = 0; diff --git a/src/libespeak-ng/ssml.c b/src/libespeak-ng/ssml.c index a69a0e54..1411e5c4 100644 --- a/src/libespeak-ng/ssml.c +++ b/src/libespeak-ng/ssml.c @@ -48,6 +48,7 @@ int attrcmp(const wchar_t *string1, const char *string2); int attrlookup(const wchar_t *string1, const MNEM_TAB *mtab); int attrnumber(const wchar_t *pw, int default_value, int type); +int attrcopy_utf8(char *buf, const wchar_t *pw, int len); int attrcmp(const wchar_t *string1, const char *string2) { @@ -91,3 +92,24 @@ int attrnumber(const wchar_t *pw, int default_value, int type) return value; } +int attrcopy_utf8(char *buf, const wchar_t *pw, int len) +{ + // Convert attribute string into utf8, write to buf, and return its utf8 length + unsigned int c; + int ix = 0; + int n; + int prev_c = 0; + + if (pw != NULL) { + while ((ix < (len-4)) && ((c = *pw++) != 0)) { + if ((c == '"') && (prev_c != '\\')) + break; // " indicates end of attribute, unless preceded by backstroke + n = utf8_out(c, &buf[ix]); + ix += n; + prev_c = c; + } + } + buf[ix] = 0; + return ix; +} +