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

Unified Diff: components/spellcheck/renderer/hunspell_engine.cc

Issue 2544793003: [spellcheck] Updated Hunspell to 1.5.4 (Closed)
Patch Set: Updated patch with encoding change Created 4 years 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 | « no previous file | components/spellcheck/renderer/spellcheck_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/spellcheck/renderer/hunspell_engine.cc
diff --git a/components/spellcheck/renderer/hunspell_engine.cc b/components/spellcheck/renderer/hunspell_engine.cc
index 8617aaa2185135f9e7b86f73e9535c600d834734..c3853483105a48ed19f23c374a19c26c8a431564 100644
--- a/components/spellcheck/renderer/hunspell_engine.cc
+++ b/components/spellcheck/renderer/hunspell_engine.cc
@@ -86,7 +86,7 @@ bool HunspellEngine::CheckSpelling(const base::string16& word_to_check,
// to check rather than crash.
if (hunspell_.get()) {
// |hunspell_->spell| returns 0 if the word is misspelled.
- word_correct = (hunspell_->spell(word_to_check_utf8.c_str()) != 0);
+ word_correct = (hunspell_->spell(word_to_check_utf8) != 0);
}
}
@@ -106,18 +106,14 @@ void HunspellEngine::FillSuggestionList(
if (!hunspell_.get())
return;
- char** suggestions = NULL;
- int number_of_suggestions =
- hunspell_->suggest(&suggestions, wrong_word_utf8.c_str());
+ std::vector<std::string> suggestions =
+ hunspell_->suggest(wrong_word_utf8);
// Populate the vector of WideStrings.
- for (int i = 0; i < number_of_suggestions; ++i) {
+ for (size_t i = 0; i < suggestions.size(); ++i) {
if (i < spellcheck::kMaxSuggestions)
optional_suggestions->push_back(base::UTF8ToUTF16(suggestions[i]));
- free(suggestions[i]);
}
- if (suggestions != NULL)
- free(suggestions);
}
bool HunspellEngine::InitializeIfNeeded() {
« no previous file with comments | « no previous file | components/spellcheck/renderer/spellcheck_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698