Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: chrome/third_party/hunspell/src/hunspell/hashmgr.cxx

Issue 6430: [Chromium-reviews] Fix issue 3039/3040 (Add to dictionary crasher) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/third_party/hunspell/src/hunspell/hashmgr.hxx ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/third_party/hunspell/src/hunspell/hashmgr.cxx
===================================================================
--- chrome/third_party/hunspell/src/hunspell/hashmgr.cxx (revision 2796)
+++ chrome/third_party/hunspell/src/hunspell/hashmgr.cxx (working copy)
@@ -119,7 +119,6 @@
#ifdef HUNSPELL_CHROME_CLIENT
EmptyHentryCache();
- STLDeleteValues(&custom_word_to_hentry_map_);
for (std::vector<std::string*>::iterator it = pointer_to_strings_.begin();
it != pointer_to_strings_.end(); ++it) {
delete *it;
@@ -152,12 +151,12 @@
int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD];
int affix_count = bdict_reader->FindWord(word, affix_ids);
if (affix_count == 0) { // look for custom added word
- std::map<StringPiece, struct hentry *>::const_iterator iter =
- custom_word_to_hentry_map_.find(word);
- if (iter != custom_word_to_hentry_map_.end())
- return iter->second;
- else
- return NULL;
+ std::map<StringPiece, int>::const_iterator iter =
+ custom_word_to_affix_id_map_.find(word);
+ if (iter != custom_word_to_affix_id_map_.end()) {
+ affix_count = 1;
+ affix_ids[0] = iter->second;
+ }
}
static const int kMaxWordLen = 128;
@@ -243,20 +242,13 @@
dp->next = hp;
}
#endif // HUNSPELL_CHROME_CLIENT
- std::map<StringPiece, struct hentry *>::iterator iter =
- custom_word_to_hentry_map_.find(word);
- if(iter == custom_word_to_hentry_map_.end()) { // word needs to be added
- // Make a custom hentry.
- struct hentry* he = new hentry;
- he->word = (char *)word;
- he->wlen = wl;
- he->next = NULL;
- he->next_homonym = NULL;
-
+ std::map<StringPiece, int>::iterator iter =
+ custom_word_to_affix_id_map_.find(word);
+ if(iter == custom_word_to_affix_id_map_.end()) { // word needs to be added
std::string* new_string_word = new std::string(word);
pointer_to_strings_.push_back(new_string_word);
StringPiece sp(*(new_string_word));
- custom_word_to_hentry_map_[sp] = he;
+ custom_word_to_affix_id_map_[sp] = 0; // no affixes for custom words
return 1;
}
« no previous file with comments | « chrome/third_party/hunspell/src/hunspell/hashmgr.hxx ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698