author | erik <erik> | 2007-01-19 01:18:01 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-19 01:18:01 (UTC) |
commit | 32343107b30904806d02672955c57ed53d39fe79 (patch) (unidiff) | |
tree | 9114a0ea170e3adc807a2445b49360f1bfde9626 /library/global.cpp | |
parent | ac0ce844e90a64247c0adb210e0a23021b011d57 (diff) | |
download | opie-32343107b30904806d02672955c57ed53d39fe79.zip opie-32343107b30904806d02672955c57ed53d39fe79.tar.gz opie-32343107b30904806d02672955c57ed53d39fe79.tar.bz2 |
Every file in this commit has a change to check the return value of a call.
-rw-r--r-- | library/global.cpp | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/library/global.cpp b/library/global.cpp index f7a0767..7bdd0b1 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -218,35 +218,34 @@ const QDawg& Global::fixedDawg() | |||
218 | if ( !fixed_dawg ) { | 218 | if ( !fixed_dawg ) { |
219 | if ( !docDirCreated ) | 219 | if ( !docDirCreated ) |
220 | createDocDir(); | 220 | createDocDir(); |
221 | 221 | ||
222 | fixed_dawg = new QDawg; | 222 | fixed_dawg = new QDawg; |
223 | QString dawgfilename = dictDir() + "/dawg"; | 223 | QString dawgfilename = dictDir() + "/dawg"; |
224 | QString words_lang; | 224 | QString words_lang; |
225 | QStringList langs = Global::languageList(); | 225 | QStringList langs = Global::languageList(); |
226 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { | 226 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { |
227 | QString lang = *it; | 227 | QString lang = *it; |
228 | words_lang = dictDir() + "/words." + lang; | 228 | words_lang = dictDir() + "/words." + lang; |
229 | QString dawgfilename_lang = dawgfilename + "." + lang; | 229 | QString dawgfilename_lang = dawgfilename + "." + lang; |
230 | if ( QFile::exists(dawgfilename_lang) || | 230 | if ( QFile::exists(dawgfilename_lang) || |
231 | QFile::exists(words_lang) ) { | 231 | QFile::exists(words_lang) ) { |
232 | dawgfilename = dawgfilename_lang; | 232 | dawgfilename = dawgfilename_lang; |
233 | break; | 233 | break; |
234 | } | 234 | } |
235 | } | ||
236 | QFile dawgfile(dawgfilename); | ||
237 | |||
238 | if ( !dawgfile.exists() ) { | ||
239 | QString fn = dictDir() + "/words"; | ||
240 | if ( QFile::exists(words_lang) ) | ||
241 | fn = words_lang; | ||
242 | QFile in(fn); | ||
243 | if ( in.open(IO_ReadOnly) ) { | ||
244 | fixed_dawg->createFromWords(&in); | ||
245 | dawgfile.open(IO_WriteOnly); | ||
246 | fixed_dawg->write(&dawgfile); | ||
247 | dawgfile.close(); | ||
248 | } | 235 | } |
249 | } else { | 236 | QFile dawgfile(dawgfilename); |
250 | fixed_dawg->readFile(dawgfilename); | 237 | |
251 | } | 238 | if ( !dawgfile.exists() ) { |
239 | QString fn = dictDir() + "/words"; | ||
240 | if ( QFile::exists(words_lang) ) | ||
241 | fn = words_lang; | ||
242 | QFile in(fn); | ||
243 | if ( in.open(IO_ReadOnly) ) { | ||
244 | fixed_dawg->createFromWords(&in); | ||
245 | if (dawgfile.open(IO_WriteOnly)) | ||
246 | fixed_dawg->write(&dawgfile); | ||
247 | dawgfile.close(); | ||
248 | } | ||
249 | } else | ||
250 | fixed_dawg->readFile(dawgfilename); | ||
252 | } | 251 | } |