OLD | NEW |
1 #include "license.hunspell" | 1 #include "license.hunspell" |
2 #include "license.myspell" | 2 #include "license.myspell" |
3 | 3 |
4 #ifndef MOZILLA_CLIENT | 4 #ifndef MOZILLA_CLIENT |
5 #include <cstdlib> | 5 #include <cstdlib> |
6 #include <cstring> | 6 #include <cstring> |
7 #include <cstdio> | 7 #include <cstdio> |
8 #include <cctype> | 8 #include <cctype> |
9 #else | 9 #else |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 #endif | 146 #endif |
147 | 147 |
148 // lookup a root word in the hashtable | 148 // lookup a root word in the hashtable |
149 struct hentry * HashMgr::lookup(const char *word) const | 149 struct hentry * HashMgr::lookup(const char *word) const |
150 { | 150 { |
151 #ifdef HUNSPELL_CHROME_CLIENT | 151 #ifdef HUNSPELL_CHROME_CLIENT |
152 int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD]; | 152 int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD]; |
153 int affix_count = bdict_reader->FindWord(word, affix_ids); | 153 int affix_count = bdict_reader->FindWord(word, affix_ids); |
154 if (affix_count == 0) { // look for custom added word | 154 if (affix_count == 0) { // look for custom added word |
155 std::map<StringPiece, int>::const_iterator iter = | 155 std::map<base::StringPiece, int>::const_iterator iter = |
156 custom_word_to_affix_id_map_.find(word); | 156 custom_word_to_affix_id_map_.find(word); |
157 if (iter != custom_word_to_affix_id_map_.end()) { | 157 if (iter != custom_word_to_affix_id_map_.end()) { |
158 affix_count = 1; | 158 affix_count = 1; |
159 affix_ids[0] = iter->second; | 159 affix_ids[0] = iter->second; |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 static const int kMaxWordLen = 128; | 163 static const int kMaxWordLen = 128; |
164 static char word_buf[kMaxWordLen]; | 164 static char word_buf[kMaxWordLen]; |
165 // To take account of null-termination, we use upto 127. | 165 // To take account of null-termination, we use upto 127. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 } | 270 } |
271 if (!upcasehomonym) { | 271 if (!upcasehomonym) { |
272 dp->next = hp; | 272 dp->next = hp; |
273 } else { | 273 } else { |
274 // remove hidden onlyupcase homonym | 274 // remove hidden onlyupcase homonym |
275 if (hp->astr) free(hp->astr); | 275 if (hp->astr) free(hp->astr); |
276 free(hp); | 276 free(hp); |
277 } | 277 } |
278 #else | 278 #else |
279 std::map<StringPiece, int>::iterator iter = | 279 std::map<base::StringPiece, int>::iterator iter = |
280 custom_word_to_affix_id_map_.find(word); | 280 custom_word_to_affix_id_map_.find(word); |
281 if(iter == custom_word_to_affix_id_map_.end()) { // word needs to be added | 281 if(iter == custom_word_to_affix_id_map_.end()) { // word needs to be added |
282 std::string* new_string_word = new std::string(word); | 282 std::string* new_string_word = new std::string(word); |
283 pointer_to_strings_.push_back(new_string_word); | 283 pointer_to_strings_.push_back(new_string_word); |
284 StringPiece sp(*(new_string_word)); | 284 base::StringPiece sp(*(new_string_word)); |
285 custom_word_to_affix_id_map_[sp] = 0; // no affixes for custom words | 285 custom_word_to_affix_id_map_[sp] = 0; // no affixes for custom words |
286 return 1; | 286 return 1; |
287 } | 287 } |
288 #endif | 288 #endif |
289 return 0; | 289 return 0; |
290 } | 290 } |
291 | 291 |
292 int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl, | 292 int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl, |
293 unsigned short * flags, int al, char * dp, int captype) | 293 unsigned short * flags, int al, char * dp, int captype) |
294 { | 294 { |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 | 1174 |
1175 int HashMgr::is_aliasm() { | 1175 int HashMgr::is_aliasm() { |
1176 return (aliasm != NULL); | 1176 return (aliasm != NULL); |
1177 } | 1177 } |
1178 | 1178 |
1179 char * HashMgr::get_aliasm(int index) { | 1179 char * HashMgr::get_aliasm(int index) { |
1180 if ((index > 0) && (index <= numaliasm)) return aliasm[index - 1]; | 1180 if ((index > 0) && (index <= numaliasm)) return aliasm[index - 1]; |
1181 HUNSPELL_WARNING(stderr, "error: bad morph. alias index: %d\n", index); | 1181 HUNSPELL_WARNING(stderr, "error: bad morph. alias index: %d\n", index); |
1182 return NULL; | 1182 return NULL; |
1183 } | 1183 } |
OLD | NEW |