Decomposition (inverse-translation) fixed

This commit is contained in:
Simon Rozman 2017-07-13 14:50:27 +02:00
parent 9ff3f8c2ab
commit 9ca82f02f8
2 changed files with 3 additions and 3 deletions

View File

@ -141,8 +141,8 @@ void wxZRColaComposerPanel::SynchronizePanels()
GetTranslationSeq(sets_begin, sets_end); GetTranslationSeq(sets_begin, sets_end);
m_mapping.clear(); m_mapping.clear();
for (auto s = sets_end; s != sets_begin; s--) { for (auto s = sets_end; (s--) != sets_begin;) {
if (*s) { if (*s == 0) {
// ZRCola Decomposed => ZRCola Composed // ZRCola Decomposed => ZRCola Composed
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map); app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map);
} else { } else {

View File

@ -125,7 +125,7 @@ void ZRCola::translation_db::TranslateInv(_In_ transetid_t set, _In_z_count_(inp
for (size_t i = 0; i < inputMax;) { for (size_t i = 0; i < inputMax;) {
// Find the longest matching inverse translation at i-th character. // Find the longest matching inverse translation at i-th character.
size_t l_match = (size_t)-1; size_t l_match = (size_t)-1;
for (size_t l = 0, r = r_set, ii = i, j = 0; ii < inputMax && l < r; ii++, j++) { for (size_t l = l_set, r = r_set, ii = i, j = 0; ii < inputMax && l < r; ii++, j++) {
wchar_t c = input[ii]; wchar_t c = input[ii];
while (l < r) { while (l < r) {
// Test the inverse translation in the middle of the search area. // Test the inverse translation in the middle of the search area.