tools/qstring.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11 -
12 -
13 -
14 -
15 -
16 -
17int qFindString(const QChar *haystack, int haystackLen, int from, -
18 const QChar *needle, int needleLen, Qt::CaseSensitivity cs); -
19int qFindStringBoyerMoore(const QChar *haystack, int haystackLen, int from, -
20 const QChar *needle, int needleLen, Qt::CaseSensitivity cs); -
21static inline int qt_last_index_of(const QChar *haystack, int haystackLen, QChar needle, -
22 int from, Qt::CaseSensitivity cs); -
23static inline int qt_string_count(const QChar *haystack, int haystackLen, -
24 const QChar *needle, int needleLen, -
25 Qt::CaseSensitivity cs); -
26static inline int qt_string_count(const QChar *haystack, int haystackLen, -
27 QChar needle, Qt::CaseSensitivity cs); -
28static inline int qt_find_latin1_string(const QChar *hay, int size, QLatin1String needle, -
29 int from, Qt::CaseSensitivity cs); -
30static inline bool qt_starts_with(const QChar *haystack, int haystackLen, -
31 const QChar *needle, int needleLen, Qt::CaseSensitivity cs); -
32static inline bool qt_starts_with(const QChar *haystack, int haystackLen, -
33 QLatin1String needle, Qt::CaseSensitivity cs); -
34static inline bool qt_ends_with(const QChar *haystack, int haystackLen, -
35 const QChar *needle, int needleLen, Qt::CaseSensitivity cs); -
36static inline bool qt_ends_with(const QChar *haystack, int haystackLen, -
37 QLatin1String needle, Qt::CaseSensitivity cs); -
38 -
39 -
40static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const ushort *be) -
41{ -
42 if (a == b)
evaluated: a == b
TRUEFALSE
yes
Evaluation Count:4326
yes
Evaluation Count:3750133
4326-3750133
43 return (ae - be);
executed: return (ae - be);
Execution Count:4326
4326
44 if (a == 0)
partially evaluated: a == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3750133
0-3750133
45 return 1;
never executed: return 1;
0
46 if (b == 0)
partially evaluated: b == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3750133
0-3750133
47 return -1;
never executed: return -1;
0
48 -
49 const ushort *e = ae; -
50 if (be - b < ae - a)
evaluated: be - b < ae - a
TRUEFALSE
yes
Evaluation Count:1177908
yes
Evaluation Count:2572225
1177908-2572225
51 e = a + (be - b);
executed: e = a + (be - b);
Execution Count:1177908
1177908
52 -
53 uint alast = 0; -
54 uint blast = 0; -
55 while (a < e) {
evaluated: a < e
TRUEFALSE
yes
Evaluation Count:11477796
yes
Evaluation Count:295350
295350-11477796
56 -
57 -
58 -
59 int diff = foldCase(*a, alast) - foldCase(*b, blast); -
60 if ((diff))
evaluated: (diff)
TRUEFALSE
yes
Evaluation Count:3454783
yes
Evaluation Count:8023013
3454783-8023013
61 return diff;
executed: return diff;
Execution Count:3454783
3454783
62 ++a; -
63 ++b; -
64 }
executed: }
Execution Count:8023013
8023013
65 if (a == ae) {
evaluated: a == ae
TRUEFALSE
yes
Evaluation Count:289080
yes
Evaluation Count:6270
6270-289080
66 if (b == be)
evaluated: b == be
TRUEFALSE
yes
Evaluation Count:283444
yes
Evaluation Count:5636
5636-283444
67 return 0;
executed: return 0;
Execution Count:283444
283444
68 return -1;
executed: return -1;
Execution Count:5636
5636
69 } -
70 return 1;
executed: return 1;
Execution Count:6270
6270
71} -
72 -
73 -
74static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b, const uchar *be) -
75{ -
76 if (a == 0) {
partially evaluated: a == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6225
0-6225
77 if (b == 0)
never evaluated: b == 0
0
78 return 0;
never executed: return 0;
0
79 return 1;
never executed: return 1;
0
80 } -
81 if (b == 0)
partially evaluated: b == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6225
0-6225
82 return -1;
never executed: return -1;
0
83 -
84 const ushort *e = ae; -
85 if (be - b < ae - a)
evaluated: be - b < ae - a
TRUEFALSE
yes
Evaluation Count:1854
yes
Evaluation Count:4371
1854-4371
86 e = a + (be - b);
executed: e = a + (be - b);
Execution Count:1854
1854
87 -
88 while (a < e) {
evaluated: a < e
TRUEFALSE
yes
Evaluation Count:28654
yes
Evaluation Count:1621
1621-28654
89 int diff = foldCase(*a) - foldCase(*b); -
90 if ((diff))
evaluated: (diff)
TRUEFALSE
yes
Evaluation Count:4604
yes
Evaluation Count:24050
4604-24050
91 return diff;
executed: return diff;
Execution Count:4604
4604
92 ++a; -
93 ++b; -
94 }
executed: }
Execution Count:24050
24050
95 if (a == ae) {
evaluated: a == ae
TRUEFALSE
yes
Evaluation Count:1518
yes
Evaluation Count:103
103-1518
96 if (b == be)
evaluated: b == be
TRUEFALSE
yes
Evaluation Count:1418
yes
Evaluation Count:100
100-1418
97 return 0;
executed: return 0;
Execution Count:1418
1418
98 return -1;
executed: return -1;
Execution Count:100
100
99 } -
100 return 1;
executed: return 1;
Execution Count:103
103
101} -
102 -
103 -
104static int ucstrncmp(const QChar *a, const QChar *b, int l) -
105{ -
106 while (l-- && *a == *b)
evaluated: l--
TRUEFALSE
yes
Evaluation Count:5130892
yes
Evaluation Count:74222
evaluated: *a == *b
TRUEFALSE
yes
Evaluation Count:4251530
yes
Evaluation Count:879404
74222-5130892
107 a++,b++;
executed: a++,b++;
Execution Count:4251512
4251512
108 if (l==-1)
evaluated: l==-1
TRUEFALSE
yes
Evaluation Count:74222
yes
Evaluation Count:879383
74222-879383
109 return 0;
executed: return 0;
Execution Count:74223
74223
110 return a->unicode() - b->unicode();
executed: return a->unicode() - b->unicode();
Execution Count:879375
879375
111} -
112 -
113 -
114static int ucstrcmp(const QChar *a, int alen, const QChar *b, int blen) -
115{ -
116 if (a == b && alen == blen)
evaluated: a == b
TRUEFALSE
yes
Evaluation Count:9958
yes
Evaluation Count:950361
evaluated: alen == blen
TRUEFALSE
yes
Evaluation Count:9957
yes
Evaluation Count:1
1-950361
117 return 0;
executed: return 0;
Execution Count:9957
9957
118 int l = qMin(alen, blen); -
119 int cmp = ucstrncmp(a, b, l); -
120 return cmp ? cmp : (alen-blen);
executed: return cmp ? cmp : (alen-blen);
Execution Count:950411
950411
121} -
122 -
123 -
124static int ucstrnicmp(const ushort *a, const ushort *b, int l) -
125{ -
126 return ucstricmp(a, a + l, b, b + l);
executed: return ucstricmp(a, a + l, b, b + l);
Execution Count:1170
1170
127} -
128static bool qMemEquals(const quint16 *a, const quint16 *b, int length) -
129{ -
130 if (a == b || !length)
evaluated: a == b
TRUEFALSE
yes
Evaluation Count:718616
yes
Evaluation Count:1759277
evaluated: !length
TRUEFALSE
yes
Evaluation Count:30698
yes
Evaluation Count:1728587
30698-1759277
131 return true;
executed: return true;
Execution Count:749314
749314
132 -
133 register union { -
134 const quint16 *w; -
135 const quint32 *d; -
136 quintptr value; -
137 } sa, sb; -
138 sa.w = a; -
139 sb.w = b; -
140 -
141 -
142 if ((sa.value & 2) == (sb.value & 2)) {
evaluated: (sa.value & 2) == (sb.value & 2)
TRUEFALSE
yes
Evaluation Count:1633053
yes
Evaluation Count:95531
95531-1633053
143 -
144 if (sa.value & 2) {
evaluated: sa.value & 2
TRUEFALSE
yes
Evaluation Count:7103
yes
Evaluation Count:1625952
7103-1625952
145 -
146 -
147 if (*sa.w != *sb.w)
evaluated: *sa.w != *sb.w
TRUEFALSE
yes
Evaluation Count:6645
yes
Evaluation Count:458
458-6645
148 return false;
executed: return false;
Execution Count:6645
6645
149 --length; -
150 ++sa.w; -
151 ++sb.w; -
152 -
153 -
154 }
executed: }
Execution Count:458
458
155 -
156 -
157 -
158 register const quint32 *e = sa.d + (length >> 1); -
159 for ( ; sa.d != e; ++sa.d, ++sb.d) {
evaluated: sa.d != e
TRUEFALSE
yes
Evaluation Count:13704451
yes
Evaluation Count:1506349
1506349-13704451
160 if (*sa.d != *sb.d)
evaluated: *sa.d != *sb.d
TRUEFALSE
yes
Evaluation Count:120070
yes
Evaluation Count:13584390
120070-13584390
161 return false;
executed: return false;
Execution Count:120067
120067
162 }
executed: }
Execution Count:13584392
13584392
163 -
164 -
165 return (length & 1) ? *sa.w == *sb.w : true;
executed: return (length & 1) ? *sa.w == *sb.w : true;
Execution Count:1506350
1506350
166 } else { -
167 -
168 register const quint16 *e = sa.w + length; -
169 for ( ; sa.w != e; ++sa.w, ++sb.w) {
evaluated: sa.w != e
TRUEFALSE
yes
Evaluation Count:461818
yes
Evaluation Count:44403
44403-461818
170 if (*sa.w != *sb.w)
evaluated: *sa.w != *sb.w
TRUEFALSE
yes
Evaluation Count:51128
yes
Evaluation Count:410690
51128-410690
171 return false;
executed: return false;
Execution Count:51128
51128
172 }
executed: }
Execution Count:410690
410690
173 }
executed: }
Execution Count:44403
44403
174 return true;
executed: return true;
Execution Count:44403
44403
175} -
176static int findChar(const QChar *str, int len, QChar ch, int from, -
177 Qt::CaseSensitivity cs) -
178{ -
179 const ushort *s = (const ushort *)str; -
180 ushort c = ch.unicode(); -
181 if (from < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:285312
1-285312
182 from = qMax(from + len, 0);
executed: from = qMax(from + len, 0);
Execution Count:1
1
183 if (from < len) {
evaluated: from < len
TRUEFALSE
yes
Evaluation Count:282232
yes
Evaluation Count:3086
3086-282232
184 const ushort *n = s + from - 1; -
185 const ushort *e = s + len; -
186 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:281772
yes
Evaluation Count:459
459-281772
187 while (++n != e)
evaluated: ++n != e
TRUEFALSE
yes
Evaluation Count:2194211
yes
Evaluation Count:158325
158325-2194211
188 if (*n == c)
evaluated: *n == c
TRUEFALSE
yes
Evaluation Count:123464
yes
Evaluation Count:2070803
123464-2070803
189 return n - s;
executed: return n - s;
Execution Count:123464
123464
190 } else {
executed: }
Execution Count:158316
158316
191 c = foldCase(c); -
192 while (++n != e)
evaluated: ++n != e
TRUEFALSE
yes
Evaluation Count:797
yes
Evaluation Count:125
125-797
193 if (foldCase(*n) == c)
evaluated: foldCase(*n) == c
TRUEFALSE
yes
Evaluation Count:334
yes
Evaluation Count:463
334-463
194 return n - s;
executed: return n - s;
Execution Count:334
334
195 }
executed: }
Execution Count:125
125
196 } -
197 return -1;
executed: return -1;
Execution Count:161528
161528
198} -
199 -
200 -
201 -
202 -
203 -
204 -
205inline bool qIsUpper(char ch) -
206{ -
207 return ch >= 'A' && ch <= 'Z';
executed: return ch >= 'A' && ch <= 'Z';
Execution Count:1056766
1056766
208} -
209 -
210inline bool qIsDigit(char ch) -
211{ -
212 return ch >= '0' && ch <= '9';
executed: return ch >= '0' && ch <= '9';
Execution Count:67314
67314
213} -
214 -
215inline char qToLower(char ch) -
216{ -
217 if (ch >= 'A' && ch <= 'Z')
partially evaluated: ch >= 'A'
TRUEFALSE
yes
Evaluation Count:1056766
no
Evaluation Count:0
evaluated: ch <= 'Z'
TRUEFALSE
yes
Evaluation Count:4992
yes
Evaluation Count:1051774
0-1056766
218 return ch - 'A' + 'a';
executed: return ch - 'A' + 'a';
Execution Count:4992
4992
219 else -
220 return ch;
executed: return ch;
Execution Count:1051774
1051774
221} -
222 -
223 -
224const QString::Null QString::null = { }; -
225int QString::toUcs4_helper(const ushort *uc, int length, uint *out) -
226{ -
227 int i = 0; -
228 for (; i < length; ++i) {
evaluated: i < length
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
229 uint u = uc[i]; -
230 if (QChar::isHighSurrogate(u) && i + 1 < length) {
partially evaluated: QChar::isHighSurrogate(u)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
never evaluated: i + 1 < length
0-5
231 ushort low = uc[i+1]; -
232 if (QChar::isLowSurrogate(low)) {
never evaluated: QChar::isLowSurrogate(low)
0
233 ++i; -
234 u = QChar::surrogateToUcs4(u, low); -
235 }
never executed: }
0
236 }
never executed: }
0
237 *out++ = u; -
238 }
executed: }
Execution Count:5
5
239 return i;
executed: return i;
Execution Count:1
1
240} -
241QString::QString(const QChar *unicode, int size) -
242{ -
243 if (!unicode) {
evaluated: !unicode
TRUEFALSE
yes
Evaluation Count:3143
yes
Evaluation Count:13370496
3143-13370496
244 d = Data::sharedNull(); -
245 } else {
executed: }
Execution Count:3143
3143
246 if (size < 0) {
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:101017
yes
Evaluation Count:13269460
101017-13269460
247 size = 0; -
248 while (unicode[size] != 0)
evaluated: unicode[size] != 0
TRUEFALSE
yes
Evaluation Count:2158999
yes
Evaluation Count:101017
101017-2158999
249 ++size;
executed: ++size;
Execution Count:2158999
2158999
250 }
executed: }
Execution Count:101017
101017
251 if (!size) {
evaluated: !size
TRUEFALSE
yes
Evaluation Count:558939
yes
Evaluation Count:12811559
558939-12811559
252 d = Data::allocate(0); -
253 } else {
executed: }
Execution Count:558925
558925
254 d = Data::allocate(size + 1); -
255 do { if (!(d)) qBadAlloc(); } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12811759
never executed: qBadAlloc();
executed: }
Execution Count:12811776
partially evaluated: !(d)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12811818
0-12811818
256 d->size = size; -
257 memcpy(d->data(), unicode, size * sizeof(QChar)); -
258 d->data()[size] = '\0'; -
259 }
executed: }
Execution Count:12811751
12811751
260 } -
261} -
262 -
263 -
264 -
265 -
266 -
267 -
268 -
269QString::QString(int size, QChar ch) -
270{ -
271 if (size <= 0) {
evaluated: size <= 0
TRUEFALSE
yes
Evaluation Count:20756
yes
Evaluation Count:168912
20756-168912
272 d = Data::allocate(0); -
273 } else {
executed: }
Execution Count:20756
20756
274 d = Data::allocate(size + 1); -
275 do { if (!(d)) qBadAlloc(); } while (0);
partially evaluated: !(d)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:168912
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:168912
never executed: qBadAlloc();
executed: }
Execution Count:168912
0-168912
276 d->size = size; -
277 d->data()[size] = '\0'; -
278 ushort *i = d->data() + size; -
279 ushort *b = d->data(); -
280 const ushort value = ch.unicode(); -
281 while (i != b)
evaluated: i != b
TRUEFALSE
yes
Evaluation Count:342275
yes
Evaluation Count:168912
168912-342275
282 *--i = value;
executed: *--i = value;
Execution Count:342275
342275
283 }
executed: }
Execution Count:168912
168912
284} -
285 -
286 -
287 -
288 -
289 -
290 -
291 -
292QString::QString(int size, Qt::Initialization) -
293{ -
294 d = Data::allocate(size + 1); -
295 do { if (!(d)) qBadAlloc(); } while (0);
partially evaluated: !(d)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:78893820
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:78893795
never executed: qBadAlloc();
executed: }
Execution Count:78893810
0-78893820
296 d->size = size; -
297 d->data()[size] = '\0'; -
298}
executed: }
Execution Count:78893799
78893799
299QString::QString(QChar ch) -
300{ -
301 d = Data::allocate(2); -
302 do { if (!(d)) qBadAlloc(); } while (0);
partially evaluated: !(d)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2510084
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2510084
never executed: qBadAlloc();
executed: }
Execution Count:2510083
0-2510084
303 d->size = 1; -
304 d->data()[0] = ch.unicode(); -
305 d->data()[1] = '\0'; -
306}
executed: }
Execution Count:2510083
2510083
307void QString::resize(int size) -
308{ -
309 if (size < 0)
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:105770619
9-105770619
310 size = 0;
executed: size = 0;
Execution Count:9
9
311 -
312 if (((d)->offset != sizeof(QStringData)) && !d->ref.isShared() && size < d->size) {
evaluated: ((d)->offset != sizeof(QStringData))
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:105770583
partially evaluated: !d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: size < d->size
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-105770583
313 d->size = size; -
314 return;
executed: return;
Execution Count:2
2
315 } -
316 -
317 if (size == 0 && !d->capacityReserved) {
evaluated: size == 0
TRUEFALSE
yes
Evaluation Count:480855
yes
Evaluation Count:105289745
evaluated: !d->capacityReserved
TRUEFALSE
yes
Evaluation Count:21506
yes
Evaluation Count:459349
21506-105289745
318 Data *x = Data::allocate(0); -
319 if (!d->ref.deref())
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:8917
yes
Evaluation Count:12589
8917-12589
320 Data::deallocate(d);
executed: Data::deallocate(d);
Execution Count:8917
8917
321 d = x; -
322 } else {
executed: }
Execution Count:21506
21506
323 if (d->ref.isShared() || uint(size) + 1u > d->alloc
evaluated: d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:743930
yes
Evaluation Count:105005228
evaluated: uint(size) + 1u > d->alloc
TRUEFALSE
yes
Evaluation Count:773677
yes
Evaluation Count:104231610
743930-105005228
324 || (!d->capacityReserved && size < d->size
evaluated: !d->capacityReserved
TRUEFALSE
yes
Evaluation Count:103488302
yes
Evaluation Count:743417
evaluated: size < d->size
TRUEFALSE
yes
Evaluation Count:62049919
yes
Evaluation Count:41438380
743417-103488302
325 && uint(size) + 1u < uint(d->alloc >> 1)))
evaluated: uint(size) + 1u < uint(d->alloc >> 1)
TRUEFALSE
yes
Evaluation Count:94531
yes
Evaluation Count:61955396
94531-61955396
326 reallocData(uint(size) + 1u, true);
executed: reallocData(uint(size) + 1u, true);
Execution Count:1612138
1612138
327 if (d->alloc) {
partially evaluated: d->alloc
TRUEFALSE
yes
Evaluation Count:105749185
no
Evaluation Count:0
0-105749185
328 d->size = size; -
329 d->data()[size] = '\0'; -
330 }
executed: }
Execution Count:105749184
105749184
331 }
executed: }
Execution Count:105749196
105749196
332} -
333void QString::reallocData(uint alloc, bool grow) -
334{ -
335 if (grow)
evaluated: grow
TRUEFALSE
yes
Evaluation Count:3493417
yes
Evaluation Count:599703
599703-3493417
336 alloc = qAllocMore(alloc * sizeof(QChar), sizeof(Data)) / sizeof(QChar);
executed: alloc = qAllocMore(alloc * sizeof(QChar), sizeof(Data)) / sizeof(QChar);
Execution Count:3493416
3493416
337 -
338 if (d->ref.isShared() || ((d)->offset != sizeof(QStringData))) {
evaluated: d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:1888219
yes
Evaluation Count:2204896
evaluated: ((d)->offset != sizeof(QStringData))
TRUEFALSE
yes
Evaluation Count:796
yes
Evaluation Count:2204105
796-2204896
339 Data::AllocationOptions allocOptions(d->capacityReserved ? Data::CapacityReserved : 0); -
340 Data *x = Data::allocate(alloc, allocOptions); -
341 do { if (!(x)) qBadAlloc(); } while (0);
partially evaluated: !(x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1889061
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1889025
never executed: qBadAlloc();
executed: }
Execution Count:1889028
0-1889061
342 x->size = qMin(int(alloc) - 1, d->size); -
343 ::memcpy(x->data(), d->data(), x->size * sizeof(QChar)); -
344 x->data()[x->size] = 0; -
345 if (!d->ref.deref())
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:796
yes
Evaluation Count:1888258
796-1888258
346 Data::deallocate(d);
executed: Data::deallocate(d);
Execution Count:796
796
347 d = x; -
348 } else {
executed: }
Execution Count:1889047
1889047
349 Data *p = static_cast<Data *>(::realloc(d, sizeof(Data) + alloc * sizeof(QChar))); -
350 do { if (!(p)) qBadAlloc(); } while (0);
partially evaluated: !(p)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2204108
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2204107
never executed: qBadAlloc();
executed: }
Execution Count:2204108
0-2204108
351 d = p; -
352 d->alloc = alloc; -
353 d->offset = sizeof(QStringData); -
354 }
executed: }
Execution Count:2204108
2204108
355} -
356 -
357void QString::expand(int i) -
358{ -
359 int sz = d->size; -
360 resize(qMax(i + 1, sz)); -
361 if (d->size - 1 > sz) {
evaluated: d->size - 1 > sz
TRUEFALSE
yes
Evaluation Count:165945
yes
Evaluation Count:1353056
165945-1353056
362 ushort *n = d->data() + d->size - 1; -
363 ushort *e = d->data() + sz; -
364 while (n != e)
evaluated: n != e
TRUEFALSE
yes
Evaluation Count:1380326
yes
Evaluation Count:165945
165945-1380326
365 * --n = ' ';
executed: * --n = ' ';
Execution Count:1380326
1380326
366 }
executed: }
Execution Count:165945
165945
367}
executed: }
Execution Count:1519001
1519001
368QString &QString::operator=(const QString &other) -
369{ -
370 other.d->ref.ref(); -
371 if (!d->ref.deref())
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:739565
yes
Evaluation Count:5901735
739565-5901735
372 Data::deallocate(d);
executed: Data::deallocate(d);
Execution Count:739565
739565
373 d = other.d; -
374 return *this;
executed: return *this;
Execution Count:6641159
6641159
375} -
376QString &QString::operator=(QChar ch) -
377{ -
378 return operator=(QString(ch));
executed: return operator=(QString(ch));
Execution Count:69542
69542
379} -
380QString &QString::insert(int i, QLatin1String str) -
381{ -
382 const uchar *s = (const uchar *)str.latin1(); -
383 if (i < 0 || !s || !(*s))
partially evaluated: i < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:893
evaluated: !s
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:892
evaluated: !(*s)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:891
0-893
384 return *this;
executed: return *this;
Execution Count:2
2
385 -
386 int len = str.size(); -
387 expand(qMax(d->size, i) + len - 1); -
388 -
389 ::memmove(d->data() + i + len, d->data() + i, (d->size - i - len) * sizeof(QChar)); -
390 for (int j = 0; j < len; ++j)
evaluated: j < len
TRUEFALSE
yes
Evaluation Count:4771
yes
Evaluation Count:891
891-4771
391 d->data()[i + j] = s[j];
executed: d->data()[i + j] = s[j];
Execution Count:4771
4771
392 return *this;
executed: return *this;
Execution Count:891
891
393} -
394QString& QString::insert(int i, const QChar *unicode, int size) -
395{ -
396 if (i < 0 || size <= 0)
partially evaluated: i < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:244832
evaluated: size <= 0
TRUEFALSE
yes
Evaluation Count:76645
yes
Evaluation Count:168187
0-244832
397 return *this;
executed: return *this;
Execution Count:76645
76645
398 -
399 const ushort *s = (const ushort *)unicode; -
400 if (s >= d->data() && s < d->data() + d->alloc) {
evaluated: s >= d->data()
TRUEFALSE
yes
Evaluation Count:118169
yes
Evaluation Count:50018
evaluated: s < d->data() + d->alloc
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:118166
3-118169
401 -
402 ushort *tmp = static_cast<ushort *>(::malloc(size * sizeof(QChar))); -
403 do { if (!(tmp)) qBadAlloc(); } while (0);
partially evaluated: !(tmp)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never executed: qBadAlloc();
executed: }
Execution Count:3
0-3
404 memcpy(tmp, s, size * sizeof(QChar)); -
405 insert(i, reinterpret_cast<const QChar *>(tmp), size); -
406 ::free(tmp); -
407 return *this;
executed: return *this;
Execution Count:3
3
408 } -
409 -
410 expand(qMax(d->size, i) + size - 1); -
411 -
412 ::memmove(d->data() + i + size, d->data() + i, (d->size - i - size) * sizeof(QChar)); -
413 memcpy(d->data() + i, s, size * sizeof(QChar)); -
414 return *this;
executed: return *this;
Execution Count:168184
168184
415} -
416QString& QString::insert(int i, QChar ch) -
417{ -
418 if (i < 0)
partially evaluated: i < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1340672
0-1340672
419 i += d->size;
never executed: i += d->size;
0
420 if (i < 0)
partially evaluated: i < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1340672
0-1340672
421 return *this;
never executed: return *this;
0
422 expand(qMax(i, d->size)); -
423 ::memmove(d->data() + i + 1, d->data() + i, (d->size - i - 1) * sizeof(QChar)); -
424 d->data()[i] = ch.unicode(); -
425 return *this;
executed: return *this;
Execution Count:1340672
1340672
426} -
427QString &QString::append(const QString &str) -
428{ -
429 if (str.d != Data::sharedNull()) {
evaluated: str.d != Data::sharedNull()
TRUEFALSE
yes
Evaluation Count:43946159
yes
Evaluation Count:131573
131573-43946159
430 if (d == Data::sharedNull()) {
evaluated: d == Data::sharedNull()
TRUEFALSE
yes
Evaluation Count:125151
yes
Evaluation Count:43821004
125151-43821004
431 operator=(str); -
432 } else {
executed: }
Execution Count:125151
125151
433 if (d->ref.isShared() || uint(d->size + str.d->size) + 1u > d->alloc)
evaluated: d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:164557
yes
Evaluation Count:43656448
evaluated: uint(d->size + str.d->size) + 1u > d->alloc
TRUEFALSE
yes
Evaluation Count:468632
yes
Evaluation Count:43187825
164557-43656448
434 reallocData(uint(d->size + str.d->size) + 1u, true);
executed: reallocData(uint(d->size + str.d->size) + 1u, true);
Execution Count:633189
633189
435 memcpy(d->data() + d->size, str.d->data(), str.d->size * sizeof(QChar)); -
436 d->size += str.d->size; -
437 d->data()[d->size] = '\0'; -
438 }
executed: }
Execution Count:43821009
43821009
439 } -
440 return *this;
executed: return *this;
Execution Count:44077734
44077734
441} -
442 -
443 -
444 -
445 -
446 -
447 -
448 -
449QString &QString::append(const QChar *str, int len) -
450{ -
451 if (str && len > 0) {
evaluated: str
TRUEFALSE
yes
Evaluation Count:23059
yes
Evaluation Count:1
evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:23057
yes
Evaluation Count:2
1-23059
452 if (d->ref.isShared() || uint(d->size + len) + 1u > d->alloc)
evaluated: d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:23056
evaluated: uint(d->size + len) + 1u > d->alloc
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:23055
1-23056
453 reallocData(uint(d->size + len) + 1u, true);
executed: reallocData(uint(d->size + len) + 1u, true);
Execution Count:2
2
454 memcpy(d->data() + d->size, str, len * sizeof(QChar)); -
455 d->size += len; -
456 d->data()[d->size] = '\0'; -
457 }
executed: }
Execution Count:23057
23057
458 return *this;
executed: return *this;
Execution Count:23060
23060
459} -
460 -
461 -
462 -
463 -
464 -
465 -
466QString &QString::append(QLatin1String str) -
467{ -
468 const uchar *s = (const uchar *)str.latin1(); -
469 if (s) {
evaluated: s
TRUEFALSE
yes
Evaluation Count:34384
yes
Evaluation Count:32
32-34384
470 int len = str.size(); -
471 if (d->ref.isShared() || uint(d->size + len) + 1u > d->alloc)
evaluated: d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:3162
yes
Evaluation Count:31223
evaluated: uint(d->size + len) + 1u > d->alloc
TRUEFALSE
yes
Evaluation Count:8111
yes
Evaluation Count:23111
3162-31223
472 reallocData(uint(d->size + len) + 1u, true);
executed: reallocData(uint(d->size + len) + 1u, true);
Execution Count:11273
11273
473 ushort *i = d->data() + d->size; -
474 while ((*i++ = *s++))
evaluated: (*i++ = *s++)
TRUEFALSE
yes
Evaluation Count:565913
yes
Evaluation Count:34392
34392-565913
475 ;
executed: ;
Execution Count:565913
565913
476 d->size += len; -
477 }
executed: }
Execution Count:34391
34391
478 return *this;
executed: return *this;
Execution Count:34425
34425
479} -
480QString &QString::append(QChar ch) -
481{ -
482 if (d->ref.isShared() || uint(d->size) + 2u > d->alloc)
evaluated: d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:119174
yes
Evaluation Count:870934
evaluated: uint(d->size) + 2u > d->alloc
TRUEFALSE
yes
Evaluation Count:405489
yes
Evaluation Count:465445
119174-870934
483 reallocData(uint(d->size) + 2u, true);
executed: reallocData(uint(d->size) + 2u, true);
Execution Count:524663
524663
484 d->data()[d->size++] = ch.unicode(); -
485 d->data()[d->size] = '\0'; -
486 return *this;
executed: return *this;
Execution Count:990108
990108
487} -
488QString &QString::remove(int pos, int len) -
489{ -
490 if (pos < 0)
partially evaluated: pos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:251257
0-251257
491 pos += d->size;
never executed: pos += d->size;
0
492 if (pos < 0 || pos >= d->size) {
partially evaluated: pos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:251257
partially evaluated: pos >= d->size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:251257
0-251257
493 -
494 } else if (len >= d->size - pos) {
never executed: }
evaluated: len >= d->size - pos
TRUEFALSE
yes
Evaluation Count:122647
yes
Evaluation Count:128610
0-128610
495 resize(pos); -
496 } else if (len > 0) {
evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:128609
yes
Evaluation Count:1
executed: }
Execution Count:122647
1-128609
497 detach(); -
498 memmove(d->data() + pos, d->data() + pos + len, -
499 (d->size - pos - len + 1) * sizeof(ushort)); -
500 d->size -= len; -
501 }
executed: }
Execution Count:128609
128609
502 return *this;
executed: return *this;
Execution Count:251257
251257
503} -
504QString &QString::remove(const QString &str, Qt::CaseSensitivity cs) -
505{ -
506 if (str.d->size) {
evaluated: str.d->size
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:4
4-70
507 int i = 0; -
508 while ((i = indexOf(str, i, cs)) != -1)
evaluated: (i = indexOf(str, i, cs)) != -1
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:70
24-70
509 remove(i, str.d->size);
executed: remove(i, str.d->size);
Execution Count:24
24
510 }
executed: }
Execution Count:70
70
511 return *this;
executed: return *this;
Execution Count:74
74
512} -
513QString &QString::remove(QChar ch, Qt::CaseSensitivity cs) -
514{ -
515 int i = 0; -
516 ushort c = ch.unicode(); -
517 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:6001
yes
Evaluation Count:11
11-6001
518 while (i < d->size)
evaluated: i < d->size
TRUEFALSE
yes
Evaluation Count:30710
yes
Evaluation Count:6001
6001-30710
519 if (d->data()[i] == ch)
evaluated: d->data()[i] == ch
TRUEFALSE
yes
Evaluation Count:1419
yes
Evaluation Count:29291
1419-29291
520 remove(i, 1);
executed: remove(i, 1);
Execution Count:1419
1419
521 else -
522 i++;
executed: i++;
Execution Count:29291
29291
523 } else {
executed: }
Execution Count:6001
6001
524 c = foldCase(c); -
525 while (i < d->size)
evaluated: i < d->size
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:11
11-36
526 if (foldCase(d->data()[i]) == c)
evaluated: foldCase(d->data()[i]) == c
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:22
14-22
527 remove(i, 1);
executed: remove(i, 1);
Execution Count:14
14
528 else -
529 i++;
executed: i++;
Execution Count:22
22
530 }
executed: }
Execution Count:11
11
531 return *this;
executed: return *this;
Execution Count:6012
6012
532} -
533QString &QString::replace(int pos, int len, const QString &after) -
534{ -
535 QString copy = after; -
536 return replace(pos, len, copy.constData(), copy.length());
executed: return replace(pos, len, copy.constData(), copy.length());
Execution Count:2015646
2015646
537} -
538QString &QString::replace(int pos, int len, const QChar *unicode, int size) -
539{ -
540 if (pos < 0 || pos > d->size)
partially evaluated: pos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2197608
partially evaluated: pos > d->size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2197608
0-2197608
541 return *this;
never executed: return *this;
0
542 if (len > d->size - pos)
evaluated: len > d->size - pos
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:2197583
25-2197583
543 len = d->size - pos;
executed: len = d->size - pos;
Execution Count:25
25
544 -
545 uint index = pos; -
546 replace_helper(&index, 1, len, unicode, size); -
547 return *this;
executed: return *this;
Execution Count:2197608
2197608
548} -
549QString &QString::replace(int pos, int len, QChar after) -
550{ -
551 return replace(pos, len, &after, 1);
executed: return replace(pos, len, &after, 1);
Execution Count:9
9
552} -
553QString &QString::replace(const QString &before, const QString &after, Qt::CaseSensitivity cs) -
554{ -
555 return replace(before.constData(), before.size(), after.constData(), after.size(), cs);
executed: return replace(before.constData(), before.size(), after.constData(), after.size(), cs);
Execution Count:157421
157421
556} -
557 -
558 -
559 -
560 -
561void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen) -
562{ -
563 -
564 -
565 QChar *afterBuffer = const_cast<QChar *>(after); -
566 if (after >= reinterpret_cast<QChar *>(d->data()) && after < reinterpret_cast<QChar *>(d->data()) + d->size) {
evaluated: after >= reinterpret_cast<QChar *>(d->data())
TRUEFALSE
yes
Evaluation Count:186199
yes
Evaluation Count:2013296
evaluated: after < reinterpret_cast<QChar *>(d->data()) + d->size
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:186178
21-2013296
567 afterBuffer = static_cast<QChar *>(::malloc(alen*sizeof(QChar))); -
568 do { if (!(afterBuffer)) qBadAlloc(); } while (0);
partially evaluated: !(afterBuffer)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
never executed: qBadAlloc();
executed: }
Execution Count:21
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
569 ::memcpy(afterBuffer, after, alen*sizeof(QChar)); -
570 }
executed: }
Execution Count:21
21
571 -
572 try { -
573 if (blen == alen) {
evaluated: blen == alen
TRUEFALSE
yes
Evaluation Count:2013152
yes
Evaluation Count:186343
186343-2013152
574 -
575 detach(); -
576 for (int i = 0; i < nIndices; ++i)
evaluated: i < nIndices
TRUEFALSE
yes
Evaluation Count:2013158
yes
Evaluation Count:2013152
2013152-2013158
577 memcpy(d->data() + indices[i], afterBuffer, alen * sizeof(QChar));
executed: memcpy(d->data() + indices[i], afterBuffer, alen * sizeof(QChar));
Execution Count:2013158
2013158
578 } else if (alen < blen) {
evaluated: alen < blen
TRUEFALSE
yes
Evaluation Count:10628
yes
Evaluation Count:175715
executed: }
Execution Count:2013152
10628-2013152
579 -
580 detach(); -
581 uint to = indices[0]; -
582 if (alen)
evaluated: alen
TRUEFALSE
yes
Evaluation Count:10598
yes
Evaluation Count:30
30-10598
583 memcpy(d->data()+to, after, alen*sizeof(QChar));
executed: memcpy(d->data()+to, after, alen*sizeof(QChar));
Execution Count:10598
10598
584 to += alen; -
585 uint movestart = indices[0] + blen; -
586 for (int i = 1; i < nIndices; ++i) {
evaluated: i < nIndices
TRUEFALSE
yes
Evaluation Count:337
yes
Evaluation Count:10628
337-10628
587 int msize = indices[i] - movestart; -
588 if (msize > 0) {
evaluated: msize > 0
TRUEFALSE
yes
Evaluation Count:335
yes
Evaluation Count:2
2-335
589 memmove(d->data() + to, d->data() + movestart, msize * sizeof(QChar)); -
590 to += msize; -
591 }
executed: }
Execution Count:335
335
592 if (alen) {
evaluated: alen
TRUEFALSE
yes
Evaluation Count:332
yes
Evaluation Count:5
5-332
593 memcpy(d->data() + to, afterBuffer, alen*sizeof(QChar)); -
594 to += alen; -
595 }
executed: }
Execution Count:332
332
596 movestart = indices[i] + blen; -
597 }
executed: }
Execution Count:337
337
598 int msize = d->size - movestart; -
599 if (msize > 0)
evaluated: msize > 0
TRUEFALSE
yes
Evaluation Count:1189
yes
Evaluation Count:9439
1189-9439
600 memmove(d->data() + to, d->data() + movestart, msize * sizeof(QChar));
executed: memmove(d->data() + to, d->data() + movestart, msize * sizeof(QChar));
Execution Count:1189
1189
601 resize(d->size - nIndices*(blen-alen)); -
602 } else {
executed: }
Execution Count:10628
10628
603 -
604 int adjust = nIndices*(alen-blen); -
605 int newLen = d->size + adjust; -
606 int moveend = d->size; -
607 resize(newLen); -
608 -
609 while (nIndices) {
evaluated: nIndices
TRUEFALSE
yes
Evaluation Count:175805
yes
Evaluation Count:175715
175715-175805
610 --nIndices; -
611 int movestart = indices[nIndices] + blen; -
612 int insertstart = indices[nIndices] + nIndices*(alen-blen); -
613 int moveto = insertstart + alen; -
614 memmove(d->data() + moveto, d->data() + movestart, -
615 (moveend - movestart)*sizeof(QChar)); -
616 memcpy(d->data() + insertstart, afterBuffer, alen*sizeof(QChar)); -
617 moveend = movestart-blen; -
618 }
executed: }
Execution Count:175805
175805
619 }
executed: }
Execution Count:175715
175715
620 } catch (const std::bad_alloc &) { -
621 if (afterBuffer != after)
never evaluated: afterBuffer != after
0
622 ::free(afterBuffer);
never executed: ::free(afterBuffer);
0
623 throw;
never executed: throw;
0
624 } -
625 if (afterBuffer != after)
evaluated: afterBuffer != after
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:2199474
21-2199474
626 ::free(afterBuffer);
executed: ::free(afterBuffer);
Execution Count:21
21
627}
executed: }
Execution Count:2199495
2199495
628QString &QString::replace(const QChar *before, int blen, -
629 const QChar *after, int alen, -
630 Qt::CaseSensitivity cs) -
631{ -
632 if (d->size == 0) {
evaluated: d->size == 0
TRUEFALSE
yes
Evaluation Count:1213
yes
Evaluation Count:162368
1213-162368
633 if (blen)
evaluated: blen
TRUEFALSE
yes
Evaluation Count:1207
yes
Evaluation Count:6
6-1207
634 return *this;
executed: return *this;
Execution Count:1207
1207
635 } else {
executed: }
Execution Count:6
6
636 if (cs == Qt::CaseSensitive && before == after && blen == alen)
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:162353
yes
Evaluation Count:15
evaluated: before == after
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:162350
partially evaluated: blen == alen
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-162353
637 return *this;
executed: return *this;
Execution Count:3
3
638 }
executed: }
Execution Count:162365
162365
639 if (alen == 0 && blen == 0)
evaluated: alen == 0
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:162351
evaluated: blen == 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:17
3-162351
640 return *this;
executed: return *this;
Execution Count:3
3
641 -
642 QStringMatcher matcher(before, blen, cs); -
643 -
644 int index = 0; -
645 while (1) {
partially evaluated: 1
TRUEFALSE
yes
Evaluation Count:162368
no
Evaluation Count:0
0-162368
646 uint indices[1024]; -
647 uint pos = 0; -
648 while (pos < 1023) {
partially evaluated: pos < 1023
TRUEFALSE
yes
Evaluation Count:164653
no
Evaluation Count:0
0-164653
649 index = matcher.indexIn(*this, index); -
650 if (index == -1)
evaluated: index == -1
TRUEFALSE
yes
Evaluation Count:162368
yes
Evaluation Count:2285
2285-162368
651 break;
executed: break;
Execution Count:162368
162368
652 indices[pos++] = index; -
653 index += blen; -
654 -
655 if (!blen)
evaluated: !blen
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2275
10-2275
656 index++;
executed: index++;
Execution Count:10
10
657 }
executed: }
Execution Count:2285
2285
658 if (!pos)
evaluated: !pos
TRUEFALSE
yes
Evaluation Count:160501
yes
Evaluation Count:1867
1867-160501
659 break;
executed: break;
Execution Count:160501
160501
660 -
661 replace_helper(indices, pos, blen, after, alen); -
662 -
663 if (index == -1)
partially evaluated: index == -1
TRUEFALSE
yes
Evaluation Count:1867
no
Evaluation Count:0
0-1867
664 break;
executed: break;
Execution Count:1867
1867
665 -
666 index += pos*(alen-blen); -
667 }
never executed: }
0
668 -
669 return *this;
executed: return *this;
Execution Count:162368
162368
670} -
671QString& QString::replace(QChar ch, const QString &after, Qt::CaseSensitivity cs) -
672{ -
673 if (after.d->size == 0)
evaluated: after.d->size == 0
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:2086
37-2086
674 return remove(ch, cs);
executed: return remove(ch, cs);
Execution Count:37
37
675 -
676 if (after.d->size == 1)
evaluated: after.d->size == 1
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:2064
22-2064
677 return replace(ch, after.d->data()[0], cs);
executed: return replace(ch, after.d->data()[0], cs);
Execution Count:22
22
678 -
679 if (d->size == 0)
evaluated: d->size == 0
TRUEFALSE
yes
Evaluation Count:490
yes
Evaluation Count:1574
490-1574
680 return *this;
executed: return *this;
Execution Count:490
490
681 -
682 ushort cc = (cs == Qt::CaseSensitive ? ch.unicode() : ch.toCaseFolded().unicode());
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:1570
yes
Evaluation Count:4
4-1570
683 -
684 int index = 0; -
685 while (1) {
partially evaluated: 1
TRUEFALSE
yes
Evaluation Count:1594
no
Evaluation Count:0
0-1594
686 uint indices[1024]; -
687 uint pos = 0; -
688 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:1587
yes
Evaluation Count:7
7-1587
689 while (pos < 1023 && index < d->size) {
partially evaluated: pos < 1023
TRUEFALSE
yes
Evaluation Count:59844
no
Evaluation Count:0
evaluated: index < d->size
TRUEFALSE
yes
Evaluation Count:58257
yes
Evaluation Count:1587
0-59844
690 if (d->data()[index] == cc)
evaluated: d->data()[index] == cc
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:58230
27-58230
691 indices[pos++] = index;
executed: indices[pos++] = index;
Execution Count:27
27
692 index++; -
693 }
executed: }
Execution Count:58257
58257
694 } else {
executed: }
Execution Count:1587
1587
695 while (pos < 1023 && index < d->size) {
partially evaluated: pos < 1023
TRUEFALSE
yes
Evaluation Count:29
no
Evaluation Count:0
evaluated: index < d->size
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:7
0-29
696 if (QChar::toCaseFolded(d->data()[index]) == cc)
evaluated: QChar::toCaseFolded(d->data()[index]) == cc
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:14
8-14
697 indices[pos++] = index;
executed: indices[pos++] = index;
Execution Count:8
8
698 index++; -
699 }
executed: }
Execution Count:22
22
700 }
executed: }
Execution Count:7
7
701 if (!pos)
evaluated: !pos
TRUEFALSE
yes
Evaluation Count:1574
yes
Evaluation Count:20
20-1574
702 break;
executed: break;
Execution Count:1574
1574
703 -
704 replace_helper(indices, pos, 1, after.constData(), after.d->size); -
705 -
706 if (index == -1)
partially evaluated: index == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
707 break;
never executed: break;
0
708 -
709 index += pos*(after.d->size - 1); -
710 }
executed: }
Execution Count:20
20
711 return *this;
executed: return *this;
Execution Count:1574
1574
712} -
713QString& QString::replace(QChar before, QChar after, Qt::CaseSensitivity cs) -
714{ -
715 ushort a = after.unicode(); -
716 ushort b = before.unicode(); -
717 if (d->size) {
evaluated: d->size
TRUEFALSE
yes
Evaluation Count:931949
yes
Evaluation Count:2
2-931949
718 detach(); -
719 ushort *i = d->data(); -
720 const ushort *e = i + d->size; -
721 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:931927
yes
Evaluation Count:22
22-931927
722 for (; i != e; ++i)
evaluated: i != e
TRUEFALSE
yes
Evaluation Count:1935401
yes
Evaluation Count:931927
931927-1935401
723 if (*i == b)
evaluated: *i == b
TRUEFALSE
yes
Evaluation Count:722
yes
Evaluation Count:1934679
722-1934679
724 *i = a;
executed: *i = a;
Execution Count:722
722
725 } else {
executed: }
Execution Count:931927
931927
726 b = foldCase(b); -
727 for (; i != e; ++i)
evaluated: i != e
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:22
22-58
728 if (foldCase(*i) == b)
evaluated: foldCase(*i) == b
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:28
28-30
729 *i = a;
executed: *i = a;
Execution Count:30
30
730 }
executed: }
Execution Count:22
22
731 } -
732 return *this;
executed: return *this;
Execution Count:931951
931951
733} -
734QString &QString::replace(QLatin1String before, QLatin1String after, Qt::CaseSensitivity cs) -
735{ -
736 int alen = after.size(); -
737 QVarLengthArray<ushort> a(alen); -
738 for (int i = 0; i < alen; ++i)
evaluated: i < alen
TRUEFALSE
yes
Evaluation Count:1487
yes
Evaluation Count:528
528-1487
739 a[i] = (uchar)after.latin1()[i];
executed: a[i] = (uchar)after.latin1()[i];
Execution Count:1487
1487
740 int blen = before.size(); -
741 QVarLengthArray<ushort> b(blen); -
742 for (int i = 0; i < blen; ++i)
evaluated: i < blen
TRUEFALSE
yes
Evaluation Count:2926
yes
Evaluation Count:528
528-2926
743 b[i] = (uchar)before.latin1()[i];
executed: b[i] = (uchar)before.latin1()[i];
Execution Count:2926
2926
744 return replace((const QChar *)b.data(), blen, (const QChar *)a.data(), alen, cs);
executed: return replace((const QChar *)b.data(), blen, (const QChar *)a.data(), alen, cs);
Execution Count:528
528
745} -
746QString &QString::replace(QLatin1String before, const QString &after, Qt::CaseSensitivity cs) -
747{ -
748 int blen = before.size(); -
749 QVarLengthArray<ushort> b(blen); -
750 for (int i = 0; i < blen; ++i)
evaluated: i < blen
TRUEFALSE
yes
Evaluation Count:258
yes
Evaluation Count:129
129-258
751 b[i] = (uchar)before.latin1()[i];
executed: b[i] = (uchar)before.latin1()[i];
Execution Count:258
258
752 return replace((const QChar *)b.data(), blen, after.constData(), after.d->size, cs);
executed: return replace((const QChar *)b.data(), blen, after.constData(), after.d->size, cs);
Execution Count:129
129
753} -
754QString &QString::replace(const QString &before, QLatin1String after, Qt::CaseSensitivity cs) -
755{ -
756 int alen = after.size(); -
757 QVarLengthArray<ushort> a(alen); -
758 for (int i = 0; i < alen; ++i)
never evaluated: i < alen
0
759 a[i] = (uchar)after.latin1()[i];
never executed: a[i] = (uchar)after.latin1()[i];
0
760 return replace(before.constData(), before.d->size, (const QChar *)a.data(), alen, cs);
never executed: return replace(before.constData(), before.d->size, (const QChar *)a.data(), alen, cs);
0
761} -
762QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs) -
763{ -
764 int alen = after.size(); -
765 QVarLengthArray<ushort> a(alen); -
766 for (int i = 0; i < alen; ++i)
evaluated: i < alen
TRUEFALSE
yes
Evaluation Count:14727
yes
Evaluation Count:5503
5503-14727
767 a[i] = (uchar)after.latin1()[i];
executed: a[i] = (uchar)after.latin1()[i];
Execution Count:14727
14727
768 return replace(&c, 1, (const QChar *)a.data(), alen, cs);
executed: return replace(&c, 1, (const QChar *)a.data(), alen, cs);
Execution Count:5503
5503
769} -
770bool operator==(const QString &s1, const QString &s2) -
771{ -
772 if (s1.d->size != s2.d->size)
evaluated: s1.d->size != s2.d->size
TRUEFALSE
yes
Evaluation Count:341015
yes
Evaluation Count:2205315
341015-2205315
773 return false;
executed: return false;
Execution Count:341015
341015
774 -
775 return qMemEquals(s1.d->data(), s2.d->data(), s1.d->size);
executed: return qMemEquals(s1.d->data(), s2.d->data(), s1.d->size);
Execution Count:2205313
2205313
776} -
777 -
778 -
779 -
780 -
781bool QString::operator==(QLatin1String other) const -
782{ -
783 if (d->size != other.size())
evaluated: d->size != other.size()
TRUEFALSE
yes
Evaluation Count:285300
yes
Evaluation Count:70731
70731-285300
784 return false;
executed: return false;
Execution Count:285300
285300
785 -
786 if (!other.size())
evaluated: !other.size()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:70726
7-70726
787 return isEmpty();
executed: return isEmpty();
Execution Count:7
7
788 -
789 const ushort *uc = d->data(); -
790 const ushort *e = uc + d->size; -
791 const uchar *c = (uchar *)other.latin1(); -
792 -
793 while (uc < e) {
evaluated: uc < e
TRUEFALSE
yes
Evaluation Count:376404
yes
Evaluation Count:55832
55832-376404
794 if (*uc != *c)
evaluated: *uc != *c
TRUEFALSE
yes
Evaluation Count:14895
yes
Evaluation Count:361509
14895-361509
795 return false;
executed: return false;
Execution Count:14895
14895
796 ++uc; -
797 ++c; -
798 }
executed: }
Execution Count:361511
361511
799 return true;
executed: return true;
Execution Count:55832
55832
800} -
801bool operator<(const QString &s1, const QString &s2) -
802{ -
803 return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0;
executed: return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0;
Execution Count:567875
567875
804} -
805 -
806 -
807 -
808 -
809bool QString::operator<(QLatin1String other) const -
810{ -
811 const uchar *c = (uchar *) other.latin1(); -
812 if (!c || *c == 0)
evaluated: !c
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1920
evaluated: *c == 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1913
5-1920
813 return false;
executed: return false;
Execution Count:12
12
814 -
815 const ushort *uc = d->data(); -
816 const ushort *e = uc + qMin(d->size, other.size()); -
817 -
818 while (uc < e) {
evaluated: uc < e
TRUEFALSE
yes
Evaluation Count:5360
yes
Evaluation Count:1862
1862-5360
819 if (*uc != *c)
evaluated: *uc != *c
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:5309
51-5309
820 break;
executed: break;
Execution Count:51
51
821 ++uc; -
822 ++c; -
823 }
executed: }
Execution Count:5309
5309
824 return (uc == e ? d->size < other.size() : *uc < *c);
executed: return (uc == e ? d->size < other.size() : *uc < *c);
Execution Count:1913
1913
825} -
826bool QString::operator>(QLatin1String other) const -
827{ -
828 const uchar *c = (uchar *) other.latin1(); -
829 if (!c || *c == '\0')
evaluated: !c
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:72913
evaluated: *c == '\0'
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:72900
5-72913
830 return !isEmpty();
executed: return !isEmpty();
Execution Count:18
18
831 -
832 const ushort *uc = d->data(); -
833 const ushort *e = uc + qMin(d->size, other.size()); -
834 -
835 while (uc < e) {
evaluated: uc < e
TRUEFALSE
yes
Evaluation Count:228038
yes
Evaluation Count:31383
31383-228038
836 if (*uc != *c)
evaluated: *uc != *c
TRUEFALSE
yes
Evaluation Count:41517
yes
Evaluation Count:186521
41517-186521
837 break;
executed: break;
Execution Count:41517
41517
838 ++uc; -
839 ++c; -
840 }
executed: }
Execution Count:186521
186521
841 return (uc == e) ? d->size > other.size() : *uc > *c;
executed: return (uc == e) ? d->size > other.size() : *uc > *c;
Execution Count:72900
72900
842} -
843int QString::indexOf(const QString &str, int from, Qt::CaseSensitivity cs) const -
844{ -
845 return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs);
executed: return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs);
Execution Count:54534
54534
846} -
847int QString::indexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const -
848{ -
849 return qt_find_latin1_string(unicode(), size(), str, from, cs);
executed: return qt_find_latin1_string(unicode(), size(), str, from, cs);
Execution Count:2528
2528
850} -
851 -
852int qFindString( -
853 const QChar *haystack0, int haystackLen, int from, -
854 const QChar *needle0, int needleLen, Qt::CaseSensitivity cs) -
855{ -
856 const int l = haystackLen; -
857 const int sl = needleLen; -
858 if (from < 0)
partially evaluated: from < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:198647
0-198647
859 from += l;
never executed: from += l;
0
860 if (uint(sl + from) > (uint)l)
evaluated: uint(sl + from) > (uint)l
TRUEFALSE
yes
Evaluation Count:53520
yes
Evaluation Count:145127
53520-145127
861 return -1;
executed: return -1;
Execution Count:53520
53520
862 if (!sl)
evaluated: !sl
TRUEFALSE
yes
Evaluation Count:337
yes
Evaluation Count:144790
337-144790
863 return from;
executed: return from;
Execution Count:337
337
864 if (!l)
partially evaluated: !l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:144790
0-144790
865 return -1;
never executed: return -1;
0
866 -
867 if (sl == 1)
evaluated: sl == 1
TRUEFALSE
yes
Evaluation Count:127178
yes
Evaluation Count:17612
17612-127178
868 return findChar(haystack0, haystackLen, needle0[0], from, cs);
executed: return findChar(haystack0, haystackLen, needle0[0], from, cs);
Execution Count:127178
127178
869 -
870 -
871 -
872 -
873 -
874 -
875 if (l > 500 && sl > 5)
evaluated: l > 500
TRUEFALSE
yes
Evaluation Count:235
yes
Evaluation Count:17377
evaluated: sl > 5
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:20
20-17377
876 return qFindStringBoyerMoore(haystack0, haystackLen, from, 215
877 needle0, needleLen, cs);
executed: return qFindStringBoyerMoore(haystack0, haystackLen, from, needle0, needleLen, cs);
Execution Count:215
215
878 -
879 -
880 -
881 -
882 -
883 -
884 -
885 const ushort *needle = (const ushort *)needle0; -
886 const ushort *haystack = (const ushort *)haystack0 + from; -
887 const ushort *end = (const ushort *)haystack0 + (l-sl); -
888 const int sl_minus_1 = sl-1; -
889 int hashNeedle = 0, hashHaystack = 0, idx; -
890 -
891 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:14608
yes
Evaluation Count:2789
2789-14608
892 for (idx = 0; idx < sl; ++idx) {
evaluated: idx < sl
TRUEFALSE
yes
Evaluation Count:85783
yes
Evaluation Count:14608
14608-85783
893 hashNeedle = ((hashNeedle<<1) + needle[idx]); -
894 hashHaystack = ((hashHaystack<<1) + haystack[idx]); -
895 }
executed: }
Execution Count:85783
85783
896 hashHaystack -= haystack[sl_minus_1]; -
897 -
898 while (haystack <= end) {
evaluated: haystack <= end
TRUEFALSE
yes
Evaluation Count:188199
yes
Evaluation Count:11548
11548-188199
899 hashHaystack += haystack[sl_minus_1]; -
900 if (hashHaystack == hashNeedle
evaluated: hashHaystack == hashNeedle
TRUEFALSE
yes
Evaluation Count:3134
yes
Evaluation Count:185065
3134-185065
901 && ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0)
evaluated: ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0
TRUEFALSE
yes
Evaluation Count:3060
yes
Evaluation Count:74
74-3060
902 return haystack - (const ushort *)haystack0;
executed: return haystack - (const ushort *)haystack0;
Execution Count:3060
3060
903 -
904 if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (*haystack) << sl_minus_1; hashHaystack <<= 1;
evaluated: sl_minus_1 < (int)sizeof(int) * 8
TRUEFALSE
yes
Evaluation Count:184006
yes
Evaluation Count:1133
executed: hashHaystack -= (*haystack) << sl_minus_1;
Execution Count:184006
1133-184006
905 ++haystack; -
906 }
executed: }
Execution Count:185139
185139
907 } else {
executed: }
Execution Count:11548
11548
908 const ushort *haystack_start = (const ushort *)haystack0; -
909 for (idx = 0; idx < sl; ++idx) {
evaluated: idx < sl
TRUEFALSE
yes
Evaluation Count:11210
yes
Evaluation Count:2789
2789-11210
910 hashNeedle = (hashNeedle<<1) + foldCase(needle + idx, needle); -
911 hashHaystack = (hashHaystack<<1) + foldCase(haystack + idx, haystack_start); -
912 }
executed: }
Execution Count:11210
11210
913 hashHaystack -= foldCase(haystack + sl_minus_1, haystack_start); -
914 -
915 while (haystack <= end) {
evaluated: haystack <= end
TRUEFALSE
yes
Evaluation Count:9870
yes
Evaluation Count:1694
1694-9870
916 hashHaystack += foldCase(haystack + sl_minus_1, haystack_start); -
917 if (hashHaystack == hashNeedle && ucstrnicmp(needle, haystack, sl) == 0)
evaluated: hashHaystack == hashNeedle
TRUEFALSE
yes
Evaluation Count:1105
yes
Evaluation Count:8765
evaluated: ucstrnicmp(needle, haystack, sl) == 0
TRUEFALSE
yes
Evaluation Count:1095
yes
Evaluation Count:10
10-8765
918 return haystack - (const ushort *)haystack0;
executed: return haystack - (const ushort *)haystack0;
Execution Count:1095
1095
919 -
920 if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (foldCase(haystack, haystack_start)) << sl_minus_1; hashHaystack <<= 1;
evaluated: sl_minus_1 < (int)sizeof(int) * 8
TRUEFALSE
yes
Evaluation Count:8590
yes
Evaluation Count:185
executed: hashHaystack -= (foldCase(haystack, haystack_start)) << sl_minus_1;
Execution Count:8590
185-8590
921 ++haystack; -
922 }
executed: }
Execution Count:8775
8775
923 }
executed: }
Execution Count:1694
1694
924 return -1;
executed: return -1;
Execution Count:13242
13242
925} -
926int QString::indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const -
927{ -
928 return findChar(unicode(), length(), ch, from, cs);
executed: return findChar(unicode(), length(), ch, from, cs);
Execution Count:158057
158057
929} -
930int QString::indexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const -
931{ -
932 return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs);
executed: return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs);
Execution Count:392
392
933} -
934 -
935static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *needle, int sl, Qt::CaseSensitivity cs) -
936{ -
937 -
938 -
939 -
940 -
941 const ushort *end = haystack; -
942 haystack += from; -
943 const int sl_minus_1 = sl-1; -
944 const ushort *n = needle+sl_minus_1; -
945 const ushort *h = haystack+sl_minus_1; -
946 int hashNeedle = 0, hashHaystack = 0, idx; -
947 -
948 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:98
78-98
949 for (idx = 0; idx < sl; ++idx) {
evaluated: idx < sl
TRUEFALSE
yes
Evaluation Count:1042
yes
Evaluation Count:78
78-1042
950 hashNeedle = ((hashNeedle<<1) + *(n-idx)); -
951 hashHaystack = ((hashHaystack<<1) + *(h-idx)); -
952 }
executed: }
Execution Count:1042
1042
953 hashHaystack -= *haystack; -
954 -
955 while (haystack >= end) {
evaluated: haystack >= end
TRUEFALSE
yes
Evaluation Count:653
yes
Evaluation Count:17
17-653
956 hashHaystack += *haystack; -
957 if (hashHaystack == hashNeedle
evaluated: hashHaystack == hashNeedle
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:588
65-588
958 && ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0)
evaluated: ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:4
4-61
959 return haystack - end;
executed: return haystack - end;
Execution Count:61
61
960 --haystack; -
961 if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (haystack[sl]) << sl_minus_1; hashHaystack <<= 1;
evaluated: sl_minus_1 < (int)sizeof(int) * 8
TRUEFALSE
yes
Evaluation Count:456
yes
Evaluation Count:136
executed: hashHaystack -= (haystack[sl]) << sl_minus_1;
Execution Count:456
136-456
962 }
executed: }
Execution Count:592
592
963 } else {
executed: }
Execution Count:17
17
964 for (idx = 0; idx < sl; ++idx) {
evaluated: idx < sl
TRUEFALSE
yes
Evaluation Count:1086
yes
Evaluation Count:98
98-1086
965 hashNeedle = ((hashNeedle<<1) + foldCase(n-idx, needle)); -
966 hashHaystack = ((hashHaystack<<1) + foldCase(h-idx, end)); -
967 }
executed: }
Execution Count:1086
1086
968 hashHaystack -= foldCase(haystack, end); -
969 -
970 while (haystack >= end) {
evaluated: haystack >= end
TRUEFALSE
yes
Evaluation Count:649
yes
Evaluation Count:37
37-649
971 hashHaystack += foldCase(haystack, end); -
972 if (hashHaystack == hashNeedle && ucstrnicmp(needle, haystack, sl) == 0)
evaluated: hashHaystack == hashNeedle
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:584
evaluated: ucstrnicmp(needle, haystack, sl) == 0
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:4
4-584
973 return haystack - end;
executed: return haystack - end;
Execution Count:61
61
974 --haystack; -
975 if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (foldCase(haystack + sl, end)) << sl_minus_1; hashHaystack <<= 1;
evaluated: sl_minus_1 < (int)sizeof(int) * 8
TRUEFALSE
yes
Evaluation Count:452
yes
Evaluation Count:136
executed: hashHaystack -= (foldCase(haystack + sl, end)) << sl_minus_1;
Execution Count:452
136-452
976 }
executed: }
Execution Count:588
588
977 }
executed: }
Execution Count:37
37
978 return -1;
executed: return -1;
Execution Count:54
54
979} -
980int QString::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) const -
981{ -
982 const int sl = str.d->size; -
983 if (sl == 1)
evaluated: sl == 1
TRUEFALSE
yes
Evaluation Count:3220
yes
Evaluation Count:83
83-3220
984 return lastIndexOf(QChar(str.d->data()[0]), from, cs);
executed: return lastIndexOf(QChar(str.d->data()[0]), from, cs);
Execution Count:3220
3220
985 -
986 const int l = d->size; -
987 if (from < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:23
23-60
988 from += l;
executed: from += l;
Execution Count:60
60
989 int delta = l-sl; -
990 if (from == l && sl == 0)
evaluated: from == l
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:77
evaluated: sl == 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3-77
991 return from;
executed: return from;
Execution Count:3
3
992 if (from < 0 || from >= l || delta < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:70
evaluated: from >= l
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:64
evaluated: delta < 0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:55
6-70
993 return -1;
executed: return -1;
Execution Count:25
25
994 if (from > delta)
evaluated: from > delta
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:17
17-38
995 from = delta;
executed: from = delta;
Execution Count:38
38
996 -
997 return lastIndexOfHelper(d->data(), from, str.d->data(), str.d->size, cs);
executed: return lastIndexOfHelper(d->data(), from, str.d->data(), str.d->size, cs);
Execution Count:55
55
998} -
999int QString::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const -
1000{ -
1001 const int sl = str.size(); -
1002 if (sl == 1)
evaluated: sl == 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:13
4-13
1003 return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs);
executed: return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs);
Execution Count:4
4
1004 -
1005 const int l = d->size; -
1006 if (from < 0)
partially evaluated: from < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1007 from += l;
never executed: from += l;
0
1008 int delta = l-sl; -
1009 if (from == l && sl == 0)
partially evaluated: from == l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
never evaluated: sl == 0
0-13
1010 return from;
never executed: return from;
0
1011 if (from < 0 || from >= l || delta < 0)
partially evaluated: from < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: from >= l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: delta < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1012 return -1;
never executed: return -1;
0
1013 if (from > delta)
partially evaluated: from > delta
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
1014 from = delta;
executed: from = delta;
Execution Count:13
13
1015 -
1016 QVarLengthArray<ushort> s(sl); -
1017 for (int i = 0; i < sl; ++i)
evaluated: i < sl
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:13
13-39
1018 s[i] = str.latin1()[i];
executed: s[i] = str.latin1()[i];
Execution Count:39
39
1019 -
1020 return lastIndexOfHelper(d->data(), from, s.data(), sl, cs);
executed: return lastIndexOfHelper(d->data(), from, s.data(), sl, cs);
Execution Count:13
13
1021} -
1022 -
1023 -
1024 -
1025 -
1026 -
1027 -
1028 -
1029int QString::lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const -
1030{ -
1031 return qt_last_index_of(unicode(), size(), ch, from, cs);
executed: return qt_last_index_of(unicode(), size(), ch, from, cs);
Execution Count:26094
26094
1032} -
1033int QString::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const -
1034{ -
1035 const int sl = str.size(); -
1036 if (sl == 1)
evaluated: sl == 1
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:62
62-86
1037 return lastIndexOf(str.at(0), from, cs);
executed: return lastIndexOf(str.at(0), from, cs);
Execution Count:86
86
1038 -
1039 const int l = d->size; -
1040 if (from < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:14
14-48
1041 from += l;
executed: from += l;
Execution Count:48
48
1042 int delta = l - sl; -
1043 if (from == l && sl == 0)
evaluated: from == l
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:58
evaluated: sl == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2-58
1044 return from;
executed: return from;
Execution Count:2
2
1045 if (from < 0 || from >= l || delta < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:52
evaluated: from >= l
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:48
evaluated: delta < 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:40
4-52
1046 return -1;
executed: return -1;
Execution Count:20
20
1047 if (from > delta)
evaluated: from > delta
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:10
10-30
1048 from = delta;
executed: from = delta;
Execution Count:30
30
1049 -
1050 return lastIndexOfHelper(d->data(), from, reinterpret_cast<const ushort*>(str.unicode()), 40
1051 str.size(), cs);
executed: return lastIndexOfHelper(d->data(), from, reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs);
Execution Count:40
40
1052} -
1053 -
1054 -
1055struct QStringCapture -
1056{ -
1057 int pos; -
1058 int len; -
1059 int no; -
1060}; -
1061QString& QString::replace(const QRegExp &rx, const QString &after) -
1062{ -
1063 QRegExp rx2(rx); -
1064 -
1065 if (isEmpty() && rx2.indexIn(*this) == -1)
evaluated: isEmpty()
TRUEFALSE
yes
Evaluation Count:51964
yes
Evaluation Count:83451
evaluated: rx2.indexIn(*this) == -1
TRUEFALSE
yes
Evaluation Count:51946
yes
Evaluation Count:18
18-83451
1066 return *this;
executed: return *this;
Execution Count:51946
51946
1067 -
1068 reallocData(uint(d->size) + 1u); -
1069 -
1070 int index = 0; -
1071 int numCaptures = rx2.captureCount(); -
1072 int al = after.length(); -
1073 QRegExp::CaretMode caretMode = QRegExp::CaretAtZero; -
1074 -
1075 if (numCaptures > 0) {
evaluated: numCaptures > 0
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:83450
19-83450
1076 const QChar *uc = after.unicode(); -
1077 int numBackRefs = 0; -
1078 -
1079 for (int i = 0; i < al - 1; i++) {
evaluated: i < al - 1
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:19
19-141
1080 if (uc[i] == QLatin1Char('\\')) {
evaluated: uc[i] == QLatin1Char('\\')
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:85
56-85
1081 int no = uc[i + 1].digitValue(); -
1082 if (no > 0 && no <= numCaptures)
evaluated: no > 0
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:4
evaluated: no <= numCaptures
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:2
2-52
1083 numBackRefs++;
executed: numBackRefs++;
Execution Count:50
50
1084 }
executed: }
Execution Count:56
56
1085 }
executed: }
Execution Count:141
141
1086 -
1087 -
1088 -
1089 -
1090 if (numBackRefs > 0) {
evaluated: numBackRefs > 0
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:6
6-13
1091 QVarLengthArray<QStringCapture, 16> captures(numBackRefs); -
1092 int j = 0; -
1093 -
1094 for (int i = 0; i < al - 1; i++) {
evaluated: i < al - 1
TRUEFALSE
yes
Evaluation Count:132
yes
Evaluation Count:13
13-132
1095 if (uc[i] == QLatin1Char('\\')) {
evaluated: uc[i] == QLatin1Char('\\')
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:80
52-80
1096 int no = uc[i + 1].digitValue(); -
1097 if (no > 0 && no <= numCaptures) {
evaluated: no > 0
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:1
evaluated: no <= numCaptures
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:1
1-51
1098 QStringCapture capture; -
1099 capture.pos = i; -
1100 capture.len = 2; -
1101 -
1102 if (i < al - 2) {
evaluated: i < al - 2
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:6
6-44
1103 int secondDigit = uc[i + 2].digitValue(); -
1104 if (secondDigit != -1 && ((no * 10) + secondDigit) <= numCaptures) {
evaluated: secondDigit != -1
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:16
evaluated: ((no * 10) + secondDigit) <= numCaptures
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:22
6-28
1105 no = (no * 10) + secondDigit; -
1106 ++capture.len; -
1107 }
executed: }
Execution Count:6
6
1108 }
executed: }
Execution Count:44
44
1109 -
1110 capture.no = no; -
1111 captures[j++] = capture; -
1112 }
executed: }
Execution Count:50
50
1113 }
executed: }
Execution Count:52
52
1114 }
executed: }
Execution Count:132
132
1115 -
1116 while (index <= length()) {
partially evaluated: index <= length()
TRUEFALSE
yes
Evaluation Count:35
no
Evaluation Count:0
0-35
1117 index = rx2.indexIn(*this, index, caretMode); -
1118 if (index == -1)
evaluated: index == -1
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:22
13-22
1119 break;
executed: break;
Execution Count:13
13
1120 -
1121 QString after2(after); -
1122 for (j = numBackRefs - 1; j >= 0; j--) {
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:22
22-58
1123 const QStringCapture &capture = captures[j]; -
1124 after2.replace(capture.pos, capture.len, rx2.cap(capture.no)); -
1125 }
executed: }
Execution Count:58
58
1126 -
1127 replace(index, rx2.matchedLength(), after2); -
1128 index += after2.length(); -
1129 -
1130 -
1131 if (rx2.matchedLength() == 0)
partially evaluated: rx2.matchedLength() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
1132 ++index;
never executed: ++index;
0
1133 -
1134 caretMode = QRegExp::CaretWontMatch; -
1135 }
executed: }
Execution Count:22
22
1136 return *this;
executed: return *this;
Execution Count:13
13
1137 } -
1138 }
executed: }
Execution Count:6
6
1139 -
1140 -
1141 -
1142 -
1143 -
1144 while (index != -1) {
evaluated: index != -1
TRUEFALSE
yes
Evaluation Count:83456
yes
Evaluation Count:1101
1101-83456
1145 struct { -
1146 int pos; -
1147 int length; -
1148 } replacements[2048]; -
1149 -
1150 int pos = 0; -
1151 int adjust = 0; -
1152 while (pos < 2047) {
partially evaluated: pos < 2047
TRUEFALSE
yes
Evaluation Count:84789
no
Evaluation Count:0
0-84789
1153 index = rx2.indexIn(*this, index, caretMode); -
1154 if (index == -1)
evaluated: index == -1
TRUEFALSE
yes
Evaluation Count:83456
yes
Evaluation Count:1333
1333-83456
1155 break;
executed: break;
Execution Count:83456
83456
1156 int ml = rx2.matchedLength(); -
1157 replacements[pos].pos = index; -
1158 replacements[pos++].length = ml; -
1159 index += ml; -
1160 adjust += al - ml; -
1161 -
1162 if (!ml)
evaluated: !ml
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1287
46-1287
1163 index++;
executed: index++;
Execution Count:46
46
1164 }
executed: }
Execution Count:1333
1333
1165 if (!pos)
evaluated: !pos
TRUEFALSE
yes
Evaluation Count:82355
yes
Evaluation Count:1101
1101-82355
1166 break;
executed: break;
Execution Count:82355
82355
1167 replacements[pos].pos = d->size; -
1168 int newlen = d->size + adjust; -
1169 -
1170 -
1171 -
1172 if (index != -1)
partially evaluated: index != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1101
0-1101
1173 index += adjust;
never executed: index += adjust;
0
1174 QString newstring; -
1175 newstring.reserve(newlen + 1); -
1176 QChar *newuc = newstring.data(); -
1177 QChar *uc = newuc; -
1178 int copystart = 0; -
1179 int i = 0; -
1180 while (i < pos) {
evaluated: i < pos
TRUEFALSE
yes
Evaluation Count:1333
yes
Evaluation Count:1101
1101-1333
1181 int copyend = replacements[i].pos; -
1182 int size = copyend - copystart; -
1183 memcpy(uc, d->data() + copystart, size * sizeof(QChar)); -
1184 uc += size; -
1185 memcpy(uc, after.d->data(), al * sizeof(QChar)); -
1186 uc += al; -
1187 copystart = copyend + replacements[i].length; -
1188 i++; -
1189 }
executed: }
Execution Count:1333
1333
1190 memcpy(uc, d->data() + copystart, (d->size - copystart) * sizeof(QChar)); -
1191 newstring.resize(newlen); -
1192 *this = newstring; -
1193 caretMode = QRegExp::CaretWontMatch; -
1194 }
executed: }
Execution Count:1101
1101
1195 return *this;
executed: return *this;
Execution Count:83456
83456
1196} -
1197QString &QString::replace(const QRegularExpression &re, const QString &after) -
1198{ -
1199 if (!re.isValid()) {
evaluated: !re.isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:33
2-33
1200 QMessageLogger("tools/qstring.cpp", 2951, __PRETTY_FUNCTION__).warning("QString::replace: invalid QRegularExpression object"); -
1201 return *this;
executed: return *this;
Execution Count:2
2
1202 } -
1203 -
1204 const QString copy(*this); -
1205 QRegularExpressionMatchIterator iterator = re.globalMatch(copy); -
1206 if (!iterator.hasNext())
evaluated: !iterator.hasNext()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:21
12-21
1207 return *this;
executed: return *this;
Execution Count:12
12
1208 -
1209 reallocData(uint(d->size) + 1u); -
1210 -
1211 int numCaptures = re.captureCount(); -
1212 -
1213 -
1214 -
1215 QVector<QStringCapture> backReferences; -
1216 const int al = after.length(); -
1217 const QChar *ac = after.unicode(); -
1218 -
1219 for (int i = 0; i < al - 1; i++) {
evaluated: i < al - 1
TRUEFALSE
yes
Evaluation Count:138
yes
Evaluation Count:21
21-138
1220 if (ac[i] == QLatin1Char('\\')) {
evaluated: ac[i] == QLatin1Char('\\')
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:83
55-83
1221 int no = ac[i + 1].digitValue(); -
1222 if (no > 0 && no <= numCaptures) {
evaluated: no > 0
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:4
evaluated: no <= numCaptures
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:3
3-51
1223 QStringCapture backReference; -
1224 backReference.pos = i; -
1225 backReference.len = 2; -
1226 -
1227 if (i < al - 2) {
evaluated: i < al - 2
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:5
5-43
1228 int secondDigit = ac[i + 2].digitValue(); -
1229 if (secondDigit != -1 && ((no * 10) + secondDigit) <= numCaptures) {
evaluated: secondDigit != -1
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:15
evaluated: ((no * 10) + secondDigit) <= numCaptures
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:22
6-28
1230 no = (no * 10) + secondDigit; -
1231 ++backReference.len; -
1232 }
executed: }
Execution Count:6
6
1233 }
executed: }
Execution Count:43
43
1234 -
1235 backReference.no = no; -
1236 backReferences.append(backReference); -
1237 }
executed: }
Execution Count:48
48
1238 }
executed: }
Execution Count:55
55
1239 }
executed: }
Execution Count:138
138
1240 -
1241 -
1242 -
1243 -
1244 -
1245 int newLength = 0; -
1246 int lastEnd = 0; -
1247 QVector<QStringRef> chunks; -
1248 while (iterator.hasNext()) {
evaluated: iterator.hasNext()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:21
21-38
1249 QRegularExpressionMatch match = iterator.next(); -
1250 int len; -
1251 -
1252 len = match.capturedStart() - lastEnd; -
1253 if (len > 0) {
evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:34
4-34
1254 chunks << copy.midRef(lastEnd, len); -
1255 newLength += len; -
1256 }
executed: }
Execution Count:4
4
1257 -
1258 lastEnd = 0; -
1259 -
1260 for (QForeachContainer<__typeof__(backReferences)> _container_(backReferences); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QStringCapture &backReference = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1261 -
1262 len = backReference.pos - lastEnd; -
1263 if (len > 0) {
evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:30
28-30
1264 chunks << after.midRef(lastEnd, len); -
1265 newLength += len; -
1266 }
executed: }
Execution Count:28
28
1267 -
1268 -
1269 len = match.capturedLength(backReference.no); -
1270 if (len > 0) {
evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:1
1-57
1271 chunks << copy.midRef(match.capturedStart(backReference.no), len); -
1272 newLength += len; -
1273 }
executed: }
Execution Count:57
57
1274 -
1275 lastEnd = backReference.pos + backReference.len; -
1276 }
executed: }
Execution Count:58
58
1277 -
1278 -
1279 len = after.length() - lastEnd; -
1280 if (len > 0) {
evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:11
11-27
1281 chunks << after.midRef(lastEnd, len); -
1282 newLength += len; -
1283 }
executed: }
Execution Count:27
27
1284 -
1285 lastEnd = match.capturedEnd(); -
1286 }
executed: }
Execution Count:38
38
1287 -
1288 -
1289 if (copy.length() > lastEnd) {
evaluated: copy.length() > lastEnd
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:14
7-14
1290 chunks << copy.midRef(lastEnd); -
1291 newLength += copy.length() - lastEnd; -
1292 }
executed: }
Execution Count:7
7
1293 -
1294 -
1295 resize(newLength); -
1296 int i = 0; -
1297 QChar *uc = data(); -
1298 for (QForeachContainer<__typeof__(chunks)> _container_(chunks); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QStringRef &chunk = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
1299 int len = chunk.length(); -
1300 memcpy(uc + i, chunk.unicode(), len * sizeof(QChar)); -
1301 i += len; -
1302 }
executed: }
Execution Count:123
123
1303 -
1304 return *this;
executed: return *this;
Execution Count:21
21
1305} -
1306int QString::count(const QString &str, Qt::CaseSensitivity cs) const -
1307{ -
1308 return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
Execution Count:12
12
1309} -
1310 -
1311 -
1312 -
1313 -
1314 -
1315 -
1316 -
1317int QString::count(QChar ch, Qt::CaseSensitivity cs) const -
1318{ -
1319 return qt_string_count(unicode(), size(), ch, cs);
executed: return qt_string_count(unicode(), size(), ch, cs);
Execution Count:3589
3589
1320 } -
1321int QString::count(const QStringRef &str, Qt::CaseSensitivity cs) const -
1322{ -
1323 return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
Execution Count:4
4
1324} -
1325int QString::indexOf(const QRegExp& rx, int from) const -
1326{ -
1327 QRegExp rx2(rx); -
1328 return rx2.indexIn(*this, from);
executed: return rx2.indexIn(*this, from);
Execution Count:20294
20294
1329} -
1330int QString::indexOf(QRegExp& rx, int from) const -
1331{ -
1332 return rx.indexIn(*this, from);
executed: return rx.indexIn(*this, from);
Execution Count:372
372
1333} -
1334int QString::lastIndexOf(const QRegExp& rx, int from) const -
1335{ -
1336 QRegExp rx2(rx); -
1337 return rx2.lastIndexIn(*this, from);
executed: return rx2.lastIndexIn(*this, from);
Execution Count:36
36
1338} -
1339int QString::lastIndexOf(QRegExp& rx, int from) const -
1340{ -
1341 return rx.lastIndexIn(*this, from);
executed: return rx.lastIndexIn(*this, from);
Execution Count:36
36
1342} -
1343int QString::count(const QRegExp& rx) const -
1344{ -
1345 QRegExp rx2(rx); -
1346 int count = 0; -
1347 int index = -1; -
1348 int len = length(); -
1349 while (index < len - 1) {
partially evaluated: index < len - 1
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1350 index = rx2.indexIn(*this, index + 1); -
1351 if (index == -1)
evaluated: index == -1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
1352 break;
executed: break;
Execution Count:2
2
1353 count++; -
1354 }
executed: }
Execution Count:3
3
1355 return count;
executed: return count;
Execution Count:2
2
1356} -
1357int QString::indexOf(const QRegularExpression& re, int from) const -
1358{ -
1359 if (!re.isValid()) {
partially evaluated: !re.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:64
0-64
1360 QMessageLogger("tools/qstring.cpp", 3276, __PRETTY_FUNCTION__).warning("QString::indexOf: invalid QRegularExpression object"); -
1361 return -1;
never executed: return -1;
0
1362 } -
1363 -
1364 QRegularExpressionMatch match = re.match(*this, from); -
1365 if (match.hasMatch())
evaluated: match.hasMatch()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:31
31-33
1366 return match.capturedStart();
executed: return match.capturedStart();
Execution Count:33
33
1367 -
1368 return -1;
executed: return -1;
Execution Count:31
31
1369} -
1370int QString::lastIndexOf(const QRegularExpression &re, int from) const -
1371{ -
1372 if (!re.isValid()) {
evaluated: !re.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:18
1-18
1373 QMessageLogger("tools/qstring.cpp", 3302, __PRETTY_FUNCTION__).warning("QString::lastIndexOf: invalid QRegularExpression object"); -
1374 return -1;
executed: return -1;
Execution Count:1
1
1375 } -
1376 -
1377 int endpos = (from < 0) ? (size() + from + 1) : (from + 1);
evaluated: (from < 0)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:12
6-12
1378 -
1379 QRegularExpressionMatchIterator iterator = re.globalMatch(*this); -
1380 int lastIndex = -1; -
1381 while (iterator.hasNext()) {
evaluated: iterator.hasNext()
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:13
13-34
1382 QRegularExpressionMatch match = iterator.next(); -
1383 int start = match.capturedStart(); -
1384 if (start < endpos)
evaluated: start < endpos
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:5
5-29
1385 lastIndex = start;
executed: lastIndex = start;
Execution Count:29
29
1386 else -
1387 break;
executed: break;
Execution Count:5
5
1388 } -
1389 -
1390 return lastIndex;
executed: return lastIndex;
Execution Count:18
18
1391} -
1392 -
1393 -
1394 -
1395 -
1396 -
1397 -
1398 -
1399bool QString::contains(const QRegularExpression &re) const -
1400{ -
1401 if (!re.isValid()) {
evaluated: !re.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
1402 QMessageLogger("tools/qstring.cpp", 3331, __PRETTY_FUNCTION__).warning("QString::contains: invalid QRegularExpression object"); -
1403 return false;
executed: return false;
Execution Count:1
1
1404 } -
1405 QRegularExpressionMatch match = re.match(*this); -
1406 return match.hasMatch();
executed: return match.hasMatch();
Execution Count:5
5
1407} -
1408int QString::count(const QRegularExpression &re) const -
1409{ -
1410 if (!re.isValid()) {
evaluated: !re.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
1411 QMessageLogger("tools/qstring.cpp", 3353, __PRETTY_FUNCTION__).warning("QString::count: invalid QRegularExpression object"); -
1412 return 0;
executed: return 0;
Execution Count:1
1
1413 } -
1414 int count = 0; -
1415 int index = -1; -
1416 int len = length(); -
1417 while (index < len - 1) {
partially evaluated: index < len - 1
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1418 QRegularExpressionMatch match = re.match(*this, index + 1); -
1419 if (!match.hasMatch())
evaluated: !match.hasMatch()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
1420 break;
executed: break;
Execution Count:2
2
1421 index = match.capturedStart(); -
1422 count++; -
1423 }
executed: }
Execution Count:3
3
1424 return count;
executed: return count;
Execution Count:2
2
1425} -
1426QString QString::section(const QString &sep, int start, int end, SectionFlags flags) const -
1427{ -
1428 QStringList sections = split(sep, KeepEmptyParts, -
1429 (flags & SectionCaseInsensitiveSeps) ? Qt::CaseInsensitive : Qt::CaseSensitive); -
1430 if (sections.isEmpty())
partially evaluated: sections.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1999
0-1999
1431 return QString();
never executed: return QString();
0
1432 if (!(flags & SectionSkipEmpty)) {
evaluated: !(flags & SectionSkipEmpty)
TRUEFALSE
yes
Evaluation Count:200
yes
Evaluation Count:1799
200-1799
1433 if (start < 0)
evaluated: start < 0
TRUEFALSE
yes
Evaluation Count:185
yes
Evaluation Count:15
15-185
1434 start += sections.count();
executed: start += sections.count();
Execution Count:185
185
1435 if (end < 0)
evaluated: end < 0
TRUEFALSE
yes
Evaluation Count:187
yes
Evaluation Count:13
13-187
1436 end += sections.count();
executed: end += sections.count();
Execution Count:187
187
1437 } else {
executed: }
Execution Count:200
200
1438 int skip = 0; -
1439 for (int k=0; k<sections.size(); ++k) {
evaluated: k<sections.size()
TRUEFALSE
yes
Evaluation Count:14488
yes
Evaluation Count:1799
1799-14488
1440 if (sections.at(k).isEmpty())
evaluated: sections.at(k).isEmpty()
TRUEFALSE
yes
Evaluation Count:1914
yes
Evaluation Count:12574
1914-12574
1441 skip++;
executed: skip++;
Execution Count:1914
1914
1442 }
executed: }
Execution Count:14488
14488
1443 if (start < 0)
partially evaluated: start < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1799
0-1799
1444 start += sections.count() - skip;
never executed: start += sections.count() - skip;
0
1445 if (end < 0)
evaluated: end < 0
TRUEFALSE
yes
Evaluation Count:1792
yes
Evaluation Count:7
7-1792
1446 end += sections.count() - skip;
executed: end += sections.count() - skip;
Execution Count:1792
1792
1447 }
executed: }
Execution Count:1799
1799
1448 int x = 0; -
1449 QString ret; -
1450 int first_i = start, last_i = end; -
1451 for (int i = 0; x <= end && i < sections.size(); ++i) {
evaluated: x <= end
TRUEFALSE
yes
Evaluation Count:12862
yes
Evaluation Count:1999
partially evaluated: i < sections.size()
TRUEFALSE
yes
Evaluation Count:12862
no
Evaluation Count:0
0-12862
1452 QString section = sections.at(i); -
1453 const bool empty = section.isEmpty(); -
1454 if (x >= start) {
evaluated: x >= start
TRUEFALSE
yes
Evaluation Count:2037
yes
Evaluation Count:10825
2037-10825
1455 if(x == start)
evaluated: x == start
TRUEFALSE
yes
Evaluation Count:2022
yes
Evaluation Count:15
15-2022
1456 first_i = i;
executed: first_i = i;
Execution Count:2022
2022
1457 if(x == end)
evaluated: x == end
TRUEFALSE
yes
Evaluation Count:2022
yes
Evaluation Count:15
15-2022
1458 last_i = i;
executed: last_i = i;
Execution Count:2022
2022
1459 if(x > start)
evaluated: x > start
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:2022
15-2022
1460 ret += sep;
executed: ret += sep;
Execution Count:15
15
1461 ret += section; -
1462 }
executed: }
Execution Count:2037
2037
1463 if (!empty || !(flags & SectionSkipEmpty))
evaluated: !empty
TRUEFALSE
yes
Evaluation Count:12788
yes
Evaluation Count:74
evaluated: !(flags & SectionSkipEmpty)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:62
12-12788
1464 x++;
executed: x++;
Execution Count:12800
12800
1465 }
executed: }
Execution Count:12862
12862
1466 if((flags & SectionIncludeLeadingSep) && first_i)
evaluated: (flags & SectionIncludeLeadingSep)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1988
evaluated: first_i
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4
4-1988
1467 ret.prepend(sep);
executed: ret.prepend(sep);
Execution Count:7
7
1468 if((flags & SectionIncludeTrailingSep) && last_i < sections.size()-1)
evaluated: (flags & SectionIncludeTrailingSep)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1991
evaluated: last_i < sections.size()-1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-1991
1469 ret += sep;
executed: ret += sep;
Execution Count:6
6
1470 return ret;
executed: return ret;
Execution Count:1999
1999
1471} -
1472 -
1473 -
1474class qt_section_chunk { -
1475public: -
1476 qt_section_chunk(int l, QString s) { length = l; string = s; }
executed: }
Execution Count:582
582
1477 int length; -
1478 QString string; -
1479}; -
1480 -
1481static QString extractSections(const QList<qt_section_chunk> &sections, -
1482 int start, -
1483 int end, -
1484 QString::SectionFlags flags) -
1485{ -
1486 if (start < 0)
evaluated: start < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:70
4-70
1487 start += sections.count();
executed: start += sections.count();
Execution Count:4
4
1488 if (end < 0)
evaluated: end < 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:64
10-64
1489 end += sections.count();
executed: end += sections.count();
Execution Count:10
10
1490 -
1491 QString ret; -
1492 int x = 0; -
1493 int first_i = start, last_i = end; -
1494 for (int i = 0; x <= end && i < sections.size(); ++i) {
evaluated: x <= end
TRUEFALSE
yes
Evaluation Count:344
yes
Evaluation Count:72
evaluated: i < sections.size()
TRUEFALSE
yes
Evaluation Count:342
yes
Evaluation Count:2
2-344
1495 const qt_section_chunk &section = sections.at(i); -
1496 const bool empty = (section.length == section.string.length()); -
1497 if (x >= start) {
evaluated: x >= start
TRUEFALSE
yes
Evaluation Count:170
yes
Evaluation Count:172
170-172
1498 if (x == start)
evaluated: x == start
TRUEFALSE
yes
Evaluation Count:118
yes
Evaluation Count:52
52-118
1499 first_i = i;
executed: first_i = i;
Execution Count:118
118
1500 if (x == end)
evaluated: x == end
TRUEFALSE
yes
Evaluation Count:118
yes
Evaluation Count:52
52-118
1501 last_i = i;
executed: last_i = i;
Execution Count:118
118
1502 if (x != start)
evaluated: x != start
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:118
52-118
1503 ret += section.string;
executed: ret += section.string;
Execution Count:52
52
1504 else -
1505 ret += section.string.mid(section.length);
executed: ret += section.string.mid(section.length);
Execution Count:118
118
1506 } -
1507 if (!empty || !(flags & QString::SectionSkipEmpty))
evaluated: !empty
TRUEFALSE
yes
Evaluation Count:170
yes
Evaluation Count:172
evaluated: !(flags & QString::SectionSkipEmpty)
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:124
48-172
1508 x++;
executed: x++;
Execution Count:218
218
1509 }
executed: }
Execution Count:342
342
1510 -
1511 if ((flags & QString::SectionIncludeLeadingSep) && first_i < sections.size()) {
evaluated: (flags & QString::SectionIncludeLeadingSep)
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:30
evaluated: first_i < sections.size()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:2
2-44
1512 const qt_section_chunk &section = sections.at(first_i); -
1513 ret.prepend(section.string.left(section.length)); -
1514 }
executed: }
Execution Count:42
42
1515 -
1516 if ((flags & QString::SectionIncludeTrailingSep) && last_i+1 <= sections.size()-1) {
evaluated: (flags & QString::SectionIncludeTrailingSep)
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:44
evaluated: last_i+1 <= sections.size()-1
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:6
6-44
1517 const qt_section_chunk &section = sections.at(last_i+1); -
1518 ret += section.string.left(section.length); -
1519 }
executed: }
Execution Count:24
24
1520 -
1521 return ret;
executed: return ret;
Execution Count:74
74
1522} -
1523QString QString::section(const QRegExp &reg, int start, int end, SectionFlags flags) const -
1524{ -
1525 const QChar *uc = unicode(); -
1526 if(!uc)
partially evaluated: !uc
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-37
1527 return QString();
never executed: return QString();
0
1528 -
1529 QRegExp sep(reg); -
1530 sep.setCaseSensitivity((flags & SectionCaseInsensitiveSeps) ? Qt::CaseInsensitive -
1531 : Qt::CaseSensitive); -
1532 -
1533 QList<qt_section_chunk> sections; -
1534 int n = length(), m = 0, last_m = 0, last_len = 0; -
1535 while ((m = sep.indexIn(*this, m)) != -1) {
evaluated: (m = sep.indexIn(*this, m)) != -1
TRUEFALSE
yes
Evaluation Count:254
yes
Evaluation Count:37
37-254
1536 sections.append(qt_section_chunk(last_len, QString(uc + last_m, m - last_m))); -
1537 last_m = m; -
1538 last_len = sep.matchedLength(); -
1539 m += qMax(sep.matchedLength(), 1); -
1540 }
executed: }
Execution Count:254
254
1541 sections.append(qt_section_chunk(last_len, QString(uc + last_m, n - last_m))); -
1542 -
1543 return extractSections(sections, start, end, flags);
executed: return extractSections(sections, start, end, flags);
Execution Count:37
37
1544} -
1545QString QString::section(const QRegularExpression &re, int start, int end, SectionFlags flags) const -
1546{ -
1547 if (!re.isValid()) {
partially evaluated: !re.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-37
1548 QMessageLogger("tools/qstring.cpp", 3597, __PRETTY_FUNCTION__).warning("QString::section: invalid QRegularExpression object"); -
1549 return QString();
never executed: return QString();
0
1550 } -
1551 -
1552 const QChar *uc = unicode(); -
1553 if (!uc)
partially evaluated: !uc
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-37
1554 return QString();
never executed: return QString();
0
1555 -
1556 QRegularExpression sep(re); -
1557 if (flags & SectionCaseInsensitiveSeps)
evaluated: flags & SectionCaseInsensitiveSeps
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:36
1-36
1558 sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption);
executed: sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption);
Execution Count:1
1
1559 -
1560 QList<qt_section_chunk> sections; -
1561 int n = length(), m = 0, last_m = 0, last_len = 0; -
1562 QRegularExpressionMatchIterator iterator = sep.globalMatch(*this); -
1563 while (iterator.hasNext()) {
evaluated: iterator.hasNext()
TRUEFALSE
yes
Evaluation Count:254
yes
Evaluation Count:37
37-254
1564 QRegularExpressionMatch match = iterator.next(); -
1565 m = match.capturedStart(); -
1566 sections.append(qt_section_chunk(last_len, QString(uc + last_m, m - last_m))); -
1567 last_m = m; -
1568 last_len = match.capturedLength(); -
1569 }
executed: }
Execution Count:254
254
1570 sections.append(qt_section_chunk(last_len, QString(uc + last_m, n - last_m))); -
1571 -
1572 return extractSections(sections, start, end, flags);
executed: return extractSections(sections, start, end, flags);
Execution Count:37
37
1573} -
1574QString QString::left(int n) const -
1575{ -
1576 if (n >= d->size || n < 0)
evaluated: n >= d->size
TRUEFALSE
yes
Evaluation Count:83284
yes
Evaluation Count:27010
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:232
yes
Evaluation Count:26785
232-83284
1577 return *this;
executed: return *this;
Execution Count:83516
83516
1578 return QString((const QChar*) d->data(), n);
executed: return QString((const QChar*) d->data(), n);
Execution Count:26783
26783
1579} -
1580QString QString::right(int n) const -
1581{ -
1582 if (n >= d->size || n < 0)
evaluated: n >= d->size
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:3356
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3355
1-3356
1583 return *this;
executed: return *this;
Execution Count:64
64
1584 return QString((const QChar*) d->data() + d->size - n, n);
executed: return QString((const QChar*) d->data() + d->size - n, n);
Execution Count:3355
3355
1585} -
1586QString QString::mid(int position, int n) const -
1587{ -
1588 if (position > d->size)
evaluated: position > d->size
TRUEFALSE
yes
Evaluation Count:12142
yes
Evaluation Count:534136
12142-534136
1589 return QString();
executed: return QString();
Execution Count:12142
12142
1590 if (position < 0) {
evaluated: position < 0
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:534102
34-534102
1591 if (n < 0 || n + position >= d->size)
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:27
evaluated: n + position >= d->size
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:15
7-27
1592 return *this;
executed: return *this;
Execution Count:19
19
1593 if (n + position <= 0)
evaluated: n + position <= 0
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:4
4-11
1594 return QString();
executed: return QString();
Execution Count:11
11
1595 -
1596 n += position; -
1597 position = 0; -
1598 } else if (n < 0 || n > d->size - position)
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:353756
yes
Evaluation Count:180367
evaluated: n > d->size - position
TRUEFALSE
yes
Evaluation Count:474
yes
Evaluation Count:179925
executed: }
Execution Count:4
4-353756
1599 n = d->size - position;
executed: n = d->size - position;
Execution Count:354231
354231
1600 if (position == 0 && n == d->size)
evaluated: position == 0
TRUEFALSE
yes
Evaluation Count:121561
yes
Evaluation Count:412582
evaluated: n == d->size
TRUEFALSE
yes
Evaluation Count:97684
yes
Evaluation Count:23879
23879-412582
1601 return *this;
executed: return *this;
Execution Count:97679
97679
1602 return QString((const QChar*) d->data() + position, n);
executed: return QString((const QChar*) d->data() + position, n);
Execution Count:436452
436452
1603} -
1604bool QString::startsWith(const QString& s, Qt::CaseSensitivity cs) const -
1605{ -
1606 return qt_starts_with(isNull() ? 0 : unicode(), size(), 72040
1607 s.isNull() ? 0 : s.unicode(), s.size(), cs);
executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs);
Execution Count:72040
72040
1608} -
1609 -
1610 -
1611 -
1612 -
1613bool QString::startsWith(QLatin1String s, Qt::CaseSensitivity cs) const -
1614{ -
1615 return qt_starts_with(isNull() ? 0 : unicode(), size(), s, cs);
executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), s, cs);
Execution Count:666288
666288
1616} -
1617 -
1618 -
1619 -
1620 -
1621 -
1622 -
1623 -
1624bool QString::startsWith(QChar c, Qt::CaseSensitivity cs) const -
1625{ -
1626 return d->size 73747
1627 && (cs == Qt::CaseSensitive 73747
1628 ? d->data()[0] == c 73747
1629 : foldCase(d->data()[0]) == foldCase(c.unicode()));
executed: return d->size && (cs == Qt::CaseSensitive ? d->data()[0] == c : foldCase(d->data()[0]) == foldCase(c.unicode()));
Execution Count:73747
73747
1630} -
1631bool QString::startsWith(const QStringRef &s, Qt::CaseSensitivity cs) const -
1632{ -
1633 return qt_starts_with(isNull() ? 0 : unicode(), size(), 4
1634 s.isNull() ? 0 : s.unicode(), s.size(), cs);
executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs);
Execution Count:4
4
1635} -
1636bool QString::endsWith(const QString& s, Qt::CaseSensitivity cs) const -
1637{ -
1638 return qt_ends_with(isNull() ? 0 : unicode(), size(), 3459
1639 s.isNull() ? 0 : s.unicode(), s.size(), cs);
executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs);
Execution Count:3459
3459
1640 } -
1641bool QString::endsWith(const QStringRef &s, Qt::CaseSensitivity cs) const -
1642{ -
1643 return qt_ends_with(isNull() ? 0 : unicode(), size(), 6
1644 s.isNull() ? 0 : s.unicode(), s.size(), cs);
executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs);
Execution Count:6
6
1645} -
1646 -
1647 -
1648 -
1649 -
1650 -
1651bool QString::endsWith(QLatin1String s, Qt::CaseSensitivity cs) const -
1652{ -
1653 return qt_ends_with(isNull() ? 0 : unicode(), size(), s, cs);
executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), s, cs);
Execution Count:5538
5538
1654} -
1655 -
1656 -
1657 -
1658 -
1659 -
1660 -
1661 -
1662bool QString::endsWith(QChar c, Qt::CaseSensitivity cs) const -
1663{ -
1664 return d->size 35119
1665 && (cs == Qt::CaseSensitive 35119
1666 ? d->data()[d->size - 1] == c 35119
1667 : foldCase(d->data()[d->size - 1]) == foldCase(c.unicode()));
executed: return d->size && (cs == Qt::CaseSensitive ? d->data()[d->size - 1] == c : foldCase(d->data()[d->size - 1]) == foldCase(c.unicode()));
Execution Count:35119
35119
1668} -
1669 -
1670 -
1671 -
1672static inline __m128i mergeQuestionMarks(__m128i chunk) -
1673{ -
1674 const __m128i questionMark = _mm_set1_epi16('?'); -
1675 const __m128i signedBitOffset = _mm_set1_epi16(0x8000); -
1676 const __m128i thresholdMask = _mm_set1_epi16(0xff + 0x8000); -
1677 -
1678 const __m128i signedChunk = _mm_add_epi16(chunk, signedBitOffset); -
1679 const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask); -
1680 -
1681 -
1682 -
1683 -
1684 -
1685 -
1686 -
1687 const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark); -
1688 -
1689 -
1690 -
1691 const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk); -
1692 -
1693 -
1694 chunk = _mm_or_si128(correctBytes, offLimitQuestionMark); -
1695 -
1696 -
1697 return chunk;
executed: return chunk;
Execution Count:8809444
8809444
1698} -
1699 -
1700 -
1701static QByteArray toLatin1_helper(const QChar *data, int length) -
1702{ -
1703 QByteArray ba; -
1704 if (length) {
evaluated: length
TRUEFALSE
yes
Evaluation Count:18649589
yes
Evaluation Count:86475
86475-18649589
1705 ba.resize(length); -
1706 const ushort *src = reinterpret_cast<const ushort *>(data); -
1707 uchar *dst = (uchar*) ba.data(); -
1708 -
1709 if (length >= 16) {
evaluated: length >= 16
TRUEFALSE
yes
Evaluation Count:1383261
yes
Evaluation Count:17266336
1383261-17266336
1710 const int chunkCount = length >> 4; -
1711 -
1712 for (int i = 0; i < chunkCount; ++i) {
evaluated: i < chunkCount
TRUEFALSE
yes
Evaluation Count:4404724
yes
Evaluation Count:1383263
1383263-4404724
1713 __m128i chunk1 = _mm_loadu_si128((__m128i*)src); -
1714 chunk1 = mergeQuestionMarks(chunk1); -
1715 src += 8; -
1716 -
1717 __m128i chunk2 = _mm_loadu_si128((__m128i*)src); -
1718 chunk2 = mergeQuestionMarks(chunk2); -
1719 src += 8; -
1720 -
1721 -
1722 const __m128i result = _mm_packus_epi16(chunk1, chunk2); -
1723 -
1724 _mm_storeu_si128((__m128i*)dst, result); -
1725 dst += 16; -
1726 }
executed: }
Execution Count:4404723
4404723
1727 length = length % 16; -
1728 }
executed: }
Execution Count:1383263
1383263
1729 while (length--) {
evaluated: length--
TRUEFALSE
yes
Evaluation Count:35448116
yes
Evaluation Count:18649587
18649587-35448116
1730 *dst++ = (*src>0xff) ? '?' : (uchar) *src;
evaluated: (*src>0xff)
TRUEFALSE
yes
Evaluation Count:2598
yes
Evaluation Count:35445518
2598-35445518
1731 ++src; -
1732 }
executed: }
Execution Count:35448118
35448118
1733 }
executed: }
Execution Count:18649590
18649590
1734 return ba;
executed: return ba;
Execution Count:18736065
18736065
1735} -
1736QByteArray QString::toLatin1() const -
1737{ -
1738 return toLatin1_helper(unicode(), length());
executed: return toLatin1_helper(unicode(), length());
Execution Count:18736048
18736048
1739} -
1740QByteArray QString::toLocal8Bit() const -
1741{ -
1742 -
1743 QTextCodec *localeCodec = QTextCodec::codecForLocale(); -
1744 if (localeCodec)
partially evaluated: localeCodec
TRUEFALSE
yes
Evaluation Count:272820
no
Evaluation Count:0
0-272820
1745 return localeCodec->fromUnicode(*this);
executed: return localeCodec->fromUnicode(*this);
Execution Count:272820
272820
1746 -
1747 return toLatin1();
never executed: return toLatin1();
0
1748} -
1749QByteArray QString::toUtf8() const -
1750{ -
1751 if (isNull())
evaluated: isNull()
TRUEFALSE
yes
Evaluation Count:179
yes
Evaluation Count:25162
179-25162
1752 return QByteArray();
executed: return QByteArray();
Execution Count:179
179
1753 -
1754 return QUtf8::convertFromUnicode(constData(), length(), 0);
executed: return QUtf8::convertFromUnicode(constData(), length(), 0);
Execution Count:25162
25162
1755} -
1756QVector<uint> QString::toUcs4() const -
1757{ -
1758 QVector<uint> v(length()); -
1759 uint *a = v.data(); -
1760 int len = toUcs4_helper(d->data(), length(), a); -
1761 v.resize(len); -
1762 return v;
never executed: return v;
0
1763} -
1764 -
1765QString::Data *QString::fromLatin1_helper(const char *str, int size) -
1766{ -
1767 Data *d; -
1768 if (!str) {
evaluated: !str
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:5179272
21-5179272
1769 d = Data::sharedNull(); -
1770 } else if (size == 0 || (!*str && size < 0)) {
evaluated: size == 0
TRUEFALSE
yes
Evaluation Count:51005
yes
Evaluation Count:5128267
evaluated: !*str
TRUEFALSE
yes
Evaluation Count:315
yes
Evaluation Count:5127952
partially evaluated: size < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
executed: }
Execution Count:21
0-5128267
1771 d = Data::allocate(0); -
1772 } else {
executed: }
Execution Count:51005
51005
1773 if (size < 0)
partially evaluated: size < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5128268
0-5128268
1774 size = qstrlen(str);
never executed: size = qstrlen(str);
0
1775 d = Data::allocate(size + 1); -
1776 do { if (!(d)) qBadAlloc(); } while (0);
partially evaluated: !(d)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5128269
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5128267
never executed: qBadAlloc();
executed: }
Execution Count:5128267
0-5128269
1777 d->size = size; -
1778 d->data()[size] = '\0'; -
1779 ushort *dst = d->data(); -
1780 -
1781 -
1782 -
1783 -
1784 -
1785 if (size >= 16) {
evaluated: size >= 16
TRUEFALSE
yes
Evaluation Count:835959
yes
Evaluation Count:4292309
835959-4292309
1786 int chunkCount = size >> 4; -
1787 const __m128i nullMask = _mm_set1_epi32(0); -
1788 for (int i = 0; i < chunkCount; ++i) {
evaluated: i < chunkCount
TRUEFALSE
yes
Evaluation Count:2470441
yes
Evaluation Count:835959
835959-2470441
1789 const __m128i chunk = _mm_loadu_si128((__m128i*)str); -
1790 str += 16; -
1791 -
1792 -
1793 const __m128i firstHalf = _mm_unpacklo_epi8(chunk, nullMask); -
1794 _mm_storeu_si128((__m128i*)dst, firstHalf); -
1795 dst += 8; -
1796 -
1797 -
1798 const __m128i secondHalf = _mm_unpackhi_epi8 (chunk, nullMask); -
1799 _mm_storeu_si128((__m128i*)dst, secondHalf); -
1800 dst += 8; -
1801 }
executed: }
Execution Count:2470441
2470441
1802 size = size % 16; -
1803 }
executed: }
Execution Count:835959
835959
1804 -
1805 while (size--)
evaluated: size--
TRUEFALSE
yes
Evaluation Count:33993822
yes
Evaluation Count:5128269
5128269-33993822
1806 *dst++ = (uchar)*str++;
executed: *dst++ = (uchar)*str++;
Execution Count:33993824
33993824
1807 }
executed: }
Execution Count:5128269
5128269
1808 return d;
executed: return d;
Execution Count:5179295
5179295
1809} -
1810 -
1811QString::Data *QString::fromAscii_helper(const char *str, int size) -
1812{ -
1813 QString s = fromUtf8(str, size); -
1814 s.d->ref.ref(); -
1815 return s.d;
executed: return s.d;
Execution Count:4416426
4416426
1816} -
1817QString QString::fromLocal8Bit_helper(const char *str, int size) -
1818{ -
1819 if (!str)
partially evaluated: !str
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:187532
0-187532
1820 return QString();
never executed: return QString();
0
1821 if (size == 0 || (!*str && size < 0)) {
evaluated: size == 0
TRUEFALSE
yes
Evaluation Count:3088
yes
Evaluation Count:184444
evaluated: !*str
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:184440
partially evaluated: size < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-184444
1822 QStringDataPtr empty = { Data::allocate(0) }; -
1823 return QString(empty);
executed: return QString(empty);
Execution Count:3088
3088
1824 } -
1825 -
1826 if (size < 0)
partially evaluated: size < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:184441
0-184441
1827 size = qstrlen(str);
never executed: size = qstrlen(str);
0
1828 QTextCodec *codec = QTextCodec::codecForLocale(); -
1829 if (codec)
partially evaluated: codec
TRUEFALSE
yes
Evaluation Count:184420
no
Evaluation Count:0
0-184420
1830 return codec->toUnicode(str, size);
executed: return codec->toUnicode(str, size);
Execution Count:184432
184432
1831 -
1832 return fromLatin1(str, size);
never executed: return fromLatin1(str, size);
0
1833} -
1834QString QString::fromUtf8_helper(const char *str, int size) -
1835{ -
1836 if (!str)
evaluated: !str
TRUEFALSE
yes
Evaluation Count:5021
yes
Evaluation Count:20545912
5021-20545912
1837 return QString();
executed: return QString();
Execution Count:5021
5021
1838 -
1839 qt_noop(); -
1840 return QUtf8::convertToUnicode(str, size, 0);
executed: return QUtf8::convertToUnicode(str, size, 0);
Execution Count:20545904
20545904
1841} -
1842QString QString::fromUtf16(const ushort *unicode, int size) -
1843{ -
1844 if (!unicode)
partially evaluated: !unicode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:106
0-106
1845 return QString();
never executed: return QString();
0
1846 if (size < 0) {
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:37
37-69
1847 size = 0; -
1848 while (unicode[size] != 0)
evaluated: unicode[size] != 0
TRUEFALSE
yes
Evaluation Count:172
yes
Evaluation Count:69
69-172
1849 ++size;
executed: ++size;
Execution Count:172
172
1850 }
executed: }
Execution Count:69
69
1851 return QUtf16::convertToUnicode((const char *)unicode, size*2, 0);
executed: return QUtf16::convertToUnicode((const char *)unicode, size*2, 0);
Execution Count:106
106
1852} -
1853QString QString::fromUcs4(const uint *unicode, int size) -
1854{ -
1855 if (!unicode)
partially evaluated: !unicode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
1856 return QString();
never executed: return QString();
0
1857 if (size < 0) {
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:18
2-18
1858 size = 0; -
1859 while (unicode[size] != 0)
evaluated: unicode[size] != 0
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:2
2-28
1860 ++size;
executed: ++size;
Execution Count:28
28
1861 }
executed: }
Execution Count:2
2
1862 return QUtf32::convertToUnicode((const char *)unicode, size*4, 0);
executed: return QUtf32::convertToUnicode((const char *)unicode, size*4, 0);
Execution Count:20
20
1863} -
1864QString& QString::setUnicode(const QChar *unicode, int size) -
1865{ -
1866 resize(size); -
1867 if (unicode && size)
never evaluated: unicode
never evaluated: size
0
1868 memcpy(d->data(), unicode, size * sizeof(QChar));
never executed: memcpy(d->data(), unicode, size * sizeof(QChar));
0
1869 return *this;
never executed: return *this;
0
1870} -
1871QString QString::simplified() const -
1872{ -
1873 if (d->size == 0)
evaluated: d->size == 0
TRUEFALSE
yes
Evaluation Count:1680
yes
Evaluation Count:78710
1680-78710
1874 return *this;
executed: return *this;
Execution Count:1680
1680
1875 -
1876 const QChar * const start = reinterpret_cast<QChar *>(d->data()); -
1877 const QChar *from = start; -
1878 const QChar *fromEnd = start + d->size; -
1879 for(;;) { -
1880 QChar ch = *from; -
1881 if (!ch.isSpace())
evaluated: !ch.isSpace()
TRUEFALSE
yes
Evaluation Count:42188
yes
Evaluation Count:210344
42188-210344
1882 break;
executed: break;
Execution Count:42188
42188
1883 if (++from == fromEnd) {
evaluated: ++from == fromEnd
TRUEFALSE
yes
Evaluation Count:36522
yes
Evaluation Count:173822
36522-173822
1884 -
1885 QStringDataPtr empty = { Data::allocate(0) }; -
1886 return QString(empty);
executed: return QString(empty);
Execution Count:36522
36522
1887 } -
1888 }
executed: }
Execution Count:173822
173822
1889 -
1890 -
1891 -
1892 while (fromEnd[-1].isSpace())
evaluated: fromEnd[-1].isSpace()
TRUEFALSE
yes
Evaluation Count:12399
yes
Evaluation Count:42188
12399-42188
1893 fromEnd--;
executed: fromEnd--;
Execution Count:12399
12399
1894 -
1895 -
1896 const QChar *copyFrom = from; -
1897 int copyCount; -
1898 for(;;) { -
1899 if (++from == fromEnd) {
evaluated: ++from == fromEnd
TRUEFALSE
yes
Evaluation Count:39488
yes
Evaluation Count:683988
39488-683988
1900 -
1901 return mid(copyFrom - start, from - copyFrom);
executed: return mid(copyFrom - start, from - copyFrom);
Execution Count:39488
39488
1902 } -
1903 QChar ch = *from; -
1904 if (!ch.isSpace())
evaluated: !ch.isSpace()
TRUEFALSE
yes
Evaluation Count:649853
yes
Evaluation Count:34135
34135-649853
1905 continue;
executed: continue;
Execution Count:649853
649853
1906 if (ch != QLatin1Char(' ')) {
evaluated: ch != QLatin1Char(' ')
TRUEFALSE
yes
Evaluation Count:1658
yes
Evaluation Count:32477
1658-32477
1907 copyCount = from - copyFrom; -
1908 break;
executed: break;
Execution Count:1658
1658
1909 } -
1910 ch = *++from; -
1911 if (ch.isSpace()) {
evaluated: ch.isSpace()
TRUEFALSE
yes
Evaluation Count:1042
yes
Evaluation Count:31435
1042-31435
1912 copyCount = from - copyFrom - 1; -
1913 break;
executed: break;
Execution Count:1042
1042
1914 } -
1915 }
executed: }
Execution Count:31435
31435
1916 -
1917 -
1918 -
1919 -
1920 QString result((fromEnd - from) + copyCount, Qt::Uninitialized); -
1921 QChar *to = reinterpret_cast<QChar *>(result.d->data()); -
1922 ::memcpy(to, copyFrom, copyCount * 2); -
1923 to += copyCount; -
1924 fromEnd--; -
1925 QChar ch; -
1926 for(;;) { -
1927 *to++ = QLatin1Char(' '); -
1928 do { -
1929 ch = *++from; -
1930 } while (ch.isSpace());
evaluated: ch.isSpace()
TRUEFALSE
yes
Evaluation Count:18816
yes
Evaluation Count:44121
executed: }
Execution Count:62937
18816-62937
1931 if (from == fromEnd)
evaluated: from == fromEnd
TRUEFALSE
yes
Evaluation Count:306
yes
Evaluation Count:43815
306-43815
1932 break;
executed: break;
Execution Count:306
306
1933 do { -
1934 *to++ = ch; -
1935 ch = *++from; -
1936 if (from == fromEnd)
evaluated: from == fromEnd
TRUEFALSE
yes
Evaluation Count:2394
yes
Evaluation Count:258519
2394-258519
1937 goto done;
executed: goto done;
Execution Count:2394
2394
1938 } while (!ch.isSpace());
evaluated: !ch.isSpace()
TRUEFALSE
yes
Evaluation Count:217098
yes
Evaluation Count:41421
executed: }
Execution Count:258519
41421-258519
1939 -
1940 }
executed: }
Execution Count:41421
41421
1941 done:
code before this statement executed: done:
Execution Count:306
306
1942 *to++ = ch; -
1943 result.truncate(to - reinterpret_cast<QChar *>(result.d->data())); -
1944 return result;
executed: return result;
Execution Count:2700
2700
1945} -
1946QString QString::trimmed() const -
1947{ -
1948 if (d->size == 0)
evaluated: d->size == 0
TRUEFALSE
yes
Evaluation Count:2810
yes
Evaluation Count:14584
2810-14584
1949 return *this;
executed: return *this;
Execution Count:2810
2810
1950 const QChar *s = (const QChar*)d->data(); -
1951 if (!s->isSpace() && !s[d->size-1].isSpace())
evaluated: !s->isSpace()
TRUEFALSE
yes
Evaluation Count:13849
yes
Evaluation Count:735
evaluated: !s[d->size-1].isSpace()
TRUEFALSE
yes
Evaluation Count:12023
yes
Evaluation Count:1826
735-13849
1952 return *this;
executed: return *this;
Execution Count:12023
12023
1953 int start = 0; -
1954 int end = d->size - 1; -
1955 while (start<=end && s[start].isSpace())
evaluated: start<=end
TRUEFALSE
yes
Evaluation Count:4330
yes
Evaluation Count:11
evaluated: s[start].isSpace()
TRUEFALSE
yes
Evaluation Count:1780
yes
Evaluation Count:2550
11-4330
1956 start++;
executed: start++;
Execution Count:1780
1780
1957 if (start <= end) {
evaluated: start <= end
TRUEFALSE
yes
Evaluation Count:2550
yes
Evaluation Count:11
11-2550
1958 while (end && s[end].isSpace())
evaluated: end
TRUEFALSE
yes
Evaluation Count:6600
yes
Evaluation Count:3
evaluated: s[end].isSpace()
TRUEFALSE
yes
Evaluation Count:4053
yes
Evaluation Count:2547
3-6600
1959 end--;
executed: end--;
Execution Count:4053
4053
1960 }
executed: }
Execution Count:2550
2550
1961 int l = end - start + 1; -
1962 if (l <= 0) {
evaluated: l <= 0
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:2550
11-2550
1963 QStringDataPtr empty = { Data::allocate(0) }; -
1964 return QString(empty);
executed: return QString(empty);
Execution Count:11
11
1965 } -
1966 return QString(s + start, l);
executed: return QString(s + start, l);
Execution Count:2550
2550
1967} -
1968void QString::truncate(int pos) -
1969{ -
1970 if (pos < d->size)
evaluated: pos < d->size
TRUEFALSE
yes
Evaluation Count:61892325
yes
Evaluation Count:17997
17997-61892325
1971 resize(pos);
executed: resize(pos);
Execution Count:61892313
61892313
1972}
executed: }
Execution Count:61910330
61910330
1973void QString::chop(int n) -
1974{ -
1975 if (n > 0)
evaluated: n > 0
TRUEFALSE
yes
Evaluation Count:21425
yes
Evaluation Count:6
6-21425
1976 resize(d->size - n);
executed: resize(d->size - n);
Execution Count:21425
21425
1977}
executed: }
Execution Count:21431
21431
1978QString& QString::fill(QChar ch, int size) -
1979{ -
1980 resize(size < 0 ? d->size : size); -
1981 if (d->size) {
evaluated: d->size
TRUEFALSE
yes
Evaluation Count:11528
yes
Evaluation Count:5438
5438-11528
1982 QChar *i = (QChar*)d->data() + d->size; -
1983 QChar *b = (QChar*)d->data(); -
1984 while (i != b)
evaluated: i != b
TRUEFALSE
yes
Evaluation Count:2697342
yes
Evaluation Count:11528
11528-2697342
1985 *--i = ch;
executed: *--i = ch;
Execution Count:2697342
2697342
1986 }
executed: }
Execution Count:11528
11528
1987 return *this;
executed: return *this;
Execution Count:16966
16966
1988} -
1989int QString::compare(const QString &other, Qt::CaseSensitivity cs) const -
1990{ -
1991 if (cs == Qt::CaseSensitive)
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:196883
yes
Evaluation Count:3753201
196883-3753201
1992 return ucstrcmp(constData(), length(), other.constData(), other.length());
executed: return ucstrcmp(constData(), length(), other.constData(), other.length());
Execution Count:196883
196883
1993 return ucstricmp(d->data(), d->data() + d->size, other.d->data(), other.d->data() + other.d->size);
executed: return ucstricmp(d->data(), d->data() + d->size, other.d->data(), other.d->data() + other.d->size);
Execution Count:3753201
3753201
1994} -
1995 -
1996 -
1997 -
1998 -
1999 -
2000int QString::compare_helper(const QChar *data1, int length1, const QChar *data2, int length2, -
2001 Qt::CaseSensitivity cs) -
2002{ -
2003 if (cs == Qt::CaseSensitive)
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:195129
yes
Evaluation Count:88
88-195129
2004 return ucstrcmp(data1, length1, data2, length2);
executed: return ucstrcmp(data1, length1, data2, length2);
Execution Count:195129
195129
2005 register const ushort *s1 = reinterpret_cast<const ushort *>(data1); -
2006 register const ushort *s2 = reinterpret_cast<const ushort *>(data2); -
2007 return ucstricmp(s1, s1 + length1, s2, s2 + length2);
executed: return ucstricmp(s1, s1 + length1, s2, s2 + length2);
Execution Count:88
88
2008} -
2009 -
2010 -
2011 -
2012 -
2013 -
2014 -
2015 -
2016int QString::compare(QLatin1String other, Qt::CaseSensitivity cs) const -
2017{ -
2018 return compare_helper(unicode(), length(), other, cs);
executed: return compare_helper(unicode(), length(), other, cs);
Execution Count:6727
6727
2019} -
2020int QString::compare_helper(const QChar *data1, int length1, const char *data2, int length2, -
2021 Qt::CaseSensitivity cs) -
2022{ -
2023 -
2024 const QString s2 = QString::fromUtf8(data2, length2 == -1 ? (data2 ? int(strlen(data2)) : -1) : length2); -
2025 return compare_helper(data1, length1, s2.constData(), s2.size(), cs);
executed: return compare_helper(data1, length1, s2.constData(), s2.size(), cs);
Execution Count:194981
194981
2026} -
2027int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, -
2028 Qt::CaseSensitivity cs) -
2029{ -
2030 const ushort *uc = reinterpret_cast<const ushort *>(data1); -
2031 const ushort *uce = uc + length1; -
2032 const uchar *c = (uchar *)s2.latin1(); -
2033 -
2034 if (!c)
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6785
0-6785
2035 return length1;
never executed: return length1;
0
2036 -
2037 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:560
yes
Evaluation Count:6225
560-6225
2038 const ushort *e = uc + length1; -
2039 if (s2.size() < length1)
evaluated: s2.size() < length1
TRUEFALSE
yes
Evaluation Count:256
yes
Evaluation Count:304
256-304
2040 e = uc + s2.size();
executed: e = uc + s2.size();
Execution Count:256
256
2041 while (uc < e) {
evaluated: uc < e
TRUEFALSE
yes
Evaluation Count:634
yes
Evaluation Count:536
536-634
2042 int diff = *uc - *c; -
2043 if (diff)
evaluated: diff
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:610
24-610
2044 return diff;
executed: return diff;
Execution Count:24
24
2045 uc++, c++; -
2046 }
executed: }
Execution Count:610
610
2047 -
2048 if (uc == uce) {
evaluated: uc == uce
TRUEFALSE
yes
Evaluation Count:286
yes
Evaluation Count:250
250-286
2049 if (c == (const uchar *)s2.latin1() + s2.size())
evaluated: c == (const uchar *)s2.latin1() + s2.size()
TRUEFALSE
yes
Evaluation Count:269
yes
Evaluation Count:17
17-269
2050 return 0;
executed: return 0;
Execution Count:269
269
2051 return -1;
executed: return -1;
Execution Count:17
17
2052 } -
2053 return 1;
executed: return 1;
Execution Count:250
250
2054 } else { -
2055 return ucstricmp(uc, uce, c, c + s2.size());
executed: return ucstricmp(uc, uce, c, c + s2.size());
Execution Count:6225
6225
2056 } -
2057} -
2058int QString::localeAwareCompare(const QString &other) const -
2059{ -
2060 return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
executed: return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
Execution Count:922069
922069
2061} -
2062 -
2063 -
2064 -
2065 -
2066 -
2067int QString::localeAwareCompare_helper(const QChar *data1, int length1, -
2068 const QChar *data2, int length2) -
2069{ -
2070 -
2071 if (length1 == 0 || length2 == 0)
evaluated: length1 == 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:922098
partially evaluated: length2 == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:922098
0-922098
2072 return ucstrcmp(data1, length1, data2, length2);
executed: return ucstrcmp(data1, length1, data2, length2);
Execution Count:7
7
2073 QCollator collator; -
2074 return collator.compare(data1, length1, data2, length2);
executed: return collator.compare(data1, length1, data2, length2);
Execution Count:922098
922098
2075} -
2076const ushort *QString::utf16() const -
2077{ -
2078 if (((d)->offset != sizeof(QStringData))) {
partially evaluated: ((d)->offset != sizeof(QStringData))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:118004
0-118004
2079 -
2080 const_cast<QString*>(this)->reallocData(uint(d->size) + 1u); -
2081 }
never executed: }
0
2082 return d->data();
executed: return d->data();
Execution Count:118004
118004
2083} -
2084QString QString::leftJustified(int width, QChar fill, bool truncate) const -
2085{ -
2086 QString result; -
2087 int len = length(); -
2088 int padlen = width - len; -
2089 if (padlen > 0) {
evaluated: padlen > 0
TRUEFALSE
yes
Evaluation Count:802
yes
Evaluation Count:4209
802-4209
2090 result.resize(len+padlen); -
2091 if (len)
evaluated: len
TRUEFALSE
yes
Evaluation Count:801
yes
Evaluation Count:1
1-801
2092 memcpy(result.d->data(), d->data(), sizeof(QChar)*len);
executed: memcpy(result.d->data(), d->data(), sizeof(QChar)*len);
Execution Count:801
801
2093 QChar *uc = (QChar*)result.d->data() + len; -
2094 while (padlen--)
evaluated: padlen--
TRUEFALSE
yes
Evaluation Count:32178
yes
Evaluation Count:802
802-32178
2095 * uc++ = fill;
executed: * uc++ = fill;
Execution Count:32178
32178
2096 } else {
executed: }
Execution Count:802
802
2097 if (truncate)
evaluated: truncate
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4205
4-4205
2098 result = left(width);
executed: result = left(width);
Execution Count:4
4
2099 else -
2100 result = *this;
executed: result = *this;
Execution Count:4205
4205
2101 } -
2102 return result;
executed: return result;
Execution Count:5011
5011
2103} -
2104QString QString::rightJustified(int width, QChar fill, bool truncate) const -
2105{ -
2106 QString result; -
2107 int len = length(); -
2108 int padlen = width - len; -
2109 if (padlen > 0) {
evaluated: padlen > 0
TRUEFALSE
yes
Evaluation Count:34075
yes
Evaluation Count:78554
34075-78554
2110 result.resize(len+padlen); -
2111 QChar *uc = (QChar*)result.d->data(); -
2112 while (padlen--)
evaluated: padlen--
TRUEFALSE
yes
Evaluation Count:78617
yes
Evaluation Count:34075
34075-78617
2113 * uc++ = fill;
executed: * uc++ = fill;
Execution Count:78617
78617
2114 if (len)
evaluated: len
TRUEFALSE
yes
Evaluation Count:34074
yes
Evaluation Count:1
1-34074
2115 memcpy(uc, d->data(), sizeof(QChar)*len);
executed: memcpy(uc, d->data(), sizeof(QChar)*len);
Execution Count:34074
34074
2116 } else {
executed: }
Execution Count:34075
34075
2117 if (truncate)
evaluated: truncate
TRUEFALSE
yes
Evaluation Count:54671
yes
Evaluation Count:23883
23883-54671
2118 result = left(width);
executed: result = left(width);
Execution Count:54671
54671
2119 else -
2120 result = *this;
executed: result = *this;
Execution Count:23883
23883
2121 } -
2122 return result;
executed: return result;
Execution Count:112629
112629
2123} -
2124QString QString::toLower() const -
2125{ -
2126 const ushort *p = d->data(); -
2127 if (!p)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:119898
0-119898
2128 return *this;
never executed: return *this;
0
2129 -
2130 const ushort *e = p + d->size; -
2131 -
2132 while (e != p && QChar::isHighSurrogate(*(e - 1)))
evaluated: e != p
TRUEFALSE
yes
Evaluation Count:117838
yes
Evaluation Count:2062
evaluated: QChar::isHighSurrogate(*(e - 1))
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:117836
2-117838
2133 --e;
executed: --e;
Execution Count:2
2
2134 -
2135 const QUnicodeTables::Properties *prop; -
2136 while (p != e) {
evaluated: p != e
TRUEFALSE
yes
Evaluation Count:247187
yes
Evaluation Count:31380
31380-247187
2137 if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) {
evaluated: QChar::isHighSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:247183
partially evaluated: QChar::isLowSurrogate(p[1])
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-247183
2138 ushort high = *p++; -
2139 prop = qGetProp(QChar::surrogateToUcs4(high, *p)); -
2140 } else {
executed: }
Execution Count:4
4
2141 prop = qGetProp(*p); -
2142 }
executed: }
Execution Count:247183
247183
2143 if (prop->lowerCaseDiff) {
evaluated: prop->lowerCaseDiff
TRUEFALSE
yes
Evaluation Count:88518
yes
Evaluation Count:158669
88518-158669
2144 if (QChar::isLowSurrogate(*p))
evaluated: QChar::isLowSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:88514
4-88514
2145 --p;
executed: --p;
Execution Count:4
4
2146 QString s(d->size, Qt::Uninitialized); -
2147 memcpy(s.d->data(), d->data(), (p - d->data())*sizeof(ushort)); -
2148 ushort *pp = s.d->data() + (p - d->data()); -
2149 while (p != e) {
evaluated: p != e
TRUEFALSE
yes
Evaluation Count:717537
yes
Evaluation Count:88518
88518-717537
2150 if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) {
evaluated: QChar::isHighSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:717530
partially evaluated: QChar::isLowSurrogate(p[1])
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-717530
2151 *pp = *p++; -
2152 prop = qGetProp(QChar::surrogateToUcs4(*pp++, *p)); -
2153 } else {
executed: }
Execution Count:7
7
2154 prop = qGetProp(*p); -
2155 }
executed: }
Execution Count:717530
717530
2156 if (prop->lowerCaseSpecial) {
evaluated: prop->lowerCaseSpecial
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:717536
1-717536
2157 const ushort *specialCase = specialCaseMap + prop->lowerCaseDiff; -
2158 ushort length = *specialCase++; -
2159 int pos = pp - s.d->data(); -
2160 s.resize(s.d->size + length - 1); -
2161 pp = s.d->data() + pos; -
2162 while (length--)
evaluated: length--
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2163 *pp++ = *specialCase++;
executed: *pp++ = *specialCase++;
Execution Count:2
2
2164 } else {
executed: }
Execution Count:1
1
2165 *pp++ = *p + prop->lowerCaseDiff; -
2166 }
executed: }
Execution Count:717536
717536
2167 ++p; -
2168 }
executed: }
Execution Count:717537
717537
2169 -
2170 -
2171 while (e != d->data() + d->size)
evaluated: e != d->data() + d->size
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:88518
2-88518
2172 *pp++ = *e++;
executed: *pp++ = *e++;
Execution Count:2
2
2173 -
2174 return s;
executed: return s;
Execution Count:88518
88518
2175 } -
2176 ++p; -
2177 }
executed: }
Execution Count:158669
158669
2178 return *this;
executed: return *this;
Execution Count:31380
31380
2179} -
2180 -
2181 -
2182 -
2183 -
2184 -
2185QString QString::toCaseFolded() const -
2186{ -
2187 const ushort *p = d->data(); -
2188 if (!p)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:131114
0-131114
2189 return *this;
never executed: return *this;
0
2190 -
2191 const ushort *e = p + d->size; -
2192 -
2193 while (e != p && QChar::isHighSurrogate(*(e - 1)))
evaluated: e != p
TRUEFALSE
yes
Evaluation Count:131110
yes
Evaluation Count:2054
evaluated: QChar::isHighSurrogate(*(e - 1))
TRUEFALSE
yes
Evaluation Count:2050
yes
Evaluation Count:129060
2050-131110
2194 --e;
executed: --e;
Execution Count:2050
2050
2195 -
2196 const QUnicodeTables::Properties *prop; -
2197 while (p != e) {
evaluated: p != e
TRUEFALSE
yes
Evaluation Count:129113
yes
Evaluation Count:129061
129061-129113
2198 if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) {
evaluated: QChar::isHighSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:129105
partially evaluated: QChar::isLowSurrogate(p[1])
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-129105
2199 ushort high = *p++; -
2200 prop = qGetProp(QChar::surrogateToUcs4(high, *p)); -
2201 } else {
executed: }
Execution Count:8
8
2202 prop = qGetProp(*p); -
2203 }
executed: }
Execution Count:129105
129105
2204 if (prop->caseFoldDiff) {
evaluated: prop->caseFoldDiff
TRUEFALSE
yes
Evaluation Count:2053
yes
Evaluation Count:127060
2053-127060
2205 if (QChar::isLowSurrogate(*p))
evaluated: QChar::isLowSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2047
6-2047
2206 --p;
executed: --p;
Execution Count:6
6
2207 QString s(d->size, Qt::Uninitialized); -
2208 memcpy(s.d->data(), d->data(), (p - d->data())*sizeof(ushort)); -
2209 ushort *pp = s.d->data() + (p - d->data()); -
2210 while (p != e) {
evaluated: p != e
TRUEFALSE
yes
Evaluation Count:2081
yes
Evaluation Count:2053
2053-2081
2211 if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) {
evaluated: QChar::isHighSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2072
partially evaluated: QChar::isLowSurrogate(p[1])
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-2072
2212 *pp = *p++; -
2213 prop = qGetProp(QChar::surrogateToUcs4(*pp++, *p)); -
2214 } else {
executed: }
Execution Count:9
9
2215 prop = qGetProp(*p); -
2216 }
executed: }
Execution Count:2072
2072
2217 if (prop->caseFoldSpecial) {
evaluated: prop->caseFoldSpecial
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2073
8-2073
2218 const ushort *specialCase = specialCaseMap + prop->caseFoldDiff; -
2219 ushort length = *specialCase++; -
2220 qt_noop(); -
2221 (void)length; -
2222 *pp++ = *specialCase; -
2223 -
2224 } else {
executed: }
Execution Count:8
8
2225 *pp++ = *p + prop->caseFoldDiff; -
2226 }
executed: }
Execution Count:2073
2073
2227 ++p; -
2228 }
executed: }
Execution Count:2081
2081
2229 -
2230 -
2231 while (e != d->data() + d->size)
evaluated: e != d->data() + d->size
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2053
2-2053
2232 *pp++ = *e++;
executed: *pp++ = *e++;
Execution Count:2
2
2233 -
2234 return s;
executed: return s;
Execution Count:2053
2053
2235 } -
2236 ++p; -
2237 }
executed: }
Execution Count:127060
127060
2238 return *this;
executed: return *this;
Execution Count:129061
129061
2239} -
2240QString QString::toUpper() const -
2241{ -
2242 const ushort *p = d->data(); -
2243 if (!p)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9170
0-9170
2244 return *this;
never executed: return *this;
0
2245 -
2246 const ushort *e = p + d->size; -
2247 -
2248 while (e != p && QChar::isHighSurrogate(*(e - 1)))
evaluated: e != p
TRUEFALSE
yes
Evaluation Count:9153
yes
Evaluation Count:19
evaluated: QChar::isHighSurrogate(*(e - 1))
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:9151
2-9153
2249 --e;
executed: --e;
Execution Count:2
2
2250 -
2251 const QUnicodeTables::Properties *prop; -
2252 while (p != e) {
evaluated: p != e
TRUEFALSE
yes
Evaluation Count:91990
yes
Evaluation Count:4133
4133-91990
2253 if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) {
evaluated: QChar::isHighSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:91986
partially evaluated: QChar::isLowSurrogate(p[1])
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-91986
2254 ushort high = *p++; -
2255 prop = qGetProp(QChar::surrogateToUcs4(high, *p)); -
2256 } else {
executed: }
Execution Count:4
4
2257 prop = qGetProp(*p); -
2258 }
executed: }
Execution Count:91986
91986
2259 if (prop->upperCaseDiff) {
evaluated: prop->upperCaseDiff
TRUEFALSE
yes
Evaluation Count:5037
yes
Evaluation Count:86953
5037-86953
2260 if (QChar::isLowSurrogate(*p))
evaluated: QChar::isLowSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5033
4-5033
2261 --p;
executed: --p;
Execution Count:4
4
2262 QString s(d->size, Qt::Uninitialized); -
2263 memcpy(s.d->data(), d->data(), (p - d->data())*sizeof(ushort)); -
2264 ushort *pp = s.d->data() + (p - d->data()); -
2265 while (p != e) {
evaluated: p != e
TRUEFALSE
yes
Evaluation Count:20692
yes
Evaluation Count:5037
5037-20692
2266 if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) {
evaluated: QChar::isHighSurrogate(*p)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:20685
partially evaluated: QChar::isLowSurrogate(p[1])
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-20685
2267 *pp = *p++; -
2268 prop = qGetProp(QChar::surrogateToUcs4(*pp++, *p)); -
2269 } else {
executed: }
Execution Count:7
7
2270 prop = qGetProp(*p); -
2271 }
executed: }
Execution Count:20685
20685
2272 if (prop->upperCaseSpecial) {
evaluated: prop->upperCaseSpecial
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:20691
1-20691
2273 const ushort *specialCase = specialCaseMap + prop->upperCaseDiff; -
2274 ushort length = *specialCase++; -
2275 int pos = pp - s.d->data(); -
2276 s.resize(s.d->size + length - 1); -
2277 pp = s.d->data() + pos; -
2278 while (length--)
evaluated: length--
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2279 *pp++ = *specialCase++;
executed: *pp++ = *specialCase++;
Execution Count:2
2
2280 } else {
executed: }
Execution Count:1
1
2281 *pp++ = *p + prop->upperCaseDiff; -
2282 }
executed: }
Execution Count:20691
20691
2283 ++p; -
2284 }
executed: }
Execution Count:20692
20692
2285 -
2286 -
2287 while (e != d->data() + d->size)
evaluated: e != d->data() + d->size
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5037
2-5037
2288 *pp++ = *e++;
executed: *pp++ = *e++;
Execution Count:2
2
2289 -
2290 return s;
executed: return s;
Execution Count:5037
5037
2291 } -
2292 ++p; -
2293 }
executed: }
Execution Count:86953
86953
2294 return *this;
executed: return *this;
Execution Count:4133
4133
2295} -
2296QString &QString::sprintf(const char *cformat, ...) -
2297{ -
2298 va_list ap; -
2299 __builtin_va_start(ap,cformat); -
2300 QString &s = vsprintf(cformat, ap); -
2301 __builtin_va_end(ap); -
2302 return s;
executed: return s;
Execution Count:12040
12040
2303} -
2304QString &QString::vsprintf(const char* cformat, va_list ap) -
2305{ -
2306 QLocale locale(QLocale::C); -
2307 -
2308 if (!cformat || !*cformat) {
evaluated: !cformat
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:12974
partially evaluated: !*cformat
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12974
0-12974
2309 -
2310 *this = fromLatin1(""); -
2311 return *this;
executed: return *this;
Execution Count:1
1
2312 } -
2313 -
2314 -
2315 -
2316 QString result; -
2317 const char *c = cformat; -
2318 for (;;) { -
2319 -
2320 while (*c != '\0' && *c != '%')
evaluated: *c != '\0'
TRUEFALSE
yes
Evaluation Count:71444
yes
Evaluation Count:12974
evaluated: *c != '%'
TRUEFALSE
yes
Evaluation Count:56185
yes
Evaluation Count:15259
12974-71444
2321 result.append(QLatin1Char(*c++));
executed: result.append(QLatin1Char(*c++));
Execution Count:56185
56185
2322 -
2323 if (*c == '\0')
evaluated: *c == '\0'
TRUEFALSE
yes
Evaluation Count:12974
yes
Evaluation Count:15259
12974-15259
2324 break;
executed: break;
Execution Count:12974
12974
2325 -
2326 -
2327 const char *escape_start = c; -
2328 ++c; -
2329 -
2330 if (*c == '\0') {
partially evaluated: *c == '\0'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15259
0-15259
2331 result.append(QLatin1Char('%')); -
2332 break;
never executed: break;
0
2333 } -
2334 if (*c == '%') {
evaluated: *c == '%'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:15258
1-15258
2335 result.append(QLatin1Char('%')); -
2336 ++c; -
2337 continue;
executed: continue;
Execution Count:1
1
2338 } -
2339 -
2340 -
2341 uint flags = 0; -
2342 bool no_more_flags = false; -
2343 do { -
2344 switch (*c) { -
2345 case '#': flags |= QLocalePrivate::Alternate; break;
executed: break;
Execution Count:4992
4992
2346 case '0': flags |= QLocalePrivate::ZeroPadded; break;
executed: break;
Execution Count:7032
7032
2347 case '-': flags |= QLocalePrivate::LeftAdjusted; break;
executed: break;
Execution Count:4997
4997
2348 case ' ': flags |= QLocalePrivate::BlankBeforePositive; break;
executed: break;
Execution Count:4992
4992
2349 case '+': flags |= QLocalePrivate::AlwaysShowSign; break;
executed: break;
Execution Count:4992
4992
2350 case '\'': flags |= QLocalePrivate::ThousandsGroup; break;
executed: break;
Execution Count:9984
9984
2351 default: no_more_flags = true; break;
executed: break;
Execution Count:15258
15258
2352 } -
2353 -
2354 if (!no_more_flags)
evaluated: !no_more_flags
TRUEFALSE
yes
Evaluation Count:36989
yes
Evaluation Count:15258
15258-36989
2355 ++c;
executed: ++c;
Execution Count:36989
36989
2356 } while (!no_more_flags);
evaluated: !no_more_flags
TRUEFALSE
yes
Evaluation Count:36989
yes
Evaluation Count:15258
executed: }
Execution Count:52247
15258-52247
2357 -
2358 if (*c == '\0') {
partially evaluated: *c == '\0'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15258
0-15258
2359 result.append(QLatin1String(escape_start)); -
2360 break;
never executed: break;
0
2361 } -
2362 -
2363 -
2364 int width = -1; -
2365 if (qIsDigit(*c)) {
evaluated: qIsDigit(*c)
TRUEFALSE
yes
Evaluation Count:9536
yes
Evaluation Count:5722
5722-9536
2366 QString width_str; -
2367 while (*c != '\0' && qIsDigit(*c))
partially evaluated: *c != '\0'
TRUEFALSE
yes
Evaluation Count:21572
no
Evaluation Count:0
evaluated: qIsDigit(*c)
TRUEFALSE
yes
Evaluation Count:12036
yes
Evaluation Count:9536
0-21572
2368 width_str.append(QLatin1Char(*c++));
executed: width_str.append(QLatin1Char(*c++));
Execution Count:12036
12036
2369 -
2370 -
2371 -
2372 width = width_str.toInt(); -
2373 }
executed: }
Execution Count:9536
9536
2374 else if (*c == '*') {
evaluated: *c == '*'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5721
1-5721
2375 width = __builtin_va_arg(ap,int); -
2376 if (width < 0)
partially evaluated: width < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2377 width = -1;
never executed: width = -1;
0
2378 ++c; -
2379 }
executed: }
Execution Count:1
1
2380 -
2381 if (*c == '\0') {
partially evaluated: *c == '\0'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15258
0-15258
2382 result.append(QLatin1String(escape_start)); -
2383 break;
never executed: break;
0
2384 } -
2385 -
2386 -
2387 int precision = -1; -
2388 if (*c == '.') {
evaluated: *c == '.'
TRUEFALSE
yes
Evaluation Count:9329
yes
Evaluation Count:5929
5929-9329
2389 ++c; -
2390 if (qIsDigit(*c)) {
evaluated: qIsDigit(*c)
TRUEFALSE
yes
Evaluation Count:9328
yes
Evaluation Count:1
1-9328
2391 QString precision_str; -
2392 while (*c != '\0' && qIsDigit(*c))
partially evaluated: *c != '\0'
TRUEFALSE
yes
Evaluation Count:21155
no
Evaluation Count:0
evaluated: qIsDigit(*c)
TRUEFALSE
yes
Evaluation Count:11827
yes
Evaluation Count:9328
0-21155
2393 precision_str.append(QLatin1Char(*c++));
executed: precision_str.append(QLatin1Char(*c++));
Execution Count:11827
11827
2394 -
2395 -
2396 -
2397 precision = precision_str.toInt(); -
2398 }
executed: }
Execution Count:9328
9328
2399 else if (*c == '*') {
partially evaluated: *c == '*'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2400 precision = __builtin_va_arg(ap,int); -
2401 if (precision < 0)
partially evaluated: precision < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2402 precision = -1;
never executed: precision = -1;
0
2403 ++c; -
2404 }
executed: }
Execution Count:1
1
2405 } -
2406 -
2407 if (*c == '\0') {
partially evaluated: *c == '\0'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15258
0-15258
2408 result.append(QLatin1String(escape_start)); -
2409 break;
never executed: break;
0
2410 } -
2411 -
2412 -
2413 enum LengthMod { lm_none, lm_hh, lm_h, lm_l, lm_ll, lm_L, lm_j, lm_z, lm_t }; -
2414 LengthMod length_mod = lm_none; -
2415 switch (*c) { -
2416 case 'h': -
2417 ++c; -
2418 if (*c == 'h') {
never evaluated: *c == 'h'
0
2419 length_mod = lm_hh; -
2420 ++c; -
2421 }
never executed: }
0
2422 else -
2423 length_mod = lm_h;
never executed: length_mod = lm_h;
0
2424 break;
never executed: break;
0
2425 -
2426 case 'l': -
2427 ++c; -
2428 if (*c == 'l') {
evaluated: *c == 'l'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2429 length_mod = lm_ll; -
2430 ++c; -
2431 }
executed: }
Execution Count:1
1
2432 else -
2433 length_mod = lm_l;
executed: length_mod = lm_l;
Execution Count:3
3
2434 break;
executed: break;
Execution Count:4
4
2435 -
2436 case 'L': -
2437 ++c; -
2438 length_mod = lm_L; -
2439 break;
never executed: break;
0
2440 -
2441 case 'j': -
2442 ++c; -
2443 length_mod = lm_j; -
2444 break;
never executed: break;
0
2445 -
2446 case 'z': -
2447 case 'Z': -
2448 ++c; -
2449 length_mod = lm_z; -
2450 break;
executed: break;
Execution Count:3
3
2451 -
2452 case 't': -
2453 ++c; -
2454 length_mod = lm_t; -
2455 break;
never executed: break;
0
2456 -
2457 default: break;
executed: break;
Execution Count:15251
15251
2458 } -
2459 -
2460 if (*c == '\0') {
partially evaluated: *c == '\0'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15258
0-15258
2461 result.append(QLatin1String(escape_start)); -
2462 break;
never executed: break;
0
2463 } -
2464 -
2465 -
2466 QString subst; -
2467 switch (*c) { -
2468 case 'd': -
2469 case 'i': { -
2470 qint64 i; -
2471 switch (length_mod) { -
2472 case lm_none: i = __builtin_va_arg(ap,int); break;
executed: break;
Execution Count:2198
2198
2473 case lm_hh: i = __builtin_va_arg(ap,int); break;
never executed: break;
0
2474 case lm_h: i = __builtin_va_arg(ap,int); break;
never executed: break;
0
2475 case lm_l: i = __builtin_va_arg(ap,long int); break;
executed: break;
Execution Count:1
1
2476 case lm_ll: i = __builtin_va_arg(ap,qint64); break;
never executed: break;
0
2477 case lm_j: i = __builtin_va_arg(ap,long int); break;
never executed: break;
0
2478 case lm_z: i = __builtin_va_arg(ap,size_t); break;
never executed: break;
0
2479 case lm_t: i = __builtin_va_arg(ap,int); break;
never executed: break;
0
2480 default: i = 0; break;
never executed: break;
0
2481 } -
2482 subst = locale.d->longLongToString(i, precision, 10, width, flags); -
2483 ++c; -
2484 break;
executed: break;
Execution Count:2199
2199
2485 } -
2486 case 'o': -
2487 case 'u': -
2488 case 'x': -
2489 case 'X': { -
2490 quint64 u; -
2491 switch (length_mod) { -
2492 case lm_none: u = __builtin_va_arg(ap,uint); break;
executed: break;
Execution Count:2046
2046
2493 case lm_hh: u = __builtin_va_arg(ap,uint); break;
never executed: break;
0
2494 case lm_h: u = __builtin_va_arg(ap,uint); break;
never executed: break;
0
2495 case lm_l: u = __builtin_va_arg(ap,ulong); break;
never executed: break;
0
2496 case lm_ll: u = __builtin_va_arg(ap,quint64); break;
never executed: break;
0
2497 case lm_z: u = __builtin_va_arg(ap,size_t); break;
executed: break;
Execution Count:3
3
2498 default: u = 0; break;
never executed: break;
0
2499 } -
2500 -
2501 if (qIsUpper(*c))
partially evaluated: qIsUpper(*c)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2049
0-2049
2502 flags |= QLocalePrivate::CapitalEorX;
never executed: flags |= QLocalePrivate::CapitalEorX;
0
2503 -
2504 int base = 10; -
2505 switch (qToLower(*c)) { -
2506 case 'o': -
2507 base = 8; break;
never executed: break;
0
2508 case 'u': -
2509 base = 10; break;
executed: break;
Execution Count:6
6
2510 case 'x': -
2511 base = 16; break;
executed: break;
Execution Count:2043
2043
2512 default: break;
never executed: break;
0
2513 } -
2514 subst = locale.d->unsLongLongToString(u, precision, base, width, flags); -
2515 ++c; -
2516 break;
executed: break;
Execution Count:2049
2049
2517 } -
2518 case 'E': -
2519 case 'e': -
2520 case 'F': -
2521 case 'f': -
2522 case 'G': -
2523 case 'g': -
2524 case 'A': -
2525 case 'a': { -
2526 double d; -
2527 if (length_mod == lm_L)
partially evaluated: length_mod == lm_L
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10009
0-10009
2528 d = __builtin_va_arg(ap,long double);
never executed: d = __builtin_va_arg(ap,long double);
0
2529 else -
2530 d = __builtin_va_arg(ap,double);
executed: d = __builtin_va_arg(ap,double);
Execution Count:10009
10009
2531 -
2532 if (qIsUpper(*c))
evaluated: qIsUpper(*c)
TRUEFALSE
yes
Evaluation Count:4992
yes
Evaluation Count:5017
4992-5017
2533 flags |= QLocalePrivate::CapitalEorX;
executed: flags |= QLocalePrivate::CapitalEorX;
Execution Count:4992
4992
2534 -
2535 QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; -
2536 switch (qToLower(*c)) { -
2537 case 'e': form = QLocalePrivate::DFExponent; break;
never executed: break;
0
2538 case 'a': -
2539 case 'f': form = QLocalePrivate::DFDecimal; break;
executed: break;
Execution Count:16
16
2540 case 'g': form = QLocalePrivate::DFSignificantDigits; break;
executed: break;
Execution Count:9993
9993
2541 default: break;
never executed: break;
0
2542 } -
2543 subst = locale.d->doubleToString(d, precision, form, width, flags); -
2544 ++c; -
2545 break;
executed: break;
Execution Count:10009
10009
2546 } -
2547 case 'c': { -
2548 if (length_mod == lm_l)
partially evaluated: length_mod == lm_l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
2549 subst = QChar((ushort) __builtin_va_arg(ap,int));
never executed: subst = QChar((ushort) __builtin_va_arg(ap,int));
0
2550 else -
2551 subst = QLatin1Char((uchar) __builtin_va_arg(ap,int));
executed: subst = QLatin1Char((uchar) __builtin_va_arg(ap,int));
Execution Count:120
120
2552 ++c; -
2553 break;
executed: break;
Execution Count:120
120
2554 } -
2555 case 's': { -
2556 if (length_mod == lm_l) {
partially evaluated: length_mod == lm_l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:844
0-844
2557 const ushort *buff = __builtin_va_arg(ap,const ushort*); -
2558 const ushort *ch = buff; -
2559 while (*ch != 0)
never evaluated: *ch != 0
0
2560 ++ch;
never executed: ++ch;
0
2561 subst.setUtf16(buff, ch - buff); -
2562 } else
never executed: }
0
2563 subst = QString::fromUtf8(__builtin_va_arg(ap,const char*));
executed: subst = QString::fromUtf8(__builtin_va_arg(ap,const char*));
Execution Count:844
844
2564 if (precision != -1)
evaluated: precision != -1
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:837
7-837
2565 subst.truncate(precision);
executed: subst.truncate(precision);
Execution Count:7
7
2566 ++c; -
2567 break;
executed: break;
Execution Count:844
844
2568 } -
2569 case 'p': { -
2570 void *arg = __builtin_va_arg(ap,void*); -
2571 -
2572 -
2573 -
2574 quint64 i = reinterpret_cast<unsigned long>(arg); -
2575 -
2576 flags |= QLocalePrivate::Alternate; -
2577 subst = locale.d->unsLongLongToString(i, precision, 16, width, flags); -
2578 ++c; -
2579 break;
executed: break;
Execution Count:35
35
2580 } -
2581 case 'n': -
2582 switch (length_mod) { -
2583 case lm_hh: { -
2584 signed char *n = __builtin_va_arg(ap,signed char*); -
2585 *n = result.length(); -
2586 break;
never executed: break;
0
2587 } -
2588 case lm_h: { -
2589 short int *n = __builtin_va_arg(ap,short int*); -
2590 *n = result.length(); -
2591 break;
never executed: break;
0
2592 } -
2593 case lm_l: { -
2594 long int *n = __builtin_va_arg(ap,long int*); -
2595 *n = result.length(); -
2596 break;
never executed: break;
0
2597 } -
2598 case lm_ll: { -
2599 qint64 *n = __builtin_va_arg(ap,qint64*); -
2600 volatile uint tmp = result.length(); -
2601 *n = tmp; -
2602 break;
executed: break;
Execution Count:1
1
2603 } -
2604 default: { -
2605 int *n = __builtin_va_arg(ap,int*); -
2606 *n = result.length(); -
2607 break;
executed: break;
Execution Count:1
1
2608 } -
2609 } -
2610 ++c; -
2611 break;
executed: break;
Execution Count:2
2
2612 -
2613 default: -
2614 for (const char *cc = escape_start; cc != c; ++cc)
never evaluated: cc != c
0
2615 result.append(QLatin1Char(*cc));
never executed: result.append(QLatin1Char(*cc));
0
2616 continue;
never executed: continue;
0
2617 } -
2618 -
2619 if (flags & QLocalePrivate::LeftAdjusted)
evaluated: flags & QLocalePrivate::LeftAdjusted
TRUEFALSE
yes
Evaluation Count:4997
yes
Evaluation Count:10261
4997-10261
2620 result.append(subst.leftJustified(width));
executed: result.append(subst.leftJustified(width));
Execution Count:4997
4997
2621 else -
2622 result.append(subst.rightJustified(width));
executed: result.append(subst.rightJustified(width));
Execution Count:10261
10261
2623 } -
2624 -
2625 *this = result; -
2626 -
2627 return *this;
executed: return *this;
Execution Count:12974
12974
2628} -
2629qint64 QString::toLongLong(bool *ok, int base) const -
2630{ -
2631 -
2632 -
2633 -
2634 -
2635 -
2636 -
2637 -
2638 QLocale c_locale(QLocale::C); -
2639 return c_locale.d->stringToLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators);
executed: return c_locale.d->stringToLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators);
Execution Count:84814
84814
2640} -
2641quint64 QString::toULongLong(bool *ok, int base) const -
2642{ -
2643 -
2644 -
2645 -
2646 -
2647 -
2648 -
2649 -
2650 QLocale c_locale(QLocale::C); -
2651 return c_locale.d->stringToUnsLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators);
executed: return c_locale.d->stringToUnsLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators);
Execution Count:13022
13022
2652} -
2653long QString::toLong(bool *ok, int base) const -
2654{ -
2655 qint64 v = toLongLong(ok, base); -
2656 if (v < (-9223372036854775807L - 1L) || v > 9223372036854775807L) {
partially evaluated: v < (-9223372036854775807L - 1L)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:54
partially evaluated: v > 9223372036854775807L
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:54
0-54
2657 if (ok)
never evaluated: ok
0
2658 *ok = false;
never executed: *ok = false;
0
2659 v = 0; -
2660 }
never executed: }
0
2661 return (long)v;
executed: return (long)v;
Execution Count:54
54
2662} -
2663ulong QString::toULong(bool *ok, int base) const -
2664{ -
2665 quint64 v = toULongLong(ok, base); -
2666 if (v > (9223372036854775807L * 2UL + 1UL)) {
partially evaluated: v > (9223372036854775807L * 2UL + 1UL)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
2667 if (ok)
never evaluated: ok
0
2668 *ok = false;
never executed: *ok = false;
0
2669 v = 0; -
2670 }
never executed: }
0
2671 return (ulong)v;
executed: return (ulong)v;
Execution Count:40
40
2672} -
2673int QString::toInt(bool *ok, int base) const -
2674{ -
2675 qint64 v = toLongLong(ok, base); -
2676 if (v < (-2147483647 - 1) || v > 2147483647) {
evaluated: v < (-2147483647 - 1)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:37015
evaluated: v > 2147483647
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:37007
1-37015
2677 if (ok)
evaluated: ok
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:4
4-6
2678 *ok = false;
executed: *ok = false;
Execution Count:6
6
2679 v = 0; -
2680 }
executed: }
Execution Count:10
10
2681 return v;
executed: return v;
Execution Count:37016
37016
2682} -
2683uint QString::toUInt(bool *ok, int base) const -
2684{ -
2685 quint64 v = toULongLong(ok, base); -
2686 if (v > (2147483647 * 2U + 1U)) {
evaluated: v > (2147483647 * 2U + 1U)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:12847
3-12847
2687 if (ok)
evaluated: ok
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2688 *ok = false;
executed: *ok = false;
Execution Count:2
2
2689 v = 0; -
2690 }
executed: }
Execution Count:3
3
2691 return (uint)v;
executed: return (uint)v;
Execution Count:12850
12850
2692} -
2693short QString::toShort(bool *ok, int base) const -
2694{ -
2695 long v = toLongLong(ok, base); -
2696 if (v < (-32767 - 1) || v > 32767) {
evaluated: v < (-32767 - 1)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:67
evaluated: v > 32767
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:62
3-67
2697 if (ok)
evaluated: ok
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
2698 *ok = false;
executed: *ok = false;
Execution Count:5
5
2699 v = 0; -
2700 }
executed: }
Execution Count:8
8
2701 return (short)v;
executed: return (short)v;
Execution Count:70
70
2702} -
2703ushort QString::toUShort(bool *ok, int base) const -
2704{ -
2705 ulong v = toULongLong(ok, base); -
2706 if (v > (32767 * 2 + 1)) {
evaluated: v > (32767 * 2 + 1)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:55
7-55
2707 if (ok)
evaluated: ok
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3
3-4
2708 *ok = false;
executed: *ok = false;
Execution Count:4
4
2709 v = 0; -
2710 }
executed: }
Execution Count:7
7
2711 return (ushort)v;
executed: return (ushort)v;
Execution Count:62
62
2712} -
2713double QString::toDouble(bool *ok) const -
2714{ -
2715 QLocale c_locale(QLocale::C); -
2716 return c_locale.d->stringToDouble(*this, ok, QLocalePrivate::FailOnGroupSeparators);
executed: return c_locale.d->stringToDouble(*this, ok, QLocalePrivate::FailOnGroupSeparators);
Execution Count:2434
2434
2717} -
2718float QString::toFloat(bool *ok) const -
2719{ -
2720 bool myOk; -
2721 double d = toDouble(&myOk); -
2722 if (!myOk) {
evaluated: !myOk
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:18
13-18
2723 if (ok != 0)
partially evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
2724 *ok = false;
executed: *ok = false;
Execution Count:13
13
2725 return 0.0;
executed: return 0.0;
Execution Count:13
13
2726 } -
2727 if (qIsInf(d))
evaluated: qIsInf(d)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:16
2-16
2728 return float(d);
executed: return float(d);
Execution Count:2
2
2729 if (d > 3.4028234663852886e+38 || d < -3.4028234663852886e+38) {
evaluated: d > 3.4028234663852886e+38
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:15
evaluated: d < -3.4028234663852886e+38
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:14
1-15
2730 if (ok != 0)
partially evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2731 *ok = false;
executed: *ok = false;
Execution Count:2
2
2732 return 0.0;
executed: return 0.0;
Execution Count:2
2
2733 } -
2734 if (ok != 0)
partially evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
2735 *ok = true;
executed: *ok = true;
Execution Count:14
14
2736 return float(d);
executed: return float(d);
Execution Count:14
14
2737} -
2738QString &QString::setNum(qlonglong n, int base) -
2739{ -
2740 -
2741 -
2742 -
2743 -
2744 -
2745 -
2746 QLocale locale(QLocale::C); -
2747 *this = locale.d->longLongToString(n, -1, base); -
2748 return *this;
executed: return *this;
Execution Count:441178
441178
2749} -
2750 -
2751 -
2752 -
2753 -
2754QString &QString::setNum(qulonglong n, int base) -
2755{ -
2756 -
2757 -
2758 -
2759 -
2760 -
2761 -
2762 QLocale locale(QLocale::C); -
2763 *this = locale.d->unsLongLongToString(n, -1, base); -
2764 return *this;
executed: return *this;
Execution Count:25880
25880
2765} -
2766QString &QString::setNum(double n, char f, int prec) -
2767{ -
2768 QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; -
2769 uint flags = 0; -
2770 -
2771 if (qIsUpper(f))
partially evaluated: qIsUpper(f)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1862
0-1862
2772 flags = QLocalePrivate::CapitalEorX;
never executed: flags = QLocalePrivate::CapitalEorX;
0
2773 f = qToLower(f); -
2774 -
2775 switch (f) { -
2776 case 'f': -
2777 form = QLocalePrivate::DFDecimal; -
2778 break;
executed: break;
Execution Count:682
682
2779 case 'e': -
2780 form = QLocalePrivate::DFExponent; -
2781 break;
executed: break;
Execution Count:6
6
2782 case 'g': -
2783 form = QLocalePrivate::DFSignificantDigits; -
2784 break;
executed: break;
Execution Count:1174
1174
2785 default: -
2786 -
2787 -
2788 -
2789 break;
never executed: break;
0
2790 } -
2791 -
2792 QLocale locale(QLocale::C); -
2793 *this = locale.d->doubleToString(n, prec, form, -1, flags); -
2794 return *this;
executed: return *this;
Execution Count:1862
1862
2795} -
2796QString QString::number(long n, int base) -
2797{ -
2798 QString s; -
2799 s.setNum(n, base); -
2800 return s;
executed: return s;
Execution Count:1
1
2801} -
2802 -
2803 -
2804 -
2805 -
2806 -
2807 -
2808QString QString::number(ulong n, int base) -
2809{ -
2810 QString s; -
2811 s.setNum(n, base); -
2812 return s;
executed: return s;
Execution Count:17
17
2813} -
2814 -
2815 -
2816 -
2817 -
2818QString QString::number(int n, int base) -
2819{ -
2820 QString s; -
2821 s.setNum(n, base); -
2822 return s;
executed: return s;
Execution Count:377260
377260
2823} -
2824 -
2825 -
2826 -
2827 -
2828QString QString::number(uint n, int base) -
2829{ -
2830 QString s; -
2831 s.setNum(n, base); -
2832 return s;
executed: return s;
Execution Count:25737
25737
2833} -
2834 -
2835 -
2836 -
2837 -
2838QString QString::number(qlonglong n, int base) -
2839{ -
2840 QString s; -
2841 s.setNum(n, base); -
2842 return s;
executed: return s;
Execution Count:37082
37082
2843} -
2844 -
2845 -
2846 -
2847 -
2848QString QString::number(qulonglong n, int base) -
2849{ -
2850 QString s; -
2851 s.setNum(n, base); -
2852 return s;
executed: return s;
Execution Count:122
122
2853} -
2854QString QString::number(double n, char f, int prec) -
2855{ -
2856 QString s; -
2857 s.setNum(n, f, prec); -
2858 return s;
executed: return s;
Execution Count:1858
1858
2859} -
2860QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const -
2861{ -
2862 QStringList list; -
2863 int start = 0; -
2864 int extra = 0; -
2865 int end; -
2866 while ((end = indexOf(sep, start + extra, cs)) != -1) {
evaluated: (end = indexOf(sep, start + extra, cs)) != -1
TRUEFALSE
yes
Evaluation Count:23514
yes
Evaluation Count:3262
3262-23514
2867 if (start != end || behavior == KeepEmptyParts)
evaluated: start != end
TRUEFALSE
yes
Evaluation Count:18459
yes
Evaluation Count:5055
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:157
yes
Evaluation Count:4898
157-18459
2868 list.append(mid(start, end - start));
executed: list.append(mid(start, end - start));
Execution Count:18616
18616
2869 start = end + sep.size(); -
2870 extra = (sep.size() == 0 ? 1 : 0);
evaluated: sep.size() == 0
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:23499
15-23499
2871 }
executed: }
Execution Count:23514
23514
2872 if (start != size() || behavior == KeepEmptyParts)
evaluated: start != size()
TRUEFALSE
yes
Evaluation Count:1232
yes
Evaluation Count:2030
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:2019
yes
Evaluation Count:11
11-2030
2873 list.append(mid(start));
executed: list.append(mid(start));
Execution Count:3251
3251
2874 return list;
executed: return list;
Execution Count:3262
3262
2875} -
2876 -
2877 -
2878 -
2879 -
2880QStringList QString::split(QChar sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const -
2881{ -
2882 QStringList list; -
2883 int start = 0; -
2884 int end; -
2885 while ((end = indexOf(sep, start, cs)) != -1) {
evaluated: (end = indexOf(sep, start, cs)) != -1
TRUEFALSE
yes
Evaluation Count:41625
yes
Evaluation Count:11891
11891-41625
2886 if (start != end || behavior == KeepEmptyParts)
evaluated: start != end
TRUEFALSE
yes
Evaluation Count:35325
yes
Evaluation Count:6300
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:1160
yes
Evaluation Count:5140
1160-35325
2887 list.append(mid(start, end - start));
executed: list.append(mid(start, end - start));
Execution Count:36485
36485
2888 start = end + 1; -
2889 }
executed: }
Execution Count:41625
41625
2890 if (start != size() || behavior == KeepEmptyParts)
evaluated: start != size()
TRUEFALSE
yes
Evaluation Count:11539
yes
Evaluation Count:352
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:218
yes
Evaluation Count:134
134-11539
2891 list.append(mid(start));
executed: list.append(mid(start));
Execution Count:11757
11757
2892 return list;
executed: return list;
Execution Count:11891
11891
2893} -
2894QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const -
2895{ -
2896 QRegExp rx2(rx); -
2897 QStringList list; -
2898 int start = 0; -
2899 int extra = 0; -
2900 int end; -
2901 while ((end = rx2.indexIn(*this, start + extra)) != -1) {
evaluated: (end = rx2.indexIn(*this, start + extra)) != -1
TRUEFALSE
yes
Evaluation Count:2342
yes
Evaluation Count:513
513-2342
2902 int matchedLen = rx2.matchedLength(); -
2903 if (start != end || behavior == KeepEmptyParts)
evaluated: start != end
TRUEFALSE
yes
Evaluation Count:1980
yes
Evaluation Count:362
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:351
yes
Evaluation Count:11
11-1980
2904 list.append(mid(start, end - start));
executed: list.append(mid(start, end - start));
Execution Count:2331
2331
2905 start = end + matchedLen; -
2906 extra = (matchedLen == 0) ? 1 : 0;
evaluated: (matchedLen == 0)
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:2311
31-2311
2907 }
executed: }
Execution Count:2342
2342
2908 if (start != size() || behavior == KeepEmptyParts)
evaluated: start != size()
TRUEFALSE
yes
Evaluation Count:212
yes
Evaluation Count:301
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:295
yes
Evaluation Count:6
6-301
2909 list.append(mid(start));
executed: list.append(mid(start));
Execution Count:507
507
2910 return list;
executed: return list;
Execution Count:513
513
2911} -
2912QStringList QString::split(const QRegularExpression &re, SplitBehavior behavior) const -
2913{ -
2914 QStringList list; -
2915 if (!re.isValid()) {
partially evaluated: !re.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
2916 QMessageLogger("tools/qstring.cpp", 6452, __PRETTY_FUNCTION__).warning("QString::split: invalid QRegularExpression object"); -
2917 return list;
never executed: return list;
0
2918 } -
2919 -
2920 int start = 0; -
2921 int end = 0; -
2922 QRegularExpressionMatchIterator iterator = re.globalMatch(*this); -
2923 while (iterator.hasNext()) {
evaluated: iterator.hasNext()
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:27
27-105
2924 QRegularExpressionMatch match = iterator.next(); -
2925 end = match.capturedStart(); -
2926 if (start != end || behavior == KeepEmptyParts)
evaluated: start != end
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:32
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:11
11-73
2927 list.append(mid(start, end - start));
executed: list.append(mid(start, end - start));
Execution Count:94
94
2928 start = match.capturedEnd(); -
2929 }
executed: }
Execution Count:105
105
2930 -
2931 if (start != size() || behavior == KeepEmptyParts)
evaluated: start != size()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:17
evaluated: behavior == KeepEmptyParts
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:6
6-17
2932 list.append(mid(start));
executed: list.append(mid(start));
Execution Count:21
21
2933 -
2934 return list;
executed: return list;
Execution Count:27
27
2935} -
2936QString QString::repeated(int times) const -
2937{ -
2938 if (d->size == 0)
evaluated: d->size == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9
5-9
2939 return *this;
executed: return *this;
Execution Count:5
5
2940 -
2941 if (times <= 1) {
evaluated: times <= 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5
4-5
2942 if (times == 1)
evaluated: times == 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2943 return *this;
executed: return *this;
Execution Count:1
1
2944 return QString();
executed: return QString();
Execution Count:3
3
2945 } -
2946 -
2947 const int resultSize = times * d->size; -
2948 -
2949 QString result; -
2950 result.reserve(resultSize); -
2951 if (result.d->alloc != uint(resultSize) + 1u)
partially evaluated: result.d->alloc != uint(resultSize) + 1u
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2952 return QString();
never executed: return QString();
0
2953 -
2954 memcpy(result.d->data(), d->data(), d->size * sizeof(ushort)); -
2955 -
2956 int sizeSoFar = d->size; -
2957 ushort *end = result.d->data() + sizeSoFar; -
2958 -
2959 const int halfResultSize = resultSize >> 1; -
2960 while (sizeSoFar <= halfResultSize) {
evaluated: sizeSoFar <= halfResultSize
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:5
5-16
2961 memcpy(end, result.d->data(), sizeSoFar * sizeof(ushort)); -
2962 end += sizeSoFar; -
2963 sizeSoFar <<= 1; -
2964 }
executed: }
Execution Count:16
16
2965 memcpy(end, result.d->data(), (resultSize - sizeSoFar) * sizeof(ushort)); -
2966 result.d->data()[resultSize] = '\0'; -
2967 result.d->size = resultSize; -
2968 return result;
executed: return result;
Execution Count:5
5
2969} -
2970 -
2971void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::UnicodeVersion version, int from) -
2972{ -
2973 bool simple = true; -
2974 const QChar *p = data->constData(); -
2975 int len = data->length(); -
2976 for (int i = from; i < len; ++i) {
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:400788
yes
Evaluation Count:11129
11129-400788
2977 if (p[i].unicode() >= 0x80) {
evaluated: p[i].unicode() >= 0x80
TRUEFALSE
yes
Evaluation Count:356558
yes
Evaluation Count:44230
44230-356558
2978 simple = false; -
2979 break;
executed: break;
Execution Count:356558
356558
2980 } -
2981 }
executed: }
Execution Count:44230
44230
2982 if (simple)
evaluated: simple
TRUEFALSE
yes
Evaluation Count:11129
yes
Evaluation Count:356558
11129-356558
2983 return;
executed: return;
Execution Count:11129
11129
2984 -
2985 if (version == QChar::Unicode_Unassigned) {
evaluated: version == QChar::Unicode_Unassigned
TRUEFALSE
yes
Evaluation Count:356431
yes
Evaluation Count:127
127-356431
2986 version = QChar::currentUnicodeVersion(); -
2987 } else if (int(version) <= NormalizationCorrectionsVersionMax) {
partially evaluated: int(version) <= NormalizationCorrectionsVersionMax
TRUEFALSE
yes
Evaluation Count:127
no
Evaluation Count:0
executed: }
Execution Count:356431
0-356431
2988 const QString &s = *data; -
2989 QChar *d = 0; -
2990 for (int i = 0; i < NumNormalizationCorrections; ++i) {
evaluated: i < NumNormalizationCorrections
TRUEFALSE
yes
Evaluation Count:762
yes
Evaluation Count:127
127-762
2991 const NormalizationCorrection &n = uc_normalization_corrections[i]; -
2992 if (n.version > version) {
evaluated: n.version > version
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:125
125-637
2993 int pos = from; -
2994 if (QChar::requiresSurrogates(n.ucs4)) {
evaluated: QChar::requiresSurrogates(n.ucs4)
TRUEFALSE
yes
Evaluation Count:635
yes
Evaluation Count:2
2-635
2995 ushort ucs4High = QChar::highSurrogate(n.ucs4); -
2996 ushort ucs4Low = QChar::lowSurrogate(n.ucs4); -
2997 ushort oldHigh = QChar::highSurrogate(n.old_mapping); -
2998 ushort oldLow = QChar::lowSurrogate(n.old_mapping); -
2999 while (pos < s.length() - 1) {
evaluated: pos < s.length() - 1
TRUEFALSE
yes
Evaluation Count:2325
yes
Evaluation Count:635
635-2325
3000 if (s.at(pos).unicode() == ucs4High && s.at(pos + 1).unicode() == ucs4Low) {
evaluated: s.at(pos).unicode() == ucs4High
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2323
partially evaluated: s.at(pos + 1).unicode() == ucs4Low
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2323
3001 if (!d)
partially evaluated: !d
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
3002 d = data->data();
executed: d = data->data();
Execution Count:2
2
3003 d[pos] = QChar(oldHigh); -
3004 d[++pos] = QChar(oldLow); -
3005 }
executed: }
Execution Count:2
2
3006 ++pos; -
3007 }
executed: }
Execution Count:2325
2325
3008 } else {
executed: }
Execution Count:635
635
3009 while (pos < s.length()) {
evaluated: pos < s.length()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
3010 if (s.at(pos).unicode() == n.ucs4) {
evaluated: s.at(pos).unicode() == n.ucs4
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
3011 if (!d)
partially evaluated: !d
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3012 d = data->data();
executed: d = data->data();
Execution Count:1
1
3013 d[pos] = QChar(n.old_mapping); -
3014 }
executed: }
Execution Count:1
1
3015 ++pos; -
3016 }
executed: }
Execution Count:3
3
3017 }
executed: }
Execution Count:2
2
3018 } -
3019 }
executed: }
Execution Count:762
762
3020 }
executed: }
Execution Count:127
127
3021 decomposeHelper(data, mode < QString::NormalizationForm_KD, version, from); -
3022 -
3023 canonicalOrderHelper(data, version, from); -
3024 -
3025 if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD)
evaluated: mode == QString::NormalizationForm_D
TRUEFALSE
yes
Evaluation Count:89109
yes
Evaluation Count:267449
evaluated: mode == QString::NormalizationForm_KD
TRUEFALSE
yes
Evaluation Count:89107
yes
Evaluation Count:178342
89107-267449
3026 return;
executed: return;
Execution Count:178216
178216
3027 -
3028 composeHelper(data, version, from); -
3029}
executed: }
Execution Count:178342
178342
3030 -
3031 -
3032 -
3033 -
3034 -
3035QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersion version) const -
3036{ -
3037 QString copy = *this; -
3038 qt_string_normalize(&copy, mode, version, 0); -
3039 return copy;
executed: return copy;
Execution Count:367563
367563
3040} -
3041 -
3042 -
3043struct ArgEscapeData -
3044{ -
3045 int min_escape; -
3046 int occurrences; -
3047 int locale_occurrences; -
3048 -
3049 int escape_len; -
3050}; -
3051 -
3052static ArgEscapeData findArgEscapes(const QString &s) -
3053{ -
3054 const QChar *uc_begin = s.unicode(); -
3055 const QChar *uc_end = uc_begin + s.length(); -
3056 -
3057 ArgEscapeData d; -
3058 -
3059 d.min_escape = 2147483647; -
3060 d.occurrences = 0; -
3061 d.escape_len = 0; -
3062 d.locale_occurrences = 0; -
3063 -
3064 const QChar *c = uc_begin; -
3065 while (c != uc_end) {
evaluated: c != uc_end
TRUEFALSE
yes
Evaluation Count:27431553
yes
Evaluation Count:10513349
10513349-27431553
3066 while (c != uc_end && c->unicode() != '%')
evaluated: c != uc_end
TRUEFALSE
yes
Evaluation Count:100687666
yes
Evaluation Count:2288166
evaluated: c->unicode() != '%'
TRUEFALSE
yes
Evaluation Count:75544290
yes
Evaluation Count:25143384
2288166-100687666
3067 ++c;
executed: ++c;
Execution Count:75544290
75544290
3068 -
3069 if (c == uc_end)
evaluated: c == uc_end
TRUEFALSE
yes
Evaluation Count:2288166
yes
Evaluation Count:25143384
2288166-25143384
3070 break;
executed: break;
Execution Count:2288166
2288166
3071 const QChar *escape_start = c; -
3072 if (++c == uc_end)
evaluated: ++c == uc_end
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:25143379
5-25143379
3073 break;
executed: break;
Execution Count:5
5
3074 -
3075 bool locale_arg = false; -
3076 if (c->unicode() == 'L') {
evaluated: c->unicode() == 'L'
TRUEFALSE
yes
Evaluation Count:265
yes
Evaluation Count:25143114
265-25143114
3077 locale_arg = true; -
3078 if (++c == uc_end)
evaluated: ++c == uc_end
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:249
16-249
3079 break;
executed: break;
Execution Count:16
16
3080 }
executed: }
Execution Count:249
249
3081 -
3082 if (c->digitValue() == -1)
evaluated: c->digitValue() == -1
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:25143161
195-25143161
3083 continue;
executed: continue;
Execution Count:195
195
3084 -
3085 int escape = c->digitValue(); -
3086 ++c; -
3087 -
3088 if (c != uc_end && c->digitValue() != -1) {
evaluated: c != uc_end
TRUEFALSE
yes
Evaluation Count:14629818
yes
Evaluation Count:10513349
evaluated: c->digitValue() != -1
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:14629724
94-14629818
3089 escape = (10 * escape) + c->digitValue(); -
3090 ++c; -
3091 }
executed: }
Execution Count:94
94
3092 -
3093 if (escape > d.min_escape)
evaluated: escape > d.min_escape
TRUEFALSE
yes
Evaluation Count:12285169
yes
Evaluation Count:12857992
12285169-12857992
3094 continue;
executed: continue;
Execution Count:12285169
12285169
3095 -
3096 if (escape < d.min_escape) {
evaluated: escape < d.min_escape
TRUEFALSE
yes
Evaluation Count:12857887
yes
Evaluation Count:106
106-12857887
3097 d.min_escape = escape; -
3098 d.occurrences = 0; -
3099 d.escape_len = 0; -
3100 d.locale_occurrences = 0; -
3101 }
executed: }
Execution Count:12857887
12857887
3102 -
3103 ++d.occurrences; -
3104 if (locale_arg)
evaluated: locale_arg
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:12857779
215-12857779
3105 ++d.locale_occurrences;
executed: ++d.locale_occurrences;
Execution Count:215
215
3106 d.escape_len += c - escape_start; -
3107 }
executed: }
Execution Count:12857993
12857993
3108 return d;
executed: return d;
Execution Count:12801536
12801536
3109} -
3110 -
3111static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int field_width, -
3112 const QString &arg, const QString &larg, QChar fillChar = QLatin1Char(' ')) -
3113{ -
3114 const QChar *uc_begin = s.unicode(); -
3115 const QChar *uc_end = uc_begin + s.length(); -
3116 -
3117 int abs_field_width = qAbs(field_width); -
3118 int result_len = s.length() -
3119 - d.escape_len -
3120 + (d.occurrences - d.locale_occurrences) -
3121 *qMax(abs_field_width, arg.length()) -
3122 + d.locale_occurrences -
3123 *qMax(abs_field_width, larg.length()); -
3124 -
3125 QString result(result_len, Qt::Uninitialized); -
3126 QChar *result_buff = (QChar*) result.unicode(); -
3127 -
3128 QChar *rc = result_buff; -
3129 const QChar *c = uc_begin; -
3130 int repl_cnt = 0; -
3131 while (c != uc_end) {
evaluated: c != uc_end
TRUEFALSE
yes
Evaluation Count:12914385
yes
Evaluation Count:12801513
12801513-12914385
3132 -
3133 -
3134 -
3135 -
3136 const QChar *text_start = c; -
3137 -
3138 while (c->unicode() != '%')
evaluated: c->unicode() != '%'
TRUEFALSE
yes
Evaluation Count:55835202
yes
Evaluation Count:12914380
12914380-55835202
3139 ++c;
executed: ++c;
Execution Count:55835204
55835204
3140 -
3141 const QChar *escape_start = c++; -
3142 -
3143 bool locale_arg = false; -
3144 if (c->unicode() == 'L') {
evaluated: c->unicode() == 'L'
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:12914164
215-12914164
3145 locale_arg = true; -
3146 ++c; -
3147 }
executed: }
Execution Count:215
215
3148 -
3149 int escape = c->digitValue(); -
3150 if (escape != -1) {
evaluated: escape != -1
TRUEFALSE
yes
Evaluation Count:12914316
yes
Evaluation Count:63
63-12914316
3151 if (c + 1 != uc_end && (c + 1)->digitValue() != -1) {
evaluated: c + 1 != uc_end
TRUEFALSE
yes
Evaluation Count:9320364
yes
Evaluation Count:3593962
evaluated: (c + 1)->digitValue() != -1
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:9320355
8-9320364
3152 escape = (10 * escape) + (c + 1)->digitValue(); -
3153 ++c; -
3154 }
executed: }
Execution Count:8
8
3155 }
executed: }
Execution Count:12914313
12914313
3156 -
3157 if (escape != d.min_escape) {
evaluated: escape != d.min_escape
TRUEFALSE
yes
Evaluation Count:112760
yes
Evaluation Count:12801613
112760-12801613
3158 memcpy(rc, text_start, (c - text_start)*sizeof(QChar)); -
3159 rc += c - text_start; -
3160 }
executed: }
Execution Count:112760
112760
3161 else { -
3162 ++c; -
3163 -
3164 memcpy(rc, text_start, (escape_start - text_start)*sizeof(QChar)); -
3165 rc += escape_start - text_start; -
3166 -
3167 uint pad_chars; -
3168 if (locale_arg)
evaluated: locale_arg
TRUEFALSE
yes
Evaluation Count:214
yes
Evaluation Count:12801400
214-12801400
3169 pad_chars = qMax(abs_field_width, larg.length()) - larg.length();
executed: pad_chars = qMax(abs_field_width, larg.length()) - larg.length();
Execution Count:214
214
3170 else -
3171 pad_chars = qMax(abs_field_width, arg.length()) - arg.length();
executed: pad_chars = qMax(abs_field_width, arg.length()) - arg.length();
Execution Count:12801398
12801398
3172 -
3173 if (field_width > 0) {
evaluated: field_width > 0
TRUEFALSE
yes
Evaluation Count:912
yes
Evaluation Count:12800700
912-12800700
3174 for (uint i = 0; i < pad_chars; ++i)
evaluated: i < pad_chars
TRUEFALSE
yes
Evaluation Count:4895
yes
Evaluation Count:912
912-4895
3175 (rc++)->unicode() = fillChar.unicode();
executed: (rc++)->unicode() = fillChar.unicode();
Execution Count:4895
4895
3176 }
executed: }
Execution Count:912
912
3177 -
3178 if (locale_arg) {
evaluated: locale_arg
TRUEFALSE
yes
Evaluation Count:214
yes
Evaluation Count:12801398
214-12801398
3179 memcpy(rc, larg.unicode(), larg.length()*sizeof(QChar)); -
3180 rc += larg.length(); -
3181 }
executed: }
Execution Count:214
214
3182 else { -
3183 memcpy(rc, arg.unicode(), arg.length()*sizeof(QChar)); -
3184 rc += arg.length(); -
3185 }
executed: }
Execution Count:12801398
12801398
3186 -
3187 if (field_width < 0) {
evaluated: field_width < 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:12801607
5-12801607
3188 for (uint i = 0; i < pad_chars; ++i)
evaluated: i < pad_chars
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:5
5-12
3189 (rc++)->unicode() = fillChar.unicode();
executed: (rc++)->unicode() = fillChar.unicode();
Execution Count:12
12
3190 }
executed: }
Execution Count:5
5
3191 -
3192 if (++repl_cnt == d.occurrences) {
evaluated: ++repl_cnt == d.occurrences
TRUEFALSE
yes
Evaluation Count:12801508
yes
Evaluation Count:104
104-12801508
3193 memcpy(rc, c, (uc_end - c)*sizeof(QChar)); -
3194 rc += uc_end - c; -
3195 qt_noop(); -
3196 c = uc_end; -
3197 }
executed: }
Execution Count:12801511
12801511
3198 }
executed: }
Execution Count:12801615
12801615
3199 } -
3200 qt_noop(); -
3201 -
3202 return result;
executed: return result;
Execution Count:12801513
12801513
3203} -
3204QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const -
3205{ -
3206 ArgEscapeData d = findArgEscapes(*this); -
3207 -
3208 if (d.occurrences == 0) {
partially evaluated: d.occurrences == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44309
0-44309
3209 QMessageLogger("tools/qstring.cpp", 6806, __PRETTY_FUNCTION__).warning("QString::arg: Argument missing: %s, %s", toLocal8Bit().data(), -
3210 a.toLocal8Bit().data()); -
3211 return *this;
never executed: return *this;
0
3212 } -
3213 return replaceArgEscapes(*this, d, fieldWidth, a, a, fillChar);
executed: return replaceArgEscapes(*this, d, fieldWidth, a, a, fillChar);
Execution Count:44309
44309
3214} -
3215QString QString::arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const -
3216{ -
3217 ArgEscapeData d = findArgEscapes(*this); -
3218 -
3219 if (d.occurrences == 0) {
evaluated: d.occurrences == 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:11709840
6-11709840
3220 QMessageLogger("tools/qstring.cpp", 6991, __PRETTY_FUNCTION__).warning() << "QString::arg: Argument missing:" << *this << ',' << a; -
3221 return *this;
executed: return *this;
Execution Count:6
6
3222 } -
3223 -
3224 unsigned flags = QLocalePrivate::NoFlags; -
3225 if (fillChar == QLatin1Char('0'))
evaluated: fillChar == QLatin1Char('0')
TRUEFALSE
yes
Evaluation Count:314
yes
Evaluation Count:11709525
314-11709525
3226 flags = QLocalePrivate::ZeroPadded;
executed: flags = QLocalePrivate::ZeroPadded;
Execution Count:314
314
3227 -
3228 QString arg; -
3229 if (d.occurrences > d.locale_occurrences)
evaluated: d.occurrences > d.locale_occurrences
TRUEFALSE
yes
Evaluation Count:11709633
yes
Evaluation Count:206
206-11709633
3230 arg = QLocale::c().d->longLongToString(a, -1, base, fieldWidth, flags);
executed: arg = QLocale::c().d->longLongToString(a, -1, base, fieldWidth, flags);
Execution Count:11709633
11709633
3231 -
3232 QString locale_arg; -
3233 if (d.locale_occurrences > 0) {
evaluated: d.locale_occurrences > 0
TRUEFALSE
yes
Evaluation Count:206
yes
Evaluation Count:11709631
206-11709631
3234 QLocale locale; -
3235 if (!(locale.numberOptions() & QLocale::OmitGroupSeparator))
evaluated: !(locale.numberOptions() & QLocale::OmitGroupSeparator)
TRUEFALSE
yes
Evaluation Count:205
yes
Evaluation Count:1
1-205
3236 flags |= QLocalePrivate::ThousandsGroup;
executed: flags |= QLocalePrivate::ThousandsGroup;
Execution Count:205
205
3237 locale_arg = locale.d->longLongToString(a, -1, base, fieldWidth, flags); -
3238 }
executed: }
Execution Count:206
206
3239 -
3240 return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar);
executed: return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar);
Execution Count:11709837
11709837
3241} -
3242QString QString::arg(qulonglong a, int fieldWidth, int base, QChar fillChar) const -
3243{ -
3244 ArgEscapeData d = findArgEscapes(*this); -
3245 -
3246 if (d.occurrences == 0) {
partially evaluated: d.occurrences == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4543
0-4543
3247 QMessageLogger("tools/qstring.cpp", 7035, __PRETTY_FUNCTION__).warning() << "QString::arg: Argument missing:" << *this << ',' << a; -
3248 return *this;
never executed: return *this;
0
3249 } -
3250 -
3251 unsigned flags = QLocalePrivate::NoFlags; -
3252 if (fillChar == QLatin1Char('0'))
partially evaluated: fillChar == QLatin1Char('0')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4543
0-4543
3253 flags = QLocalePrivate::ZeroPadded;
never executed: flags = QLocalePrivate::ZeroPadded;
0
3254 -
3255 QString arg; -
3256 if (d.occurrences > d.locale_occurrences)
partially evaluated: d.occurrences > d.locale_occurrences
TRUEFALSE
yes
Evaluation Count:4541
no
Evaluation Count:0
0-4541
3257 arg = QLocale::c().d->unsLongLongToString(a, -1, base, fieldWidth, flags);
executed: arg = QLocale::c().d->unsLongLongToString(a, -1, base, fieldWidth, flags);
Execution Count:4543
4543
3258 -
3259 QString locale_arg; -
3260 if (d.locale_occurrences > 0) {
partially evaluated: d.locale_occurrences > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4544
0-4544
3261 QLocale locale; -
3262 if (!(locale.numberOptions() & QLocale::OmitGroupSeparator))
never evaluated: !(locale.numberOptions() & QLocale::OmitGroupSeparator)
0
3263 flags |= QLocalePrivate::ThousandsGroup;
never executed: flags |= QLocalePrivate::ThousandsGroup;
0
3264 locale_arg = locale.d->unsLongLongToString(a, -1, base, fieldWidth, flags); -
3265 }
never executed: }
0
3266 -
3267 return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar);
executed: return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar);
Execution Count:4544
4544
3268} -
3269QString QString::arg(QChar a, int fieldWidth, QChar fillChar) const -
3270{ -
3271 QString c; -
3272 c += a; -
3273 return arg(c, fieldWidth, fillChar);
executed: return arg(c, fieldWidth, fillChar);
Execution Count:470
470
3274} -
3275 -
3276 -
3277 -
3278 -
3279 -
3280 -
3281QString QString::arg(char a, int fieldWidth, QChar fillChar) const -
3282{ -
3283 QString c; -
3284 c += QLatin1Char(a); -
3285 return arg(c, fieldWidth, fillChar);
executed: return arg(c, fieldWidth, fillChar);
Execution Count:3
3
3286} -
3287QString QString::arg(double a, int fieldWidth, char fmt, int prec, QChar fillChar) const -
3288{ -
3289 ArgEscapeData d = findArgEscapes(*this); -
3290 -
3291 if (d.occurrences == 0) {
partially evaluated: d.occurrences == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1042846
0-1042846
3292 QMessageLogger("tools/qstring.cpp", 7147, __PRETTY_FUNCTION__).warning("QString::arg: Argument missing: %s, %g", toLocal8Bit().data(), a); -
3293 return *this;
never executed: return *this;
0
3294 } -
3295 -
3296 unsigned flags = QLocalePrivate::NoFlags; -
3297 if (fillChar == QLatin1Char('0'))
evaluated: fillChar == QLatin1Char('0')
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1042844
2-1042844
3298 flags = QLocalePrivate::ZeroPadded;
executed: flags = QLocalePrivate::ZeroPadded;
Execution Count:2
2
3299 -
3300 if (qIsUpper(fmt))
partially evaluated: qIsUpper(fmt)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1042846
0-1042846
3301 flags |= QLocalePrivate::CapitalEorX;
never executed: flags |= QLocalePrivate::CapitalEorX;
0
3302 fmt = qToLower(fmt); -
3303 -
3304 QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; -
3305 switch (fmt) { -
3306 case 'f': -
3307 form = QLocalePrivate::DFDecimal; -
3308 break;
never executed: break;
0
3309 case 'e': -
3310 form = QLocalePrivate::DFExponent; -
3311 break;
never executed: break;
0
3312 case 'g': -
3313 form = QLocalePrivate::DFSignificantDigits; -
3314 break;
executed: break;
Execution Count:1042846
1042846
3315 default: -
3316 -
3317 -
3318 -
3319 break;
never executed: break;
0
3320 } -
3321 -
3322 QString arg; -
3323 if (d.occurrences > d.locale_occurrences)
evaluated: d.occurrences > d.locale_occurrences
TRUEFALSE
yes
Evaluation Count:1042842
yes
Evaluation Count:4
4-1042842
3324 arg = QLocale::c().d->doubleToString(a, prec, form, fieldWidth, flags);
executed: arg = QLocale::c().d->doubleToString(a, prec, form, fieldWidth, flags);
Execution Count:1042842
1042842
3325 -
3326 QString locale_arg; -
3327 if (d.locale_occurrences > 0) {
evaluated: d.locale_occurrences > 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1042842
4-1042842
3328 QLocale locale; -
3329 -
3330 if (!(locale.numberOptions() & QLocale::OmitGroupSeparator))
evaluated: !(locale.numberOptions() & QLocale::OmitGroupSeparator)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
3331 flags |= QLocalePrivate::ThousandsGroup;
executed: flags |= QLocalePrivate::ThousandsGroup;
Execution Count:3
3
3332 locale_arg = locale.d->doubleToString(a, prec, form, fieldWidth, flags); -
3333 }
executed: }
Execution Count:4
4
3334 -
3335 return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar);
executed: return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar);
Execution Count:1042846
1042846
3336} -
3337 -
3338static int getEscape(const QChar *uc, int *pos, int len, int maxNumber = 999) -
3339{ -
3340 int i = *pos; -
3341 ++i; -
3342 if (i < len && uc[i] == QLatin1Char('L'))
partially evaluated: i < len
TRUEFALSE
yes
Evaluation Count:959754
no
Evaluation Count:0
partially evaluated: uc[i] == QLatin1Char('L')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:959754
0-959754
3343 ++i;
never executed: ++i;
0
3344 if (i < len) {
partially evaluated: i < len
TRUEFALSE
yes
Evaluation Count:959754
no
Evaluation Count:0
0-959754
3345 int escape = uc[i].unicode() - '0'; -
3346 if (uint(escape) >= 10U)
evaluated: uint(escape) >= 10U
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:959746
8-959746
3347 return -1;
executed: return -1;
Execution Count:8
8
3348 ++i; -
3349 while (i < len) {
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:954760
yes
Evaluation Count:5030
5030-954760
3350 int digit = uc[i].unicode() - '0'; -
3351 if (uint(digit) >= 10U)
evaluated: uint(digit) >= 10U
TRUEFALSE
yes
Evaluation Count:954716
yes
Evaluation Count:44
44-954716
3352 break;
executed: break;
Execution Count:954716
954716
3353 escape = (escape * 10) + digit; -
3354 ++i; -
3355 }
executed: }
Execution Count:44
44
3356 if (escape <= maxNumber) {
evaluated: escape <= maxNumber
TRUEFALSE
yes
Evaluation Count:959713
yes
Evaluation Count:33
33-959713
3357 *pos = i; -
3358 return escape;
executed: return escape;
Execution Count:959713
959713
3359 } -
3360 }
executed: }
Execution Count:33
33
3361 return -1;
executed: return -1;
Execution Count:33
33
3362} -
3363 -
3364QString QString::multiArg(int numArgs, const QString **args) const -
3365{ -
3366 QString result; -
3367 QMap<int, int> numbersUsed; -
3368 const QChar *uc = (const QChar *) d->data(); -
3369 const int len = d->size; -
3370 const int end = len - 1; -
3371 int lastNumber = -1; -
3372 int i = 0; -
3373 -
3374 -
3375 while (i < end) {
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:5624272
yes
Evaluation Count:161516
161516-5624272
3376 if (uc[i] == QLatin1Char('%')) {
evaluated: uc[i] == QLatin1Char('%')
TRUEFALSE
yes
Evaluation Count:479877
yes
Evaluation Count:5144395
479877-5144395
3377 int number = getEscape(uc, &i, len); -
3378 if (number != -1) {
evaluated: number != -1
TRUEFALSE
yes
Evaluation Count:479871
yes
Evaluation Count:6
6-479871
3379 numbersUsed.insert(number, -1); -
3380 continue;
executed: continue;
Execution Count:479871
479871
3381 } -
3382 }
executed: }
Execution Count:6
6
3383 ++i; -
3384 }
executed: }
Execution Count:5144401
5144401
3385 -
3386 -
3387 QMap<int, int>::iterator j = numbersUsed.begin(); -
3388 QMap<int, int>::iterator jend = numbersUsed.end(); -
3389 int arg = 0; -
3390 while (j != jend && arg < numArgs) {
evaluated: j != jend
TRUEFALSE
yes
Evaluation Count:479867
yes
Evaluation Count:161489
evaluated: arg < numArgs
TRUEFALSE
yes
Evaluation Count:479840
yes
Evaluation Count:27
27-479867
3391 *j = arg++; -
3392 lastNumber = j.key(); -
3393 ++j; -
3394 }
executed: }
Execution Count:479840
479840
3395 -
3396 -
3397 if (numArgs > arg) {
partially evaluated: numArgs > arg
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:161516
0-161516
3398 QMessageLogger("tools/qstring.cpp", 7253, __PRETTY_FUNCTION__).warning("QString::arg: %d argument(s) missing in %s", numArgs - arg, toLocal8Bit().data()); -
3399 numArgs = arg; -
3400 }
never executed: }
0
3401 -
3402 i = 0; -
3403 while (i < len) {
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:5783305
yes
Evaluation Count:161516
161516-5783305
3404 if (uc[i] == QLatin1Char('%') && i != end) {
evaluated: uc[i] == QLatin1Char('%')
TRUEFALSE
yes
Evaluation Count:479878
yes
Evaluation Count:5303427
evaluated: i != end
TRUEFALSE
yes
Evaluation Count:479877
yes
Evaluation Count:1
1-5303427
3405 int number = getEscape(uc, &i, len, lastNumber); -
3406 int arg = numbersUsed[number]; -
3407 if (number != -1 && arg != -1) {
evaluated: number != -1
TRUEFALSE
yes
Evaluation Count:479842
yes
Evaluation Count:35
partially evaluated: arg != -1
TRUEFALSE
yes
Evaluation Count:479842
no
Evaluation Count:0
0-479842
3408 result += *args[arg]; -
3409 continue;
executed: continue;
Execution Count:479842
479842
3410 } -
3411 }
executed: }
Execution Count:35
35
3412 result += uc[i++]; -
3413 }
executed: }
Execution Count:5303463
5303463
3414 return result;
executed: return result;
Execution Count:161516
161516
3415} -
3416 -
3417 -
3418 -
3419 -
3420 -
3421 -
3422bool QString::isSimpleText() const -
3423{ -
3424 const ushort *p = d->data(); -
3425 const ushort * const end = p + d->size; -
3426 while (p < end) {
never evaluated: p < end
0
3427 ushort uc = *p; -
3428 -
3429 if (uc > 0x058f && (uc < 0x1100 || uc > 0xfb0f)) {
never evaluated: uc > 0x058f
never evaluated: uc < 0x1100
never evaluated: uc > 0xfb0f
0
3430 return false;
never executed: return false;
0
3431 } -
3432 p++; -
3433 }
never executed: }
0
3434 -
3435 return true;
never executed: return true;
0
3436} -
3437 -
3438 -
3439 -
3440 -
3441 -
3442bool QString::isRightToLeft() const -
3443{ -
3444 const ushort *p = d->data(); -
3445 const ushort * const end = p + d->size; -
3446 while (p < end) {
evaluated: p < end
TRUEFALSE
yes
Evaluation Count:626149
yes
Evaluation Count:98839
98839-626149
3447 uint ucs4 = *p; -
3448 if (QChar::isHighSurrogate(ucs4) && p < end - 1) {
evaluated: QChar::isHighSurrogate(ucs4)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:626146
partially evaluated: p < end - 1
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-626146
3449 ushort low = p[1]; -
3450 if (QChar::isLowSurrogate(low)) {
partially evaluated: QChar::isLowSurrogate(low)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
3451 ucs4 = QChar::surrogateToUcs4(ucs4, low); -
3452 ++p; -
3453 }
executed: }
Execution Count:3
3
3454 }
executed: }
Execution Count:3
3
3455 switch (QChar::direction(ucs4)) -
3456 { -
3457 case QChar::DirL: -
3458 return false;
executed: return false;
Execution Count:67710
67710
3459 case QChar::DirR: -
3460 case QChar::DirAL: -
3461 return true;
executed: return true;
Execution Count:507
507
3462 default: -
3463 break;
executed: break;
Execution Count:557932
557932
3464 } -
3465 ++p; -
3466 }
executed: }
Execution Count:557932
557932
3467 return false;
executed: return false;
Execution Count:98839
98839
3468} -
3469QString QString::fromRawData(const QChar *unicode, int size) -
3470{ -
3471 Data *x; -
3472 if (!unicode) {
evaluated: !unicode
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:35702
2-35702
3473 x = Data::sharedNull(); -
3474 } else if (!size) {
partially evaluated: !size
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35714
executed: }
Execution Count:2
0-35714
3475 x = Data::allocate(0); -
3476 } else {
never executed: }
0
3477 x = Data::fromRawData(reinterpret_cast<const ushort *>(unicode), size); -
3478 do { if (!(x)) qBadAlloc(); } while (0);
partially evaluated: !(x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35724
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35717
never executed: qBadAlloc();
executed: }
Execution Count:35717
0-35724
3479 }
executed: }
Execution Count:35720
35720
3480 QStringDataPtr dataPtr = { x }; -
3481 return QString(dataPtr);
executed: return QString(dataPtr);
Execution Count:35727
35727
3482} -
3483QString &QString::setRawData(const QChar *unicode, int size) -
3484{ -
3485 if (d->ref.isShared() || d->alloc) {
evaluated: d->ref.isShared()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
evaluated: d->alloc
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-2
3486 *this = fromRawData(unicode, size); -
3487 } else {
executed: }
Execution Count:2
2
3488 if (unicode) {
partially evaluated: unicode
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3489 d->size = size; -
3490 d->offset = reinterpret_cast<const char *>(unicode) - reinterpret_cast<char *>(d); -
3491 } else {
executed: }
Execution Count:1
1
3492 d->offset = sizeof(QStringData); -
3493 d->size = 0; -
3494 }
never executed: }
0
3495 } -
3496 return *this;
executed: return *this;
Execution Count:3
3
3497} -
3498QDataStream &operator<<(QDataStream &out, const QString &str) -
3499{ -
3500 if (out.version() == 1) {
partially evaluated: out.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14021
0-14021
3501 out << str.toLatin1(); -
3502 } else {
never executed: }
0
3503 if (!str.isNull() || out.version() < 3) {
evaluated: !str.isNull()
TRUEFALSE
yes
Evaluation Count:13793
yes
Evaluation Count:228
evaluated: out.version() < 3
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:227
1-13793
3504 if ((out.byteOrder() == QDataStream::BigEndian) == (QSysInfo::ByteOrder == QSysInfo::BigEndian)) {
partially evaluated: (out.byteOrder() == QDataStream::BigEndian) == (QSysInfo::ByteOrder == QSysInfo::BigEndian)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13794
0-13794
3505 out.writeBytes(reinterpret_cast<const char *>(str.unicode()), sizeof(QChar) * str.length()); -
3506 } else {
never executed: }
0
3507 QVarLengthArray<ushort> buffer(str.length()); -
3508 const ushort *data = reinterpret_cast<const ushort *>(str.constData()); -
3509 for (int i = 0; i < str.length(); i++) {
evaluated: i < str.length()
TRUEFALSE
yes
Evaluation Count:51612
yes
Evaluation Count:13794
13794-51612
3510 buffer[i] = qbswap(*data); -
3511 ++data; -
3512 }
executed: }
Execution Count:51612
51612
3513 out.writeBytes(reinterpret_cast<const char *>(buffer.data()), sizeof(ushort) * buffer.size()); -
3514 }
executed: }
Execution Count:13794
13794
3515 } else { -
3516 -
3517 out << (quint32)0xffffffff; -
3518 }
executed: }
Execution Count:227
227
3519 } -
3520 return out;
executed: return out;
Execution Count:14021
14021
3521} -
3522QDataStream &operator>>(QDataStream &in, QString &str) -
3523{ -
3524 -
3525 -
3526 -
3527 -
3528 -
3529 -
3530 if (in.version() == 1) {
partially evaluated: in.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13994
0-13994
3531 QByteArray l; -
3532 in >> l; -
3533 str = QString::fromLatin1(l); -
3534 } else {
never executed: }
0
3535 quint32 bytes = 0; -
3536 in >> bytes; -
3537 if (bytes == 0xffffffff) {
evaluated: bytes == 0xffffffff
TRUEFALSE
yes
Evaluation Count:222
yes
Evaluation Count:13772
222-13772
3538 str.clear(); -
3539 } else if (bytes > 0) {
evaluated: bytes > 0
TRUEFALSE
yes
Evaluation Count:13521
yes
Evaluation Count:251
executed: }
Execution Count:222
222-13521
3540 if (bytes & 0x1) {
evaluated: bytes & 0x1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:13515
6-13515
3541 str.clear(); -
3542 in.setStatus(QDataStream::ReadCorruptData); -
3543 return in;
executed: return in;
Execution Count:6
6
3544 } -
3545 -
3546 const quint32 Step = 1024 * 1024; -
3547 quint32 len = bytes / 2; -
3548 quint32 allocated = 0; -
3549 -
3550 while (allocated < len) {
evaluated: allocated < len
TRUEFALSE
yes
Evaluation Count:13527
yes
Evaluation Count:13501
13501-13527
3551 int blockSize = qMin(Step, len - allocated); -
3552 str.resize(allocated + blockSize); -
3553 if (in.readRawData(reinterpret_cast<char *>(str.data()) + allocated * 2, 14-13513
3554 blockSize * 2) != blockSize * 2) {
evaluated: in.readRawData(reinterpret_cast<char *>(str.data()) + allocated * 2, blockSize * 2) != blockSize * 2
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:13513
14-13513
3555 str.clear(); -
3556 in.setStatus(QDataStream::ReadPastEnd); -
3557 return in;
executed: return in;
Execution Count:14
14
3558 } -
3559 allocated += blockSize; -
3560 }
executed: }
Execution Count:13513
13513
3561 -
3562 if ((in.byteOrder() == QDataStream::BigEndian) 0-13501
3563 != (QSysInfo::ByteOrder == QSysInfo::BigEndian)) {
partially evaluated: (in.byteOrder() == QDataStream::BigEndian) != (QSysInfo::ByteOrder == QSysInfo::BigEndian)
TRUEFALSE
yes
Evaluation Count:13501
no
Evaluation Count:0
0-13501
3564 ushort *data = reinterpret_cast<ushort *>(str.data()); -
3565 while (len--) {
evaluated: len--
TRUEFALSE
yes
Evaluation Count:12627457
yes
Evaluation Count:13501
13501-12627457
3566 *data = qbswap(*data); -
3567 ++data; -
3568 }
executed: }
Execution Count:12627457
12627457
3569 }
executed: }
Execution Count:13501
13501
3570 } else {
executed: }
Execution Count:13501
13501
3571 str = QString(QLatin1String("")); -
3572 }
executed: }
Execution Count:251
251
3573 } -
3574 return in;
executed: return in;
Execution Count:13974
13974
3575} -
3576QString QStringRef::toString() const { -
3577 if (!m_string)
evaluated: !m_string
TRUEFALSE
yes
Evaluation Count:2005
yes
Evaluation Count:85212
2005-85212
3578 return QString();
executed: return QString();
Execution Count:2005
2005
3579 if (m_size && m_position == 0 && m_size == m_string->size())
evaluated: m_size
TRUEFALSE
yes
Evaluation Count:85160
yes
Evaluation Count:52
evaluated: m_position == 0
TRUEFALSE
yes
Evaluation Count:1488
yes
Evaluation Count:83672
evaluated: m_size == m_string->size()
TRUEFALSE
yes
Evaluation Count:1487
yes
Evaluation Count:1
1-85160
3580 return *m_string;
executed: return *m_string;
Execution Count:1487
1487
3581 return QString(m_string->unicode() + m_position, m_size);
executed: return QString(m_string->unicode() + m_position, m_size);
Execution Count:83725
83725
3582} -
3583 -
3584 -
3585 -
3586 -
3587 -
3588 -
3589 -
3590bool operator==(const QStringRef &s1,const QStringRef &s2) -
3591{ return (s1.size() == s2.size() && 243003
3592 qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size()));
executed: return (s1.size() == s2.size() && qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size()));
Execution Count:243003
243003
3593} -
3594 -
3595 -
3596 -
3597 -
3598 -
3599 -
3600bool operator==(const QString &s1,const QStringRef &s2) -
3601{ return (s1.size() == s2.size() && 55623
3602 qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size()));
executed: return (s1.size() == s2.size() && qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size()));
Execution Count:55623
55623
3603} -
3604 -
3605 -
3606 -
3607 -
3608 -
3609 -
3610bool operator==(QLatin1String s1, const QStringRef &s2) -
3611{ -
3612 if (s1.size() != s2.size())
evaluated: s1.size() != s2.size()
TRUEFALSE
yes
Evaluation Count:226819
yes
Evaluation Count:25905
25905-226819
3613 return false;
executed: return false;
Execution Count:226819
226819
3614 -
3615 const ushort *uc = reinterpret_cast<const ushort *>(s2.unicode()); -
3616 const ushort *e = uc + s2.size(); -
3617 const uchar *c = reinterpret_cast<const uchar *>(s1.latin1()); -
3618 if (!c)
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25905
0-25905
3619 return s2.isEmpty();
never executed: return s2.isEmpty();
0
3620 -
3621 while (*c) {
evaluated: *c
TRUEFALSE
yes
Evaluation Count:143940
yes
Evaluation Count:22137
22137-143940
3622 if (uc == e || *uc != *c)
partially evaluated: uc == e
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:143940
evaluated: *uc != *c
TRUEFALSE
yes
Evaluation Count:3768
yes
Evaluation Count:140172
0-143940
3623 return false;
executed: return false;
Execution Count:3768
3768
3624 ++uc; -
3625 ++c; -
3626 }
executed: }
Execution Count:140172
140172
3627 return (uc == e);
executed: return (uc == e);
Execution Count:22137
22137
3628} -
3629bool operator<(const QStringRef &s1,const QStringRef &s2) -
3630{ -
3631 return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0;
executed: return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0;
Execution Count:411
411
3632} -
3633QStringRef QStringRef::appendTo(QString *string) const -
3634{ -
3635 if (!string)
partially evaluated: !string
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
3636 return QStringRef();
never executed: return QStringRef();
0
3637 int pos = string->size(); -
3638 string->insert(pos, unicode(), size()); -
3639 return QStringRef(string, pos, size());
executed: return QStringRef(string, pos, size());
Execution Count:8
8
3640} -
3641QString &QString::append(const QStringRef &str) -
3642{ -
3643 if (str.string() == this) {
never evaluated: str.string() == this
0
3644 str.appendTo(this); -
3645 } else if (str.string()) {
never evaluated: str.string()
never executed: }
0
3646 int oldSize = size(); -
3647 resize(oldSize + str.size()); -
3648 memcpy(data() + oldSize, str.unicode(), str.size() * sizeof(QChar)); -
3649 }
never executed: }
0
3650 return *this;
never executed: return *this;
0
3651} -
3652QStringRef QString::leftRef(int n) const -
3653{ -
3654 if (n >= d->size || n < 0)
evaluated: n >= d->size
TRUEFALSE
yes
Evaluation Count:2300
yes
Evaluation Count:73
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:72
1-2300
3655 n = d->size;
executed: n = d->size;
Execution Count:2301
2301
3656 return QStringRef(this, 0, n);
executed: return QStringRef(this, 0, n);
Execution Count:2373
2373
3657} -
3658QStringRef QString::rightRef(int n) const -
3659{ -
3660 if (n >= d->size || n < 0)
evaluated: n >= d->size
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-3
3661 n = d->size;
executed: n = d->size;
Execution Count:4
4
3662 return QStringRef(this, d->size - n, n);
executed: return QStringRef(this, d->size - n, n);
Execution Count:6
6
3663} -
3664QStringRef QString::midRef(int position, int n) const -
3665{ -
3666 if (position > d->size)
evaluated: position > d->size
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:562
16-562
3667 return QStringRef();
executed: return QStringRef();
Execution Count:16
16
3668 if (position < 0) {
evaluated: position < 0
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:529
33-529
3669 if (n < 0 || n + position >= d->size)
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:27
evaluated: n + position >= d->size
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:15
6-27
3670 return QStringRef(this, 0, d->size);
executed: return QStringRef(this, 0, d->size);
Execution Count:18
18
3671 if (n + position <= 0)
evaluated: n + position <= 0
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:4
4-11
3672 return QStringRef();
executed: return QStringRef();
Execution Count:11
11
3673 -
3674 n += position; -
3675 position = 0; -
3676 } else if (n < 0 || n > d->size - position)
evaluated: n < 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:517
evaluated: n > d->size - position
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:508
executed: }
Execution Count:4
4-517
3677 n = d->size - position;
executed: n = d->size - position;
Execution Count:21
21
3678 return QStringRef(this, position, n);
executed: return QStringRef(this, position, n);
Execution Count:533
533
3679} -
3680int QStringRef::indexOf(const QString &str, int from, Qt::CaseSensitivity cs) const -
3681{ -
3682 return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs);
executed: return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs);
Execution Count:197
197
3683} -
3684int QStringRef::indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const -
3685{ -
3686 return findChar(unicode(), length(), ch, from, cs);
executed: return findChar(unicode(), length(), ch, from, cs);
Execution Count:79
79
3687} -
3688int QStringRef::indexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const -
3689{ -
3690 return qt_find_latin1_string(unicode(), size(), str, from, cs);
never executed: return qt_find_latin1_string(unicode(), size(), str, from, cs);
0
3691} -
3692int QStringRef::indexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const -
3693{ -
3694 return qFindString(unicode(), size(), from, str.unicode(), str.size(), cs);
executed: return qFindString(unicode(), size(), from, str.unicode(), str.size(), cs);
Execution Count:196
196
3695} -
3696int QStringRef::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) const -
3697{ -
3698 const int sl = str.size(); -
3699 if (sl == 1)
evaluated: sl == 1
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:50
50-53
3700 return lastIndexOf(str.at(0), from, cs);
executed: return lastIndexOf(str.at(0), from, cs);
Execution Count:53
53
3701 -
3702 const int l = size();; -
3703 if (from < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:7
7-43
3704 from += l;
executed: from += l;
Execution Count:43
43
3705 int delta = l - sl; -
3706 if (from == l && sl == 0)
evaluated: from == l
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:48
evaluated: sl == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-48
3707 return from;
executed: return from;
Execution Count:1
1
3708 if (from < 0 || from >= l || delta < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:43
evaluated: from >= l
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:41
evaluated: delta < 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:34
2-43
3709 return -1;
executed: return -1;
Execution Count:15
15
3710 if (from > delta)
evaluated: from > delta
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:5
5-29
3711 from = delta;
executed: from = delta;
Execution Count:29
29
3712 -
3713 return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, 34
3714 reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs);
executed: return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs);
Execution Count:34
34
3715} -
3716int QStringRef::lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const -
3717{ -
3718 return qt_last_index_of(unicode(), size(), ch, from, cs);
executed: return qt_last_index_of(unicode(), size(), ch, from, cs);
Execution Count:136
136
3719} -
3720int QStringRef::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const -
3721{ -
3722 const int sl = str.size(); -
3723 if (sl == 1)
never evaluated: sl == 1
0
3724 return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs);
never executed: return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs);
0
3725 -
3726 const int l = size(); -
3727 if (from < 0)
never evaluated: from < 0
0
3728 from += l;
never executed: from += l;
0
3729 int delta = l - sl; -
3730 if (from == l && sl == 0)
never evaluated: from == l
never evaluated: sl == 0
0
3731 return from;
never executed: return from;
0
3732 if (from < 0 || from >= l || delta < 0)
never evaluated: from < 0
never evaluated: from >= l
never evaluated: delta < 0
0
3733 return -1;
never executed: return -1;
0
3734 if (from > delta)
never evaluated: from > delta
0
3735 from = delta;
never executed: from = delta;
0
3736 -
3737 QVarLengthArray<ushort> s(sl); -
3738 for (int i = 0; i < sl; ++i)
never evaluated: i < sl
0
3739 s[i] = str.latin1()[i];
never executed: s[i] = str.latin1()[i];
0
3740 -
3741 return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, s.data(), sl, cs);
never executed: return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, s.data(), sl, cs);
0
3742} -
3743int QStringRef::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const -
3744{ -
3745 const int sl = str.size(); -
3746 if (sl == 1)
evaluated: sl == 1
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:50
50-53
3747 return lastIndexOf(str.at(0), from, cs);
executed: return lastIndexOf(str.at(0), from, cs);
Execution Count:53
53
3748 -
3749 const int l = size(); -
3750 if (from < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:7
7-43
3751 from += l;
executed: from += l;
Execution Count:43
43
3752 int delta = l - sl; -
3753 if (from == l && sl == 0)
evaluated: from == l
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:48
evaluated: sl == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-48
3754 return from;
executed: return from;
Execution Count:1
1
3755 if (from < 0 || from >= l || delta < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:43
evaluated: from >= l
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:41
evaluated: delta < 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:34
2-43
3756 return -1;
executed: return -1;
Execution Count:15
15
3757 if (from > delta)
evaluated: from > delta
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:5
5-29
3758 from = delta;
executed: from = delta;
Execution Count:29
29
3759 -
3760 return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, 34
3761 reinterpret_cast<const ushort*>(str.unicode()), 34
3762 str.size(), cs);
executed: return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs);
Execution Count:34
34
3763} -
3764int QStringRef::count(const QString &str, Qt::CaseSensitivity cs) const -
3765{ -
3766 return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
Execution Count:4
4
3767} -
3768int QStringRef::count(QChar ch, Qt::CaseSensitivity cs) const -
3769{ -
3770 return qt_string_count(unicode(), size(), ch, cs);
executed: return qt_string_count(unicode(), size(), ch, cs);
Execution Count:5
5
3771} -
3772int QStringRef::count(const QStringRef &str, Qt::CaseSensitivity cs) const -
3773{ -
3774 return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
never executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs);
0
3775} -
3776bool QStringRef::startsWith(const QString &str, Qt::CaseSensitivity cs) const -
3777{ -
3778 return qt_starts_with(isNull() ? 0 : unicode(), size(), 25
3779 str.isNull() ? 0 : str.unicode(), str.size(), cs);
executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs);
Execution Count:25
25
3780} -
3781 -
3782 -
3783 -
3784 -
3785 -
3786 -
3787bool QStringRef::startsWith(QLatin1String str, Qt::CaseSensitivity cs) const -
3788{ -
3789 return qt_starts_with(isNull() ? 0 : unicode(), size(), str, cs);
executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), str, cs);
Execution Count:25
25
3790} -
3791 -
3792 -
3793 -
3794 -
3795 -
3796 -
3797bool QStringRef::startsWith(const QStringRef &str, Qt::CaseSensitivity cs) const -
3798{ -
3799 return qt_starts_with(isNull() ? 0 : unicode(), size(), 0
3800 str.isNull() ? 0 : str.unicode(), str.size(), cs);
never executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs);
0
3801} -
3802bool QStringRef::startsWith(QChar ch, Qt::CaseSensitivity cs) const -
3803{ -
3804 if (!isEmpty()) {
evaluated: !isEmpty()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:6
6-19
3805 const ushort *data = reinterpret_cast<const ushort*>(unicode()); -
3806 return (cs == Qt::CaseSensitive 19
3807 ? data[0] == ch 19
3808 : foldCase(data[0]) == foldCase(ch.unicode()));
executed: return (cs == Qt::CaseSensitive ? data[0] == ch : foldCase(data[0]) == foldCase(ch.unicode()));
Execution Count:19
19
3809 } else { -
3810 return false;
executed: return false;
Execution Count:6
6
3811 } -
3812} -
3813bool QStringRef::endsWith(const QString &str, Qt::CaseSensitivity cs) const -
3814{ -
3815 return qt_ends_with(isNull() ? 0 : unicode(), size(), 25
3816 str.isNull() ? 0 : str.unicode(), str.size(), cs);
executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs);
Execution Count:25
25
3817} -
3818bool QStringRef::endsWith(QChar ch, Qt::CaseSensitivity cs) const -
3819{ -
3820 if (!isEmpty()) {
evaluated: !isEmpty()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:6
6-19
3821 const ushort *data = reinterpret_cast<const ushort*>(unicode()); -
3822 const int size = length(); -
3823 return (cs == Qt::CaseSensitive 19
3824 ? data[size - 1] == ch 19
3825 : foldCase(data[size - 1]) == foldCase(ch.unicode()));
executed: return (cs == Qt::CaseSensitive ? data[size - 1] == ch : foldCase(data[size - 1]) == foldCase(ch.unicode()));
Execution Count:19
19
3826 } else { -
3827 return false;
executed: return false;
Execution Count:6
6
3828 } -
3829} -
3830 -
3831 -
3832 -
3833 -
3834 -
3835 -
3836bool QStringRef::endsWith(QLatin1String str, Qt::CaseSensitivity cs) const -
3837{ -
3838 return qt_ends_with(isNull() ? 0 : unicode(), size(), str, cs);
executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), str, cs);
Execution Count:25
25
3839} -
3840 -
3841 -
3842 -
3843 -
3844 -
3845 -
3846bool QStringRef::endsWith(const QStringRef &str, Qt::CaseSensitivity cs) const -
3847{ -
3848 return qt_ends_with(isNull() ? 0 : unicode(), size(), 0
3849 str.isNull() ? 0 : str.unicode(), str.size(), cs);
never executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs);
0
3850} -
3851static inline int qt_last_index_of(const QChar *haystack, int haystackLen, QChar needle, -
3852 int from, Qt::CaseSensitivity cs) -
3853{ -
3854 ushort c = needle.unicode(); -
3855 if (from < 0)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:21568
yes
Evaluation Count:4665
4665-21568
3856 from += haystackLen;
executed: from += haystackLen;
Execution Count:21568
21568
3857 if (from < 0 || from >= haystackLen)
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:115
yes
Evaluation Count:26108
evaluated: from >= haystackLen
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:26104
19-26108
3858 return -1;
executed: return -1;
Execution Count:134
134
3859 if (from >= 0) {
partially evaluated: from >= 0
TRUEFALSE
yes
Evaluation Count:26128
no
Evaluation Count:0
0-26128
3860 const ushort *b = reinterpret_cast<const ushort*>(haystack); -
3861 const ushort *n = b + from; -
3862 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:26090
yes
Evaluation Count:32
32-26090
3863 for (; n >= b; --n)
evaluated: n >= b
TRUEFALSE
yes
Evaluation Count:196431
yes
Evaluation Count:10518
10518-196431
3864 if (*n == c)
evaluated: *n == c
TRUEFALSE
yes
Evaluation Count:15599
yes
Evaluation Count:180939
15599-180939
3865 return n - b;
executed: return n - b;
Execution Count:15601
15601
3866 } else {
executed: }
Execution Count:10518
10518
3867 c = foldCase(c); -
3868 for (; n >= b; --n)
evaluated: n >= b
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:8
8-56
3869 if (foldCase(*n) == c)
evaluated: foldCase(*n) == c
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:32
24-32
3870 return n - b;
executed: return n - b;
Execution Count:24
24
3871 }
executed: }
Execution Count:8
8
3872 } -
3873 return -1;
executed: return -1;
Execution Count:10526
10526
3874 -
3875 -
3876} -
3877 -
3878static inline int qt_string_count(const QChar *haystack, int haystackLen, -
3879 const QChar *needle, int needleLen, -
3880 Qt::CaseSensitivity cs) -
3881{ -
3882 int num = 0; -
3883 int i = -1; -
3884 if (haystackLen > 500 && needleLen > 5) {
evaluated: haystackLen > 500
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:18
partially evaluated: needleLen > 5
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-18
3885 QStringMatcher matcher(needle, needleLen, cs); -
3886 while ((i = matcher.indexIn(haystack, haystackLen, i + 1)) != -1)
never evaluated: (i = matcher.indexIn(haystack, haystackLen, i + 1)) != -1
0
3887 ++num;
never executed: ++num;
0
3888 } else {
never executed: }
0
3889 while ((i = qFindString(haystack, haystackLen, i + 1, needle, needleLen, cs)) != -1)
evaluated: (i = qFindString(haystack, haystackLen, i + 1, needle, needleLen, cs)) != -1
TRUEFALSE
yes
Evaluation Count:20628
yes
Evaluation Count:20
20-20628
3890 ++num;
executed: ++num;
Execution Count:20628
20628
3891 }
executed: }
Execution Count:20
20
3892 return num;
executed: return num;
Execution Count:20
20
3893} -
3894 -
3895static inline int qt_string_count(const QChar *unicode, int size, QChar ch, -
3896 Qt::CaseSensitivity cs) -
3897{ -
3898 ushort c = ch.unicode(); -
3899 int num = 0; -
3900 const ushort *b = reinterpret_cast<const ushort*>(unicode); -
3901 const ushort *i = b + size; -
3902 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:3592
yes
Evaluation Count:2
2-3592
3903 while (i != b)
evaluated: i != b
TRUEFALSE
yes
Evaluation Count:55773
yes
Evaluation Count:3592
3592-55773
3904 if (*--i == c)
evaluated: *--i == c
TRUEFALSE
yes
Evaluation Count:2327
yes
Evaluation Count:53446
2327-53446
3905 ++num;
executed: ++num;
Execution Count:2327
2327
3906 } else {
executed: }
Execution Count:3592
3592
3907 c = foldCase(c); -
3908 while (i != b)
evaluated: i != b
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:2
2-30
3909 if (foldCase(*(--i)) == c)
evaluated: foldCase(*(--i)) == c
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:24
6-24
3910 ++num;
executed: ++num;
Execution Count:6
6
3911 }
executed: }
Execution Count:2
2
3912 return num;
executed: return num;
Execution Count:3594
3594
3913} -
3914 -
3915static inline int qt_find_latin1_string(const QChar *haystack, int size, -
3916 QLatin1String needle, -
3917 int from, Qt::CaseSensitivity cs) -
3918{ -
3919 const char *latin1 = needle.latin1(); -
3920 int len = needle.size(); -
3921 QVarLengthArray<ushort> s(len); -
3922 for (int i = 0; i < len; ++i)
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:19501
yes
Evaluation Count:2528
2528-19501
3923 s[i] = latin1[i];
executed: s[i] = latin1[i];
Execution Count:19501
19501
3924 -
3925 return qFindString(haystack, size, from, 2528
3926 reinterpret_cast<const QChar*>(s.constData()), len, cs);
executed: return qFindString(haystack, size, from, reinterpret_cast<const QChar*>(s.constData()), len, cs);
Execution Count:2528
2528
3927} -
3928 -
3929static inline bool qt_starts_with(const QChar *haystack, int haystackLen, -
3930 const QChar *needle, int needleLen, Qt::CaseSensitivity cs) -
3931{ -
3932 if (!haystack)
evaluated: !haystack
TRUEFALSE
yes
Evaluation Count:260
yes
Evaluation Count:71809
260-71809
3933 return !needle;
executed: return !needle;
Execution Count:260
260
3934 if (haystackLen == 0)
evaluated: haystackLen == 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:71799
10-71799
3935 return needleLen == 0;
executed: return needleLen == 0;
Execution Count:10
10
3936 if (needleLen > haystackLen)
evaluated: needleLen > haystackLen
TRUEFALSE
yes
Evaluation Count:14927
yes
Evaluation Count:56872
14927-56872
3937 return false;
executed: return false;
Execution Count:14927
14927
3938 -
3939 const ushort *h = reinterpret_cast<const ushort*>(haystack); -
3940 const ushort *n = reinterpret_cast<const ushort*>(needle); -
3941 -
3942 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:55368
yes
Evaluation Count:1504
1504-55368
3943 return qMemEquals(h, n, needleLen);
executed: return qMemEquals(h, n, needleLen);
Execution Count:55368
55368
3944 } else { -
3945 uint last = 0; -
3946 uint olast = 0; -
3947 for (int i = 0; i < needleLen; ++i)
evaluated: i < needleLen
TRUEFALSE
yes
Evaluation Count:2030
yes
Evaluation Count:228
228-2030
3948 if (foldCase(h[i], last) != foldCase(n[i], olast))
evaluated: foldCase(h[i], last) != foldCase(n[i], olast)
TRUEFALSE
yes
Evaluation Count:1276
yes
Evaluation Count:754
754-1276
3949 return false;
executed: return false;
Execution Count:1276
1276
3950 }
executed: }
Execution Count:228
228
3951 return true;
executed: return true;
Execution Count:228
228
3952} -
3953 -
3954static inline bool qt_starts_with(const QChar *haystack, int haystackLen, -
3955 QLatin1String needle, Qt::CaseSensitivity cs) -
3956{ -
3957 if (!haystack)
evaluated: !haystack
TRUEFALSE
yes
Evaluation Count:3152
yes
Evaluation Count:663161
3152-663161
3958 return !needle.latin1();
executed: return !needle.latin1();
Execution Count:3152
3152
3959 if (haystackLen == 0)
evaluated: haystackLen == 0
TRUEFALSE
yes
Evaluation Count:1803
yes
Evaluation Count:661358
1803-661358
3960 return !needle.latin1() || *needle.latin1() == 0;
executed: return !needle.latin1() || *needle.latin1() == 0;
Execution Count:1803
1803
3961 const int slen = needle.size(); -
3962 if (slen > haystackLen)
evaluated: slen > haystackLen
TRUEFALSE
yes
Evaluation Count:265295
yes
Evaluation Count:396063
265295-396063
3963 return false;
executed: return false;
Execution Count:265295
265295
3964 const ushort *data = reinterpret_cast<const ushort*>(haystack); -
3965 const uchar *latin = reinterpret_cast<const uchar*>(needle.latin1()); -
3966 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:395935
yes
Evaluation Count:128
128-395935
3967 for (int i = 0; i < slen; ++i)
evaluated: i < slen
TRUEFALSE
yes
Evaluation Count:573913
yes
Evaluation Count:105791
105791-573913
3968 if (data[i] != latin[i])
evaluated: data[i] != latin[i]
TRUEFALSE
yes
Evaluation Count:290144
yes
Evaluation Count:283769
283769-290144
3969 return false;
executed: return false;
Execution Count:290144
290144
3970 } else {
executed: }
Execution Count:105791
105791
3971 for (int i = 0; i < slen; ++i)
evaluated: i < slen
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:19
19-144
3972 if (foldCase(data[i]) != foldCase((ushort)latin[i]))
evaluated: foldCase(data[i]) != foldCase((ushort)latin[i])
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:35
35-109
3973 return false;
executed: return false;
Execution Count:109
109
3974 }
executed: }
Execution Count:19
19
3975 return true;
executed: return true;
Execution Count:105810
105810
3976} -
3977 -
3978static inline bool qt_ends_with(const QChar *haystack, int haystackLen, -
3979 const QChar *needle, int needleLen, Qt::CaseSensitivity cs) -
3980{ -
3981 if (!haystack)
evaluated: !haystack
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3484
6-3484
3982 return !needle;
executed: return !needle;
Execution Count:6
6
3983 if (haystackLen == 0)
evaluated: haystackLen == 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3478
6-3478
3984 return needleLen == 0;
executed: return needleLen == 0;
Execution Count:6
6
3985 const int pos = haystackLen - needleLen; -
3986 if (pos < 0)
evaluated: pos < 0
TRUEFALSE
yes
Evaluation Count:125
yes
Evaluation Count:3353
125-3353
3987 return false;
executed: return false;
Execution Count:125
125
3988 -
3989 const ushort *h = reinterpret_cast<const ushort*>(haystack); -
3990 const ushort *n = reinterpret_cast<const ushort*>(needle); -
3991 -
3992 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:3334
yes
Evaluation Count:19
19-3334
3993 return qMemEquals(h + pos, n, needleLen);
executed: return qMemEquals(h + pos, n, needleLen);
Execution Count:3334
3334
3994 } else { -
3995 uint last = 0; -
3996 uint olast = 0; -
3997 for (int i = 0; i < needleLen; i++)
evaluated: i < needleLen
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:13
13-17
3998 if (foldCase(h[pos+i], last) != foldCase(n[i], olast))
evaluated: foldCase(h[pos+i], last) != foldCase(n[i], olast)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:11
6-11
3999 return false;
executed: return false;
Execution Count:6
6
4000 }
executed: }
Execution Count:13
13
4001 return true;
executed: return true;
Execution Count:13
13
4002} -
4003 -
4004 -
4005static inline bool qt_ends_with(const QChar *haystack, int haystackLen, -
4006 QLatin1String needle, Qt::CaseSensitivity cs) -
4007{ -
4008 if (!haystack)
evaluated: !haystack
TRUEFALSE
yes
Evaluation Count:189
yes
Evaluation Count:5374
189-5374
4009 return !needle.latin1();
executed: return !needle.latin1();
Execution Count:189
189
4010 if (haystackLen == 0)
evaluated: haystackLen == 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:5368
6-5368
4011 return !needle.latin1() || *needle.latin1() == 0;
executed: return !needle.latin1() || *needle.latin1() == 0;
Execution Count:6
6
4012 const int slen = needle.size(); -
4013 int pos = haystackLen - slen; -
4014 if (pos < 0)
evaluated: pos < 0
TRUEFALSE
yes
Evaluation Count:1420
yes
Evaluation Count:3948
1420-3948
4015 return false;
executed: return false;
Execution Count:1420
1420
4016 const uchar *latin = reinterpret_cast<const uchar*>(needle.latin1()); -
4017 const ushort *data = reinterpret_cast<const ushort*>(haystack); -
4018 if (cs == Qt::CaseSensitive) {
evaluated: cs == Qt::CaseSensitive
TRUEFALSE
yes
Evaluation Count:3650
yes
Evaluation Count:298
298-3650
4019 for (int i = 0; i < slen; i++)
evaluated: i < slen
TRUEFALSE
yes
Evaluation Count:5807
yes
Evaluation Count:839
839-5807
4020 if (data[pos+i] != latin[i])
evaluated: data[pos+i] != latin[i]
TRUEFALSE
yes
Evaluation Count:2811
yes
Evaluation Count:2996
2811-2996
4021 return false;
executed: return false;
Execution Count:2811
2811
4022 } else {
executed: }
Execution Count:839
839
4023 for (int i = 0; i < slen; i++)
evaluated: i < slen
TRUEFALSE
yes
Evaluation Count:595
yes
Evaluation Count:271
271-595
4024 if (foldCase(data[pos+i]) != foldCase((ushort)latin[i]))
evaluated: foldCase(data[pos+i]) != foldCase((ushort)latin[i])
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:568
27-568
4025 return false;
executed: return false;
Execution Count:27
27
4026 }
executed: }
Execution Count:271
271
4027 return true;
executed: return true;
Execution Count:1110
1110
4028} -
4029QByteArray QStringRef::toLatin1() const -
4030{ -
4031 return toLatin1_helper(unicode(), length());
executed: return toLatin1_helper(unicode(), length());
Execution Count:16
16
4032} -
4033QByteArray QStringRef::toLocal8Bit() const -
4034{ -
4035 -
4036 QTextCodec *localeCodec = QTextCodec::codecForLocale(); -
4037 if (localeCodec)
partially evaluated: localeCodec
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
4038 return localeCodec->fromUnicode(unicode(), length());
executed: return localeCodec->fromUnicode(unicode(), length());
Execution Count:5
5
4039 -
4040 return toLatin1();
never executed: return toLatin1();
0
4041} -
4042QByteArray QStringRef::toUtf8() const -
4043{ -
4044 if (isNull())
partially evaluated: isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
4045 return QByteArray();
never executed: return QByteArray();
0
4046 -
4047 return QUtf8::convertFromUnicode(constData(), length(), 0);
executed: return QUtf8::convertFromUnicode(constData(), length(), 0);
Execution Count:5
5
4048} -
4049QVector<uint> QStringRef::toUcs4() const -
4050{ -
4051 QVector<uint> v(length()); -
4052 uint *a = v.data(); -
4053 int len = QString::toUcs4_helper(reinterpret_cast<const ushort *>(unicode()), length(), a); -
4054 v.resize(len); -
4055 return v;
never executed: return v;
0
4056} -
4057QString QString::toHtmlEscaped() const -
4058{ -
4059 QString rich; -
4060 const int len = length(); -
4061 rich.reserve(int(len * 1.1)); -
4062 for (int i = 0; i < len; ++i) {
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:1729
yes
Evaluation Count:261
261-1729
4063 if (at(i) == QLatin1Char('<'))
evaluated: at(i) == QLatin1Char('<')
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1722
7-1722
4064 rich += QLatin1String("&lt;");
executed: rich += QLatin1String("&lt;");
Execution Count:7
7
4065 else if (at(i) == QLatin1Char('>'))
evaluated: at(i) == QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1715
7-1715
4066 rich += QLatin1String("&gt;");
executed: rich += QLatin1String("&gt;");
Execution Count:7
7
4067 else if (at(i) == QLatin1Char('&'))
evaluated: at(i) == QLatin1Char('&')
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1710
5-1710
4068 rich += QLatin1String("&amp;");
executed: rich += QLatin1String("&amp;");
Execution Count:5
5
4069 else if (at(i) == QLatin1Char('"'))
evaluated: at(i) == QLatin1Char('"')
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1704
6-1704
4070 rich += QLatin1String("&quot;");
executed: rich += QLatin1String("&quot;");
Execution Count:6
6
4071 else -
4072 rich += at(i);
executed: rich += at(i);
Execution Count:1704
1704
4073 } -
4074 rich.squeeze(); -
4075 return rich;
executed: return rich;
Execution Count:261
261
4076} -
4077 -
4078 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial