Commit Graph
115 Commits
Author SHA1 Message Date
Juho Hiltunen c5fac3185c cleanup: join two adjacent if (only == false) blocks.
Note: The latter part is untested code.
2022-11-05 21:22:39 +02:00
Juho Hiltunen ca0019b197 cleanup: use bool in LookupCharName() 2022-11-05 21:22:39 +02:00
Juho Hiltunen acc43a76e4 cleanup: remove code duplication with UnGetC() 2022-11-05 21:22:39 +02:00
Juho Hiltunen 95e5c4458d cleanup: remove duplication with DecodeWithPhonemeMode().
TODO: think of a better function name.
2022-11-05 21:22:39 +02:00
Juho Hiltunen f53ebf469c cleanup: remove code duplication with TerminateBufWithSpaceAndZero().
One redundant ix++ was removed because there's a return right after that.
2022-11-05 21:22:39 +02:00
Juho Hiltunen 185c93e702 cleanup: reduce variable scopes in readclause.c
Contributes to #9.
2022-10-23 19:15:18 +03:00
Juho Hiltunen c5db9220bf code cleanup: move Read4Bytes() 2022-09-17 17:41:43 +03:00
Juho Hiltunen 14ede3e372 code cleanup: move is_str_totally_null() 2022-09-17 17:28:52 +03:00
Juho Hiltunen 64f12fec87 code cleanup: move towlower2() 2022-09-17 17:22:01 +03:00
Juho Hiltunen b52d1f3afd code cleanup: move strncpy0 to common.c 2022-09-04 07:12:39 +03:00
Juho Hiltunen c4d8976fbc code cleanup: Add new source file common.h for misc functions. 2022-09-03 21:19:37 +03:00
Juho Hiltunen 0e07d929fd code cleanup: refactor checking phoneme_mode into a function 2022-09-01 20:50:27 +03:00
Juho Hiltunen 7492475728 code cleanup: make a function for checking tr->chars_ignore
ReadClause() is very long and should be shortened for code readability
2022-08-28 20:13:32 +03:00
Juho Hiltunen a161118976 code cleanup: move lookupwchar2 to readclause.c
It's used only in readclause.c

TODO: Rename so the meaning of the function is easier to understand.
2022-08-28 20:13:16 +03:00
Samuel Thibault 482ee1da05 Add missing check for EOF 2022-07-02 02:43:23 +02:00
Samuel Thibault 9decedb8c2 Fix missing checks for EOF 2022-06-30 12:41:18 +02:00
Samuel Thibault 24e1eaa0cc Mark static arrays undefined when they are reused
So valgrind can potentially catch e.g. missing \0.
2022-06-09 09:48:43 +02:00
Samuel Thibault 3ce135ac2b Mark re-used buffers as undefined
These are global arrays reused several times. When using them msan and
valgrind thus believe they are always initialized, which reduces their
capacity to detect uninitialized values. We can however explicitly tell them
when they are reused, and thus to be considered as uninitialized.
2022-04-10 22:42:51 +02:00
Juho Hiltunen d80f1a80a2 Use ESPEAKNG_DEFAULT_VOICE instead of hard coded "en".
This will make it easier to set a default voice other than
English. This is important for cases when a language will fall back to
the default voice.

Some references to L('e', 'n') still need to be changed.
2021-08-10 19:57:53 +03:00
Juho Hiltunen 4d0a4df86b Revert "code cleanup: remove unnecessary current_voice_id in readclause.c"
See #950.
2021-06-07 17:43:28 +03:00
Christopher Brannon 8810fa330e Fix another out-of-bounds read in SSML parsing.
A malformed tag like <foo could cause espeak to read past
the end of the string.
2021-05-15 15:19:57 -07:00
Christopher Brannon 2d7286d571 Fix out-of-bounds read when processing malformed SSML. 2021-05-15 21:12:59 +03:00
Juho Hiltunen c4740b3053 New language option lowercaseSentence
When set in a language file, a period followed by a lower case letter is
detected as end of sentence. Normal behavior is to require a capital
letter.
2021-04-05 19:29:18 +03:00
Juho Hiltunen 6e197d967e code cleanup: move soundicon logic to a new file
Soundicons are used for external audio with SSML <audio> tag and for
replacing punctuation names with sound files in LoadConfig().

Currently there's a bug wih soundicon slots: if both LoadConfig and
<audio> are used, the punctuation reserves all slots and no sound from
<audio> is played.
2021-03-21 18:53:05 +02:00
Valdis Vitolins 2d633b72cd Merge pull request #886 2021-03-02 20:56:52 +02:00
Juho Hiltunen 326b63132f bugfix: force bitrate to 16 for SSML <audio>.
Espeak-ng uses bitrate 16 internally. If the input inside <audio> has a
different bitrate the audio will not play correctly unless converted to
16 bits.

Closes #885.
2021-03-02 06:26:36 +02:00
Juho Hiltunen 40613d5b67 code cleanup: remove ssml_ignore_l_angle.
It is supposed to be used with SSML for reading < (&lt;) and & (&amp;)
when invoking espeak-ng --punct -m.

However, it looks like the code is dead since removing it doesn't fail
the ssml reference test.
2021-02-28 20:17:16 +02:00
Juho Hiltunen 19e2f697f6 code cleanup: remove unnecessary current_voice_id in readclause.c
Instead of passing a temporary variable current_voice_id to SSML
processing logic and then copying the value to voice_change, pass
voice_change directly. GetVoiceAttributes() both sets voice_change and
retuns CLAUSE_TYPE_VOICE_CHANGE that is used by TranslateClause() for
error checking.

tests/ssml/language-switch.ssml covers the intended behavior of language
switching and will fail when either voice_change or CLAUSE_TYPE_VOICE_CHANGE
is not set correctly.
2021-02-25 19:33:09 +02:00
Juho Hiltunen cc5b1e1119 code cleanup: reorganize check for u.s.a.'s in int ReadClause()
This approach reduces the amount of nested if statements and doesn't
require the temporary variable int c_next_2.

A test already exists for this case in tests/translate.test
2021-02-25 18:01:52 +02:00
Juho Hiltunen d1332d7f35 code cleanup: remove unnecessary text_buf2 2021-02-25 17:17:19 +02:00
freddii 61efed30fa fixed spelling mistakes 2021-01-13 01:55:34 +01:00
Juho Hiltunen 07c8ad3f7b jbo: remove unnecessary lojban related code in ReadClause()
It is enough to have the logic in dictsource/jbo_*.

Thanks to xunsku @ irc.freenode.org
2020-12-26 20:07:40 +02:00
Juho Hiltunen 54d93cf2b4 code cleanup: move ssml reference handling logic to a new function ParseSsmlReference()
It's unclear why c2 needs to be set after an entity reference.
2020-08-23 20:43:29 +03:00
Juho Hiltunen 34657e7ea4 code cleanup: move check for SSML comments and declarations to
ProcessSsmlTag()

Note the line in readclause.c:
if ((c2 == '/') || iswalpha(c2) || c2 == '!' || c2 == '?') {

It might be enough to pass everything to ProcessSsmlTag. What are the
cases that are skipped because of this?
2020-08-23 20:42:24 +03:00
Juho Hiltunen 75d66c89d0 code cleanup: Move self_closing checks to ProcessSsmlTag()
This is a bit slower since we don't pass n_xml_buf as an argument but
rather get it with a call to wcslen. It is much cleaner though, since
the name ProcessSsmlTag() implies that all processing should be done
there.
2020-08-23 20:41:52 +03:00
Juho Hiltunen 0352616de9 code cleanup: remove ununsed ctrl_embedded
It's a duplicate of CTRL_EMBEDDED.
2020-07-24 15:44:03 +03:00
Juho Hiltunen ee944700f8 code cleanup: Check all local includes with include-what-you-use
Going through files in src/libespeak-ng/, include-what-you-use removed a
few unnecessary includes and included explanations on why a certain
header should be included. This makes tracking globals and dependencies easier.

Running the codebase through IWYU should be repeated after each major
code restIncludes to standard c library weren't checked to avoid
breaking builds with other platforms.

See https://github.com/include-what-you-use/include-what-you-use
2020-07-24 07:29:47 +03:00
Reece H. Dunn d36d3bd197 Merge remote-tracking branch 'BenTalagan/fix/genitive_on_acronym' 2020-05-14 21:16:25 +01:00
BenTalagan c96a0e409d Fixing sequences of ? and ! 2020-05-09 17:03:32 +01:00
BenTalagan 608bd41e73 Use another var to handle next to next char 2020-05-07 14:11:05 +02:00
BenTalagan 93fbca0e31 Fixing handling of sequence .' in english (potential acronym+genitive vs simple quote usage of apostrophe) 2020-05-07 13:49:12 +02:00
BenTalagan 02447abde8 Fixing is_str_totally_null 2019-11-19 21:05:52 +01:00
BenTalagan 9fd480afbf Fixing typos and naming 2019-11-19 12:30:32 +01:00
BenTalagan 94677f4af8 Rule alignment fixes for non compliant platforms / Fix for emscripten demo 2019-11-19 09:54:11 +01:00
Juho Hiltunen b23e8a7269 maintainability: pass Translator as to towlower2() instead of using a global 2018-03-25 12:40:57 +03:00
Juho Hiltunen d196d93ed5 maintainability: move variables to files where they are used, allowing removal of unnecessary extern declarations 2018-03-24 15:05:23 +02:00
Reece H. Dunn 444e4544d2 Simplify the !v comparison and check PATHSEP
SetVoiceStack looks for "!v" in variant_name and skips the first
three characters if "!v" is found. The problem here is that it
does not check that the third character is the path separator, so
may advance into unknown memory if variant_name is exactly "!v".

This fixes that problem by checking for the path separator. It
also simplifies the logic by checking the bytes explicitly.

NOTE: This is not strictly needed, as the only code paths this is
relevant for is in espeak_ng_SetVoiceByName, and the variant name
comes from ExtractVoiceVariantName, which sets up the variant name
correctly.
2018-03-21 21:35:26 +00:00
Reece H. Dunn c9ca77a4d4 Compare variant_name with "!v" only if long enough
Various places call SetVoiceStack with "" for the variant_name. This
causes -fsanitize=address to fail with an overflow as the call to
memcmp is checking the first 2 bytes, and there is only 1 byte
available.
2018-03-21 21:16:08 +00:00
Juho Hiltunen 9012f3f0bf headers: continue with synthdata.h 2018-03-10 13:54:58 +02:00
Juho Hiltunen 231a1d0944 headers: add new file dictionary.h with declarations of functions in dictionary.c 2018-03-10 12:47:02 +02:00