| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | enum Tag { Tag_End = 1, Tag_SourceText16, Tag_Translation, Tag_Context16, Tag_Obsolete1, | - |
| 22 | Tag_SourceText, Tag_Context, Tag_Comment, Tag_Obsolete2 }; | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | static const int MagicLength = 16; | - |
| 31 | static const uchar magic[MagicLength] = { | - |
| 32 | 0x3c, 0xb8, 0x64, 0x18, 0xca, 0xef, 0x9c, 0x95, | - |
| 33 | 0xcd, 0x21, 0x1c, 0xbf, 0x60, 0xa1, 0xbd, 0xdd | - |
| 34 | }; | - |
| 35 | | - |
| 36 | static bool match(const uchar* found, const char* target, uint len) | - |
| 37 | { | - |
| 38 | | - |
| 39 | | - |
| 40 | if (len > 0 && found[len-1] == '\0') evaluated: len > 0| yes Evaluation Count:346 | yes Evaluation Count:167 |
evaluated: found[len-1] == '\0'| yes Evaluation Count:12 | yes Evaluation Count:334 |
| 12-346 |
| 41 | --len; executed: --len;Execution Count:12 | 12 |
| 42 | return (memcmp(found, target, len) == 0 && target[len] == '\0'); executed: return (memcmp(found, target, len) == 0 && target[len] == '\0');Execution Count:513 | 513 |
| 43 | } | - |
| 44 | | - |
| 45 | static void elfHash_continue(const char *name, uint &h) | - |
| 46 | { | - |
| 47 | const uchar *k; | - |
| 48 | uint g; | - |
| 49 | | - |
| 50 | k = (const uchar *) name; | - |
| 51 | while (*k) { evaluated: *k| yes Evaluation Count:11514 | yes Evaluation Count:544 |
| 544-11514 |
| 52 | h = (h << 4) + *k++; | - |
| 53 | if ((g = (h & 0xf0000000)) != 0) evaluated: (g = (h & 0xf0000000)) != 0| yes Evaluation Count:9554 | yes Evaluation Count:1960 |
| 1960-9554 |
| 54 | h ^= g >> 24; executed: h ^= g >> 24;Execution Count:9554 | 9554 |
| 55 | h &= ~g; | - |
| 56 | } executed: }Execution Count:11514 | 11514 |
| 57 | } executed: }Execution Count:544 | 544 |
| 58 | | - |
| 59 | static void elfHash_finish(uint &h) | - |
| 60 | { | - |
| 61 | if (!h) partially evaluated: !h| no Evaluation Count:0 | yes Evaluation Count:272 |
| 0-272 |
| 62 | h = 1; | 0 |
| 63 | } executed: }Execution Count:272 | 272 |
| 64 | | - |
| 65 | static uint elfHash(const char *name) | - |
| 66 | { | - |
| 67 | uint hash = 0; | - |
| 68 | elfHash_continue(name, hash); | - |
| 69 | elfHash_finish(hash); | - |
| 70 | return hash; never executed: return hash; | 0 |
| 71 | } | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | static bool isValidNumerusRules(const uchar *rules, uint rulesSize) | - |
| 80 | { | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | if (rulesSize == 0) evaluated: rulesSize == 0| yes Evaluation Count:1 | yes Evaluation Count:15 |
| 1-15 |
| 85 | return true; executed: return true;Execution Count:1 | 1 |
| 86 | | - |
| 87 | quint32 offset = 0; | - |
| 88 | do { | - |
| 89 | uchar opcode = rules[offset]; | - |
| 90 | uchar op = opcode & Q_OP_MASK; | - |
| 91 | | - |
| 92 | if (opcode & 0x80) partially evaluated: opcode & 0x80| no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
| 93 | return false; never executed: return false; | 0 |
| 94 | | - |
| 95 | if (++offset == rulesSize) partially evaluated: ++offset == rulesSize| no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
| 96 | return false; never executed: return false; | 0 |
| 97 | | - |
| 98 | | - |
| 99 | ++offset; | - |
| 100 | | - |
| 101 | switch (op) | - |
| 102 | { | - |
| 103 | case Q_EQ: | - |
| 104 | case Q_LT: | - |
| 105 | case Q_LEQ: | - |
| 106 | break; executed: break;Execution Count:15 | 15 |
| 107 | | - |
| 108 | case Q_BETWEEN: | - |
| 109 | if (offset != rulesSize) { never evaluated: offset != rulesSize | 0 |
| 110 | | - |
| 111 | ++offset; | - |
| 112 | break; | 0 |
| 113 | } | - |
| 114 | return false; never executed: return false; | 0 |
| 115 | | - |
| 116 | default: | - |
| 117 | return false; never executed: return false; | 0 |
| 118 | } | - |
| 119 | | - |
| 120 | | - |
| 121 | if (offset == rulesSize) partially evaluated: offset == rulesSize| yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
| 122 | return true; executed: return true;Execution Count:15 | 15 |
| 123 | | - |
| 124 | } while (((rules[offset] == Q_AND) never evaluated: (rules[offset] == Q_AND) | 0 |
| 125 | || (rules[offset] == Q_OR) never evaluated: (rules[offset] == Q_OR) | 0 |
| 126 | || (rules[offset] == Q_NEWRULE)) never evaluated: (rules[offset] == Q_NEWRULE) | 0 |
| 127 | && ++offset != rulesSize); never evaluated: ++offset != rulesSize | 0 |
| 128 | | - |
| 129 | | - |
| 130 | return false; never executed: return false; | 0 |
| 131 | } | - |
| 132 | static uint numerusHelper(int n, const uchar *rules, uint rulesSize) | - |
| 133 | { | - |
| 134 | uint result = 0; | - |
| 135 | uint i = 0; | - |
| 136 | | - |
| 137 | if (rulesSize == 0) partially evaluated: rulesSize == 0| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 138 | return 0; never executed: return 0; | 0 |
| 139 | | - |
| 140 | for (;;) { | - |
| 141 | bool orExprTruthValue = false; | - |
| 142 | | - |
| 143 | for (;;) { | - |
| 144 | bool andExprTruthValue = true; | - |
| 145 | | - |
| 146 | for (;;) { | - |
| 147 | bool truthValue = true; | - |
| 148 | int opcode = rules[i++]; | - |
| 149 | | - |
| 150 | int leftOperand = n; | - |
| 151 | if (opcode & Q_MOD_10) { partially evaluated: opcode & Q_MOD_10| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 152 | leftOperand %= 10; | - |
| 153 | } else if (opcode & Q_MOD_100) { partially evaluated: opcode & Q_MOD_100| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 154 | leftOperand %= 100; | - |
| 155 | } else if (opcode & Q_LEAD_1000) { partially evaluated: opcode & Q_LEAD_1000| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 156 | while (leftOperand >= 1000) never evaluated: leftOperand >= 1000 | 0 |
| 157 | leftOperand /= 1000; never executed: leftOperand /= 1000; | 0 |
| 158 | } | 0 |
| 159 | | - |
| 160 | int op = opcode & Q_OP_MASK; | - |
| 161 | int rightOperand = rules[i++]; | - |
| 162 | | - |
| 163 | switch (op) { | - |
| 164 | case Q_EQ: | - |
| 165 | truthValue = (leftOperand == rightOperand); | - |
| 166 | break; executed: break;Execution Count:9 | 9 |
| 167 | case Q_LT: | - |
| 168 | truthValue = (leftOperand < rightOperand); | - |
| 169 | break; | 0 |
| 170 | case Q_LEQ: | - |
| 171 | truthValue = (leftOperand <= rightOperand); | - |
| 172 | break; | 0 |
| 173 | case Q_BETWEEN: | - |
| 174 | int bottom = rightOperand; | - |
| 175 | int top = rules[i++]; | - |
| 176 | truthValue = (leftOperand >= bottom && leftOperand <= top); never evaluated: leftOperand >= bottom never evaluated: leftOperand <= top | 0 |
| 177 | } | 0 |
| 178 | | - |
| 179 | if (opcode & Q_NOT) partially evaluated: opcode & Q_NOT| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 180 | truthValue = !truthValue; never executed: truthValue = !truthValue; | 0 |
| 181 | | - |
| 182 | andExprTruthValue = andExprTruthValue && truthValue; partially evaluated: andExprTruthValue| yes Evaluation Count:9 | no Evaluation Count:0 |
evaluated: truthValue| yes Evaluation Count:3 | yes Evaluation Count:6 |
| 0-9 |
| 183 | | - |
| 184 | if (i == rulesSize || rules[i] != Q_AND) partially evaluated: i == rulesSize| yes Evaluation Count:9 | no Evaluation Count:0 |
never evaluated: rules[i] != Q_AND | 0-9 |
| 185 | break; executed: break;Execution Count:9 | 9 |
| 186 | ++i; | - |
| 187 | } | 0 |
| 188 | | - |
| 189 | orExprTruthValue = orExprTruthValue || andExprTruthValue; partially evaluated: orExprTruthValue| no Evaluation Count:0 | yes Evaluation Count:9 |
evaluated: andExprTruthValue| yes Evaluation Count:3 | yes Evaluation Count:6 |
| 0-9 |
| 190 | | - |
| 191 | if (i == rulesSize || rules[i] != Q_OR) partially evaluated: i == rulesSize| yes Evaluation Count:9 | no Evaluation Count:0 |
never evaluated: rules[i] != Q_OR | 0-9 |
| 192 | break; executed: break;Execution Count:9 | 9 |
| 193 | ++i; | - |
| 194 | } | 0 |
| 195 | | - |
| 196 | if (orExprTruthValue) evaluated: orExprTruthValue| yes Evaluation Count:3 | yes Evaluation Count:6 |
| 3-6 |
| 197 | return result; executed: return result;Execution Count:3 | 3 |
| 198 | | - |
| 199 | ++result; | - |
| 200 | | - |
| 201 | if (i == rulesSize) partially evaluated: i == rulesSize| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 202 | return result; executed: return result;Execution Count:6 | 6 |
| 203 | | - |
| 204 | i++; | - |
| 205 | } | 0 |
| 206 | | - |
| 207 | qt_noop(); | - |
| 208 | } | 0 |
| 209 | | - |
| 210 | class QTranslatorPrivate : public QObjectPrivate | - |
| 211 | { | - |
| 212 | inline QTranslator* q_func() { return static_cast<QTranslator *>(q_ptr); } inline const QTranslator* q_func() const { return static_cast<const QTranslator *>(q_ptr); } friend class QTranslator; | - |
| 213 | public: | - |
| 214 | enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96 }; | - |
| 215 | | - |
| 216 | QTranslatorPrivate() : | - |
| 217 | | - |
| 218 | used_mmap(0), | - |
| 219 | | - |
| 220 | unmapPointer(0), unmapLength(0), resource(0), | - |
| 221 | messageArray(0), offsetArray(0), contextArray(0), numerusRulesArray(0), | - |
| 222 | messageLength(0), offsetLength(0), contextLength(0), numerusRulesLength(0) {} executed: }Execution Count:14 | 14 |
| 223 | | - |
| 224 | | - |
| 225 | bool used_mmap : 1; | - |
| 226 | | - |
| 227 | char *unmapPointer; | - |
| 228 | quint32 unmapLength; | - |
| 229 | | - |
| 230 | | - |
| 231 | QResource *resource; | - |
| 232 | | - |
| 233 | | - |
| 234 | QList<QTranslator*> subTranslators; | - |
| 235 | | - |
| 236 | | - |
| 237 | | - |
| 238 | const uchar *messageArray; | - |
| 239 | const uchar *offsetArray; | - |
| 240 | const uchar *contextArray; | - |
| 241 | const uchar *numerusRulesArray; | - |
| 242 | uint messageLength; | - |
| 243 | uint offsetLength; | - |
| 244 | uint contextLength; | - |
| 245 | uint numerusRulesLength; | - |
| 246 | | - |
| 247 | bool do_load(const QString &filename, const QString &directory); | - |
| 248 | bool do_load(const uchar *data, int len, const QString &directory); | - |
| 249 | QString do_translate(const char *context, const char *sourceText, const char *comment, | - |
| 250 | int n) const; | - |
| 251 | void clear(); | - |
| 252 | }; | - |
| 253 | QTranslator::QTranslator(QObject * parent) | - |
| 254 | : QObject(*new QTranslatorPrivate, parent) | - |
| 255 | { | - |
| 256 | } executed: }Execution Count:14 | 14 |
| 257 | | - |
| 258 | | - |
| 259 | | - |
| 260 | | - |
| 261 | | - |
| 262 | QTranslator::~QTranslator() | - |
| 263 | { | - |
| 264 | if (QCoreApplication::instance()) partially evaluated: QCoreApplication::instance()| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 265 | QCoreApplication::removeTranslator(this); executed: QCoreApplication::removeTranslator(this);Execution Count:14 | 14 |
| 266 | QTranslatorPrivate * const d = d_func(); | - |
| 267 | d->clear(); | - |
| 268 | } executed: }Execution Count:14 | 14 |
| 269 | bool QTranslator::load(const QString & filename, const QString & directory, | - |
| 270 | const QString & search_delimiters, | - |
| 271 | const QString & suffix) | - |
| 272 | { | - |
| 273 | QTranslatorPrivate * const d = d_func(); | - |
| 274 | d->clear(); | - |
| 275 | | - |
| 276 | QString prefix; | - |
| 277 | if (QFileInfo(filename).isRelative()) { evaluated: QFileInfo(filename).isRelative()| yes Evaluation Count:15 | yes Evaluation Count:3 |
| 3-15 |
| 278 | prefix = directory; | - |
| 279 | if (prefix.length() && !prefix.endsWith(QLatin1Char('/'))) evaluated: prefix.length()| yes Evaluation Count:1 | yes Evaluation Count:14 |
partially evaluated: !prefix.endsWith(QLatin1Char('/'))| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-14 |
| 280 | prefix += QLatin1Char('/'); executed: prefix += QLatin1Char('/');Execution Count:1 | 1 |
| 281 | } executed: }Execution Count:15 | 15 |
| 282 | | - |
| 283 | QString fname = filename; | - |
| 284 | QString realname; | - |
| 285 | QString delims; | - |
| 286 | delims = search_delimiters.isNull() ? QString::fromLatin1("_.") : search_delimiters; partially evaluated: search_delimiters.isNull()| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
| 287 | | - |
| 288 | for (;;) { | - |
| 289 | QFileInfo fi; | - |
| 290 | | - |
| 291 | realname = prefix + fname + (suffix.isNull() ? QString::fromLatin1(".qm") : suffix); partially evaluated: suffix.isNull()| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-18 |
| 292 | fi.setFile(realname); | - |
| 293 | if (fi.isReadable() && fi.isFile()) evaluated: fi.isReadable()| yes Evaluation Count:9 | yes Evaluation Count:9 |
partially evaluated: fi.isFile()| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 294 | break; executed: break;Execution Count:9 | 9 |
| 295 | | - |
| 296 | realname = prefix + fname; | - |
| 297 | fi.setFile(realname); | - |
| 298 | if (fi.isReadable() && fi.isFile()) evaluated: fi.isReadable()| yes Evaluation Count:6 | yes Evaluation Count:3 |
evaluated: fi.isFile()| yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-6 |
| 299 | break; executed: break;Execution Count:5 | 5 |
| 300 | | - |
| 301 | int rightmost = 0; | - |
| 302 | for (int i = 0; i < (int)delims.length(); i++) { evaluated: i < (int)delims.length()| yes Evaluation Count:8 | yes Evaluation Count:4 |
| 4-8 |
| 303 | int k = fname.lastIndexOf(delims[i]); | - |
| 304 | if (k > rightmost) partially evaluated: k > rightmost| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 305 | rightmost = k; never executed: rightmost = k; | 0 |
| 306 | } executed: }Execution Count:8 | 8 |
| 307 | | - |
| 308 | | - |
| 309 | if (rightmost == 0) partially evaluated: rightmost == 0| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 310 | return false; executed: return false;Execution Count:4 | 4 |
| 311 | | - |
| 312 | fname.truncate(rightmost); | - |
| 313 | } | 0 |
| 314 | | - |
| 315 | | - |
| 316 | return d->do_load(realname, directory); executed: return d->do_load(realname, directory);Execution Count:14 | 14 |
| 317 | } | - |
| 318 | | - |
| 319 | bool QTranslatorPrivate::do_load(const QString &realname, const QString &directory) | - |
| 320 | { | - |
| 321 | QTranslatorPrivate *d = this; | - |
| 322 | bool ok = false; | - |
| 323 | | - |
| 324 | if (realname.startsWith(':')) { evaluated: realname.startsWith(':')| yes Evaluation Count:3 | yes Evaluation Count:11 |
| 3-11 |
| 325 | | - |
| 326 | | - |
| 327 | qt_noop(); | - |
| 328 | d->resource = new QResource(realname); | - |
| 329 | if (resource->isValid() && !resource->isCompressed() && resource->size() > MagicLength partially evaluated: resource->isValid()| yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: !resource->isCompressed()| yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: resource->size() > MagicLength| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-3 |
| 330 | && !memcmp(resource->data(), magic, MagicLength)) { partially evaluated: !memcmp(resource->data(), magic, MagicLength)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 331 | d->unmapLength = resource->size(); | - |
| 332 | d->unmapPointer = reinterpret_cast<char *>(const_cast<uchar *>(resource->data())); | - |
| 333 | | - |
| 334 | d->used_mmap = false; | - |
| 335 | | - |
| 336 | ok = true; | - |
| 337 | } else { executed: }Execution Count:2 | 2 |
| 338 | delete resource; | - |
| 339 | resource = 0; | - |
| 340 | } executed: }Execution Count:1 | 1 |
| 341 | } | - |
| 342 | | - |
| 343 | if (!ok) { evaluated: !ok| yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
| 344 | QFile file(realname); | - |
| 345 | if (!file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) partially evaluated: !file.open(QIODevice::ReadOnly | QIODevice::Unbuffered)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 346 | return false; never executed: return false; | 0 |
| 347 | | - |
| 348 | qint64 fileSize = file.size(); | - |
| 349 | if (fileSize <= MagicLength || quint32(-1) <= fileSize) partially evaluated: fileSize <= MagicLength| no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: quint32(-1) <= fileSize| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 350 | return false; never executed: return false; | 0 |
| 351 | | - |
| 352 | { | - |
| 353 | char magicBuffer[MagicLength]; | - |
| 354 | if (MagicLength != file.read(magicBuffer, MagicLength) partially evaluated: MagicLength != file.read(magicBuffer, MagicLength)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 355 | || memcmp(magicBuffer, magic, MagicLength)) partially evaluated: memcmp(magicBuffer, magic, MagicLength)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 356 | return false; never executed: return false; | 0 |
| 357 | } | - |
| 358 | | - |
| 359 | d->unmapLength = quint32(fileSize); | - |
| 360 | int fd = file.handle(); | - |
| 361 | if (fd >= 0) { evaluated: fd >= 0| yes Evaluation Count:11 | yes Evaluation Count:1 |
| 1-11 |
| 362 | char *ptr; | - |
| 363 | ptr = reinterpret_cast<char *>( | - |
| 364 | mmap(0, d->unmapLength, | - |
| 365 | 0x1, | - |
| 366 | 0 | 0x02, | - |
| 367 | fd, 0)); | - |
| 368 | if (ptr && ptr != reinterpret_cast<char *>(((void *) -1))) { partially evaluated: ptr| yes Evaluation Count:11 | no Evaluation Count:0 |
partially evaluated: ptr != reinterpret_cast<char *>(((void *) -1))| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 369 | file.close(); | - |
| 370 | d->used_mmap = true; | - |
| 371 | d->unmapPointer = ptr; | - |
| 372 | ok = true; | - |
| 373 | } executed: }Execution Count:11 | 11 |
| 374 | } executed: }Execution Count:11 | 11 |
| 375 | | - |
| 376 | | - |
| 377 | if (!ok) { evaluated: !ok| yes Evaluation Count:1 | yes Evaluation Count:11 |
| 1-11 |
| 378 | d->unmapPointer = new char[d->unmapLength]; | - |
| 379 | if (d->unmapPointer) { partially evaluated: d->unmapPointer| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 380 | file.seek(0); | - |
| 381 | qint64 readResult = file.read(d->unmapPointer, d->unmapLength); | - |
| 382 | if (readResult == qint64(unmapLength)) partially evaluated: readResult == qint64(unmapLength)| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 383 | ok = true; executed: ok = true;Execution Count:1 | 1 |
| 384 | } executed: }Execution Count:1 | 1 |
| 385 | } executed: }Execution Count:1 | 1 |
| 386 | } executed: }Execution Count:12 | 12 |
| 387 | | - |
| 388 | if (ok && d->do_load(reinterpret_cast<const uchar *>(d->unmapPointer), d->unmapLength, directory)) partially evaluated: ok| yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: d->do_load(reinterpret_cast<const uchar *>(d->unmapPointer), d->unmapLength, directory)| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 389 | return true; executed: return true;Execution Count:14 | 14 |
| 390 | | - |
| 391 | | - |
| 392 | if (used_mmap) { never evaluated: used_mmap | 0 |
| 393 | used_mmap = false; | - |
| 394 | munmap(unmapPointer, unmapLength); | - |
| 395 | } else | 0 |
| 396 | | - |
| 397 | if (!d->resource) never evaluated: !d->resource | 0 |
| 398 | delete [] unmapPointer; never executed: delete [] unmapPointer; | 0 |
| 399 | | - |
| 400 | delete d->resource; | - |
| 401 | d->resource = 0; | - |
| 402 | d->unmapPointer = 0; | - |
| 403 | d->unmapLength = 0; | - |
| 404 | | - |
| 405 | return false; never executed: return false; | 0 |
| 406 | } | - |
| 407 | | - |
| 408 | static QString find_translation(const QLocale & locale, | - |
| 409 | const QString & filename, | - |
| 410 | const QString & prefix, | - |
| 411 | const QString & directory, | - |
| 412 | const QString & suffix) | - |
| 413 | { | - |
| 414 | QString path; | - |
| 415 | if (QFileInfo(filename).isRelative()) { never evaluated: QFileInfo(filename).isRelative() | 0 |
| 416 | path = directory; | - |
| 417 | if (!path.isEmpty() && !path.endsWith(QLatin1Char('/'))) never evaluated: !path.isEmpty() never evaluated: !path.endsWith(QLatin1Char('/')) | 0 |
| 418 | path += QLatin1Char('/'); never executed: path += QLatin1Char('/'); | 0 |
| 419 | } | 0 |
| 420 | | - |
| 421 | QFileInfo fi; | - |
| 422 | QString realname; | - |
| 423 | QStringList fuzzyLocales; | - |
| 424 | | - |
| 425 | | - |
| 426 | | - |
| 427 | QStringList languages = locale.uiLanguages(); | - |
| 428 | | - |
| 429 | for (int i = languages.size()-1; i >= 0; --i) { | 0 |
| 430 | QString lang = languages.at(i); | - |
| 431 | QString lowerLang = lang.toLower(); | - |
| 432 | if (lang != lowerLang) never evaluated: lang != lowerLang | 0 |
| 433 | languages.insert(i+1, lowerLang); never executed: languages.insert(i+1, lowerLang); | 0 |
| 434 | } | 0 |
| 435 | | - |
| 436 | | - |
| 437 | | - |
| 438 | for (QForeachContainer<__typeof__(languages)> _container_(languages); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QString localeName = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 439 | localeName.replace(QLatin1Char('-'), QLatin1Char('_')); | - |
| 440 | | - |
| 441 | realname = path + filename + prefix + localeName + (suffix.isNull() ? QLatin1String(".qm") : suffix); never evaluated: suffix.isNull() | 0 |
| 442 | fi.setFile(realname); | - |
| 443 | if (fi.isReadable() && fi.isFile()) never evaluated: fi.isReadable() never evaluated: fi.isFile() | 0 |
| 444 | return realname; never executed: return realname; | 0 |
| 445 | | - |
| 446 | realname = path + filename + prefix + localeName; | - |
| 447 | fi.setFile(realname); | - |
| 448 | if (fi.isReadable() && fi.isFile()) never evaluated: fi.isReadable() never evaluated: fi.isFile() | 0 |
| 449 | return realname; never executed: return realname; | 0 |
| 450 | | - |
| 451 | fuzzyLocales.append(localeName); | - |
| 452 | } | 0 |
| 453 | | - |
| 454 | | - |
| 455 | for (QForeachContainer<__typeof__(fuzzyLocales)> _container_(fuzzyLocales); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QString localeName = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 456 | for (;;) { | - |
| 457 | int rightmost = localeName.lastIndexOf(QLatin1Char('_')); | - |
| 458 | | - |
| 459 | if (rightmost <= 0) never evaluated: rightmost <= 0 | 0 |
| 460 | break; | 0 |
| 461 | localeName.truncate(rightmost); | - |
| 462 | | - |
| 463 | realname = path + filename + prefix + localeName + (suffix.isNull() ? QLatin1String(".qm") : suffix); never evaluated: suffix.isNull() | 0 |
| 464 | fi.setFile(realname); | - |
| 465 | if (fi.isReadable() && fi.isFile()) never evaluated: fi.isReadable() never evaluated: fi.isFile() | 0 |
| 466 | return realname; never executed: return realname; | 0 |
| 467 | | - |
| 468 | realname = path + filename + prefix + localeName; | - |
| 469 | fi.setFile(realname); | - |
| 470 | if (fi.isReadable() && fi.isFile()) never evaluated: fi.isReadable() never evaluated: fi.isFile() | 0 |
| 471 | return realname; never executed: return realname; | 0 |
| 472 | } | 0 |
| 473 | } | 0 |
| 474 | | - |
| 475 | if (!suffix.isNull()) { never evaluated: !suffix.isNull() | 0 |
| 476 | realname = path + filename + suffix; | - |
| 477 | fi.setFile(realname); | - |
| 478 | if (fi.isReadable() && fi.isFile()) never evaluated: fi.isReadable() never evaluated: fi.isFile() | 0 |
| 479 | return realname; never executed: return realname; | 0 |
| 480 | } | 0 |
| 481 | | - |
| 482 | realname = path + filename + prefix; | - |
| 483 | fi.setFile(realname); | - |
| 484 | if (fi.isReadable() && fi.isFile()) never evaluated: fi.isReadable() never evaluated: fi.isFile() | 0 |
| 485 | return realname; never executed: return realname; | 0 |
| 486 | | - |
| 487 | realname = path + filename; | - |
| 488 | fi.setFile(realname); | - |
| 489 | if (fi.isReadable() && fi.isFile()) never evaluated: fi.isReadable() never evaluated: fi.isFile() | 0 |
| 490 | return realname; never executed: return realname; | 0 |
| 491 | | - |
| 492 | return QString(); never executed: return QString(); | 0 |
| 493 | } | - |
| 494 | bool QTranslator::load(const QLocale & locale, | - |
| 495 | const QString & filename, | - |
| 496 | const QString & prefix, | - |
| 497 | const QString & directory, | - |
| 498 | const QString & suffix) | - |
| 499 | { | - |
| 500 | QTranslatorPrivate * const d = d_func(); | - |
| 501 | d->clear(); | - |
| 502 | QString fname = find_translation(locale, filename, prefix, directory, suffix); | - |
| 503 | return !fname.isEmpty() && d->do_load(fname, directory); never executed: return !fname.isEmpty() && d->do_load(fname, directory); | 0 |
| 504 | } | - |
| 505 | bool QTranslator::load(const uchar *data, int len, const QString &directory) | - |
| 506 | { | - |
| 507 | QTranslatorPrivate * const d = d_func(); | - |
| 508 | d->clear(); | - |
| 509 | | - |
| 510 | if (!data || len < MagicLength || memcmp(data, magic, MagicLength)) partially evaluated: !data| no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: len < MagicLength| no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: memcmp(data, magic, MagicLength)| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 511 | return false; never executed: return false; | 0 |
| 512 | | - |
| 513 | return d->do_load(data, len, directory); executed: return d->do_load(data, len, directory);Execution Count:2 | 2 |
| 514 | } | - |
| 515 | | - |
| 516 | static quint8 read8(const uchar *data) | - |
| 517 | { | - |
| 518 | return qFromBigEndian<quint8>(data); executed: return qFromBigEndian<quint8>(data);Execution Count:902 | 902 |
| 519 | } | - |
| 520 | | - |
| 521 | static quint16 read16(const uchar *data) | - |
| 522 | { | - |
| 523 | return qFromBigEndian<quint16>(data); never executed: return qFromBigEndian<quint16>(data); | 0 |
| 524 | } | - |
| 525 | | - |
| 526 | static quint32 read32(const uchar *data) | - |
| 527 | { | - |
| 528 | return qFromBigEndian<quint32>(data); executed: return qFromBigEndian<quint32>(data);Execution Count:3331 | 3331 |
| 529 | } | - |
| 530 | | - |
| 531 | bool QTranslatorPrivate::do_load(const uchar *data, int len, const QString &directory) | - |
| 532 | { | - |
| 533 | bool ok = true; | - |
| 534 | const uchar *end = data + len; | - |
| 535 | | - |
| 536 | data += MagicLength; | - |
| 537 | | - |
| 538 | QStringList dependencies; | - |
| 539 | while (data < end - 4) { evaluated: data < end - 4| yes Evaluation Count:49 | yes Evaluation Count:16 |
| 16-49 |
| 540 | quint8 tag = read8(data++); | - |
| 541 | quint32 blockLen = read32(data); | - |
| 542 | data += 4; | - |
| 543 | if (!tag || !blockLen) partially evaluated: !tag| no Evaluation Count:0 | yes Evaluation Count:49 |
partially evaluated: !blockLen| no Evaluation Count:0 | yes Evaluation Count:49 |
| 0-49 |
| 544 | break; | 0 |
| 545 | if (quint32(end - data) < blockLen) { partially evaluated: quint32(end - data) < blockLen| no Evaluation Count:0 | yes Evaluation Count:49 |
| 0-49 |
| 546 | ok = false; | - |
| 547 | break; | 0 |
| 548 | } | - |
| 549 | | - |
| 550 | if (tag == QTranslatorPrivate::Contexts) { partially evaluated: tag == QTranslatorPrivate::Contexts| no Evaluation Count:0 | yes Evaluation Count:49 |
| 0-49 |
| 551 | contextArray = data; | - |
| 552 | contextLength = blockLen; | - |
| 553 | } else if (tag == QTranslatorPrivate::Hashes) { evaluated: tag == QTranslatorPrivate::Hashes| yes Evaluation Count:16 | yes Evaluation Count:33 |
| 0-33 |
| 554 | offsetArray = data; | - |
| 555 | offsetLength = blockLen; | - |
| 556 | } else if (tag == QTranslatorPrivate::Messages) { evaluated: tag == QTranslatorPrivate::Messages| yes Evaluation Count:16 | yes Evaluation Count:17 |
executed: }Execution Count:16 | 16-17 |
| 557 | messageArray = data; | - |
| 558 | messageLength = blockLen; | - |
| 559 | } else if (tag == QTranslatorPrivate::NumerusRules) { evaluated: tag == QTranslatorPrivate::NumerusRules| yes Evaluation Count:15 | yes Evaluation Count:2 |
executed: }Execution Count:16 | 2-16 |
| 560 | numerusRulesArray = data; | - |
| 561 | numerusRulesLength = blockLen; | - |
| 562 | } else if (tag == QTranslatorPrivate::Dependencies) { partially evaluated: tag == QTranslatorPrivate::Dependencies| yes Evaluation Count:2 | no Evaluation Count:0 |
executed: }Execution Count:15 | 0-15 |
| 563 | QDataStream stream(QByteArray::fromRawData((const char*)data, blockLen)); | - |
| 564 | QString dep; | - |
| 565 | while (!stream.atEnd()) { evaluated: !stream.atEnd()| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 566 | stream >> dep; | - |
| 567 | dependencies.append(dep); | - |
| 568 | } executed: }Execution Count:2 | 2 |
| 569 | } executed: }Execution Count:2 | 2 |
| 570 | | - |
| 571 | data += blockLen; | - |
| 572 | } executed: }Execution Count:49 | 49 |
| 573 | | - |
| 574 | if (dependencies.isEmpty() && (!offsetArray || !messageArray)) evaluated: dependencies.isEmpty()| yes Evaluation Count:14 | yes Evaluation Count:2 |
partially evaluated: !offsetArray| no Evaluation Count:0 | yes Evaluation Count:14 |
partially evaluated: !messageArray| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 575 | ok = false; never executed: ok = false; | 0 |
| 576 | if (ok && !isValidNumerusRules(numerusRulesArray, numerusRulesLength)) partially evaluated: ok| yes Evaluation Count:16 | no Evaluation Count:0 |
partially evaluated: !isValidNumerusRules(numerusRulesArray, numerusRulesLength)| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 577 | ok = false; never executed: ok = false; | 0 |
| 578 | if (ok) { partially evaluated: ok| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 579 | const int dependenciesCount = dependencies.count(); | - |
| 580 | subTranslators.reserve(dependenciesCount); | - |
| 581 | for (int i = 0 ; i < dependenciesCount; ++i) { evaluated: i < dependenciesCount| yes Evaluation Count:2 | yes Evaluation Count:16 |
| 2-16 |
| 582 | QTranslator *translator = new QTranslator; | - |
| 583 | subTranslators.append(translator); | - |
| 584 | ok = translator->load(dependencies.at(i), directory); | - |
| 585 | if (!ok) partially evaluated: !ok| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 586 | break; | 0 |
| 587 | } executed: }Execution Count:2 | 2 |
| 588 | | - |
| 589 | | - |
| 590 | if (!ok) { partially evaluated: !ok| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 591 | qDeleteAll(subTranslators); | - |
| 592 | subTranslators.clear(); | - |
| 593 | } | 0 |
| 594 | } executed: }Execution Count:16 | 16 |
| 595 | | - |
| 596 | if (!ok) { partially evaluated: !ok| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 597 | messageArray = 0; | - |
| 598 | contextArray = 0; | - |
| 599 | offsetArray = 0; | - |
| 600 | numerusRulesArray = 0; | - |
| 601 | messageLength = 0; | - |
| 602 | contextLength = 0; | - |
| 603 | offsetLength = 0; | - |
| 604 | numerusRulesLength = 0; | - |
| 605 | } | 0 |
| 606 | | - |
| 607 | return ok; executed: return ok;Execution Count:16 | 16 |
| 608 | } | - |
| 609 | | - |
| 610 | static QString getMessage(const uchar *m, const uchar *end, const char *context, | - |
| 611 | const char *sourceText, const char *comment, uint numerus) | - |
| 612 | { | - |
| 613 | const uchar *tn = 0; | - |
| 614 | uint tn_length = 0; | - |
| 615 | | - |
| 616 | for (;;) { | - |
| 617 | uchar tag = 0; | - |
| 618 | if (m < end) partially evaluated: m < end| yes Evaluation Count:853 | no Evaluation Count:0 |
| 0-853 |
| 619 | tag = read8(m++); executed: tag = read8(m++);Execution Count:853 | 853 |
| 620 | switch((Tag)tag) { | - |
| 621 | case Tag_End: | - |
| 622 | goto end; executed: goto end;Execution Count:144 | 144 |
| 623 | case Tag_Translation: { | - |
| 624 | int len = read32(m); | - |
| 625 | if (len % 1) partially evaluated: len % 1| no Evaluation Count:0 | yes Evaluation Count:187 |
| 0-187 |
| 626 | return QString(); never executed: return QString(); | 0 |
| 627 | m += 4; | - |
| 628 | if (!numerus--) { evaluated: !numerus--| yes Evaluation Count:173 | yes Evaluation Count:14 |
| 14-173 |
| 629 | tn_length = len; | - |
| 630 | tn = m; | - |
| 631 | } executed: }Execution Count:173 | 173 |
| 632 | m += len; | - |
| 633 | break; executed: break;Execution Count:187 | 187 |
| 634 | } | - |
| 635 | case Tag_Obsolete1: | - |
| 636 | m += 4; | - |
| 637 | break; executed: break;Execution Count:3 | 3 |
| 638 | case Tag_SourceText: { | - |
| 639 | quint32 len = read32(m); | - |
| 640 | m += 4; | - |
| 641 | if (!match(m, sourceText, len)) partially evaluated: !match(m, sourceText, len)| no Evaluation Count:0 | yes Evaluation Count:173 |
| 0-173 |
| 642 | return QString(); never executed: return QString(); | 0 |
| 643 | m += len; | - |
| 644 | } | - |
| 645 | break; executed: break;Execution Count:173 | 173 |
| 646 | case Tag_Context: { | - |
| 647 | quint32 len = read32(m); | - |
| 648 | m += 4; | - |
| 649 | if (!match(m, context, len)) evaluated: !match(m, context, len)| yes Evaluation Count:29 | yes Evaluation Count:144 |
| 29-144 |
| 650 | return QString(); executed: return QString();Execution Count:29 | 29 |
| 651 | m += len; | - |
| 652 | } | - |
| 653 | break; executed: break;Execution Count:144 | 144 |
| 654 | case Tag_Comment: { | - |
| 655 | quint32 len = read32(m); | - |
| 656 | m += 4; | - |
| 657 | if (*m && !match(m, comment, len)) evaluated: *m| yes Evaluation Count:167 | yes Evaluation Count:6 |
partially evaluated: !match(m, comment, len)| no Evaluation Count:0 | yes Evaluation Count:167 |
| 0-167 |
| 658 | return QString(); never executed: return QString(); | 0 |
| 659 | m += len; | - |
| 660 | } | - |
| 661 | break; executed: break;Execution Count:173 | 173 |
| 662 | default: | - |
| 663 | return QString(); never executed: return QString(); | 0 |
| 664 | } | - |
| 665 | } executed: }Execution Count:680 | 680 |
| 666 | end: code before this statement never executed: end: | 0 |
| 667 | if (!tn) partially evaluated: !tn| no Evaluation Count:0 | yes Evaluation Count:144 |
| 0-144 |
| 668 | return QString(); never executed: return QString(); | 0 |
| 669 | QString str = QString((const QChar *)tn, tn_length/2); | - |
| 670 | if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) { partially evaluated: QSysInfo::ByteOrder == QSysInfo::LittleEndian| yes Evaluation Count:144 | no Evaluation Count:0 |
| 0-144 |
| 671 | for (int i = 0; i < str.length(); ++i) evaluated: i < str.length()| yes Evaluation Count:818 | yes Evaluation Count:144 |
| 144-818 |
| 672 | str[i] = QChar((str.at(i).unicode() >> 8) + ((str.at(i).unicode() << 8) & 0xff00)); executed: str[i] = QChar((str.at(i).unicode() >> 8) + ((str.at(i).unicode() << 8) & 0xff00));Execution Count:818 | 818 |
| 673 | } executed: }Execution Count:144 | 144 |
| 674 | return str; executed: return str;Execution Count:144 | 144 |
| 675 | } | - |
| 676 | | - |
| 677 | QString QTranslatorPrivate::do_translate(const char *context, const char *sourceText, | - |
| 678 | const char *comment, int n) const | - |
| 679 | { | - |
| 680 | if (context == 0) partially evaluated: context == 0| no Evaluation Count:0 | yes Evaluation Count:220 |
| 0-220 |
| 681 | context = ""; never executed: context = ""; | 0 |
| 682 | if (sourceText == 0) partially evaluated: sourceText == 0| no Evaluation Count:0 | yes Evaluation Count:220 |
| 0-220 |
| 683 | sourceText = ""; never executed: sourceText = ""; | 0 |
| 684 | if (comment == 0) evaluated: comment == 0| yes Evaluation Count:163 | yes Evaluation Count:57 |
| 57-163 |
| 685 | comment = ""; executed: comment = "";Execution Count:163 | 163 |
| 686 | | - |
| 687 | uint numerus = 0; | - |
| 688 | size_t numItems = 0; | - |
| 689 | | - |
| 690 | if (!offsetLength) partially evaluated: !offsetLength| no Evaluation Count:0 | yes Evaluation Count:220 |
| 0-220 |
| 691 | goto searchDependencies; never executed: goto searchDependencies; | 0 |
| 692 | | - |
| 693 | | - |
| 694 | | - |
| 695 | | - |
| 696 | | - |
| 697 | if (contextLength) { partially evaluated: contextLength| no Evaluation Count:0 | yes Evaluation Count:220 |
| 0-220 |
| 698 | quint16 hTableSize = read16(contextArray); | - |
| 699 | uint g = elfHash(context) % hTableSize; | - |
| 700 | const uchar *c = contextArray + 2 + (g << 1); | - |
| 701 | quint16 off = read16(c); | - |
| 702 | c += 2; | - |
| 703 | if (off == 0) never evaluated: off == 0 | 0 |
| 704 | return QString(); never executed: return QString(); | 0 |
| 705 | c = contextArray + (2 + (hTableSize << 1) + (off << 1)); | - |
| 706 | | - |
| 707 | for (;;) { | - |
| 708 | quint8 len = read8(c++); | - |
| 709 | if (len == 0) never evaluated: len == 0 | 0 |
| 710 | return QString(); never executed: return QString(); | 0 |
| 711 | if (match(c, context, len)) never evaluated: match(c, context, len) | 0 |
| 712 | break; | 0 |
| 713 | c += len; | - |
| 714 | } | 0 |
| 715 | } | 0 |
| 716 | | - |
| 717 | numItems = offsetLength / (2 * sizeof(quint32)); | - |
| 718 | if (!numItems) partially evaluated: !numItems| no Evaluation Count:0 | yes Evaluation Count:220 |
| 0-220 |
| 719 | goto searchDependencies; never executed: goto searchDependencies; | 0 |
| 720 | | - |
| 721 | if (n >= 0) evaluated: n >= 0| yes Evaluation Count:9 | yes Evaluation Count:211 |
| 9-211 |
| 722 | numerus = numerusHelper(n, numerusRulesArray, numerusRulesLength); executed: numerus = numerusHelper(n, numerusRulesArray, numerusRulesLength);Execution Count:9 | 9 |
| 723 | | - |
| 724 | for (;;) { | - |
| 725 | quint32 h = 0; | - |
| 726 | elfHash_continue(sourceText, h); | - |
| 727 | elfHash_continue(comment, h); | - |
| 728 | elfHash_finish(h); | - |
| 729 | | - |
| 730 | const uchar *start = offsetArray; | - |
| 731 | const uchar *end = start + ((numItems-1) << 3); | - |
| 732 | while (start <= end) { evaluated: start <= end| yes Evaluation Count:1871 | yes Evaluation Count:99 |
| 99-1871 |
| 733 | const uchar *middle = start + (((end - start) >> 4) << 3); | - |
| 734 | uint hash = read32(middle); | - |
| 735 | if (h == hash) { evaluated: h == hash| yes Evaluation Count:173 | yes Evaluation Count:1698 |
| 173-1698 |
| 736 | start = middle; | - |
| 737 | break; executed: break;Execution Count:173 | 173 |
| 738 | } else if (hash < h) { evaluated: hash < h| yes Evaluation Count:685 | yes Evaluation Count:1013 |
| 685-1013 |
| 739 | start = middle + 8; | - |
| 740 | } else { executed: }Execution Count:685 | 685 |
| 741 | end = middle - 8; | - |
| 742 | } executed: }Execution Count:1013 | 1013 |
| 743 | } | - |
| 744 | | - |
| 745 | if (start <= end) { evaluated: start <= end| yes Evaluation Count:173 | yes Evaluation Count:99 |
| 99-173 |
| 746 | | - |
| 747 | while (start != offsetArray && read32(start) == read32(start-8)) evaluated: start != offsetArray| yes Evaluation Count:165 | yes Evaluation Count:8 |
partially evaluated: read32(start) == read32(start-8)| no Evaluation Count:0 | yes Evaluation Count:165 |
| 0-165 |
| 748 | start -= 8; never executed: start -= 8; | 0 |
| 749 | | - |
| 750 | while (start < offsetArray + offsetLength) { partially evaluated: start < offsetArray + offsetLength| yes Evaluation Count:202 | no Evaluation Count:0 |
| 0-202 |
| 751 | quint32 rh = read32(start); | - |
| 752 | start += 4; | - |
| 753 | if (rh != h) evaluated: rh != h| yes Evaluation Count:29 | yes Evaluation Count:173 |
| 29-173 |
| 754 | break; executed: break;Execution Count:29 | 29 |
| 755 | quint32 ro = read32(start); | - |
| 756 | start += 4; | - |
| 757 | QString tn = getMessage(messageArray + ro, messageArray + messageLength, context, | - |
| 758 | sourceText, comment, numerus); | - |
| 759 | if (!tn.isNull()) evaluated: !tn.isNull()| yes Evaluation Count:144 | yes Evaluation Count:29 |
| 29-144 |
| 760 | return tn; executed: return tn;Execution Count:144 | 144 |
| 761 | } executed: }Execution Count:29 | 29 |
| 762 | } executed: }Execution Count:29 | 29 |
| 763 | if (!comment[0]) evaluated: !comment[0]| yes Evaluation Count:76 | yes Evaluation Count:52 |
| 52-76 |
| 764 | break; executed: break;Execution Count:76 | 76 |
| 765 | comment = ""; | - |
| 766 | } executed: }Execution Count:52 | 52 |
| 767 | | - |
| 768 | searchDependencies: code before this statement executed: searchDependencies:Execution Count:76 | 76 |
| 769 | for (QForeachContainer<__typeof__(subTranslators)> _container_(subTranslators); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QTranslator *translator = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 770 | QString tn = translator->translate(context, sourceText, comment, n); | - |
| 771 | if (!tn.isNull()) partially evaluated: !tn.isNull()| yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
| 772 | return tn; executed: return tn;Execution Count:5 | 5 |
| 773 | } | 0 |
| 774 | return QString(); executed: return QString();Execution Count:71 | 71 |
| 775 | } | - |
| 776 | | - |
| 777 | | - |
| 778 | | - |
| 779 | | - |
| 780 | | - |
| 781 | | - |
| 782 | | - |
| 783 | void QTranslatorPrivate::clear() | - |
| 784 | { | - |
| 785 | QTranslator * const q = q_func(); | - |
| 786 | if (unmapPointer && unmapLength) { evaluated: unmapPointer| yes Evaluation Count:14 | yes Evaluation Count:20 |
partially evaluated: unmapLength| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-20 |
| 787 | | - |
| 788 | if (used_mmap) { evaluated: used_mmap| yes Evaluation Count:11 | yes Evaluation Count:3 |
| 3-11 |
| 789 | used_mmap = false; | - |
| 790 | munmap(unmapPointer, unmapLength); | - |
| 791 | } else executed: }Execution Count:11 | 11 |
| 792 | | - |
| 793 | if (!resource) evaluated: !resource| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 794 | delete [] unmapPointer; executed: delete [] unmapPointer;Execution Count:1 | 1 |
| 795 | } | - |
| 796 | | - |
| 797 | delete resource; | - |
| 798 | resource = 0; | - |
| 799 | unmapPointer = 0; | - |
| 800 | unmapLength = 0; | - |
| 801 | messageArray = 0; | - |
| 802 | contextArray = 0; | - |
| 803 | offsetArray = 0; | - |
| 804 | numerusRulesArray = 0; | - |
| 805 | messageLength = 0; | - |
| 806 | contextLength = 0; | - |
| 807 | offsetLength = 0; | - |
| 808 | numerusRulesLength = 0; | - |
| 809 | | - |
| 810 | qDeleteAll(subTranslators); | - |
| 811 | subTranslators.clear(); | - |
| 812 | | - |
| 813 | if (QCoreApplicationPrivate::isTranslatorInstalled(q)) evaluated: QCoreApplicationPrivate::isTranslatorInstalled(q)| yes Evaluation Count:3 | yes Evaluation Count:31 |
| 3-31 |
| 814 | QCoreApplication::postEvent(QCoreApplication::instance(), | 3 |
| 815 | new QEvent(QEvent::LanguageChange)); executed: QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(QEvent::LanguageChange));Execution Count:3 | 3 |
| 816 | } executed: }Execution Count:34 | 34 |
| 817 | QString QTranslator::translate(const char *context, const char *sourceText, const char *disambiguation, | - |
| 818 | int n) const | - |
| 819 | { | - |
| 820 | const QTranslatorPrivate * const d = d_func(); | - |
| 821 | return d->do_translate(context, sourceText, disambiguation, n); executed: return d->do_translate(context, sourceText, disambiguation, n);Execution Count:220 | 220 |
| 822 | } | - |
| 823 | | - |
| 824 | | - |
| 825 | | - |
| 826 | | - |
| 827 | | - |
| 828 | bool QTranslator::isEmpty() const | - |
| 829 | { | - |
| 830 | const QTranslatorPrivate * const d = d_func(); | - |
| 831 | return !d->unmapPointer && !d->unmapLength && !d->messageArray && | 39 |
| 832 | !d->offsetArray && !d->contextArray && d->subTranslators.isEmpty(); executed: return !d->unmapPointer && !d->unmapLength && !d->messageArray && !d->offsetArray && !d->contextArray && d->subTranslators.isEmpty();Execution Count:39 | 39 |
| 833 | } | - |
| 834 | | - |
| 835 | | - |
| 836 | | - |
| | |