io/qurl.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7inline static bool isHex(char c) -
8{ -
9 c |= 0x20; -
10 return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
executed: return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
Execution Count:43
43
11} -
12 -
13static inline QString ftpScheme() -
14{ -
15 return QString::fromUtf8("" "ftp" "", sizeof("ftp") - 1);
executed: return QString::fromUtf8("" "ftp" "", sizeof("ftp") - 1);
Execution Count:44
44
16} -
17 -
18static inline QString httpScheme() -
19{ -
20 return QString::fromUtf8("" "http" "", sizeof("http") - 1);
never executed: return QString::fromUtf8("" "http" "", sizeof("http") - 1);
0
21} -
22 -
23static inline QString fileScheme() -
24{ -
25 return QString::fromUtf8("" "file" "", sizeof("file") - 1);
executed: return QString::fromUtf8("" "file" "", sizeof("file") - 1);
Execution Count:12165
12165
26} -
27 -
28class QUrlPrivate -
29{ -
30public: -
31 enum Section { -
32 Scheme = 0x01, -
33 UserName = 0x02, -
34 Password = 0x04, -
35 UserInfo = UserName | Password, -
36 Host = 0x08, -
37 Port = 0x10, -
38 Authority = UserInfo | Host | Port, -
39 Path = 0x20, -
40 Hierarchy = Authority | Path, -
41 Query = 0x40, -
42 Fragment = 0x80, -
43 FullUrl = 0xff -
44 }; -
45 -
46 enum ErrorCode { -
47 -
48 -
49 InvalidSchemeError = Scheme << 8, -
50 -
51 InvalidUserNameError = UserName << 8, -
52 -
53 InvalidPasswordError = Password << 8, -
54 -
55 InvalidRegNameError = Host << 8, -
56 InvalidIPv4AddressError, -
57 InvalidIPv6AddressError, -
58 InvalidIPvFutureError, -
59 HostMissingEndBracket, -
60 -
61 InvalidPortError = Port << 8, -
62 PortEmptyError, -
63 -
64 InvalidPathError = Path << 8, -
65 -
66 InvalidQueryError = Query << 8, -
67 -
68 InvalidFragmentError = Fragment << 8, -
69 -
70 -
71 -
72 AuthorityPresentAndPathIsRelative = Authority << 8 | Path << 8 | 0x10000, -
73 RelativeUrlPathContainsColonBeforeSlash = Scheme << 8 | Authority << 8 | Path << 8 | 0x10000, -
74 -
75 NoError = 0 -
76 }; -
77 -
78 struct Error { -
79 QString source; -
80 ErrorCode code; -
81 int position; -
82 }; -
83 -
84 QUrlPrivate(); -
85 QUrlPrivate(const QUrlPrivate &copy); -
86 ~QUrlPrivate(); -
87 -
88 void parse(const QString &url, QUrl::ParsingMode parsingMode); -
89 bool isEmpty() const -
90 { return sectionIsPresent == 0 && port == -1 && path.isEmpty(); }
executed: return sectionIsPresent == 0 && port == -1 && path.isEmpty();
Execution Count:11381
11381
91 -
92 Error *cloneError() const; -
93 void clearError(); -
94 void setError(ErrorCode errorCode, const QString &source, int supplement = -1); -
95 ErrorCode validityError(QString *source = 0, int *position = 0) const; -
96 bool validateComponent(Section section, const QString &input, int begin, int end); -
97 bool validateComponent(Section section, const QString &input) -
98 { return validateComponent(section, input, 0, uint(input.length())); }
executed: return validateComponent(section, input, 0, uint(input.length()));
Execution Count:21
21
99 -
100 -
101 void appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; -
102 void appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; -
103 void appendUserName(QString &appendTo, QUrl::FormattingOptions options) const; -
104 void appendPassword(QString &appendTo, QUrl::FormattingOptions options) const; -
105 void appendHost(QString &appendTo, QUrl::FormattingOptions options) const; -
106 void appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; -
107 void appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; -
108 void appendFragment(QString &appendTo, QUrl::FormattingOptions options) const; -
109 -
110 -
111 bool setScheme(const QString &value, int len, bool doSetError); -
112 void setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode); -
113 void setUserInfo(const QString &userInfo, int from, int end); -
114 void setUserName(const QString &value, int from, int end); -
115 void setPassword(const QString &value, int from, int end); -
116 bool setHost(const QString &value, int from, int end, QUrl::ParsingMode mode); -
117 void setPath(const QString &value, int from, int end); -
118 void setQuery(const QString &value, int from, int end); -
119 void setFragment(const QString &value, int from, int end); -
120 -
121 inline bool hasScheme() const { return sectionIsPresent & Scheme; }
executed: return sectionIsPresent & Scheme;
Execution Count:9840
9840
122 inline bool hasAuthority() const { return sectionIsPresent & Authority; }
executed: return sectionIsPresent & Authority;
Execution Count:9628
9628
123 inline bool hasUserInfo() const { return sectionIsPresent & UserInfo; }
executed: return sectionIsPresent & UserInfo;
Execution Count:4613
4613
124 inline bool hasUserName() const { return sectionIsPresent & UserName; }
executed: return sectionIsPresent & UserName;
Execution Count:3590
3590
125 inline bool hasPassword() const { return sectionIsPresent & Password; }
executed: return sectionIsPresent & Password;
Execution Count:3394
3394
126 inline bool hasHost() const { return sectionIsPresent & Host; }
never executed: return sectionIsPresent & Host;
0
127 inline bool hasPort() const { return port != -1; }
never executed: return port != -1;
0
128 inline bool hasPath() const { return !path.isEmpty(); }
never executed: return !path.isEmpty();
0
129 inline bool hasQuery() const { return sectionIsPresent & Query; }
executed: return sectionIsPresent & Query;
Execution Count:8480
8480
130 inline bool hasFragment() const { return sectionIsPresent & Fragment; }
executed: return sectionIsPresent & Fragment;
Execution Count:9156
9156
131 -
132 QString mergePaths(const QString &relativePath) const; -
133 -
134 QAtomicInt ref; -
135 int port; -
136 -
137 QString scheme; -
138 QString userName; -
139 QString password; -
140 QString host; -
141 QString path; -
142 QString query; -
143 QString fragment; -
144 -
145 Error *error; -
146 -
147 -
148 -
149 -
150 -
151 uchar sectionIsPresent; -
152}; -
153 -
154inline QUrlPrivate::QUrlPrivate() -
155 : ref(1), port(-1), -
156 error(0), -
157 sectionIsPresent(0) -
158{ -
159}
executed: }
Execution Count:14664
14664
160 -
161inline QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy) -
162 : ref(1), port(copy.port), -
163 scheme(copy.scheme), -
164 userName(copy.userName), -
165 password(copy.password), -
166 host(copy.host), -
167 path(copy.path), -
168 query(copy.query), -
169 fragment(copy.fragment), -
170 error(copy.cloneError()), -
171 sectionIsPresent(copy.sectionIsPresent) -
172{ -
173}
executed: }
Execution Count:8150
8150
174 -
175inline QUrlPrivate::~QUrlPrivate() -
176{ -
177 delete error; -
178}
executed: }
Execution Count:22811
22811
179 -
180inline QUrlPrivate::Error *QUrlPrivate::cloneError() const -
181{ -
182 return error ? new Error(*error) : 0;
executed: return error ? new Error(*error) : 0;
Execution Count:8149
8149
183} -
184 -
185inline void QUrlPrivate::clearError() -
186{ -
187 delete error; -
188 error = 0; -
189}
executed: }
Execution Count:24961
24961
190 -
191inline void QUrlPrivate::setError(ErrorCode errorCode, const QString &source, int supplement) -
192{ -
193 if (error) {
evaluated: error
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:122
19-122
194 -
195 return;
executed: return;
Execution Count:19
19
196 } -
197 error = new Error; -
198 error->code = errorCode; -
199 error->source = source; -
200 error->position = supplement; -
201}
executed: }
Execution Count:122
122
202static const ushort encodedUserNameActions[] = { -
203 -
204 -
205 ushort(0x200 | ('/')), -
206 ushort(0x200 | ('?')), -
207 ushort(0x200 | ('#')), -
208 ushort(0x200 | ('[')), -
209 ushort(0x200 | (']')), -
210 ushort(0x200 | ('@')), -
211 ushort(0x200 | (':')), -
212 0 -
213}; -
214static const ushort * const decodedUserNameInAuthorityActions = encodedUserNameActions + 3; -
215static const ushort * const decodedUserNameInUserInfoActions = encodedUserNameActions + 6; -
216static const ushort * const decodedUserNameInUrlActions = encodedUserNameActions; -
217static const ushort * const decodedUserNameInIsolationActions = 0; -
218 -
219static const ushort encodedPasswordActions[] = { -
220 -
221 -
222 ushort(0x200 | ('/')), -
223 ushort(0x200 | ('?')), -
224 ushort(0x200 | ('#')), -
225 ushort(0x200 | ('[')), -
226 ushort(0x200 | (']')), -
227 ushort(0x200 | ('@')), -
228 0 -
229}; -
230static const ushort * const decodedPasswordInAuthorityActions = encodedPasswordActions + 3; -
231static const ushort * const decodedPasswordInUserInfoActions = 0; -
232static const ushort * const decodedPasswordInUrlActions = encodedPasswordActions; -
233static const ushort * const decodedPasswordInIsolationActions = 0; -
234 -
235static const ushort encodedPathActions[] = { -
236 -
237 ushort(0x200 | ('[')), -
238 ushort(0x200 | (']')), -
239 ushort(0x200 | ('?')), -
240 ushort(0x200 | ('#')), -
241 ushort(0x100 | ('/')), -
242 0 -
243}; -
244static const ushort decodedPathInUrlActions[] = { -
245 ushort('{'), -
246 ushort('}'), -
247 ushort(0x200 | ('?')), -
248 ushort(0x200 | ('#')), -
249 ushort(0x100 | ('/')), -
250 0 -
251}; -
252static const ushort * const decodedPathInIsolationActions = encodedPathActions + 4; -
253 -
254static const ushort encodedFragmentActions[] = { -
255 -
256 -
257 -
258 -
259 ushort('#'), -
260 ushort(':'), -
261 ushort('@'), -
262 ushort('/'), -
263 ushort('?'), -
264 ushort(0x200 | ('[')), -
265 ushort(0x200 | (']')), -
266 0 -
267}; -
268static const ushort * const decodedFragmentInUrlActions = 0; -
269static const ushort * const decodedFragmentInIsolationActions = 0; -
270 -
271 -
272 -
273static const ushort encodedQueryActions[] = { -
274 -
275 -
276 -
277 -
278 ushort(0x200 | ('#')), -
279 0 -
280}; -
281static const ushort decodedQueryInIsolationActions[] = { -
282 ushort('"'), -
283 ushort('<'), -
284 ushort('>'), -
285 ushort('^'), -
286 ushort('\\'), -
287 ushort('|'), -
288 ushort('{'), -
289 ushort('}'), -
290 ushort('#'), -
291 0 -
292}; -
293static const ushort decodedQueryInUrlActions[] = { -
294 ushort('{'), -
295 ushort('}'), -
296 ushort(0x200 | ('#')), -
297 0 -
298}; -
299 -
300static inline void parseDecodedComponent(QString &data) -
301{ -
302 data.replace(QLatin1Char('%'), QString::fromUtf8("" "%25" "", sizeof("%25") - 1)); -
303}
executed: }
Execution Count:2047
2047
304 -
305static inline QString -
306recodeFromUser(const QString &input, const ushort *actions, int from, int to) -
307{ -
308 QString output; -
309 const QChar *begin = input.constData() + from; -
310 const QChar *end = input.constData() + to; -
311 if (qt_urlRecode(output, begin, end, 159-13778
312 QUrl::DecodeReserved, actions))
evaluated: qt_urlRecode(output, begin, end, QUrl::DecodeReserved, actions)
TRUEFALSE
yes
Evaluation Count:159
yes
Evaluation Count:13778
159-13778
313 return output;
executed: return output;
Execution Count:159
159
314 -
315 return input.mid(from, to - from);
executed: return input.mid(from, to - from);
Execution Count:13777
13777
316} -
317 -
318 -
319 -
320 -
321 -
322 -
323 -
324static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options, -
325 const ushort *encodedActions, const ushort *decodedActions) -
326{ -
327 if (options == QUrl::PrettyDecoded) {
evaluated: options == QUrl::PrettyDecoded
TRUEFALSE
yes
Evaluation Count:3821
yes
Evaluation Count:10540
3821-10540
328 appendTo += value; -
329 return;
executed: return;
Execution Count:3821
3821
330 } -
331 -
332 const ushort *actions = 0; -
333 if (options & QUrl::EncodeDelimiters)
evaluated: options & QUrl::EncodeDelimiters
TRUEFALSE
yes
Evaluation Count:10402
yes
Evaluation Count:138
138-10402
334 actions = encodedActions;
executed: actions = encodedActions;
Execution Count:10402
10402
335 else -
336 actions = decodedActions;
executed: actions = decodedActions;
Execution Count:138
138
337 -
338 if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions))
evaluated: !qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions)
TRUEFALSE
yes
Evaluation Count:9725
yes
Evaluation Count:815
815-9725
339 appendTo += value;
executed: appendTo += value;
Execution Count:9725
9725
340}
executed: }
Execution Count:10540
10540
341 -
342inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const -
343{ -
344 if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
evaluated: (options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo
TRUEFALSE
yes
Evaluation Count:3588
yes
Evaluation Count:801
801-3588
345 appendUserInfo(appendTo, options, appendingTo); -
346 -
347 -
348 if (hasUserName() || (hasPassword() && (options & QUrl::RemovePassword) == 0))
evaluated: hasUserName()
TRUEFALSE
yes
Evaluation Count:553
yes
Evaluation Count:3038
evaluated: hasPassword()
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:2944
evaluated: (options & QUrl::RemovePassword) == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:91
5-3038
349 appendTo += QLatin1Char('@');
executed: appendTo += QLatin1Char('@');
Execution Count:558
558
350 }
executed: }
Execution Count:3593
3593
351 appendHost(appendTo, options); -
352 if (!(options & QUrl::RemovePort) && port != -1)
evaluated: !(options & QUrl::RemovePort)
TRUEFALSE
yes
Evaluation Count:4389
yes
Evaluation Count:4
evaluated: port != -1
TRUEFALSE
yes
Evaluation Count:1304
yes
Evaluation Count:3082
4-4389
353 appendTo += QLatin1Char(':') + QString::number(port);
executed: appendTo += QLatin1Char(':') + QString::number(port);
Execution Count:1304
1304
354}
executed: }
Execution Count:4389
4389
355 -
356inline void QUrlPrivate::appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const -
357{ -
358 if (__builtin_expect(!!(!hasUserInfo()), true))
evaluated: __builtin_expect(!!(!hasUserInfo()), true)
TRUEFALSE
yes
Evaluation Count:3903
yes
Evaluation Count:712
712-3903
359 return;
executed: return;
Execution Count:3902
3902
360 -
361 const ushort *userNameActions; -
362 const ushort *passwordActions; -
363 if (options & QUrl::EncodeDelimiters) {
evaluated: options & QUrl::EncodeDelimiters
TRUEFALSE
yes
Evaluation Count:574
yes
Evaluation Count:138
138-574
364 userNameActions = encodedUserNameActions; -
365 passwordActions = encodedPasswordActions; -
366 } else {
executed: }
Execution Count:574
574
367 switch (appendingTo) { -
368 case UserInfo: -
369 userNameActions = decodedUserNameInUserInfoActions; -
370 passwordActions = decodedPasswordInUserInfoActions; -
371 break;
executed: break;
Execution Count:54
54
372 -
373 case Authority: -
374 userNameActions = decodedUserNameInAuthorityActions; -
375 passwordActions = decodedPasswordInAuthorityActions; -
376 break;
executed: break;
Execution Count:23
23
377 -
378 case FullUrl: -
379 default: -
380 userNameActions = decodedUserNameInUrlActions; -
381 passwordActions = decodedPasswordInUrlActions; -
382 break;
executed: break;
Execution Count:61
61
383 } -
384 }
executed: }
Execution Count:138
138
385 -
386 if ((options & QUrl::EncodeReserved) == 0)
evaluated: (options & QUrl::EncodeReserved) == 0
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:625
87-625
387 options |= QUrl::DecodeReserved;
executed: options |= QUrl::DecodeReserved;
Execution Count:87
87
388 -
389 if (!qt_urlRecode(appendTo, userName.constData(), userName.constEnd(), options, userNameActions))
evaluated: !qt_urlRecode(appendTo, userName.constData(), userName.constEnd(), options, userNameActions)
TRUEFALSE
yes
Evaluation Count:652
yes
Evaluation Count:60
60-652
390 appendTo += userName;
executed: appendTo += userName;
Execution Count:652
652
391 if (options & QUrl::RemovePassword || !hasPassword()) {
evaluated: options & QUrl::RemovePassword
TRUEFALSE
yes
Evaluation Count:357
yes
Evaluation Count:355
evaluated: !hasPassword()
TRUEFALSE
yes
Evaluation Count:160
yes
Evaluation Count:195
160-357
392 return;
executed: return;
Execution Count:517
517
393 } else { -
394 appendTo += QLatin1Char(':'); -
395 if (!qt_urlRecode(appendTo, password.constData(), password.constEnd(), options, passwordActions))
evaluated: !qt_urlRecode(appendTo, password.constData(), password.constEnd(), options, passwordActions)
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:54
54-141
396 appendTo += password;
executed: appendTo += password;
Execution Count:141
141
397 }
executed: }
Execution Count:195
195
398} -
399 -
400inline void QUrlPrivate::appendUserName(QString &appendTo, QUrl::FormattingOptions options) const -
401{ -
402 appendToUser(appendTo, userName, options, encodedUserNameActions, decodedUserNameInIsolationActions); -
403}
executed: }
Execution Count:752
752
404 -
405inline void QUrlPrivate::appendPassword(QString &appendTo, QUrl::FormattingOptions options) const -
406{ -
407 appendToUser(appendTo, password, options, encodedPasswordActions, decodedPasswordInIsolationActions); -
408}
executed: }
Execution Count:239
239
409 -
410inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const -
411{ -
412 if (appendingTo != Path && !(options & QUrl::EncodeDelimiters)) {
evaluated: appendingTo != Path
TRUEFALSE
yes
Evaluation Count:4780
yes
Evaluation Count:9172
evaluated: !(options & QUrl::EncodeDelimiters)
TRUEFALSE
yes
Evaluation Count:1477
yes
Evaluation Count:3303
1477-9172
413 if (!qt_urlRecode(appendTo, path.constData(), path.constEnd(), options, decodedPathInUrlActions))
evaluated: !qt_urlRecode(appendTo, path.constData(), path.constEnd(), options, decodedPathInUrlActions)
TRUEFALSE
yes
Evaluation Count:1459
yes
Evaluation Count:15
15-1459
414 appendTo += path;
executed: appendTo += path;
Execution Count:1459
1459
415 -
416 } else {
executed: }
Execution Count:1479
1479
417 appendToUser(appendTo, path, options, encodedPathActions, decodedPathInIsolationActions); -
418 }
executed: }
Execution Count:12475
12475
419} -
420 -
421inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options) const -
422{ -
423 appendToUser(appendTo, fragment, options, encodedFragmentActions, decodedFragmentInIsolationActions); -
424}
executed: }
Execution Count:895
895
425 -
426inline void QUrlPrivate::appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const -
427{ -
428 -
429 -
430 if (options == QUrl::PrettyDecoded && appendingTo == Query) {
evaluated: options == QUrl::PrettyDecoded
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:447
partially evaluated: appendingTo == Query
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
0-447
431 appendTo += query; -
432 return;
executed: return;
Execution Count:34
34
433 } -
434 -
435 const ushort *actions = 0; -
436 if (options & QUrl::EncodeDelimiters) {
evaluated: options & QUrl::EncodeDelimiters
TRUEFALSE
yes
Evaluation Count:355
yes
Evaluation Count:92
92-355
437 actions = encodedQueryActions; -
438 } else {
executed: }
Execution Count:355
355
439 -
440 options |= QUrl::EncodeDelimiters; -
441 actions = appendingTo == Query ? decodedQueryInIsolationActions : decodedQueryInUrlActions;
evaluated: appendingTo == Query
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:74
18-74
442 }
executed: }
Execution Count:92
92
443 -
444 if (!qt_urlRecode(appendTo, query.constData(), query.constData() + query.length(), 101-346
445 options, actions))
evaluated: !qt_urlRecode(appendTo, query.constData(), query.constData() + query.length(), options, actions)
TRUEFALSE
yes
Evaluation Count:346
yes
Evaluation Count:101
101-346
446 appendTo += query;
executed: appendTo += query;
Execution Count:346
346
447}
executed: }
Execution Count:447
447
448 -
449 -
450 -
451inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetError) -
452{ -
453 -
454 -
455 -
456 -
457 -
458 -
459 -
460 scheme.clear(); -
461 if (len == 0)
evaluated: len == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:6657
5-6657
462 return false;
executed: return false;
Execution Count:5
5
463 -
464 sectionIsPresent |= Scheme; -
465 -
466 -
467 int needsLowercasing = -1; -
468 const ushort *p = reinterpret_cast<const ushort *>(value.constData()); -
469 for (int i = 0; i < len; ++i) {
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:28624
yes
Evaluation Count:6628
6628-28624
470 if (p[i] >= 'a' && p[i] <= 'z')
evaluated: p[i] >= 'a'
TRUEFALSE
yes
Evaluation Count:28138
yes
Evaluation Count:494
partially evaluated: p[i] <= 'z'
TRUEFALSE
yes
Evaluation Count:28140
no
Evaluation Count:0
0-28140
471 continue;
executed: continue;
Execution Count:28139
28139
472 if (p[i] >= 'A' && p[i] <= 'Z') {
evaluated: p[i] >= 'A'
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:477
partially evaluated: p[i] <= 'Z'
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
0-477
473 needsLowercasing = i; -
474 continue;
executed: continue;
Execution Count:17
17
475 } -
476 if (p[i] >= '0' && p[i] <= '9' && i > 0)
evaluated: p[i] >= '0'
TRUEFALSE
yes
Evaluation Count:129
yes
Evaluation Count:348
evaluated: p[i] <= '9'
TRUEFALSE
yes
Evaluation Count:128
yes
Evaluation Count:1
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:124
yes
Evaluation Count:4
1-348
477 continue;
executed: continue;
Execution Count:124
124
478 if (p[i] == '+' || p[i] == '-' || p[i] == '.')
partially evaluated: p[i] == '+'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:353
evaluated: p[i] == '-'
TRUEFALSE
yes
Evaluation Count:318
yes
Evaluation Count:35
evaluated: p[i] == '.'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:33
0-353
479 continue;
executed: continue;
Execution Count:320
320
480 -
481 -
482 -
483 -
484 if (doSetError)
evaluated: doSetError
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:27
6-27
485 setError(InvalidSchemeError, value, i);
executed: setError(InvalidSchemeError, value, i);
Execution Count:6
6
486 return false;
executed: return false;
Execution Count:33
33
487 } -
488 -
489 scheme = value.left(len); -
490 -
491 if (needsLowercasing != -1) {
evaluated: needsLowercasing != -1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6621
4-6621
492 -
493 QChar *schemeData = scheme.data(); -
494 for (int i = needsLowercasing; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:4
4-19
495 register ushort c = schemeData[i].unicode(); -
496 if (c >= 'A' && c <= 'Z')
partially evaluated: c >= 'A'
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
evaluated: c <= 'Z'
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:2
0-19
497 schemeData[i] = c + 0x20;
executed: schemeData[i] = c + 0x20;
Execution Count:17
17
498 }
executed: }
Execution Count:19
19
499 }
executed: }
Execution Count:4
4
500 return true;
executed: return true;
Execution Count:6619
6619
501} -
502 -
503inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode) -
504{ -
505 sectionIsPresent &= ~Authority; -
506 sectionIsPresent |= Host; -
507 -
508 -
509 while (from != end) {
evaluated: from != end
TRUEFALSE
yes
Evaluation Count:3884
yes
Evaluation Count:148
148-3884
510 int userInfoIndex = auth.indexOf(QLatin1Char('@'), from); -
511 if (uint(userInfoIndex) < uint(end)) {
evaluated: uint(userInfoIndex) < uint(end)
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:3738
136-3738
512 setUserInfo(auth, from, userInfoIndex); -
513 if (mode == QUrl::StrictMode && !validateComponent(UserInfo, auth, from, userInfoIndex))
evaluated: mode == QUrl::StrictMode
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:128
evaluated: !validateComponent(UserInfo, auth, from, userInfoIndex)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1
1-128
514 break;
executed: break;
Execution Count:7
7
515 from = userInfoIndex + 1; -
516 }
executed: }
Execution Count:129
129
517 -
518 int colonIndex = auth.lastIndexOf(QLatin1Char(':'), end - 1); -
519 if (colonIndex < from)
evaluated: colonIndex < from
TRUEFALSE
yes
Evaluation Count:3145
yes
Evaluation Count:735
735-3145
520 colonIndex = -1;
executed: colonIndex = -1;
Execution Count:3142
3142
521 -
522 if (uint(colonIndex) < uint(end)) {
evaluated: uint(colonIndex) < uint(end)
TRUEFALSE
yes
Evaluation Count:735
yes
Evaluation Count:3143
735-3143
523 if (auth.at(from).unicode() == '[') {
evaluated: auth.at(from).unicode() == '['
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:691
44-691
524 -
525 int closingBracket = auth.indexOf(QLatin1Char(']'), from); -
526 if (uint(closingBracket) > uint(colonIndex))
evaluated: uint(closingBracket) > uint(colonIndex)
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:6
6-38
527 colonIndex = -1;
executed: colonIndex = -1;
Execution Count:38
38
528 }
executed: }
Execution Count:44
44
529 }
executed: }
Execution Count:735
735
530 -
531 if (colonIndex == end - 1) {
evaluated: colonIndex == end - 1
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3864
9-3864
532 -
533 setError(PortEmptyError, auth, colonIndex + 1); -
534 } else if (uint(colonIndex) < uint(end)) {
evaluated: uint(colonIndex) < uint(end)
TRUEFALSE
yes
Evaluation Count:688
yes
Evaluation Count:3176
executed: }
Execution Count:9
9-3176
535 unsigned long x = 0; -
536 for (int i = colonIndex + 1; i < end; ++i) {
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:2863
yes
Evaluation Count:681
681-2863
537 ushort c = auth.at(i).unicode(); -
538 if (c >= '0' && c <= '9') {
evaluated: c >= '0'
TRUEFALSE
yes
Evaluation Count:2862
yes
Evaluation Count:1
evaluated: c <= '9'
TRUEFALSE
yes
Evaluation Count:2856
yes
Evaluation Count:6
1-2862
539 x *= 10; -
540 x += c - '0'; -
541 } else {
executed: }
Execution Count:2856
2856
542 x = ulong(-1); -
543 break;
executed: break;
Execution Count:7
7
544 } -
545 } -
546 if (x == ushort(x)) {
evaluated: x == ushort(x)
TRUEFALSE
yes
Evaluation Count:678
yes
Evaluation Count:10
10-678
547 port = ushort(x); -
548 } else {
executed: }
Execution Count:678
678
549 setError(InvalidPortError, auth, colonIndex + 1); -
550 if (mode == QUrl::StrictMode)
evaluated: mode == QUrl::StrictMode
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6
4-6
551 break;
executed: break;
Execution Count:4
4
552 }
executed: }
Execution Count:6
6
553 } else { -
554 port = -1; -
555 }
executed: }
Execution Count:3173
3173
556 -
557 setHost(auth, from, qMin<uint>(end, colonIndex), mode); -
558 if (mode == QUrl::StrictMode && !validateComponent(Host, auth, from, qMin<uint>(end, colonIndex))) {
evaluated: mode == QUrl::StrictMode
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:3806
evaluated: !validateComponent(Host, auth, from, qMin<uint>(end, colonIndex))
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:59
2-3806
559 -
560 sectionIsPresent &= ~Authority; -
561 break;
executed: break;
Execution Count:2
2
562 } -
563 -
564 -
565 return;
executed: return;
Execution Count:3862
3862
566 } -
567 -
568 sectionIsPresent &= ~Authority | Host; -
569 userName.clear(); -
570 password.clear(); -
571 host.clear(); -
572 port = -1; -
573}
executed: }
Execution Count:161
161
574 -
575inline void QUrlPrivate::setUserInfo(const QString &userInfo, int from, int end) -
576{ -
577 int delimIndex = userInfo.indexOf(QLatin1Char(':'), from); -
578 setUserName(userInfo, from, qMin<uint>(delimIndex, end)); -
579 -
580 if (uint(delimIndex) >= uint(end)) {
evaluated: uint(delimIndex) >= uint(end)
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:110
72-110
581 password.clear(); -
582 sectionIsPresent &= ~Password; -
583 } else {
executed: }
Execution Count:72
72
584 setPassword(userInfo, delimIndex + 1, end); -
585 }
executed: }
Execution Count:110
110
586} -
587 -
588inline void QUrlPrivate::setUserName(const QString &value, int from, int end) -
589{ -
590 sectionIsPresent |= UserName; -
591 userName = recodeFromUser(value, decodedUserNameInIsolationActions, from, end); -
592}
executed: }
Execution Count:2021
2021
593 -
594inline void QUrlPrivate::setPassword(const QString &value, int from, int end) -
595{ -
596 sectionIsPresent |= Password; -
597 password = recodeFromUser(value, decodedPasswordInIsolationActions, from, end); -
598}
executed: }
Execution Count:543
543
599 -
600inline void QUrlPrivate::setPath(const QString &value, int from, int end) -
601{ -
602 -
603 path = recodeFromUser(value, decodedPathInIsolationActions, from, end); -
604}
executed: }
Execution Count:9939
9939
605 -
606inline void QUrlPrivate::setFragment(const QString &value, int from, int end) -
607{ -
608 sectionIsPresent |= Fragment; -
609 fragment = recodeFromUser(value, decodedFragmentInIsolationActions, from, end); -
610}
executed: }
Execution Count:1466
1466
611 -
612inline void QUrlPrivate::setQuery(const QString &value, int from, int iend) -
613{ -
614 sectionIsPresent |= Query; -
615 -
616 -
617 QString output; -
618 const QChar *begin = value.constData() + from; -
619 const QChar *end = value.constData() + iend; -
620 -
621 -
622 if (qt_urlRecode(output, begin, end, QUrl::EncodeDelimiters, 39-360
623 decodedQueryInIsolationActions))
evaluated: qt_urlRecode(output, begin, end, QUrl::EncodeDelimiters, decodedQueryInIsolationActions)
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:360
39-360
624 query = output;
executed: query = output;
Execution Count:39
39
625 else -
626 query = value.mid(from, iend - from);
executed: query = value.mid(from, iend - from);
Execution Count:360
360
627} -
628inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions options) const -
629{ -
630 -
631 options &= QUrl::EncodeUnicode; -
632 if (host.isEmpty())
evaluated: host.isEmpty()
TRUEFALSE
yes
Evaluation Count:896
yes
Evaluation Count:8126
896-8126
633 return;
executed: return;
Execution Count:896
896
634 if (host.at(0).unicode() == '[') {
evaluated: host.at(0).unicode() == '['
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:8007
120-8007
635 -
636 appendTo += host; -
637 } else {
executed: }
Execution Count:120
120
638 -
639 -
640 if (options == QUrl::EncodeUnicode)
evaluated: options == QUrl::EncodeUnicode
TRUEFALSE
yes
Evaluation Count:3014
yes
Evaluation Count:4993
3014-4993
641 appendTo += qt_ACE_do(host, ToAceOnly);
executed: appendTo += qt_ACE_do(host, ToAceOnly);
Execution Count:3014
3014
642 else -
643 appendTo += host;
executed: appendTo += host;
Execution Count:4993
4993
644 } -
645} -
646 -
647 -
648 -
649static const QChar *parseIpFuture(QString &host, const QChar *begin, const QChar *end) -
650{ -
651 -
652 static const char acceptable[] = -
653 "!$&'()*+,;=" -
654 ":" -
655 "-._~"; -
656 -
657 -
658 if (begin[3].unicode() != '.')
partially evaluated: begin[3].unicode() != '.'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
659 return &begin[3];
executed: return &begin[3];
Execution Count:1
1
660 if ((begin[2].unicode() >= 'A' && begin[2].unicode() >= 'F') ||
never evaluated: begin[2].unicode() >= 'A'
never evaluated: begin[2].unicode() >= 'F'
0
661 (begin[2].unicode() >= 'a' && begin[2].unicode() <= 'f') ||
never evaluated: begin[2].unicode() >= 'a'
never evaluated: begin[2].unicode() <= 'f'
0
662 (begin[2].unicode() >= '0' && begin[2].unicode() <= '9')) {
never evaluated: begin[2].unicode() >= '0'
never evaluated: begin[2].unicode() <= '9'
0
663 -
664 -
665 host += QString::fromRawData(begin, 4); -
666 begin += 4; -
667 --end; -
668 -
669 QString decoded; -
670 if (qt_urlRecode(decoded, begin, end, QUrl::FullyEncoded, 0)) {
never evaluated: qt_urlRecode(decoded, begin, end, QUrl::FullyEncoded, 0)
0
671 begin = decoded.constBegin(); -
672 end = decoded.constEnd(); -
673 }
never executed: }
0
674 -
675 for ( ; begin != end; ++begin) {
never evaluated: begin != end
0
676 if (begin->unicode() >= 'A' && begin->unicode() <= 'Z')
never evaluated: begin->unicode() >= 'A'
never evaluated: begin->unicode() <= 'Z'
0
677 host += *begin;
never executed: host += *begin;
0
678 else if (begin->unicode() >= 'a' && begin->unicode() <= 'z')
never evaluated: begin->unicode() >= 'a'
never evaluated: begin->unicode() <= 'z'
0
679 host += *begin;
never executed: host += *begin;
0
680 else if (begin->unicode() >= '0' && begin->unicode() <= '9')
never evaluated: begin->unicode() >= '0'
never evaluated: begin->unicode() <= '9'
0
681 host += *begin;
never executed: host += *begin;
0
682 else if (begin->unicode() < 0x80 && strchr(acceptable, begin->unicode()) != 0)
never evaluated: begin->unicode() < 0x80
never evaluated: strchr(acceptable, begin->unicode()) != 0
0
683 host += *begin;
never executed: host += *begin;
0
684 else -
685 return begin;
never executed: return begin;
0
686 } -
687 host += QLatin1Char(']'); -
688 return 0;
never executed: return 0;
0
689 } -
690 return &begin[2];
never executed: return &begin[2];
0
691} -
692 -
693 -
694static bool parseIp6(QString &host, const QChar *begin, const QChar *end) -
695{ -
696 QIPAddressUtils::IPv6Address address; -
697 if (!QIPAddressUtils::parseIp6(address, begin, end)) {
evaluated: !QIPAddressUtils::parseIp6(address, begin, end)
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:69
32-69
698 -
699 -
700 QString decoded; -
701 if (!qt_urlRecode(decoded, begin, end, QUrl::FullyEncoded, 0)) {
evaluated: !qt_urlRecode(decoded, begin, end, QUrl::FullyEncoded, 0)
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:11
11-21
702 -
703 return false;
executed: return false;
Execution Count:21
21
704 } -
705 -
706 -
707 -
708 return parseIp6(host, decoded.constBegin(), decoded.constEnd());
executed: return parseIp6(host, decoded.constBegin(), decoded.constEnd());
Execution Count:11
11
709 } -
710 -
711 host.reserve(host.size() + (end - begin)); -
712 host += QLatin1Char('['); -
713 QIPAddressUtils::toString(host, address); -
714 host += QLatin1Char(']'); -
715 return true;
executed: return true;
Execution Count:69
69
716} -
717 -
718inline bool QUrlPrivate::setHost(const QString &value, int from, int iend, QUrl::ParsingMode mode) -
719{ -
720 const QChar *begin = value.constData() + from; -
721 const QChar *end = value.constData() + iend; -
722 -
723 const int len = end - begin; -
724 host.clear(); -
725 sectionIsPresent |= Host; -
726 if (len == 0)
evaluated: len == 0
TRUEFALSE
yes
Evaluation Count:176
yes
Evaluation Count:6789
176-6789
727 return true;
executed: return true;
Execution Count:176
176
728 -
729 if (begin[0].unicode() == '[') {
evaluated: begin[0].unicode() == '['
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:6702
92-6702
730 -
731 -
732 -
733 if (end[-1].unicode() != ']') {
evaluated: end[-1].unicode() != ']'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:91
1-91
734 setError(HostMissingEndBracket, value); -
735 return false;
executed: return false;
Execution Count:1
1
736 } -
737 -
738 if (len > 5 && begin[1].unicode() == 'v') {
evaluated: len > 5
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:19
evaluated: begin[1].unicode() == 'v'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:71
1-72
739 const QChar *c = parseIpFuture(host, begin, end); -
740 if (c)
partially evaluated: c
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
741 setError(InvalidIPvFutureError, value, c - value.constData());
executed: setError(InvalidIPvFutureError, value, c - value.constData());
Execution Count:1
1
742 return !c;
executed: return !c;
Execution Count:1
1
743 } -
744 -
745 if (parseIp6(host, begin + 1, end - 1))
evaluated: parseIp6(host, begin + 1, end - 1)
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:21
21-69
746 return true;
executed: return true;
Execution Count:69
69
747 -
748 setError(begin[1].unicode() == 'v' ? InvalidIPvFutureError : InvalidIPv6AddressError, -
749 value, from); -
750 return false;
executed: return false;
Execution Count:21
21
751 } -
752 -
753 -
754 QIPAddressUtils::IPv4Address ip4; -
755 if (QIPAddressUtils::parseIp4(ip4, begin, end)) {
evaluated: QIPAddressUtils::parseIp4(ip4, begin, end)
TRUEFALSE
yes
Evaluation Count:629
yes
Evaluation Count:6016
629-6016
756 -
757 QIPAddressUtils::toString(host, ip4); -
758 return true;
executed: return true;
Execution Count:629
629
759 } -
760 QString s; -
761 if (mode == QUrl::TolerantMode && qt_urlRecode(s, begin, end, QUrl::DecodeReserved, 0)) {
evaluated: mode == QUrl::TolerantMode
TRUEFALSE
yes
Evaluation Count:5925
yes
Evaluation Count:89
evaluated: qt_urlRecode(s, begin, end, QUrl::DecodeReserved, 0)
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:5927
40-5927
762 -
763 -
764 int pos = s.indexOf(QChar(0x25)); -
765 if (pos != -1) {
evaluated: pos != -1
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:31
9-31
766 setError(InvalidRegNameError, s, pos); -
767 return false;
executed: return false;
Execution Count:9
9
768 } -
769 -
770 -
771 return setHost(s, 0, s.length(), QUrl::StrictMode);
executed: return setHost(s, 0, s.length(), QUrl::StrictMode);
Execution Count:31
31
772 } -
773 -
774 s = qt_ACE_do(QString::fromRawData(begin, len), NormalizeAce); -
775 if (s.isEmpty()) {
evaluated: s.isEmpty()
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:5980
46-5980
776 setError(InvalidRegNameError, value); -
777 return false;
executed: return false;
Execution Count:46
46
778 } -
779 -
780 -
781 if (QIPAddressUtils::parseIp4(ip4, s.constBegin(), s.constEnd())) {
partially evaluated: QIPAddressUtils::parseIp4(ip4, s.constBegin(), s.constEnd())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5929
0-5929
782 QIPAddressUtils::toString(host, ip4); -
783 } else {
never executed: }
0
784 host = s; -
785 }
executed: }
Execution Count:5950
5950
786 return true;
executed: return true;
Execution Count:5968
5968
787} -
788 -
789inline void QUrlPrivate::parse(const QString &url, QUrl::ParsingMode parsingMode) -
790{ -
791 sectionIsPresent = 0; -
792 clearError(); -
793 -
794 -
795 int colon = -1; -
796 int question = -1; -
797 int hash = -1; -
798 const int len = url.length(); -
799 const QChar *const begin = url.constData(); -
800 const ushort *const data = reinterpret_cast<const ushort *>(begin); -
801 -
802 for (int i = 0; i < len; ++i) {
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:180729
yes
Evaluation Count:7689
7689-180729
803 register uint uc = data[i]; -
804 if (uc == '#' && hash == -1) {
evaluated: uc == '#'
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:180619
partially evaluated: hash == -1
TRUEFALSE
yes
Evaluation Count:126
no
Evaluation Count:0
0-180619
805 hash = i; -
806 -
807 -
808 break;
executed: break;
Execution Count:126
126
809 } -
810 -
811 if (question == -1) {
evaluated: question == -1
TRUEFALSE
yes
Evaluation Count:177615
yes
Evaluation Count:2995
2995-177615
812 if (uc == ':' && colon == -1)
evaluated: uc == ':'
TRUEFALSE
yes
Evaluation Count:5261
yes
Evaluation Count:172468
evaluated: colon == -1
TRUEFALSE
yes
Evaluation Count:4241
yes
Evaluation Count:1015
1015-172468
813 colon = i;
executed: colon = i;
Execution Count:4238
4238
814 else if (uc == '?')
evaluated: uc == '?'
TRUEFALSE
yes
Evaluation Count:261
yes
Evaluation Count:173250
261-173250
815 question = i;
executed: question = i;
Execution Count:261
261
816 } -
817 }
executed: }
Execution Count:180678
180678
818 -
819 -
820 int hierStart; -
821 if (colon != -1 && setScheme(url, colon, false)) {
evaluated: colon != -1
TRUEFALSE
yes
Evaluation Count:4243
yes
Evaluation Count:3581
evaluated: setScheme(url, colon, false)
TRUEFALSE
yes
Evaluation Count:4206
yes
Evaluation Count:32
32-4243
822 hierStart = colon + 1; -
823 } else {
executed: }
Execution Count:4206
4206
824 -
825 scheme.clear(); -
826 sectionIsPresent = 0; -
827 hierStart = 0; -
828 }
executed: }
Execution Count:3613
3613
829 -
830 int pathStart; -
831 int hierEnd = qMin<uint>(qMin<uint>(question, hash), len); -
832 if (hierEnd - hierStart >= 2 && data[hierStart] == '/' && data[hierStart + 1] == '/') {
evaluated: hierEnd - hierStart >= 2
TRUEFALSE
yes
Evaluation Count:7635
yes
Evaluation Count:186
evaluated: data[hierStart] == '/'
TRUEFALSE
yes
Evaluation Count:4113
yes
Evaluation Count:3530
evaluated: data[hierStart + 1] == '/'
TRUEFALSE
yes
Evaluation Count:4005
yes
Evaluation Count:102
102-7635
833 -
834 int authorityEnd = hierEnd; -
835 for (int i = hierStart + 2; i < authorityEnd ; ++i) {
evaluated: i < authorityEnd
TRUEFALSE
yes
Evaluation Count:64155
yes
Evaluation Count:2543
2543-64155
836 if (data[i] == '/') {
evaluated: data[i] == '/'
TRUEFALSE
yes
Evaluation Count:1474
yes
Evaluation Count:62670
1474-62670
837 authorityEnd = i; -
838 break;
executed: break;
Execution Count:1474
1474
839 } -
840 }
executed: }
Execution Count:62689
62689
841 -
842 setAuthority(url, hierStart + 2, authorityEnd, parsingMode); -
843 -
844 -
845 pathStart = authorityEnd; -
846 setPath(url, pathStart, hierEnd); -
847 } else {
executed: }
Execution Count:3991
3991
848 userName.clear(); -
849 password.clear(); -
850 host.clear(); -
851 port = -1; -
852 pathStart = hierStart; -
853 -
854 if (hierStart < hierEnd)
evaluated: hierStart < hierEnd
TRUEFALSE
yes
Evaluation Count:3654
yes
Evaluation Count:164
164-3654
855 setPath(url, hierStart, hierEnd);
executed: setPath(url, hierStart, hierEnd);
Execution Count:3653
3653
856 else -
857 path.clear();
executed: path.clear();
Execution Count:164
164
858 } -
859 -
860 if (uint(question) < uint(hash))
evaluated: uint(question) < uint(hash)
TRUEFALSE
yes
Evaluation Count:261
yes
Evaluation Count:7532
261-7532
861 setQuery(url, question + 1, qMin<uint>(hash, len));
executed: setQuery(url, question + 1, qMin<uint>(hash, len));
Execution Count:261
261
862 -
863 if (hash != -1)
evaluated: hash != -1
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:7671
126-7671
864 setFragment(url, hash + 1, len);
executed: setFragment(url, hash + 1, len);
Execution Count:126
126
865 -
866 if (error || parsingMode == QUrl::TolerantMode)
evaluated: error
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:7760
evaluated: parsingMode == QUrl::TolerantMode
TRUEFALSE
yes
Evaluation Count:7707
yes
Evaluation Count:61
35-7760
867 return;
executed: return;
Execution Count:7748
7748
868 -
869 -
870 -
871 -
872 -
873 -
874 -
875 if (!validateComponent(Path, url, pathStart, hierEnd))
evaluated: !validateComponent(Path, url, pathStart, hierEnd)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:56
5-56
876 return;
executed: return;
Execution Count:5
5
877 if (uint(question) < uint(hash) && !validateComponent(Query, url, question + 1, qMin<uint>(hash, len)))
evaluated: uint(question) < uint(hash)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:55
partially evaluated: !validateComponent(Query, url, question + 1, qMin<uint>(hash, len))
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-55
878 return;
executed: return;
Execution Count:1
1
879 if (hash != -1)
evaluated: hash != -1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:54
1-54
880 validateComponent(Fragment, url, hash + 1, len);
executed: validateComponent(Fragment, url, hash + 1, len);
Execution Count:1
1
881}
executed: }
Execution Count:55
55
882inline QString QUrlPrivate::mergePaths(const QString &relativePath) const -
883{ -
884 -
885 -
886 -
887 if (!host.isEmpty() && path.isEmpty())
evaluated: !host.isEmpty()
TRUEFALSE
yes
Evaluation Count:1028
yes
Evaluation Count:2338
evaluated: path.isEmpty()
TRUEFALSE
yes
Evaluation Count:987
yes
Evaluation Count:44
44-2338
888 return QLatin1Char('/') + relativePath;
executed: return QLatin1Char('/') + relativePath;
Execution Count:987
987
889 -
890 -
891 -
892 -
893 -
894 -
895 QString newPath; -
896 if (!path.contains(QLatin1Char('/')))
evaluated: !path.contains(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:2363
19-2363
897 newPath = relativePath;
executed: newPath = relativePath;
Execution Count:19
19
898 else -
899 newPath = path.leftRef(path.lastIndexOf(QLatin1Char('/')) + 1) + relativePath;
executed: newPath = path.leftRef(path.lastIndexOf(QLatin1Char('/')) + 1) + relativePath;
Execution Count:2363
2363
900 -
901 return newPath;
executed: return newPath;
Execution Count:2382
2382
902} -
903 -
904 -
905 -
906 -
907 -
908 -
909 -
910static void removeDotsFromPath(QString *path) -
911{ -
912 -
913 -
914 -
915 QChar *out = path->data(); -
916 const QChar *in = out; -
917 const QChar *end = out + path->size(); -
918 -
919 -
920 -
921 -
922 if (path->size() == 1 && in[0].unicode() == '.')
evaluated: path->size() == 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4461
partially evaluated: in[0].unicode() == '.'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-4461
923 ++in;
never executed: ++in;
0
924 else if (path->size() == 2 && in[0].unicode() == '.' && in[1].unicode() == '.')
evaluated: path->size() == 2
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4462
partially evaluated: in[0].unicode() == '.'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never evaluated: in[1].unicode() == '.'
0-4462
925 in += 2;
never executed: in += 2;
0
926 -
927 while (in < end) {
evaluated: in < end
TRUEFALSE
yes
Evaluation Count:37749
yes
Evaluation Count:4462
4462-37749
928 -
929 -
930 -
931 if (path->size() >= 2 && in[0].unicode() == '.' && in[1].unicode() == '/')
evaluated: path->size() >= 2
TRUEFALSE
yes
Evaluation Count:37745
yes
Evaluation Count:3
evaluated: in[0].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:37745
partially evaluated: in[1].unicode() == '/'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-37745
932 in += 2;
never executed: in += 2;
0
933 else if (path->size() >= 3 && in[0].unicode() == '.'
evaluated: path->size() >= 3
TRUEFALSE
yes
Evaluation Count:37745
yes
Evaluation Count:6
evaluated: in[0].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:37745
1-37745
934 && in[1].unicode() == '.' && in[2].unicode() == '/')
partially evaluated: in[1].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: in[2].unicode() == '/'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
935 in += 3;
executed: in += 3;
Execution Count:1
1
936 -
937 -
938 -
939 -
940 if (in <= end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'
evaluated: in <= end - 3
TRUEFALSE
yes
Evaluation Count:37700
yes
Evaluation Count:53
evaluated: in[0].unicode() == '/'
TRUEFALSE
yes
Evaluation Count:37669
yes
Evaluation Count:29
evaluated: in[1].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:37625
29-37700
941 && in[2].unicode() == '/') {
evaluated: in[2].unicode() == '/'
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:37
7-37
942 in += 2; -
943 continue;
executed: continue;
Execution Count:7
7
944 } else if (in == end - 2 && in[0].unicode() == '/' && in[1].unicode() == '.') {
evaluated: in == end - 2
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:37715
partially evaluated: in[0].unicode() == '/'
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
evaluated: in[1].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:28
0-37715
945 *out++ = QLatin1Char('/'); -
946 in += 2; -
947 break;
executed: break;
Execution Count:2
2
948 } -
949 -
950 -
951 -
952 -
953 -
954 -
955 if (in <= end - 4 && in[0].unicode() == '/' && in[1].unicode() == '.'
evaluated: in <= end - 4
TRUEFALSE
yes
Evaluation Count:37687
yes
Evaluation Count:57
evaluated: in[0].unicode() == '/'
TRUEFALSE
yes
Evaluation Count:37658
yes
Evaluation Count:29
evaluated: in[1].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:37623
29-37687
956 && in[2].unicode() == '.' && in[3].unicode() == '/') {
partially evaluated: in[2].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
evaluated: in[3].unicode() == '/'
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:1
0-34
957 while (out > path->constData() && (--out)->unicode() != '/')
evaluated: out > path->constData()
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:8
evaluated: (--out)->unicode() != '/'
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:25
8-96
958 ;
executed: ;
Execution Count:71
71
959 if (out == path->constData() && out->unicode() != '/')
evaluated: out == path->constData()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:19
evaluated: out->unicode() != '/'
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
3-19
960 ++in;
executed: ++in;
Execution Count:3
3
961 in += 3; -
962 continue;
executed: continue;
Execution Count:33
33
963 } else if (in == end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'
evaluated: in == end - 3
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:37705
partially evaluated: in[0].unicode() == '/'
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
evaluated: in[1].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
0-37705
964 && in[2].unicode() == '.') {
evaluated: in[2].unicode() == '.'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
965 while (out > path->constData() && (--out)->unicode() != '/')
partially evaluated: out > path->constData()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
evaluated: (--out)->unicode() != '/'
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
0-4
966 ;
executed: ;
Execution Count:2
2
967 if (out->unicode() == '/')
partially evaluated: out->unicode() == '/'
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
968 ++out;
executed: ++out;
Execution Count:2
2
969 in += 3; -
970 break;
executed: break;
Execution Count:2
2
971 } -
972 -
973 -
974 -
975 -
976 -
977 -
978 -
979 *out++ = *in++; -
980 while (in < end && in->unicode() != '/')
evaluated: in < end
TRUEFALSE
yes
Evaluation Count:283716
yes
Evaluation Count:3467
evaluated: in->unicode() != '/'
TRUEFALSE
yes
Evaluation Count:249490
yes
Evaluation Count:34242
3467-283716
981 *out++ = *in++;
executed: *out++ = *in++;
Execution Count:249493
249493
982 }
executed: }
Execution Count:37710
37710
983 path->truncate(out - path->constData()); -
984}
executed: }
Execution Count:4456
4456
985 -
986inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, int *position) const -
987{ -
988 qt_noop(); -
989 if (error) {
evaluated: error
TRUEFALSE
yes
Evaluation Count:249
yes
Evaluation Count:10701
249-10701
990 if (source) {
evaluated: source
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:144
105-144
991 *source = error->source; -
992 *position = error->position; -
993 }
executed: }
Execution Count:105
105
994 return error->code;
executed: return error->code;
Execution Count:249
249
995 } -
996 if (path.isEmpty() || path.at(0) == QLatin1Char('/'))
evaluated: path.isEmpty()
TRUEFALSE
yes
Evaluation Count:3737
yes
Evaluation Count:6964
evaluated: path.at(0) == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:6448
yes
Evaluation Count:516
516-6964
997 return NoError;
executed: return NoError;
Execution Count:10185
10185
998 if (sectionIsPresent & QUrlPrivate::Host) {
evaluated: sectionIsPresent & QUrlPrivate::Host
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:510
6-510
999 if (source) {
evaluated: source
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
1000 *source = path; -
1001 *position = 0; -
1002 }
executed: }
Execution Count:1
1
1003 return AuthorityPresentAndPathIsRelative;
executed: return AuthorityPresentAndPathIsRelative;
Execution Count:6
6
1004 } -
1005 if (sectionIsPresent & QUrlPrivate::Scheme)
evaluated: sectionIsPresent & QUrlPrivate::Scheme
TRUEFALSE
yes
Evaluation Count:336
yes
Evaluation Count:174
174-336
1006 return NoError;
executed: return NoError;
Execution Count:336
336
1007 -
1008 -
1009 for (int i = 0; i < path.length(); ++i) {
evaluated: i < path.length()
TRUEFALSE
yes
Evaluation Count:1114
yes
Evaluation Count:113
113-1114
1010 register ushort c = path.at(i).unicode(); -
1011 if (c == '/') {
evaluated: c == '/'
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1066
48-1066
1012 -
1013 return NoError;
executed: return NoError;
Execution Count:48
48
1014 } -
1015 if (c == ':') {
evaluated: c == ':'
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1053
13-1053
1016 -
1017 if (source) {
evaluated: source
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:7
6-7
1018 *source = path; -
1019 *position = i; -
1020 }
executed: }
Execution Count:6
6
1021 return RelativeUrlPathContainsColonBeforeSlash;
executed: return RelativeUrlPathContainsColonBeforeSlash;
Execution Count:13
13
1022 } -
1023 }
executed: }
Execution Count:1053
1053
1024 return NoError;
executed: return NoError;
Execution Count:113
113
1025} -
1026 -
1027bool QUrlPrivate::validateComponent(QUrlPrivate::Section section, const QString &input, -
1028 int begin, int end) -
1029{ -
1030 static const char forbidden[] = "\"<>\\^`{|}\x7F"; -
1031 static const char forbiddenUserInfo[] = ":/?#[]@"; -
1032 -
1033 qt_noop(); -
1034 -
1035 const ushort *const data = reinterpret_cast<const ushort *>(input.constData()); -
1036 for (uint i = uint(begin); i < uint(end); ++i) {
evaluated: i < uint(end)
TRUEFALSE
yes
Evaluation Count:3456
yes
Evaluation Count:118
118-3456
1037 register uint uc = data[i]; -
1038 if (uc >= 0x80)
partially evaluated: uc >= 0x80
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3456
0-3456
1039 continue;
never executed: continue;
0
1040 -
1041 bool error = false; -
1042 if ((uc == '%' && (uint(end) < i + 2 || !isHex(data[i + 1]) || !isHex(data[i + 2])))
evaluated: uc == '%'
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:3431
evaluated: uint(end) < i + 2
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:24
evaluated: !isHex(data[i + 1])
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:19
evaluated: !isHex(data[i + 2])
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:9
1-3431
1043 || uc <= 0x20 || strchr(forbidden, uc)) {
evaluated: uc <= 0x20
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3438
evaluated: strchr(forbidden, uc)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3426
2-3438
1044 -
1045 error = true; -
1046 } else if (section & UserInfo) {
executed: }
Execution Count:30
evaluated: section & UserInfo
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:3351
30-3351
1047 if (section == UserInfo && strchr(forbiddenUserInfo + 1, uc))
evaluated: section == UserInfo
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:22
evaluated: strchr(forbiddenUserInfo + 1, uc)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:52
1-53
1048 error = true;
executed: error = true;
Execution Count:1
1
1049 else if (section != UserInfo && strchr(forbiddenUserInfo, uc))
evaluated: section != UserInfo
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:52
evaluated: strchr(forbiddenUserInfo, uc)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:18
4-52
1050 error = true;
executed: error = true;
Execution Count:4
4
1051 } -
1052 -
1053 if (!error)
evaluated: !error
TRUEFALSE
yes
Evaluation Count:3421
yes
Evaluation Count:35
35-3421
1054 continue;
executed: continue;
Execution Count:3421
3421
1055 -
1056 ErrorCode errorCode = ErrorCode(int(section) << 8); -
1057 if (section == UserInfo) {
evaluated: section == UserInfo
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:23
12-23
1058 -
1059 errorCode = InvalidUserNameError; -
1060 for (uint j = uint(begin); j < i; ++j)
evaluated: j < i
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:9
9-41
1061 if (data[j] == ':') {
evaluated: data[j] == ':'
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:38
3-38
1062 errorCode = InvalidPasswordError; -
1063 break;
executed: break;
Execution Count:3
3
1064 } -
1065 }
executed: }
Execution Count:12
12
1066 -
1067 setError(errorCode, input, i); -
1068 return false;
executed: return false;
Execution Count:35
35
1069 } -
1070 -
1071 -
1072 return true;
executed: return true;
Execution Count:118
118
1073} -
1074QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0) -
1075{ -
1076 setUrl(url, parsingMode); -
1077}
executed: }
Execution Count:6414
6414
1078 -
1079 -
1080 -
1081 -
1082QUrl::QUrl() : d(0) -
1083{ -
1084}
executed: }
Execution Count:23169
23169
1085 -
1086 -
1087 -
1088 -
1089QUrl::QUrl(const QUrl &other) : d(other.d) -
1090{ -
1091 if (d)
evaluated: d
TRUEFALSE
yes
Evaluation Count:39982
yes
Evaluation Count:6172
6172-39982
1092 d->ref.ref();
executed: d->ref.ref();
Execution Count:39979
39979
1093}
executed: }
Execution Count:46180
46180
1094 -
1095 -
1096 -
1097 -
1098QUrl::~QUrl() -
1099{ -
1100 if (d && !d->ref.deref())
evaluated: d
TRUEFALSE
yes
Evaluation Count:59462
yes
Evaluation Count:20714
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:22757
yes
Evaluation Count:36755
20714-59462
1101 delete d;
executed: delete d;
Execution Count:22736
22736
1102}
executed: }
Execution Count:80171
80171
1103bool QUrl::isValid() const -
1104{ -
1105 if (isEmpty()) {
evaluated: isEmpty()
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:10835
73-10835
1106 -
1107 return false;
executed: return false;
Execution Count:73
73
1108 } -
1109 return d->validityError() == QUrlPrivate::NoError;
executed: return d->validityError() == QUrlPrivate::NoError;
Execution Count:10835
10835
1110} -
1111 -
1112 -
1113 -
1114 -
1115 -
1116 -
1117bool QUrl::isEmpty() const -
1118{ -
1119 if (!d) return true;
executed: return true;
Execution Count:154
evaluated: !d
TRUEFALSE
yes
Evaluation Count:154
yes
Evaluation Count:10926
154-10926
1120 return d->isEmpty();
executed: return d->isEmpty();
Execution Count:10924
10924
1121} -
1122void QUrl::clear() -
1123{ -
1124 if (d && !d->ref.deref())
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1125 delete d;
executed: delete d;
Execution Count:1
1
1126 d = 0; -
1127}
executed: }
Execution Count:1
1
1128void QUrl::setUrl(const QString &url, ParsingMode parsingMode) -
1129{ -
1130 if (parsingMode == DecodedMode) {
partially evaluated: parsingMode == DecodedMode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7806
0-7806
1131 QMessageLogger("io/qurl.cpp", 1819, __PRETTY_FUNCTION__).warning("QUrl: QUrl::DecodedMode is not permitted when parsing a full URL"); -
1132 } else {
never executed: }
0
1133 detach(); -
1134 d->parse(url, parsingMode); -
1135 }
executed: }
Execution Count:7788
7788
1136} -
1137void QUrl::setScheme(const QString &scheme) -
1138{ -
1139 detach(); -
1140 d->clearError(); -
1141 if (scheme.isEmpty()) {
evaluated: scheme.isEmpty()
TRUEFALSE
yes
Evaluation Count:2088
yes
Evaluation Count:2417
2088-2417
1142 -
1143 d->sectionIsPresent &= ~QUrlPrivate::Scheme; -
1144 d->scheme.clear(); -
1145 } else {
executed: }
Execution Count:2088
2088
1146 d->setScheme(scheme, scheme.length(), true); -
1147 }
executed: }
Execution Count:2417
2417
1148} -
1149QString QUrl::scheme() const -
1150{ -
1151 if (!d) return QString();
executed: return QString();
Execution Count:1
evaluated: !d
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5879
1-5879
1152 -
1153 return d->scheme;
executed: return d->scheme;
Execution Count:5877
5877
1154} -
1155void QUrl::setAuthority(const QString &authority, ParsingMode mode) -
1156{ -
1157 detach(); -
1158 d->clearError(); -
1159 QString data = authority; -
1160 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:20
1-20
1161 parseDecodedComponent(data); -
1162 mode = TolerantMode; -
1163 }
executed: }
Execution Count:1
1
1164 -
1165 d->setAuthority(data, 0, data.length(), mode); -
1166 if (authority.isNull()) {
evaluated: authority.isNull()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:18
3-18
1167 -
1168 -
1169 d->sectionIsPresent &= ~QUrlPrivate::Authority; -
1170 }
executed: }
Execution Count:3
3
1171}
executed: }
Execution Count:21
21
1172QString QUrl::authority(ComponentFormattingOptions options) const -
1173{ -
1174 if (!d) return QString();
executed: return QString();
Execution Count:1
evaluated: !d
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:70
1-70
1175 -
1176 QString result; -
1177 d->appendAuthority(result, options, QUrlPrivate::Authority); -
1178 return result;
executed: return result;
Execution Count:70
70
1179} -
1180void QUrl::setUserInfo(const QString &userInfo, ParsingMode mode) -
1181{ -
1182 detach(); -
1183 d->clearError(); -
1184 QString trimmed = userInfo.trimmed(); -
1185 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:45
1-45
1186 parseDecodedComponent(trimmed); -
1187 mode = TolerantMode; -
1188 }
executed: }
Execution Count:1
1
1189 -
1190 d->setUserInfo(trimmed, 0, trimmed.length()); -
1191 if (userInfo.isNull()) {
evaluated: userInfo.isNull()
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:10
10-36
1192 -
1193 -
1194 d->sectionIsPresent &= ~QUrlPrivate::UserInfo; -
1195 } else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::UserInfo, userInfo)) {
executed: }
Execution Count:36
evaluated: mode == StrictMode
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
partially evaluated: !d->validateComponent(QUrlPrivate::UserInfo, userInfo)
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-36
1196 d->sectionIsPresent &= ~QUrlPrivate::UserInfo; -
1197 d->userName.clear(); -
1198 d->password.clear(); -
1199 }
executed: }
Execution Count:5
5
1200} -
1201QString QUrl::userInfo(ComponentFormattingOptions options) const -
1202{ -
1203 if (!d) return QString();
executed: return QString();
Execution Count:1
evaluated: !d
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1025
1-1025
1204 -
1205 QString result; -
1206 d->appendUserInfo(result, options, QUrlPrivate::UserInfo); -
1207 return result;
executed: return result;
Execution Count:1025
1025
1208} -
1209void QUrl::setUserName(const QString &userName, ParsingMode mode) -
1210{ -
1211 detach(); -
1212 d->clearError(); -
1213 -
1214 QString data = userName; -
1215 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1855
1-1855
1216 parseDecodedComponent(data); -
1217 mode = TolerantMode; -
1218 }
executed: }
Execution Count:1
1
1219 -
1220 d->setUserName(data, 0, data.length()); -
1221 if (userName.isNull())
evaluated: userName.isNull()
TRUEFALSE
yes
Evaluation Count:499
yes
Evaluation Count:1340
499-1340
1222 d->sectionIsPresent &= ~QUrlPrivate::UserName;
executed: d->sectionIsPresent &= ~QUrlPrivate::UserName;
Execution Count:499
499
1223 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::UserName, userName))
evaluated: mode == StrictMode
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1334
partially evaluated: !d->validateComponent(QUrlPrivate::UserName, userName)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-1334
1224 d->userName.clear();
executed: d->userName.clear();
Execution Count:4
4
1225} -
1226QString QUrl::userName(ComponentFormattingOptions options) const -
1227{ -
1228 if (!d) return QString();
executed: return QString();
Execution Count:2
evaluated: !d
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:752
2-752
1229 -
1230 QString result; -
1231 d->appendUserName(result, options); -
1232 return result;
executed: return result;
Execution Count:752
752
1233} -
1234void QUrl::setPassword(const QString &password, ParsingMode mode) -
1235{ -
1236 detach(); -
1237 d->clearError(); -
1238 -
1239 QString data = password; -
1240 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:432
1-432
1241 parseDecodedComponent(data); -
1242 mode = TolerantMode; -
1243 }
executed: }
Execution Count:1
1
1244 -
1245 d->setPassword(data, 0, data.length()); -
1246 if (password.isNull())
evaluated: password.isNull()
TRUEFALSE
yes
Evaluation Count:418
yes
Evaluation Count:15
15-418
1247 d->sectionIsPresent &= ~QUrlPrivate::Password;
executed: d->sectionIsPresent &= ~QUrlPrivate::Password;
Execution Count:418
418
1248 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Password, password))
evaluated: mode == StrictMode
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:11
partially evaluated: !d->validateComponent(QUrlPrivate::Password, password)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-11
1249 d->password.clear();
executed: d->password.clear();
Execution Count:4
4
1250} -
1251QString QUrl::password(ComponentFormattingOptions options) const -
1252{ -
1253 if (!d) return QString();
executed: return QString();
Execution Count:2
evaluated: !d
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:239
2-239
1254 -
1255 QString result; -
1256 d->appendPassword(result, options); -
1257 return result;
executed: return result;
Execution Count:239
239
1258} -
1259void QUrl::setHost(const QString &host, ParsingMode mode) -
1260{ -
1261 detach(); -
1262 d->clearError(); -
1263 -
1264 QString data = host; -
1265 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3016
1-3016
1266 parseDecodedComponent(data); -
1267 mode = TolerantMode; -
1268 }
executed: }
Execution Count:1
1
1269 -
1270 if (d->setHost(data, 0, data.length(), mode)) {
evaluated: d->setHost(data, 0, data.length(), mode)
TRUEFALSE
yes
Evaluation Count:2963
yes
Evaluation Count:43
43-2963
1271 if (host.isNull())
evaluated: host.isNull()
TRUEFALSE
yes
Evaluation Count:173
yes
Evaluation Count:2791
173-2791
1272 d->sectionIsPresent &= ~QUrlPrivate::Host;
executed: d->sectionIsPresent &= ~QUrlPrivate::Host;
Execution Count:173
173
1273 } else if (!data.startsWith(QLatin1Char('['))) {
executed: }
Execution Count:2960
partially evaluated: !data.startsWith(QLatin1Char('['))
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
0-2960
1274 -
1275 qt_noop(); -
1276 -
1277 data.prepend(QLatin1Char('[')); -
1278 data.append(QLatin1Char(']')); -
1279 if (!d->setHost(data, 0, data.length(), mode)) {
evaluated: !d->setHost(data, 0, data.length(), mode)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:28
15-28
1280 -
1281 if (data.contains(QLatin1Char(':'))) {
evaluated: data.contains(QLatin1Char(':'))
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:6
6-9
1282 -
1283 d->error->code = QUrlPrivate::InvalidIPv6AddressError; -
1284 }
executed: }
Execution Count:9
9
1285 } else {
executed: }
Execution Count:15
15
1286 -
1287 d->clearError(); -
1288 }
executed: }
Execution Count:28
28
1289 } -
1290} -
1291QString QUrl::host(ComponentFormattingOptions options) const -
1292{ -
1293 if (!d) return QString();
executed: return QString();
Execution Count:857
evaluated: !d
TRUEFALSE
yes
Evaluation Count:857
yes
Evaluation Count:4630
857-4630
1294 -
1295 QString result; -
1296 d->appendHost(result, options); -
1297 if (result.startsWith(QLatin1Char('[')))
evaluated: result.startsWith(QLatin1Char('['))
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:4586
44-4586
1298 return result.mid(1, result.length() - 2);
executed: return result.mid(1, result.length() - 2);
Execution Count:44
44
1299 return result;
executed: return result;
Execution Count:4586
4586
1300} -
1301void QUrl::setPort(int port) -
1302{ -
1303 detach(); -
1304 d->clearError(); -
1305 -
1306 if (port < -1 || port > 65535) {
evaluated: port < -1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3453
evaluated: port > 65535
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3451
1-3453
1307 port = -1; -
1308 d->setError(QUrlPrivate::InvalidPortError, QString::number(port), 0); -
1309 }
executed: }
Execution Count:3
3
1310 -
1311 d->port = port; -
1312}
executed: }
Execution Count:3454
3454
1313int QUrl::port(int defaultPort) const -
1314{ -
1315 if (!d) return defaultPort;
executed: return defaultPort;
Execution Count:1
evaluated: !d
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2721
1-2721
1316 return d->port == -1 ? defaultPort : d->port;
executed: return d->port == -1 ? defaultPort : d->port;
Execution Count:2721
2721
1317} -
1318void QUrl::setPath(const QString &path, ParsingMode mode) -
1319{ -
1320 detach(); -
1321 d->clearError(); -
1322 -
1323 QString data = path; -
1324 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:2040
yes
Evaluation Count:255
255-2040
1325 parseDecodedComponent(data); -
1326 mode = TolerantMode; -
1327 }
executed: }
Execution Count:2040
2040
1328 -
1329 d->setPath(data, 0, data.length()); -
1330 -
1331 -
1332 -
1333 -
1334 -
1335 if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Path, path))
evaluated: mode == StrictMode
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2291
evaluated: !d->validateComponent(QUrlPrivate::Path, path)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2-2291
1336 d->path.clear();
executed: d->path.clear();
Execution Count:2
2
1337}
executed: }
Execution Count:2295
2295
1338QString QUrl::path(ComponentFormattingOptions options) const -
1339{ -
1340 if (!d) return QString();
executed: return QString();
Execution Count:7
evaluated: !d
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:9172
7-9172
1341 -
1342 QString result; -
1343 d->appendPath(result, options, QUrlPrivate::Path); -
1344 return result;
executed: return result;
Execution Count:9172
9172
1345} -
1346bool QUrl::hasQuery() const -
1347{ -
1348 if (!d) return false;
never executed: return false;
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
1349 return d->hasQuery();
executed: return d->hasQuery();
Execution Count:19
19
1350} -
1351void QUrl::setQuery(const QString &query, ParsingMode mode) -
1352{ -
1353 detach(); -
1354 d->clearError(); -
1355 -
1356 QString data = query; -
1357 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:137
1-137
1358 parseDecodedComponent(data); -
1359 mode = TolerantMode; -
1360 }
executed: }
Execution Count:1
1
1361 -
1362 d->setQuery(data, 0, data.length()); -
1363 if (query.isNull())
evaluated: query.isNull()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:135
3-135
1364 d->sectionIsPresent &= ~QUrlPrivate::Query;
executed: d->sectionIsPresent &= ~QUrlPrivate::Query;
Execution Count:3
3
1365 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Query, query))
evaluated: mode == StrictMode
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:133
partially evaluated: !d->validateComponent(QUrlPrivate::Query, query)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-133
1366 d->query.clear();
executed: d->query.clear();
Execution Count:2
2
1367} -
1368void QUrl::setQuery(const QUrlQuery &query) -
1369{ -
1370 detach(); -
1371 d->clearError(); -
1372 -
1373 -
1374 d->query = query.toString(); -
1375 if (query.isEmpty())
never evaluated: query.isEmpty()
0
1376 d->sectionIsPresent &= ~QUrlPrivate::Query;
never executed: d->sectionIsPresent &= ~QUrlPrivate::Query;
0
1377 else -
1378 d->sectionIsPresent |= QUrlPrivate::Query;
never executed: d->sectionIsPresent |= QUrlPrivate::Query;
0
1379} -
1380QString QUrl::query(ComponentFormattingOptions options) const -
1381{ -
1382 if (!d) return QString();
executed: return QString();
Execution Count:2
evaluated: !d
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:90
2-90
1383 -
1384 QString result; -
1385 d->appendQuery(result, options, QUrlPrivate::Query); -
1386 if (d->hasQuery() && result.isNull())
evaluated: d->hasQuery()
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:22
evaluated: result.isNull()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:66
2-68
1387 result.detach();
executed: result.detach();
Execution Count:2
2
1388 return result;
executed: return result;
Execution Count:90
90
1389} -
1390void QUrl::setFragment(const QString &fragment, ParsingMode mode) -
1391{ -
1392 detach(); -
1393 d->clearError(); -
1394 -
1395 QString data = fragment; -
1396 if (mode == DecodedMode) {
evaluated: mode == DecodedMode
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1339
1-1339
1397 parseDecodedComponent(data); -
1398 mode = TolerantMode; -
1399 }
executed: }
Execution Count:1
1
1400 -
1401 d->setFragment(data, 0, data.length()); -
1402 if (fragment.isNull())
evaluated: fragment.isNull()
TRUEFALSE
yes
Evaluation Count:691
yes
Evaluation Count:649
649-691
1403 d->sectionIsPresent &= ~QUrlPrivate::Fragment;
executed: d->sectionIsPresent &= ~QUrlPrivate::Fragment;
Execution Count:691
691
1404 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Fragment, fragment))
evaluated: mode == StrictMode
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:647
partially evaluated: !d->validateComponent(QUrlPrivate::Fragment, fragment)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-647
1405 d->fragment.clear();
executed: d->fragment.clear();
Execution Count:2
2
1406} -
1407QString QUrl::fragment(ComponentFormattingOptions options) const -
1408{ -
1409 if (!d) return QString();
executed: return QString();
Execution Count:2
evaluated: !d
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:131
2-131
1410 -
1411 QString result; -
1412 d->appendFragment(result, options); -
1413 if (d->hasFragment() && result.isNull())
evaluated: d->hasFragment()
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:67
evaluated: result.isNull()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:62
2-67
1414 result.detach();
executed: result.detach();
Execution Count:2
2
1415 return result;
executed: return result;
Execution Count:131
131
1416} -
1417bool QUrl::hasFragment() const -
1418{ -
1419 if (!d) return false;
never executed: return false;
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:62
0-62
1420 return d->hasFragment();
executed: return d->hasFragment();
Execution Count:62
62
1421} -
1422QString QUrl::topLevelDomain(ComponentFormattingOptions options) const -
1423{ -
1424 QString tld = qTopLevelDomain(host()); -
1425 if (options & EncodeUnicode) {
partially evaluated: options & EncodeUnicode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
1426 return qt_ACE_do(tld, ToAceOnly);
never executed: return qt_ACE_do(tld, ToAceOnly);
0
1427 } -
1428 return tld;
executed: return tld;
Execution Count:9
9
1429} -
1430QUrl QUrl::resolved(const QUrl &relative) const -
1431{ -
1432 if (!d) return relative;
executed: return relative;
Execution Count:24
evaluated: !d
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:4452
24-4452
1433 if (!relative.d) return *this;
never executed: return *this;
partially evaluated: !relative.d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4458
0-4458
1434 -
1435 QUrl t; -
1436 -
1437 if (!relative.d->scheme.isEmpty() && relative.d->scheme != d->scheme) {
evaluated: !relative.d->scheme.isEmpty()
TRUEFALSE
yes
Evaluation Count:1071
yes
Evaluation Count:3385
evaluated: relative.d->scheme != d->scheme
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1068
6-3385
1438 t = relative; -
1439 t.detach(); -
1440 } else {
executed: }
Execution Count:6
6
1441 if (relative.d->hasAuthority()) {
evaluated: relative.d->hasAuthority()
TRUEFALSE
yes
Evaluation Count:1039
yes
Evaluation Count:3414
1039-3414
1442 t = relative; -
1443 t.detach(); -
1444 } else {
executed: }
Execution Count:1046
1046
1445 t.d = new QUrlPrivate; -
1446 -
1447 -
1448 t.d->userName = d->userName; -
1449 t.d->password = d->password; -
1450 t.d->host = d->host; -
1451 t.d->port = d->port; -
1452 t.d->sectionIsPresent = d->sectionIsPresent & QUrlPrivate::Authority; -
1453 -
1454 if (relative.d->path.isEmpty()) {
evaluated: relative.d->path.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3407
5-3407
1455 t.d->path = d->path; -
1456 if (relative.d->hasQuery()) {
evaluated: relative.d->hasQuery()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
1457 t.d->query = relative.d->query; -
1458 t.d->sectionIsPresent |= QUrlPrivate::Query; -
1459 } else if (d->hasQuery()) {
executed: }
Execution Count:1
evaluated: d->hasQuery()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
1-2
1460 t.d->query = d->query; -
1461 t.d->sectionIsPresent |= QUrlPrivate::Query; -
1462 }
executed: }
Execution Count:2
2
1463 } else { -
1464 t.d->path = relative.d->path.startsWith(QLatin1Char('/'))
evaluated: relative.d->path.startsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:3371
36-3371
1465 ? relative.d->path -
1466 : d->mergePaths(relative.d->path); -
1467 if (relative.d->hasQuery()) {
evaluated: relative.d->hasQuery()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:3385
24-3385
1468 t.d->query = relative.d->query; -
1469 t.d->sectionIsPresent |= QUrlPrivate::Query; -
1470 }
executed: }
Execution Count:24
24
1471 }
executed: }
Execution Count:3406
3406
1472 } -
1473 t.d->scheme = d->scheme; -
1474 if (d->hasScheme())
evaluated: d->hasScheme()
TRUEFALSE
yes
Evaluation Count:4453
yes
Evaluation Count:11
11-4453
1475 t.d->sectionIsPresent |= QUrlPrivate::Scheme;
executed: t.d->sectionIsPresent |= QUrlPrivate::Scheme;
Execution Count:4452
4452
1476 else -
1477 t.d->sectionIsPresent &= ~QUrlPrivate::Scheme;
executed: t.d->sectionIsPresent &= ~QUrlPrivate::Scheme;
Execution Count:11
11
1478 } -
1479 t.d->fragment = relative.d->fragment; -
1480 if (relative.d->hasFragment())
evaluated: relative.d->hasFragment()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4458
10-4458
1481 t.d->sectionIsPresent |= QUrlPrivate::Fragment;
executed: t.d->sectionIsPresent |= QUrlPrivate::Fragment;
Execution Count:10
10
1482 else -
1483 t.d->sectionIsPresent &= ~QUrlPrivate::Fragment;
executed: t.d->sectionIsPresent &= ~QUrlPrivate::Fragment;
Execution Count:4454
4454
1484 -
1485 removeDotsFromPath(&t.d->path); -
1486 -
1487 -
1488 -
1489 -
1490 -
1491 -
1492 -
1493 return t;
executed: return t;
Execution Count:4455
4455
1494} -
1495bool QUrl::isRelative() const -
1496{ -
1497 if (!d) return true;
executed: return true;
Execution Count:3
evaluated: !d
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:230
3-230
1498 return !d->hasScheme();
executed: return !d->hasScheme();
Execution Count:230
230
1499} -
1500QString QUrl::url(FormattingOptions options) const -
1501{ -
1502 return toString(options);
executed: return toString(options);
Execution Count:43
43
1503} -
1504QString QUrl::toString(FormattingOptions options) const -
1505{ -
1506 if (!isValid()) {
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:6162
94-6162
1507 -
1508 return QString();
executed: return QString();
Execution Count:94
94
1509 } -
1510 if (options == QUrl::FullyDecoded) {
partially evaluated: options == QUrl::FullyDecoded
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6162
0-6162
1511 QMessageLogger("io/qurl.cpp", 3119, __PRETTY_FUNCTION__).warning("QUrl: QUrl::FullyDecoded is not permitted when reconstructing the full URL"); -
1512 options = QUrl::PrettyDecoded; -
1513 }
never executed: }
0
1514 if (options.testFlag(QUrl::PreferLocalFile) && !options.testFlag(QUrl::RemovePath)
evaluated: options.testFlag(QUrl::PreferLocalFile)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6156
partially evaluated: !options.testFlag(QUrl::RemovePath)
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6156
1515 && (!d->hasQuery() || options.testFlag(QUrl::RemoveQuery))
partially evaluated: !d->hasQuery()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
never evaluated: options.testFlag(QUrl::RemoveQuery)
0-6
1516 && (!d->hasFragment() || options.testFlag(QUrl::RemoveFragment))
evaluated: !d->hasFragment()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
partially evaluated: options.testFlag(QUrl::RemoveFragment)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-5
1517 && isLocalFile()) {
evaluated: isLocalFile()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
1518 return path(options);
executed: return path(options);
Execution Count:3
3
1519 } -
1520 -
1521 QString url; -
1522 -
1523 -
1524 if (options & DecodeReserved)
evaluated: options & DecodeReserved
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:6134
25-6134
1525 options &= ~EncodeReserved;
executed: options &= ~EncodeReserved;
Execution Count:25
25
1526 else -
1527 options |= EncodeReserved;
executed: options |= EncodeReserved;
Execution Count:6134
6134
1528 -
1529 if (!(options & QUrl::RemoveScheme) && d->hasScheme())
evaluated: !(options & QUrl::RemoveScheme)
TRUEFALSE
yes
Evaluation Count:5154
yes
Evaluation Count:1006
evaluated: d->hasScheme()
TRUEFALSE
yes
Evaluation Count:4962
yes
Evaluation Count:194
194-5154
1530 url += d->scheme + QLatin1Char(':');
executed: url += d->scheme + QLatin1Char(':');
Execution Count:4961
4961
1531 -
1532 bool pathIsAbsolute = d->path.startsWith(QLatin1Char('/')); -
1533 if (!((options & QUrl::RemoveAuthority) == QUrl::RemoveAuthority) && d->hasAuthority()) {
evaluated: !((options & QUrl::RemoveAuthority) == QUrl::RemoveAuthority)
TRUEFALSE
yes
Evaluation Count:5184
yes
Evaluation Count:977
evaluated: d->hasAuthority()
TRUEFALSE
yes
Evaluation Count:4322
yes
Evaluation Count:860
860-5184
1534 url += QLatin1String("//"); -
1535 d->appendAuthority(url, options, QUrlPrivate::FullUrl); -
1536 } else if (isLocalFile() && pathIsAbsolute) {
executed: }
Execution Count:4320
evaluated: isLocalFile()
TRUEFALSE
yes
Evaluation Count:593
yes
Evaluation Count:1244
evaluated: pathIsAbsolute
TRUEFALSE
yes
Evaluation Count:360
yes
Evaluation Count:233
233-4320
1537 url += QLatin1String("//"); -
1538 }
executed: }
Execution Count:360
360
1539 -
1540 if (!(options & QUrl::RemovePath)) {
evaluated: !(options & QUrl::RemovePath)
TRUEFALSE
yes
Evaluation Count:4778
yes
Evaluation Count:1378
1378-4778
1541 d->appendPath(url, options, QUrlPrivate::FullUrl); -
1542 -
1543 if ((options & StripTrailingSlash) && !d->path.isEmpty() && d->path != QLatin1String("/") && url.endsWith(QLatin1Char('/')))
evaluated: (options & StripTrailingSlash)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4770
evaluated: !d->path.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
evaluated: d->path != QLatin1String("/")
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
evaluated: url.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4770
1544 url.chop(1);
executed: url.chop(1);
Execution Count:4
4
1545 }
executed: }
Execution Count:4776
4776
1546 -
1547 if (!(options & QUrl::RemoveQuery) && d->hasQuery()) {
evaluated: !(options & QUrl::RemoveQuery)
TRUEFALSE
yes
Evaluation Count:4772
yes
Evaluation Count:1386
evaluated: d->hasQuery()
TRUEFALSE
yes
Evaluation Count:391
yes
Evaluation Count:4380
391-4772
1548 url += QLatin1Char('?'); -
1549 d->appendQuery(url, options, QUrlPrivate::FullUrl); -
1550 }
executed: }
Execution Count:391
391
1551 if (!(options & QUrl::RemoveFragment) && d->hasFragment()) {
evaluated: !(options & QUrl::RemoveFragment)
TRUEFALSE
yes
Evaluation Count:4334
yes
Evaluation Count:1823
evaluated: d->hasFragment()
TRUEFALSE
yes
Evaluation Count:764
yes
Evaluation Count:3570
764-4334
1552 url += QLatin1Char('#'); -
1553 d->appendFragment(url, options); -
1554 }
executed: }
Execution Count:764
764
1555 -
1556 return url;
executed: return url;
Execution Count:6157
6157
1557} -
1558QString QUrl::toDisplayString(FormattingOptions options) const -
1559{ -
1560 return toString(options | RemovePassword);
executed: return toString(options | RemovePassword);
Execution Count:11
11
1561} -
1562QByteArray QUrl::toEncoded(FormattingOptions options) const -
1563{ -
1564 options &= ~(FullyDecoded | FullyEncoded); -
1565 QString stringForm = toString(options | FullyEncoded); -
1566 return stringForm.toLatin1();
executed: return stringForm.toLatin1();
Execution Count:3802
3802
1567} -
1568QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode) -
1569{ -
1570 return QUrl(QString::fromUtf8(input.constData(), input.size()), mode);
executed: return QUrl(QString::fromUtf8(input.constData(), input.size()), mode);
Execution Count:245
245
1571} -
1572 -
1573 -
1574 -
1575 -
1576 -
1577QString QUrl::fromPercentEncoding(const QByteArray &input) -
1578{ -
1579 QByteArray ba = QByteArray::fromPercentEncoding(input); -
1580 return QString::fromUtf8(ba, ba.size());
executed: return QString::fromUtf8(ba, ba.size());
Execution Count:14
14
1581} -
1582QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclude, const QByteArray &include) -
1583{ -
1584 return input.toUtf8().toPercentEncoding(exclude, include);
executed: return input.toUtf8().toPercentEncoding(exclude, include);
Execution Count:13
13
1585} -
1586 -
1587 -
1588 -
1589 -
1590 -
1591 -
1592 -
1593QString QUrl::fromEncodedComponent_helper(const QByteArray &ba) -
1594{ -
1595 return qt_urlRecodeByteArray(ba);
executed: return qt_urlRecodeByteArray(ba);
Execution Count:37
37
1596} -
1597QString QUrl::fromAce(const QByteArray &domain) -
1598{ -
1599 return qt_ACE_do(QString::fromLatin1(domain), NormalizeAce);
executed: return qt_ACE_do(QString::fromLatin1(domain), NormalizeAce);
Execution Count:153
153
1600} -
1601QByteArray QUrl::toAce(const QString &domain) -
1602{ -
1603 QString result = qt_ACE_do(domain, ToAceOnly); -
1604 return result.toLatin1();
executed: return result.toLatin1();
Execution Count:1233
1233
1605} -
1606 -
1607 -
1608 -
1609 -
1610 -
1611 -
1612 -
1613bool QUrl::operator <(const QUrl &url) const -
1614{ -
1615 if (!d || !url.d) {
evaluated: !d
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:139
evaluated: !url.d
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:131
8-139
1616 bool thisIsEmpty = !d || d->isEmpty();
evaluated: !d
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:8
evaluated: d->isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-18
1617 bool thatIsEmpty = !url.d || url.d->isEmpty();
evaluated: !url.d
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:9
evaluated: url.d->isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-17
1618 -
1619 -
1620 return thisIsEmpty && !thatIsEmpty;
executed: return thisIsEmpty && !thatIsEmpty;
Execution Count:26
26
1621 } -
1622 -
1623 int cmp; -
1624 cmp = d->scheme.compare(url.d->scheme); -
1625 if (cmp != 0)
evaluated: cmp != 0
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:114
17-114
1626 return cmp < 0;
executed: return cmp < 0;
Execution Count:17
17
1627 -
1628 cmp = d->userName.compare(url.d->userName); -
1629 if (cmp != 0)
partially evaluated: cmp != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:114
0-114
1630 return cmp < 0;
never executed: return cmp < 0;
0
1631 -
1632 cmp = d->password.compare(url.d->password); -
1633 if (cmp != 0)
partially evaluated: cmp != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:114
0-114
1634 return cmp < 0;
never executed: return cmp < 0;
0
1635 -
1636 cmp = d->host.compare(url.d->host); -
1637 if (cmp != 0)
partially evaluated: cmp != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:114
0-114
1638 return cmp < 0;
never executed: return cmp < 0;
0
1639 -
1640 if (d->port != url.d->port)
evaluated: d->port != url.d->port
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:106
8-106
1641 return d->port < url.d->port;
executed: return d->port < url.d->port;
Execution Count:8
8
1642 -
1643 cmp = d->path.compare(url.d->path); -
1644 if (cmp != 0)
evaluated: cmp != 0
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:85
21-85
1645 return cmp < 0;
executed: return cmp < 0;
Execution Count:21
21
1646 -
1647 if (d->hasQuery() != url.d->hasQuery())
evaluated: d->hasQuery() != url.d->hasQuery()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:77
8-77
1648 return url.d->hasQuery();
executed: return url.d->hasQuery();
Execution Count:8
8
1649 -
1650 cmp = d->query.compare(url.d->query); -
1651 if (cmp != 0)
evaluated: cmp != 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:76
1-76
1652 return cmp < 0;
executed: return cmp < 0;
Execution Count:1
1
1653 -
1654 if (d->hasFragment() != url.d->hasFragment())
evaluated: d->hasFragment() != url.d->hasFragment()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:68
8-68
1655 return url.d->hasFragment();
executed: return url.d->hasFragment();
Execution Count:8
8
1656 -
1657 cmp = d->fragment.compare(url.d->fragment); -
1658 return cmp < 0;
executed: return cmp < 0;
Execution Count:68
68
1659} -
1660 -
1661 -
1662 -
1663 -
1664 -
1665bool QUrl::operator ==(const QUrl &url) const -
1666{ -
1667 if (!d && !url.d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:2221
evaluated: !url.d
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:113
100-2221
1668 return true;
executed: return true;
Execution Count:100
100
1669 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:2221
113-2221
1670 return url.d->isEmpty();
executed: return url.d->isEmpty();
Execution Count:113
113
1671 if (!url.d)
evaluated: !url.d
TRUEFALSE
yes
Evaluation Count:328
yes
Evaluation Count:1893
328-1893
1672 return d->isEmpty();
executed: return d->isEmpty();
Execution Count:328
328
1673 -
1674 -
1675 -
1676 const int mask = QUrlPrivate::FullUrl & ~QUrlPrivate::Host; -
1677 return (d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask) && 1893
1678 d->scheme == url.d->scheme && 1893
1679 d->userName == url.d->userName && 1893
1680 d->password == url.d->password && 1893
1681 d->host == url.d->host && 1893
1682 d->port == url.d->port && 1893
1683 d->path == url.d->path && 1893
1684 d->query == url.d->query && 1893
1685 d->fragment == url.d->fragment;
executed: return (d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask) && d->scheme == url.d->scheme && d->userName == url.d->userName && d->password == url.d->password && d->host == url.d->host && d->port == url.d->port && d->path == url.d->path && d->query == url.d->query && d->fragment == url.d->fragment;
Execution Count:1893
1893
1686} -
1687 -
1688 -
1689 -
1690 -
1691 -
1692bool QUrl::operator !=(const QUrl &url) const -
1693{ -
1694 return !(*this == url);
executed: return !(*this == url);
Execution Count:100
100
1695} -
1696 -
1697 -
1698 -
1699 -
1700QUrl &QUrl::operator =(const QUrl &url) -
1701{ -
1702 if (!d) {
evaluated: !d
TRUEFALSE
yes
Evaluation Count:5742
yes
Evaluation Count:332
332-5742
1703 if (url.d) {
evaluated: url.d
TRUEFALSE
yes
Evaluation Count:4779
yes
Evaluation Count:960
960-4779
1704 url.d->ref.ref(); -
1705 d = url.d; -
1706 }
executed: }
Execution Count:4805
4805
1707 } else {
executed: }
Execution Count:5766
5766
1708 if (url.d)
partially evaluated: url.d
TRUEFALSE
yes
Evaluation Count:332
no
Evaluation Count:0
0-332
1709 qAtomicAssign(d, url.d);
executed: qAtomicAssign(d, url.d);
Execution Count:332
332
1710 else -
1711 clear();
never executed: clear();
0
1712 } -
1713 return *this;
executed: return *this;
Execution Count:6098
6098
1714} -
1715 -
1716 -
1717 -
1718 -
1719QUrl &QUrl::operator =(const QString &url) -
1720{ -
1721 if (url.isEmpty()) {
partially evaluated: url.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
1722 clear(); -
1723 } else {
never executed: }
0
1724 detach(); -
1725 d->parse(url, TolerantMode); -
1726 }
executed: }
Execution Count:10
10
1727 return *this;
executed: return *this;
Execution Count:10
10
1728} -
1729void QUrl::detach() -
1730{ -
1731 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:11257
yes
Evaluation Count:15639
11257-15639
1732 d = new QUrlPrivate;
executed: d = new QUrlPrivate;
Execution Count:11257
11257
1733 else -
1734 qAtomicDetach(d);
executed: qAtomicDetach(d);
Execution Count:15637
15637
1735} -
1736 -
1737 -
1738 -
1739 -
1740bool QUrl::isDetached() const -
1741{ -
1742 return !d || d->ref.load() == 1;
never executed: return !d || d->ref.load() == 1;
0
1743} -
1744QUrl QUrl::fromLocalFile(const QString &localFile) -
1745{ -
1746 QUrl url; -
1747 url.setScheme(fileScheme()); -
1748 QString deslashified = QDir::fromNativeSeparators(localFile); -
1749 -
1750 -
1751 if (deslashified.length() > 1 && deslashified.at(1) == QLatin1Char(':') && deslashified.at(0) != QLatin1Char('/')) {
evaluated: deslashified.length() > 1
TRUEFALSE
yes
Evaluation Count:1513
yes
Evaluation Count:526
evaluated: deslashified.at(1) == QLatin1Char(':')
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1512
partially evaluated: deslashified.at(0) != QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1513
1752 deslashified.prepend(QLatin1Char('/')); -
1753 } else if (deslashified.startsWith(QLatin1String("//"))) {
executed: }
Execution Count:1
evaluated: deslashified.startsWith(QLatin1String("//"))
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2035
1-2035
1754 -
1755 int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2); -
1756 url.setHost(deslashified.mid(2, indexOfPath - 2)); -
1757 if (indexOfPath > 2)
evaluated: indexOfPath > 2
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1758 deslashified = deslashified.right(deslashified.length() - indexOfPath);
executed: deslashified = deslashified.right(deslashified.length() - indexOfPath);
Execution Count:2
2
1759 else -
1760 deslashified.clear();
executed: deslashified.clear();
Execution Count:1
1
1761 } -
1762 -
1763 url.setPath(deslashified, DecodedMode); -
1764 return url;
executed: return url;
Execution Count:2039
2039
1765} -
1766QString QUrl::toLocalFile() const -
1767{ -
1768 -
1769 if (!isLocalFile())
evaluated: !isLocalFile()
TRUEFALSE
yes
Evaluation Count:1035
yes
Evaluation Count:6315
1035-6315
1770 return QString();
executed: return QString();
Execution Count:1035
1035
1771 -
1772 QString tmp; -
1773 QString ourPath = path(QUrl::FullyDecoded); -
1774 -
1775 -
1776 if (!d->host.isEmpty()) {
evaluated: !d->host.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6311
4-6311
1777 tmp = QString::fromUtf8("" "//" "", sizeof("//") - 1) + host() + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/')
evaluated: ourPath.length() > 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
evaluated: ourPath.at(0) != QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-3
1778 ? QLatin1Char('/') + ourPath : ourPath); -
1779 } else {
executed: }
Execution Count:4
4
1780 tmp = ourPath; -
1781 -
1782 -
1783 -
1784 -
1785 -
1786 }
executed: }
Execution Count:6311
6311
1787 return tmp;
executed: return tmp;
Execution Count:6315
6315
1788} -
1789bool QUrl::isLocalFile() const -
1790{ -
1791 if (!d) return false;
executed: return false;
Execution Count:3
evaluated: !d
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10129
3-10129
1792 -
1793 if (d->scheme != fileScheme())
evaluated: d->scheme != fileScheme()
TRUEFALSE
yes
Evaluation Count:3104
yes
Evaluation Count:7030
3104-7030
1794 return false;
executed: return false;
Execution Count:3102
3102
1795 return true;
executed: return true;
Execution Count:7030
7030
1796} -
1797 -
1798 -
1799 -
1800 -
1801 -
1802 -
1803bool QUrl::isParentOf(const QUrl &childUrl) const -
1804{ -
1805 QString childPath = childUrl.path(); -
1806 -
1807 if (!d)
partially evaluated: !d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1808 return ((childUrl.scheme().isEmpty()) 0
1809 && (childUrl.authority().isEmpty()) 0
1810 && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
never executed: return ((childUrl.scheme().isEmpty()) && (childUrl.authority().isEmpty()) && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
0
1811 -
1812 QString ourPath = path(); -
1813 -
1814 return ((childUrl.scheme().isEmpty() || d->scheme == childUrl.scheme()) 5
1815 && (childUrl.authority().isEmpty() || authority() == childUrl.authority()) 5
1816 && childPath.startsWith(ourPath) 5
1817 && ((ourPath.endsWith(QLatin1Char('/')) && childPath.length() > ourPath.length()) 5
1818 || (!ourPath.endsWith(QLatin1Char('/')) 5
1819 && childPath.length() > ourPath.length() && childPath.at(ourPath.length()) == QLatin1Char('/'))));
executed: return ((childUrl.scheme().isEmpty() || d->scheme == childUrl.scheme()) && (childUrl.authority().isEmpty() || authority() == childUrl.authority()) && childPath.startsWith(ourPath) && ((ourPath.endsWith(QLatin1Char('/')) && childPath.length() > ourPath.length()) || (!ourPath.endsWith(QLatin1Char('/')) && childPath.length() > ourPath.length() && childPath.at(ourPath.length()) == QLatin1Char('/'))));
Execution Count:5
5
1820} -
1821QDataStream &operator<<(QDataStream &out, const QUrl &url) -
1822{ -
1823 QByteArray u; -
1824 if (url.isValid())
evaluated: url.isValid()
TRUEFALSE
yes
Evaluation Count:474
yes
Evaluation Count:5
5-474
1825 u = url.toEncoded();
executed: u = url.toEncoded();
Execution Count:474
474
1826 out << u; -
1827 return out;
executed: return out;
Execution Count:479
479
1828} -
1829QDataStream &operator>>(QDataStream &in, QUrl &url) -
1830{ -
1831 QByteArray u; -
1832 in >> u; -
1833 url.setUrl(QString::fromLatin1(u)); -
1834 return in;
executed: return in;
Execution Count:309
309
1835} -
1836 -
1837 -
1838 -
1839QDebug operator<<(QDebug d, const QUrl &url) -
1840{ -
1841 d.maybeSpace() << "QUrl(" << url.toDisplayString() << ')'; -
1842 return d.space();
executed: return d.space();
Execution Count:1
1
1843} -
1844 -
1845 -
1846static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, int errorPosition) -
1847{ -
1848 QChar c = uint(errorPosition) < uint(errorSource.length()) ?
evaluated: uint(errorPosition) < uint(errorSource.length())
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:24
24-88
1849 errorSource.at(errorPosition) : QChar(QChar::Null); -
1850 -
1851 switch (errorCode) { -
1852 case QUrlPrivate::NoError: -
1853 qt_noop(); -
1854 -
1855 do { qt_noop(); qt_noop(); } while (0);
never executed: }
never evaluated: 0
0
1856 return QString();
never executed: return QString();
0
1857 -
1858 case QUrlPrivate::InvalidSchemeError: { -
1859 QString msg = QString::fromUtf8("" "Invalid scheme (character '%1' not permitted)" "", sizeof("Invalid scheme (character '%1' not permitted)") - 1); -
1860 return msg.arg(c);
never executed: return msg.arg(c);
0
1861 } -
1862 -
1863 case QUrlPrivate::InvalidUserNameError: -
1864 return QString(QString::fromUtf8("" "Invalid user name (character '%1' not permitted)" "", sizeof("Invalid user name (character '%1' not permitted)") - 1)) 10
1865 .arg(c);
executed: return QString(QString::fromUtf8("" "Invalid user name (character '%1' not permitted)" "", sizeof("Invalid user name (character '%1' not permitted)") - 1)) .arg(c);
Execution Count:10
10
1866 -
1867 case QUrlPrivate::InvalidPasswordError: -
1868 return QString(QString::fromUtf8("" "Invalid password (character '%1' not permitted)" "", sizeof("Invalid password (character '%1' not permitted)") - 1)) 5
1869 .arg(c);
executed: return QString(QString::fromUtf8("" "Invalid password (character '%1' not permitted)" "", sizeof("Invalid password (character '%1' not permitted)") - 1)) .arg(c);
Execution Count:5
5
1870 -
1871 case QUrlPrivate::InvalidRegNameError: -
1872 if (errorPosition != -1)
partially evaluated: errorPosition != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1873 return QString(QString::fromUtf8("" "Invalid hostname (character '%1' not permitted)" "", sizeof("Invalid hostname (character '%1' not permitted)") - 1)) 0
1874 .arg(c);
never executed: return QString(QString::fromUtf8("" "Invalid hostname (character '%1' not permitted)" "", sizeof("Invalid hostname (character '%1' not permitted)") - 1)) .arg(c);
0
1875 else -
1876 return QString::fromUtf8("" "Invalid hostname (contains invalid characters)" "", sizeof("Invalid hostname (contains invalid characters)") - 1);
executed: return QString::fromUtf8("" "Invalid hostname (contains invalid characters)" "", sizeof("Invalid hostname (contains invalid characters)") - 1);
Execution Count:14
14
1877 case QUrlPrivate::InvalidIPv4AddressError: -
1878 return QString();
never executed: return QString();
0
1879 case QUrlPrivate::InvalidIPv6AddressError: -
1880 return QString::fromUtf8("" "Invalid IPv6 address" "", sizeof("Invalid IPv6 address") - 1);
executed: return QString::fromUtf8("" "Invalid IPv6 address" "", sizeof("Invalid IPv6 address") - 1);
Execution Count:5
5
1881 case QUrlPrivate::InvalidIPvFutureError: -
1882 return QString::fromUtf8("" "Invalid IPvFuture address" "", sizeof("Invalid IPvFuture address") - 1);
executed: return QString::fromUtf8("" "Invalid IPvFuture address" "", sizeof("Invalid IPvFuture address") - 1);
Execution Count:15
15
1883 case QUrlPrivate::HostMissingEndBracket: -
1884 return QString::fromUtf8("" "Expected ']' to match '[' in hostname" "", sizeof("Expected ']' to match '[' in hostname") - 1);
executed: return QString::fromUtf8("" "Expected ']' to match '[' in hostname" "", sizeof("Expected ']' to match '[' in hostname") - 1);
Execution Count:5
5
1885 -
1886 case QUrlPrivate::InvalidPortError: -
1887 return QString::fromUtf8("" "Invalid port or port number out of range" "", sizeof("Invalid port or port number out of range") - 1);
executed: return QString::fromUtf8("" "Invalid port or port number out of range" "", sizeof("Invalid port or port number out of range") - 1);
Execution Count:21
21
1888 case QUrlPrivate::PortEmptyError: -
1889 return QString::fromUtf8("" "Port field was empty" "", sizeof("Port field was empty") - 1);
executed: return QString::fromUtf8("" "Port field was empty" "", sizeof("Port field was empty") - 1);
Execution Count:10
10
1890 -
1891 case QUrlPrivate::InvalidPathError: -
1892 return QString(QString::fromUtf8("" "Invalid path (character '%1' not permitted)" "", sizeof("Invalid path (character '%1' not permitted)") - 1)) 10
1893 .arg(c);
executed: return QString(QString::fromUtf8("" "Invalid path (character '%1' not permitted)" "", sizeof("Invalid path (character '%1' not permitted)") - 1)) .arg(c);
Execution Count:10
10
1894 -
1895 case QUrlPrivate::InvalidQueryError: -
1896 return QString(QString::fromUtf8("" "Invalid query (character '%1' not permitted)" "", sizeof("Invalid query (character '%1' not permitted)") - 1)) 5
1897 .arg(c);
executed: return QString(QString::fromUtf8("" "Invalid query (character '%1' not permitted)" "", sizeof("Invalid query (character '%1' not permitted)") - 1)) .arg(c);
Execution Count:5
5
1898 -
1899 case QUrlPrivate::InvalidFragmentError: -
1900 return QString(QString::fromUtf8("" "Invalid fragment (character '%1' not permitted)" "", sizeof("Invalid fragment (character '%1' not permitted)") - 1)) 5
1901 .arg(c);
executed: return QString(QString::fromUtf8("" "Invalid fragment (character '%1' not permitted)" "", sizeof("Invalid fragment (character '%1' not permitted)") - 1)) .arg(c);
Execution Count:5
5
1902 -
1903 case QUrlPrivate::AuthorityPresentAndPathIsRelative: -
1904 return QString::fromUtf8("" "Path component is relative and authority is present" "", sizeof("Path component is relative and authority is present") - 1);
executed: return QString::fromUtf8("" "Path component is relative and authority is present" "", sizeof("Path component is relative and authority is present") - 1);
Execution Count:1
1
1905 case QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash: -
1906 return QString::fromUtf8("" "Relative URL's path component contains ':' before any '/'" "", sizeof("Relative URL's path component contains ':' before any '/'") - 1);
executed: return QString::fromUtf8("" "Relative URL's path component contains ':' before any '/'" "", sizeof("Relative URL's path component contains ':' before any '/'") - 1);
Execution Count:6
6
1907 } -
1908 -
1909 qt_noop(); -
1910 do { qt_noop(); qt_noop(); } while (0);
never executed: }
never evaluated: 0
0
1911 return QString();
never executed: return QString();
0
1912} -
1913 -
1914static inline void appendComponentIfPresent(QString &msg, bool present, const char *componentName, -
1915 const QString &component) -
1916{ -
1917 if (present) {
evaluated: present
TRUEFALSE
yes
Evaluation Count:216
yes
Evaluation Count:568
216-568
1918 msg += QLatin1String(componentName); -
1919 msg += QLatin1Char('"'); -
1920 msg += component; -
1921 msg += QLatin1String("\","); -
1922 }
executed: }
Execution Count:216
216
1923}
executed: }
Execution Count:784
784
1924QString QUrl::errorString() const -
1925{ -
1926 if (!d)
evaluated: !d
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:114
22-114
1927 return QString();
executed: return QString();
Execution Count:22
22
1928 -
1929 QString errorSource; -
1930 int errorPosition; -
1931 QUrlPrivate::ErrorCode errorCode = d->validityError(&errorSource, &errorPosition); -
1932 if (errorCode == QUrlPrivate::NoError)
evaluated: errorCode == QUrlPrivate::NoError
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:112
2-112
1933 return QString();
executed: return QString();
Execution Count:2
2
1934 -
1935 QString msg = errorMessage(errorCode, errorSource, errorPosition); -
1936 msg += QLatin1String("; source was \""); -
1937 msg += errorSource; -
1938 msg += QLatin1String("\";"); -
1939 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Scheme, -
1940 " scheme = ", d->scheme); -
1941 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::UserInfo, -
1942 " userinfo = ", userInfo()); -
1943 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Host, -
1944 " host = ", d->host); -
1945 appendComponentIfPresent(msg, d->port != -1, -
1946 " port = ", QString::number(d->port)); -
1947 appendComponentIfPresent(msg, !d->path.isEmpty(), -
1948 " path = ", d->path); -
1949 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Query, -
1950 " query = ", d->query); -
1951 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Fragment, -
1952 " fragment = ", d->fragment); -
1953 if (msg.endsWith(QLatin1Char(',')))
evaluated: msg.endsWith(QLatin1Char(','))
TRUEFALSE
yes
Evaluation Count:111
yes
Evaluation Count:1
1-111
1954 msg.chop(1);
executed: msg.chop(1);
Execution Count:111
111
1955 return msg;
executed: return msg;
Execution Count:112
112
1956} -
1957uint qHash(const QUrl &url, uint seed) -
1958{ -
1959 if (!url.d)
evaluated: !url.d
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
3-7
1960 return qHash(-1, seed);
executed: return qHash(-1, seed);
Execution Count:3
3
1961 -
1962 return qHash(url.d->scheme) ^ 7
1963 qHash(url.d->userName) ^ 7
1964 qHash(url.d->password) ^ 7
1965 qHash(url.d->host) ^ 7
1966 qHash(url.d->port, seed) ^ 7
1967 qHash(url.d->path) ^ 7
1968 qHash(url.d->query) ^ 7
1969 qHash(url.d->fragment);
executed: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Execution Count:7
7
1970} -
1971 -
1972static QUrl adjustFtpPath(QUrl url) -
1973{ -
1974 if (url.scheme() == ftpScheme()) {
evaluated: url.scheme() == ftpScheme()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:24
3-24
1975 QString path = url.path(); -
1976 if (path.startsWith(QLatin1String("//")))
evaluated: path.startsWith(QLatin1String("//"))
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1977 url.setPath(QLatin1String("/%2F") + path.midRef(2));
executed: url.setPath(QLatin1String("/%2F") + path.midRef(2));
Execution Count:2
2
1978 }
executed: }
Execution Count:3
3
1979 return url;
executed: return url;
Execution Count:27
27
1980} -
1981QUrl QUrl::fromUserInput(const QString &userInput) -
1982{ -
1983 QString trimmedString = userInput.trimmed(); -
1984 -
1985 -
1986 if (QDir::isAbsolutePath(trimmedString))
evaluated: QDir::isAbsolutePath(trimmedString)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:28
7-28
1987 return QUrl::fromLocalFile(trimmedString);
executed: return QUrl::fromLocalFile(trimmedString);
Execution Count:7
7
1988 -
1989 QUrl url = QUrl(trimmedString, QUrl::TolerantMode); -
1990 QUrl urlPrepended = QUrl(QString::fromUtf8("" "http://" "", sizeof("http://") - 1) + trimmedString, QUrl::TolerantMode); -
1991 -
1992 -
1993 -
1994 -
1995 if (url.isValid()
evaluated: url.isValid()
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1
1-27
1996 && !url.scheme().isEmpty()
evaluated: !url.scheme().isEmpty()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:12
12-15
1997 && urlPrepended.port() == -1)
evaluated: urlPrepended.port() == -1
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3
3-12
1998 return adjustFtpPath(url);
executed: return adjustFtpPath(url);
Execution Count:12
12
1999 -
2000 -
2001 if (urlPrepended.isValid() && (!urlPrepended.host().isEmpty() || !urlPrepended.path().isEmpty()))
partially evaluated: urlPrepended.isValid()
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
evaluated: !urlPrepended.host().isEmpty()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
partially evaluated: !urlPrepended.path().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-16
2002 { -
2003 int dotIndex = trimmedString.indexOf(QLatin1Char('.')); -
2004 const QString hostscheme = trimmedString.left(dotIndex).toLower(); -
2005 if (hostscheme == ftpScheme())
evaluated: hostscheme == ftpScheme()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:13
2-13
2006 urlPrepended.setScheme(ftpScheme());
executed: urlPrepended.setScheme(ftpScheme());
Execution Count:2
2
2007 return adjustFtpPath(urlPrepended);
executed: return adjustFtpPath(urlPrepended);
Execution Count:15
15
2008 } -
2009 -
2010 return QUrl();
executed: return QUrl();
Execution Count:1
1
2011} -
2012 -
2013 -
2014 -
2015 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial