Commit Graph
86 Commits
Author SHA1 Message Date
Reece H. Dunn b7a8751f4d Remove a redundant comment -- history is available in git. 2018-03-24 14:32:43 +00:00
Juho Hiltunen c4ec7bfe34 remove option_phoneme_variants that is never set and always evaluates true 2018-03-24 15:03:12 +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 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 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
Juho Hiltunen 231a1d0944 headers: add new file dictionary.h with declarations of functions in dictionary.c 2018-03-10 12:47:02 +02:00
Juho Hiltunen cd991bd2c9 headers: add new file numbers.h with declarations of functions in numbers.c 2018-03-10 09:27:23 +02:00
Juho Hiltunen 07160f9286 headers: add new file synthdata.h with declarations of functions in synthdata.c 2018-03-10 08:23:24 +02:00
Juho Hiltunen 706df97b20 headers: add new file readclause.h with declarations of functions in readclause.c 2018-03-10 07:18:07 +02:00
Juho Hiltunen 30ad5c39f6 move struct MatchRecord to dictionary.c since it's the only file that uses it 2018-03-09 21:08:38 +02:00
Juho Hiltunen 78749f14f8 readability fix: use boolean instead of 0 and 1 for loop control 2018-02-17 18:17:00 +02:00
Reece H. Dunn b8d5d96dea Merge remote-tracking branch 'jaacoppi/maintainability' 2018-01-14 13:43:13 +00:00
Juho Hiltunen da287fb851 Unify terminology for stress
synthesize.h now contains the definitions STRESS_IS_... that should be used with code related to syllable stress.

Note that isBreak and other defines were renumbered so that stress definitions could have values 0-6.

Possible TODOs:
1. Unify with terms used with phonemes, i.e. keywords like isDiminished in compiledata.c and stress_type in phsource/phonemes
2. Add functionality and documentation about STRESS_IS_PRIORITY and STRESS_IS_EMPHASIZED
2018-01-14 15:26:03 +02:00
Juho Hiltunen 88315250ff readability fix: use boolean instead of 0 and 1 for loop control 2018-01-14 15:22:37 +02:00
Juho Hiltunen afb4fe75e2 fi: fix behaviour of S_2_TO_HEAVY (adding secondary stress)
Stress flag S_2_TO_HEAVY is currently only used by finnish.

Current behaviour skips adding secondary stress if the following syllable is heavy. The behaviour should be to skip adding secondary stress if the rest of the word (excluding last syllable) contains a heavy syllable.

Source of grammar rule and examples of expected behaviour: http://scripta.kotus.fi/visk/sisallys.php?p=13
2018-01-14 14:48:36 +02:00
Reece H. Dunn 50a2d8e291 Revert "Use strcpy instead of memcpy+strlen."
This reverts commit 119c200e00.
2017-11-04 08:14:59 +00:00
Reece H. Dunn 7f42e0aaca compiledict.c: Fix -Wmissing-prototypes warnings. 2017-10-11 07:51:36 +01:00
Reece H. Dunn 74f9f5e34b wavegen.c: Fix -Wmissing-prototypes warnings. 2017-10-10 21:37:46 +01:00
Reece H. Dunn 119c200e00 Use strcpy instead of memcpy+strlen.
This replaces uses of:

	memcpy(dst, src, strlen(src))

with:

	strcpy(dst, src)

This fixes issues with reading past the end of the copied buffer
(e.g. when processing word-based replacements for emoji characters)
by ensuring that the destination buffer is null terminated.

Reported by Michael Curran <mick@nvaccess.org>
2017-10-01 08:50:56 +01:00
Reece H. Dunn a2f751044c Remove unused letter assignment in MatchRule.
This was identified by the clang static analyser. The letter
variable is set in the various match_type switch cases, so
does not need to be initialised in the start of the while loop.
2017-09-12 07:46:53 +01:00
Reece H. Dunn ecdff298b0 last_letter in MatchRule is not used.
This was identified by the clang static analyser.
2017-09-12 07:43:00 +01:00
Reece H. Dunn 8a777385a8 Use wflags to access wtab->flags in LookupDict2.
Clang static analysis reports a 'Dereference of null pointer'
error when accessing wtab->flags. This is properly guarded
against when setting the wflags variable, so use that variable
instead.
2017-09-12 07:36:54 +01:00
Reece H. Dunn e6ea8fabea Initialise ending in RemoveEnding.
Clang static analysis reports this as several 'Result of operation
is garbage or undefined' errors, when `ending` has not been set
due to no matching endings.
2017-09-12 07:29:07 +01:00
Reece H. Dunn 988db184ea Prevent invalid access to word in LookupDictList.
Clang static analysis reports this as several 'Result of operation
is garbage or undefined' errors.
2017-09-12 07:17:46 +01:00
Reece H. Dunn 22270bd259 Fix reading hash table entries > 128.
This is related to ebfa320956, but
when reading the hash chain entry length, not writing it.

If char is signed, then before this change the length would be
negative, causing problems loading the dictionary.
2017-07-26 21:11:44 +01:00
Reece H. Dunn 921229259d Use int to store the value from GetFileLength.
This fixes the clang warning:

    comparison of unsigned expression < 0 is always false
    [-Wtautological-compare]

Reported by Reef Turner <reef@nvaccess.org>
2017-07-26 19:50:03 +01:00
Reece H. Dunn 48ca2239bb Fix non-Latin character languages falling back to English when reading Latin characters. 2017-05-12 07:35:27 +01:00
Reece H. Dunn 2f8f125c68 Remove voice/language support for alphabet2.
This is not used by any of the espeak-ng voices and languages.
Additionally, this functionality would be superceded by support
for specifying the language used by different scripts in the
language argument on the command line.
2017-05-07 15:10:42 +01:00
Reece H. Dunn 9af96da469 Make the encoding.h API public. 2017-05-02 18:40:16 +01:00
Reece H. Dunn 8749891069 Better specify the CLAUSE_ flags returned by ReadClause. 2017-04-17 22:04:45 +01:00
Reece H. Dunn 7c16ac543c Use the text decoder API in readclause.c. 2017-03-31 13:17:37 +01:00
Reece H. Dunn d5d93be00e Group the LookupMnem API implementations into mnemonics.c. 2017-03-27 21:08:07 +01:00
Reece H. Dunn 5975f07095 Replace the *2 wchar/wctype APIs with their standard versions. These will be fixed using compatibility headers. 2017-02-13 07:43:23 +00:00
Valdis Vitolins 17168a5669 More proper fix for issue #196 2017-02-12 15:56:27 +02:00
Valdis Vitolins fd4b397ad7 Merge branch 'test' 2017-02-11 21:49:02 +02:00
Valdis Vitolins 9558e60e4b Merge branch 'master' of https://github.com/espeak-ng/espeak-ng 2017-02-11 21:48:04 +02:00
Valdis Vitolins 872433d62c Fix for Jump rule to allow no letters in between current and pre/post (literal letter/letter group) 2017-02-11 21:42:09 +02:00
Valdis Vitolins 41f29f3e87 Fix for issue #196 Word end mark _ doesn't work properly with ~ character group 2017-02-11 20:52:52 +02:00
Reece H. Dunn 71c010b712 Remove unused wchar.h and wctype.h includes. 2017-02-10 08:03:40 +00:00
Valdis Vitolins af7fc1b657 Issue #199 Jump statement now supports letter groups 2017-02-05 23:31:24 +02:00
Valdis Vitolins b2057635c4 PRE jump rule e.g. 'xyJ)' implemented 2017-02-05 15:40:28 +00:00
Valdis Vitolins 29f0b673ee Updated comments for POST jump rule 2017-02-05 15:40:14 +00:00
Valdis Vitolins 6bd656cf4a Limit search for jump POST rule to null byte for last word in sentence 2017-02-05 15:40:00 +00:00
Valdis Vitolins 7ad277e39e Fixed typo 2017-01-15 22:13:13 +02:00
Valdis Vitolins 059543ceb0 Fix for issue #195 Different non-Latin diacritized consonants are wrongly considered as one doubled 2017-01-15 21:06:32 +02:00
Reece H. Dunn 2ccaa7f002 Improve the IsLetterGroup comments. 2017-01-10 19:34:12 +00:00
Reece H. Dunn af1fae46de Fix formatting of the previous changes to match style guidelines. 2017-01-10 19:26:40 +00:00
Valdis Vitolins a621ad46e7 Implementation for issue #155 2017-01-09 19:05:54 +02:00
Rui Batista 7b82e39793 Make strcpy calls in load dictionary copy at most 40 bytes so clang __strcpy_check does not get triggered (possible buffer overflow?) 2016-10-05 13:15:48 +01:00