Commit Graph
1604 Commits
Author SHA1 Message Date
Juho Hiltunen 6d751c93bf wavegen.c: Fix -Wunused-but-set-variable warning. 2018-05-01 19:02:32 +01:00
Juho Hiltunen f4aec775cf compiledata.c: Fix -Wunused-result warning. 2018-05-01 19:02:21 +01:00
Reece H. Dunn eb8ced46e3 Don't treat words without alpha characters (e.g. emoji) as upper case. 2018-04-30 07:09:28 +01:00
Juho Hiltunen dd7f788dcf remove unused ints testing and phoneme_change 2018-04-22 12:26:15 +03:00
Juho Hiltunen 8904700ad3 remove unused wmark and all related code 2018-04-22 12:26:14 +03:00
Juho Hiltunen cd35a6fd07 refactor setting tone_out in TranslateClause 2018-04-22 12:26:14 +03:00
Juho Hiltunen b7c2ad604b refactor and remove redundant call to towlower2() 2018-04-15 19:36:40 +03:00
Reece H. Dunn 5ebf5b8fa4 en: Fix several -er and -est words (e.g. wickeder, wickedest, brittlest). 2018-04-01 12:06:18 +01:00
Reece H. Dunn d26fce3217 Be more specific in the missing --compile voice name, and fix punctuation. 2018-03-30 08:46:18 +01:00
Reece H. Dunn 7c7081cb32 Handle the '--compile=' case when reporting a 'Voice name not specified' error. 2018-03-30 08:43:20 +01:00
Reece H. Dunn 9395240a9e Merge remote-tracking branch 'jaacoppi/bugfix' 2018-03-30 08:39:47 +01:00
Juho Hiltunen fb175ec600 Print an error message if voice is not specified with --compile
Prevents a segfault.
2018-03-30 10:24:46 +03:00
Reece H. Dunn 6d25013c94 CompileReport: Don't generate a report if there are no references. [msvc /analyze] 2018-03-27 12:59:51 +01:00
Reece H. Dunn 36c29c479a LookupDict2: Check if flags is not null before setting it. [msvc /analyze] 2018-03-27 12:55:18 +01:00
Reece H. Dunn 28f700e829 en: fix resignedly, manoeuvred, reckon, Frances (name), and sponging. 2018-03-26 07:31:51 +01:00
Reece H. Dunn 9344dab0c3 Revert "maintainability: pass seq_len_adjust to LookupSpect() instead of using globals"
This reverts commit d08b8e43ca.

This commit causes gcc-4.8 to output a different SHA1 hash on the
language-phonemes test for `af` (the first language tested). It
does not break on clang or on gcc-7 so may be a compiler bug,
however the Travis CI build server is using it on Ubuntu Trusty
(14.04 LTS) and so may other older OSes.
2018-03-25 13:34:52 +01:00
Reece H. Dunn 566e904b33 LookupDict2: Fix searching entries longer than 128
This is a fix for https://github.com/nvaccess/nvda/issues/7740.

With the addition of emoji support, dictionary entries can now be
longer than 128 bytes. This fix makes sure the character is
interpreted as an unsigned byte so it does not treat long entries
as having a negative offset.

Treating the offset as a signed byte (like in the previous code)
could cause the hash chain search to loop indefinitely when
processing certain input, like the Tamil characters in the NVDA
issue noted above that is added as a test case to translate.test.
2018-03-25 12:52:22 +01:00
Juho Hiltunen 839f727a24 headers: move WordToString() to synthesize.h 2018-03-25 12:41:26 +03:00
Juho Hiltunen 9174a2045e maintainability: remove unused externs 2018-03-25 12:41:11 +03:00
Juho Hiltunen f0c345eb6a maintainability: pass n_ph_list2 and ph_list2 to MakePhonemeList() and SubstitutePhonemes() instead of using globals 2018-03-25 12:41:05 +03:00
Juho Hiltunen d08b8e43ca maintainability: pass seq_len_adjust to LookupSpect() instead of using globals 2018-03-25 12:41:01 +03:00
Juho Hiltunen b23e8a7269 maintainability: pass Translator as to towlower2() instead of using a global 2018-03-25 12:40:57 +03:00
Reece H. Dunn b7a8751f4d Remove a redundant comment -- history is available in git. 2018-03-24 14:32:43 +00:00
Juho Hiltunen f73ebfd126 maintainability: pass current_alphabet as argument to TranslateLetter() instead of using global 2018-03-24 15:05:53 +02: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
Juho Hiltunen 1bad240de8 maintainability: remove some unused variables and unnecessary extern declarations 2018-03-24 15:03:48 +02:00
Juho Hiltunen c4ec7bfe34 remove option_phoneme_variants that is never set and always evaluates true 2018-03-24 15:03:12 +02:00
Juho Hiltunen 7ee0d7905c remove unused int option_tone2
It is set in voices.c but never used. docs/voices.md indicates that the keyword intonation only takes one parameter, confirming that option_tone2 is unused.
2018-03-24 14:25:50 +02:00
Reece H. Dunn dfe66289c8 Don't set final_ph2 to before phonetic in the stack if ix=1. 2018-03-22 20:52:28 +00:00
Reece H. Dunn 2d7f3e9d54 Don't skip blanks past charix_top in TranslateClause. 2018-03-22 20:49:15 +00:00
Reece H. Dunn 7dad0dfd40 Prevent TranslateRoman reading stack data from Lookup. 2018-03-22 20:12:35 +00:00
Reece H. Dunn b24db06a84 Copy name to tr->dictionary_name if not equal
This is a similar change to b60d2452c3.
In this case, it is when tr->dictionary_name is passed as the name
parameter in LoadDictionary.

This happens in the SetTranslator2 function when loading the
dictionary for the second language translator object.
2018-03-22 19:48:56 +00:00
Reece H. Dunn bb19c7a336 Release the memory allocated by p_text in espeak-ng.c. 2018-03-22 19:37:25 +00:00
Reece H. Dunn 062cb8dfc9 Merge remote-tracking branch 'valdisvi/master' 2018-03-22 19:09:29 +00:00
Reece H. Dunn 879cb9c08a Don't free 'tr' if null in DeleteTranslator. 2018-03-22 19:01:59 +00:00
Valdis Vitolins ad1fa7f25f Expose SpectSeqCreate(), SpectSeqDestroy() and LoadSpectSeq() functions for eSpeakNG Java Editor 2018-03-22 10:25:13 +02:00
Reece H. Dunn d23735ae1b Release the translator memory in espeak{_ng,}_Terminate. 2018-03-22 07:26:22 +00:00
Reece H. Dunn 87a2586bb0 Fix formatting of free_rules. 2018-03-22 07:19:26 +00: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
Reece H. Dunn a08d2c7bfb Ensure the allocated rules are properly cleaned up in compile_dictrules. 2018-03-21 20:58:55 +00:00
Reece H. Dunn b60d2452c3 Copy name in LoadDictionary if not dictionary_name
compiledict.c sets dict_name to dictionary_name if dict_name is
not set, and passes that to LoadDictionary. LoadDictionary then
copies the passed in name to dictionary_name.

This causes -fsanitize=address to fail with overlapping memory
addresses passed to strncpy (copying the string to itself). As
such, don't copy the name in this case.
2018-03-21 20:37:44 +00:00
Sascha Brawer 8aa4521d31 Make phoneme properties unsigned
Fixes two sanitizer warnings:

```
src/libespeak-ng/compiledata.c:2291:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
src/libespeak-ng/compiledata.c:2424:34: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
```
2018-03-20 02:29:32 +01:00
Reece H. Dunn 7429a58510 Merge commit '22009de5f84974e77147fd5264781fb1c09a7764' 2018-03-19 20:51:53 +00:00
Reece H. Dunn 22009de5f8 Fix running the tests with -fsanitize=address. 2018-03-19 20:22:54 +00:00
Reece H. Dunn 768957e0fc Don't copy filepath to buf. [coverity]
No modification was being done to buf after the copy of filepath.
It was just being passed to fopen. As such the copy is redundant,
and can lead to buffer overflow issues if the specified filepath
is larger than buf.
2018-03-17 07:13:21 +00:00
Reece H. Dunn d0410d8585 Include dictionary.h in the relevant source files to avoid implicit-function-declaration warnings. 2018-03-17 07:12:45 +00:00
Reece H. Dunn 99bbc6294e Fix building on Windows. 2018-03-12 12:26:57 +00:00
Reece H. Dunn 07e155a150 TranslateWord2: Don't process invalid phonemes.
If ph_code is not located in the phoneme_tab, the resulting ph
value will be NULL. This does not normally happen, but it can
happen if word_phonemes contains garbage data, such as with the
1.49.2 multi-word logic when processing words like 'riposted'.
2018-03-11 18:00:38 +00:00
Reece H. Dunn eaa08a2bc3 translate: Don't crash translating root words that map to another list entry.
If the list file contains a text replacement to another
entry in the list file, e.g.:

	ripost     riposte $text
	riposte    rI#p0st

calling it from a prefix or suffix rule such as 'riposted'
causes word_out[0] to be NULL, as TranslateWord3 has the
information needed to perform the mapping. In this case,
no phonemes have been written in this loop and the phonemes
have been calculated, so don't override them.
2018-03-11 17:58:15 +00:00