OLD | NEW |
1 diff -rc /home/hbono/Downloads/hunspell-1.2.12/src/hunspell/affixmgr.cxx hunspel
l/src/hunspell/affixmgr.cxx | 1 diff -rc /home/hbono/Downloads/hunspell-1.2.12/src/hunspell/affixmgr.cxx hunspel
l/src/hunspell/affixmgr.cxx |
2 *** /home/hbono/Downloads/hunspell-1.2.12/src/hunspell/affixmgr.cxx Sat Jun
26 22:35:37 2010 | 2 *** /home/hbono/Downloads/hunspell-1.2.12/src/hunspell/affixmgr.cxx Sat Jun
26 22:35:37 2010 |
3 --- hunspell/src/hunspell/affixmgr.cxx Fri Aug 13 16:47:10 2010 | 3 --- hunspell/src/hunspell/affixmgr.cxx Fri Aug 13 16:47:10 2010 |
4 *************** | 4 *************** |
5 *** 14,21 **** | 5 *** 14,21 **** |
6 --- 14,27 ---- | 6 --- 14,27 ---- |
7 | 7 |
8 #include "csutil.hxx" | 8 #include "csutil.hxx" |
9 | 9 |
10 + #ifdef HUNSPELL_CHROME_CLIENT | 10 + #ifdef HUNSPELL_CHROME_CLIENT |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const | 546 struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const |
547 { | 547 { |
548 + #ifdef HUNSPELL_CHROME_CLIENT | 548 + #ifdef HUNSPELL_CHROME_CLIENT |
549 + // Return NULL if dictionary is not valid. | 549 + // Return NULL if dictionary is not valid. |
550 + if (!bdict_reader->IsValid()) | 550 + if (!bdict_reader->IsValid()) |
551 + return NULL; | 551 + return NULL; |
552 + | 552 + |
553 + // This function is only ever called by one place and not nested. We can | 553 + // This function is only ever called by one place and not nested. We can |
554 + // therefore keep static state between calls and use |col| as a "reset" flag | 554 + // therefore keep static state between calls and use |col| as a "reset" flag |
555 + // to avoid changing the API. It is set to -1 for the first call. | 555 + // to avoid changing the API. It is set to -1 for the first call. |
556 + static hunspell::WordIterator word_iterator = | 556 + // Allocate the iterator on the heap to prevent an exit time destructor. |
557 + bdict_reader->GetAllWordIterator(); | 557 + static hunspell::WordIterator& word_iterator = |
| 558 + *new hunspell::WordIterator(bdict_reader->GetAllWordIterator()); |
558 + if (col < 0) { | 559 + if (col < 0) { |
559 + col = 1; | 560 + col = 1; |
560 + word_iterator = bdict_reader->GetAllWordIterator(); | 561 + word_iterator = bdict_reader->GetAllWordIterator(); |
561 + } | 562 + } |
562 + | 563 + |
563 + int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD]; | 564 + int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD]; |
564 + static const int kMaxWordLen = 128; | 565 + static const int kMaxWordLen = 128; |
565 + static char word[kMaxWordLen]; | 566 + static char word[kMaxWordLen]; |
566 + int affix_count = word_iterator.Advance(word, kMaxWordLen, affix_ids); | 567 + int affix_count = word_iterator.Advance(word, kMaxWordLen, affix_ids); |
567 + if (affix_count == 0) | 568 + if (affix_count == 0) |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 if (sc > scores[lp]) { | 1256 if (sc > scores[lp]) { |
1256 scores[lp] = sc; | 1257 scores[lp] = sc; |
1257 + #ifdef HUNSPELL_CHROME_CLIENT | 1258 + #ifdef HUNSPELL_CHROME_CLIENT |
1258 + roots[lp] = hash_entry_factory.CreateScopedHashEntry(lp, hp); | 1259 + roots[lp] = hash_entry_factory.CreateScopedHashEntry(lp, hp); |
1259 + #else | 1260 + #else |
1260 roots[lp] = hp; | 1261 roots[lp] = hp; |
1261 + #endif | 1262 + #endif |
1262 lval = sc; | 1263 lval = sc; |
1263 for (j=0; j < MAX_ROOTS; j++) | 1264 for (j=0; j < MAX_ROOTS; j++) |
1264 if (scores[j] < lval) { | 1265 if (scores[j] < lval) { |
OLD | NEW |