qurl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qurl.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41/*!-
42 \class QUrl-
43 \inmodule QtCore-
44-
45 \brief The QUrl class provides a convenient interface for working-
46 with URLs.-
47-
48 \reentrant-
49 \ingroup io-
50 \ingroup network-
51 \ingroup shared-
52-
53-
54 It can parse and construct URLs in both encoded and unencoded-
55 form. QUrl also has support for internationalized domain names-
56 (IDNs).-
57-
58 The most common way to use QUrl is to initialize it via the-
59 constructor by passing a QString. Otherwise, setUrl() can also-
60 be used.-
61-
62 URLs can be represented in two forms: encoded or unencoded. The-
63 unencoded representation is suitable for showing to users, but-
64 the encoded representation is typically what you would send to-
65 a web server. For example, the unencoded URL-
66 "http://bühler.example.com/List of applicants.xml"-
67 would be sent to the server as-
68 "http://xn--bhler-kva.example.com/List%20of%20applicants.xml".-
69-
70 A URL can also be constructed piece by piece by calling-
71 setScheme(), setUserName(), setPassword(), setHost(), setPort(),-
72 setPath(), setQuery() and setFragment(). Some convenience-
73 functions are also available: setAuthority() sets the user name,-
74 password, host and port. setUserInfo() sets the user name and-
75 password at once.-
76-
77 Call isValid() to check if the URL is valid. This can be done at any point-
78 during the constructing of a URL. If isValid() returns \c false, you should-
79 clear() the URL before proceeding, or start over by parsing a new URL with-
80 setUrl().-
81-
82 Constructing a query is particularly convenient through the use of the \l-
83 QUrlQuery class and its methods QUrlQuery::setQueryItems(),-
84 QUrlQuery::addQueryItem() and QUrlQuery::removeQueryItem(). Use-
85 QUrlQuery::setQueryDelimiters() to customize the delimiters used for-
86 generating the query string.-
87-
88 For the convenience of generating encoded URL strings or query-
89 strings, there are two static functions called-
90 fromPercentEncoding() and toPercentEncoding() which deal with-
91 percent encoding and decoding of QString objects.-
92-
93 Calling isRelative() will tell whether or not the URL is-
94 relative. A relative URL can be resolved by passing it as argument-
95 to resolved(), which returns an absolute URL. isParentOf() is used-
96 for determining whether one URL is a parent of another.-
97-
98 fromLocalFile() constructs a QUrl by parsing a local-
99 file path. toLocalFile() converts a URL to a local file path.-
100-
101 The human readable representation of the URL is fetched with-
102 toString(). This representation is appropriate for displaying a-
103 URL to a user in unencoded form. The encoded form however, as-
104 returned by toEncoded(), is for internal use, passing to web-
105 servers, mail clients and so on. Both forms are technically correct-
106 and represent the same URL unambiguously -- in fact, passing either-
107 form to QUrl's constructor or to setUrl() will yield the same QUrl-
108 object.-
109-
110 QUrl conforms to the URI specification from-
111 \l{RFC 3986} (Uniform Resource Identifier: Generic Syntax), and includes-
112 scheme extensions from \l{RFC 1738} (Uniform Resource Locators). Case-
113 folding rules in QUrl conform to \l{RFC 3491} (Nameprep: A Stringprep-
114 Profile for Internationalized Domain Names (IDN)). It is also compatible with the-
115 \l{http://freedesktop.org/wiki/Specifications/file-uri-spec/}{file URI specification}-
116 from freedesktop.org, provided that the locale encodes file names using-
117 UTF-8 (required by IDN).-
118-
119 \section2 Error checking-
120-
121 QUrl is capable of detecting many errors in URLs while parsing it or when-
122 components of the URL are set with individual setter methods (like-
123 setScheme(), setHost() or setPath()). If the parsing or setter function is-
124 successful, any previously recorded error conditions will be discarded.-
125-
126 By default, QUrl setter methods operate in QUrl::TolerantMode, which means-
127 they accept some common mistakes and mis-representation of data. An-
128 alternate method of parsing is QUrl::StrictMode, which applies further-
129 checks. See QUrl::ParsingMode for a description of the difference of the-
130 parsing modes.-
131-
132 QUrl only checks for conformance with the URL specification. It does not-
133 try to verify that high-level protocol URLs are in the format they are-
134 expected to be by handlers elsewhere. For example, the following URIs are-
135 all considered valid by QUrl, even if they do not make sense when used:-
136-
137 \list-
138 \li "http:/filename.html"-
139 \li "mailto://example.com"-
140 \endlist-
141-
142 When the parser encounters an error, it signals the event by making-
143 isValid() return false and toString() / toEncoded() return an empty string.-
144 If it is necessary to show the user the reason why the URL failed to parse,-
145 the error condition can be obtained from QUrl by calling errorString().-
146 Note that this message is highly technical and may not make sense to-
147 end-users.-
148-
149 QUrl is capable of recording only one error condition. If more than one-
150 error is found, it is undefined which error is reported.-
151-
152 \section2 Character Conversions-
153-
154 Follow these rules to avoid erroneous character conversion when-
155 dealing with URLs and strings:-
156-
157 \list-
158 \li When creating a QString to contain a URL from a QByteArray or a-
159 char*, always use QString::fromUtf8().-
160 \endlist-
161*/-
162-
163/*!-
164 \enum QUrl::ParsingMode-
165-
166 The parsing mode controls the way QUrl parses strings.-
167-
168 \value TolerantMode QUrl will try to correct some common errors in URLs.-
169 This mode is useful for parsing URLs coming from sources-
170 not known to be strictly standards-conforming.-
171-
172 \value StrictMode Only valid URLs are accepted. This mode is useful for-
173 general URL validation.-
174-
175 \value DecodedMode QUrl will interpret the URL component in the fully-decoded form,-
176 where percent characters stand for themselves, not as the beginning-
177 of a percent-encoded sequence. This mode is only valid for the-
178 setters setting components of a URL; it is not permitted in-
179 the QUrl constructor, in fromEncoded() or in setUrl().-
180 For more information on this mode, see the documentation for-
181 \l {QUrl::ComponentFormattingOption}{QUrl::FullyDecoded}.-
182-
183 In TolerantMode, the parser has the following behaviour:-
184-
185 \list-
186-
187 \li Spaces and "%20": unencoded space characters will be accepted and will-
188 be treated as equivalent to "%20".-
189-
190 \li Single "%" characters: Any occurrences of a percent character "%" not-
191 followed by exactly two hexadecimal characters (e.g., "13% coverage.html")-
192 will be replaced by "%25". Note that one lone "%" character will trigger-
193 the correction mode for all percent characters.-
194-
195 \li Reserved and unreserved characters: An encoded URL should only-
196 contain a few characters as literals; all other characters should-
197 be percent-encoded. In TolerantMode, these characters will be-
198 accepted if they are found in the URL:-
199 space / double-quote / "<" / ">" / "\" /-
200 "^" / "`" / "{" / "|" / "}"-
201 Those same characters can be decoded again by passing QUrl::DecodeReserved-
202 to toString() or toEncoded(). In the getters of individual components,-
203 those characters are often returned in decoded form.-
204-
205 \endlist-
206-
207 When in StrictMode, if a parsing error is found, isValid() will return \c-
208 false and errorString() will return a message describing the error.-
209 If more than one error is detected, it is undefined which error gets-
210 reported.-
211-
212 Note that TolerantMode is not usually enough for parsing user input, which-
213 often contains more errors and expectations than the parser can deal with.-
214 When dealing with data coming directly from the user -- as opposed to data-
215 coming from data-transfer sources, such as other programs -- it is-
216 recommended to use fromUserInput().-
217-
218 \sa fromUserInput(), setUrl(), toString(), toEncoded(), QUrl::FormattingOptions-
219*/-
220-
221/*!-
222 \enum QUrl::UrlFormattingOption-
223-
224 The formatting options define how the URL is formatted when written out-
225 as text.-
226-
227 \value None The format of the URL is unchanged.-
228 \value RemoveScheme The scheme is removed from the URL.-
229 \value RemovePassword Any password in the URL is removed.-
230 \value RemoveUserInfo Any user information in the URL is removed.-
231 \value RemovePort Any specified port is removed from the URL.-
232 \value RemoveAuthority-
233 \value RemovePath The URL's path is removed, leaving only the scheme,-
234 host address, and port (if present).-
235 \value RemoveQuery The query part of the URL (following a '?' character)-
236 is removed.-
237 \value RemoveFragment-
238 \value RemoveFilename The filename (i.e. everything after the last '/' in the path) is removed.-
239 The trailing '/' is kept, unless StripTrailingSlash is set.-
240 Only valid if RemovePath is not set.-
241 \value PreferLocalFile If the URL is a local file according to isLocalFile()-
242 and contains no query or fragment, a local file path is returned.-
243 \value StripTrailingSlash The trailing slash is removed if one is present.-
244 \value NormalizePathSegments Modifies the path to remove redundant directory separators,-
245 and to resolve "."s and ".."s (as far as possible).-
246-
247 Note that the case folding rules in \l{RFC 3491}{Nameprep}, which QUrl-
248 conforms to, require host names to always be converted to lower case,-
249 regardless of the Qt::FormattingOptions used.-
250-
251 The options from QUrl::ComponentFormattingOptions are also possible.-
252-
253 \sa QUrl::ComponentFormattingOptions-
254*/-
255-
256/*!-
257 \enum QUrl::ComponentFormattingOption-
258 \since 5.0-
259-
260 The component formatting options define how the components of an URL will-
261 be formatted when written out as text. They can be combined with the-
262 options from QUrl::FormattingOptions when used in toString() and-
263 toEncoded().-
264-
265 \value PrettyDecoded The component is returned in a "pretty form", with-
266 most percent-encoded characters decoded. The exact-
267 behavior of PrettyDecoded varies from component to-
268 component and may also change from Qt release to Qt-
269 release. This is the default.-
270-
271 \value EncodeSpaces Leave space characters in their encoded form ("%20").-
272-
273 \value EncodeUnicode Leave non-US-ASCII characters encoded in their UTF-8-
274 percent-encoded form (e.g., "%C3%A9" for the U+00E9-
275 codepoint, LATIN SMALL LETTER E WITH ACUTE).-
276-
277 \value EncodeDelimiters Leave certain delimiters in their encoded form, as-
278 would appear in the URL when the full URL is-
279 represented as text. The delimiters are affected-
280 by this option change from component to component.-
281 This flag has no effect in toString() or toEncoded().-
282-
283 \value EncodeReserved Leave US-ASCII characters not permitted in the URL by-
284 the specification in their encoded form. This is the-
285 default on toString() and toEncoded().-
286-
287 \value DecodeReserved Decode the US-ASCII characters that the URL specification-
288 does not allow to appear in the URL. This is the-
289 default on the getters of individual components.-
290-
291 \value FullyEncoded Leave all characters in their properly-encoded form,-
292 as this component would appear as part of a URL. When-
293 used with toString(), this produces a fully-compliant-
294 URL in QString form, exactly equal to the result of-
295 toEncoded()-
296-
297 \value FullyDecoded Attempt to decode as much as possible. For individual-
298 components of the URL, this decodes every percent-
299 encoding sequence, including control characters (U+0000-
300 to U+001F) and UTF-8 sequences found in percent-encoded form.-
301 Use of this mode may cause data loss, see below for more information.-
302-
303 The values of EncodeReserved and DecodeReserved should not be used together-
304 in one call. The behavior is undefined if that happens. They are provided-
305 as separate values because the behavior of the "pretty mode" with regards-
306 to reserved characters is different on certain components and specially on-
307 the full URL.-
308-
309 \section2 Full decoding-
310-
311 The FullyDecoded mode is similar to the behavior of the functions returning-
312 QString in Qt 4.x, in that every character represents itself and never has-
313 any special meaning. This is true even for the percent character ('%'),-
314 which should be interpreted to mean a literal percent, not the beginning of-
315 a percent-encoded sequence. The same actual character, in all other-
316 decoding modes, is represented by the sequence "%25".-
317-
318 Whenever re-applying data obtained with QUrl::FullyDecoded into a QUrl,-
319 care must be taken to use the QUrl::DecodedMode parameter to the setters-
320 (like setPath() and setUserName()). Failure to do so may cause-
321 re-interpretation of the percent character ('%') as the beginning of a-
322 percent-encoded sequence.-
323-
324 This mode is quite useful when portions of a URL are used in a non-URL-
325 context. For example, to extract the username, password or file paths in an-
326 FTP client application, the FullyDecoded mode should be used.-
327-
328 This mode should be used with care, since there are two conditions that-
329 cannot be reliably represented in the returned QString. They are:-
330-
331 \list-
332 \li \b{Non-UTF-8 sequences:} URLs may contain sequences of-
333 percent-encoded characters that do not form valid UTF-8 sequences. Since-
334 URLs need to be decoded using UTF-8, any decoder failure will result in-
335 the QString containing one or more replacement characters where the-
336 sequence existed.-
337-
338 \li \b{Encoded delimiters:} URLs are also allowed to make a distinction-
339 between a delimiter found in its literal form and its equivalent in-
340 percent-encoded form. This is most commonly found in the query, but is-
341 permitted in most parts of the URL.-
342 \endlist-
343-
344 The following example illustrates the problem:-
345-
346 \code-
347 QUrl original("http://example.com/?q=a%2B%3Db%26c");-
348 QUrl copy(original);-
349 copy.setQuery(copy.query(QUrl::FullyDecoded), QUrl::DecodedMode);-
350-
351 qDebug() << original.toString(); // prints: http://example.com/?q=a%2B%3Db%26c-
352 qDebug() << copy.toString(); // prints: http://example.com/?q=a+=b&c-
353 \endcode-
354-
355 If the two URLs were used via HTTP GET, the interpretation by the web-
356 server would probably be different. In the first case, it would interpret-
357 as one parameter, with a key of "q" and value "a+=b&c". In the second-
358 case, it would probably interpret as two parameters, one with a key of "q"-
359 and value "a =b", and the second with a key "c" and no value.-
360-
361 \sa QUrl::FormattingOptions-
362*/-
363-
364/*!-
365 \enum QUrl::UserInputResolutionOption-
366 \since 5.4-
367-
368 The user input resolution options define how fromUserInput() should-
369 interpret strings that could either be a relative path or the short-
370 form of a HTTP URL. For instance \c{file.pl} can be either a local file-
371 or the URL \c{http://file.pl}.-
372-
373 \value DefaultResolution The default resolution mechanism is to check-
374 whether a local file exists, in the working-
375 directory given to fromUserInput, and only-
376 return a local path in that case. Otherwise a URL-
377 is assumed.-
378 \value AssumeLocalFile This option makes fromUserInput() always return-
379 a local path unless the input contains a scheme, such as-
380 \c{http://file.pl}. This is useful for applications-
381 such as text editors, which are able to create-
382 the file if it doesn't exist.-
383-
384 \sa fromUserInput()-
385*/-
386-
387/*!-
388 \fn QUrl::QUrl(QUrl &&other)-
389-
390 Move-constructs a QUrl instance, making it point at the same-
391 object that \a other was pointing to.-
392-
393 \since 5.2-
394*/-
395-
396/*!-
397 \fn QUrl &QUrl::operator=(QUrl &&other)-
398-
399 Move-assigns \a other to this QUrl instance.-
400-
401 \since 5.2-
402*/-
403-
404#include "qurl.h"-
405#include "qurl_p.h"-
406#include "qplatformdefs.h"-
407#include "qstring.h"-
408#include "qstringlist.h"-
409#include "qdebug.h"-
410#include "qhash.h"-
411#include "qdir.h" // for QDir::fromNativeSeparators-
412#include "qdatastream.h"-
413#include "qtldurl_p.h"-
414#include "private/qipaddress_p.h"-
415#include "qurlquery.h"-
416#if defined(Q_OS_WINCE_WM)-
417#pragma optimize("g", off)-
418#endif-
419-
420QT_BEGIN_NAMESPACE-
421extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths); // qdir.cpp-
422-
423inline static bool isHex(char c)-
424{-
425 c |= 0x20;-
426 return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
executed 59 times by 2 tests: return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
Executed by:
  • tst_QNetworkRequest
  • tst_QUrl
59
427}-
428-
429static inline QString ftpScheme()-
430{-
431 return QStringLiteral("ftp");
executed 55 times by 2 tests: return ([]() -> QString { enum { Size = sizeof(u"" "ftp")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ftp" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
executed 55 times by 2 tests: return qstring_literal_temp;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
55
432}-
433-
434static inline QString fileScheme()-
435{-
436 return QStringLiteral("file");
executed 17440 times by 33 tests: return ([]() -> QString { enum { Size = sizeof(u"" "file")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "file" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
executed 17440 times by 33 tests: return qstring_literal_temp;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
17440
437}-
438-
439static inline QString webDavScheme()-
440{-
441 return QStringLiteral("webdavs");
executed 1 time by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "webdavs")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "webdavs" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 1 time by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
1
442}-
443-
444static inline QString webDavSslTag()-
445{-
446 return QStringLiteral("@SSL");
executed 4 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "@SSL")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "@SSL" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 4 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
4
447}-
448-
449#ifdef Q_COMPILER_CLASS_ENUM-
450# define colon_uchar : uchar-
451#else-
452# define colon_uchar-
453#endif-
454-
455class QUrlPrivate-
456{-
457public:-
458 enum Section colon_uchar {-
459 Scheme = 0x01,-
460 UserName = 0x02,-
461 Password = 0x04,-
462 UserInfo = UserName | Password,-
463 Host = 0x08,-
464 Port = 0x10,-
465 Authority = UserInfo | Host | Port,-
466 Path = 0x20,-
467 Hierarchy = Authority | Path,-
468 Query = 0x40,-
469 Fragment = 0x80,-
470 FullUrl = 0xff-
471 };-
472-
473 enum Flags colon_uchar {-
474 IsLocalFile = 0x01-
475 };-
476-
477 enum ErrorCode {-
478 // the high byte of the error code matches the Section-
479 // the first item in each value must be the generic "Invalid xxx Error"-
480 InvalidSchemeError = Scheme << 8,-
481-
482 InvalidUserNameError = UserName << 8,-
483-
484 InvalidPasswordError = Password << 8,-
485-
486 InvalidRegNameError = Host << 8,-
487 InvalidIPv4AddressError,-
488 InvalidIPv6AddressError,-
489 InvalidCharacterInIPv6Error,-
490 InvalidIPvFutureError,-
491 HostMissingEndBracket,-
492-
493 InvalidPortError = Port << 8,-
494 PortEmptyError,-
495-
496 InvalidPathError = Path << 8,-
497-
498 InvalidQueryError = Query << 8,-
499-
500 InvalidFragmentError = Fragment << 8,-
501-
502 // the following two cases are only possible in combination-
503 // with presence/absence of the authority and scheme. See validityError().-
504 AuthorityPresentAndPathIsRelative = Authority << 8 | Path << 8 | 0x10000,-
505 RelativeUrlPathContainsColonBeforeSlash = Scheme << 8 | Authority << 8 | Path << 8 | 0x10000,-
506-
507 NoError = 0-
508 };-
509-
510 struct Error {-
511 QString source;-
512 ErrorCode code;-
513 int position;-
514 };-
515-
516 QUrlPrivate();-
517 QUrlPrivate(const QUrlPrivate &copy);-
518 ~QUrlPrivate();-
519-
520 void parse(const QString &url, QUrl::ParsingMode parsingMode);-
521 bool isEmpty() const-
522 { return sectionIsPresent == 0 && port == -1 && path.isEmpty(); }
executed 17289 times by 32 tests: return sectionIsPresent == 0 && port == -1 && path.isEmpty();
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
17289
523-
524 Error *cloneError() const;-
525 void clearError();-
526 void setError(ErrorCode errorCode, const QString &source, int supplement = -1);-
527 ErrorCode validityError(QString *source = 0, int *position = 0) const;-
528 bool validateComponent(Section section, const QString &input, int begin, int end);-
529 bool validateComponent(Section section, const QString &input)-
530 { return validateComponent(section, input, 0, uint(input.length())); }
executed 21 times by 1 test: return validateComponent(section, input, 0, uint(input.length()));
Executed by:
  • tst_QUrl
21
531-
532 // no QString scheme() const;-
533 void appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
534 void appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
535 void appendUserName(QString &appendTo, QUrl::FormattingOptions options) const;-
536 void appendPassword(QString &appendTo, QUrl::FormattingOptions options) const;-
537 void appendHost(QString &appendTo, QUrl::FormattingOptions options) const;-
538 void appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
539 void appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
540 void appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
541-
542 // the "end" parameters are like STL iterators: they point to one past the last valid element-
543 bool setScheme(const QString &value, int len, bool doSetError);-
544 void setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode);-
545 void setUserInfo(const QString &userInfo, int from, int end);-
546 void setUserName(const QString &value, int from, int end);-
547 void setPassword(const QString &value, int from, int end);-
548 bool setHost(const QString &value, int from, int end, QUrl::ParsingMode mode);-
549 void setPath(const QString &value, int from, int end);-
550 void setQuery(const QString &value, int from, int end);-
551 void setFragment(const QString &value, int from, int end);-
552-
553 inline bool hasScheme() const { return sectionIsPresent & Scheme; }
executed 10891 times by 31 tests: return sectionIsPresent & Scheme;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • ...
10891
554 inline bool hasAuthority() const { return sectionIsPresent & Authority; }
executed 10496 times by 30 tests: return sectionIsPresent & Authority;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_QXmlStream
  • ...
10496
555 inline bool hasUserInfo() const { return sectionIsPresent & UserInfo; }
executed 6896 times by 20 tests: return sectionIsPresent & UserInfo;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
6896
556 inline bool hasUserName() const { return sectionIsPresent & UserName; }
executed 4548 times by 17 tests: return sectionIsPresent & UserName;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
4548
557 inline bool hasPassword() const { return sectionIsPresent & Password; }
executed 4337 times by 17 tests: return sectionIsPresent & Password;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
4337
558 inline bool hasHost() const { return sectionIsPresent & Host; }
never executed: return sectionIsPresent & Host;
0
559 inline bool hasPort() const { return port != -1; }
never executed: return port != -1;
0
560 inline bool hasPath() const { return !path.isEmpty(); }
never executed: return !path.isEmpty();
0
561 inline bool hasQuery() const { return sectionIsPresent & Query; }
executed 10978 times by 33 tests: return sectionIsPresent & Query;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
10978
562 inline bool hasFragment() const { return sectionIsPresent & Fragment; }
executed 10982 times by 30 tests: return sectionIsPresent & Fragment;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlStream
  • ...
10982
563-
564 inline bool isLocalFile() const { return flags & IsLocalFile; }
executed 21307 times by 34 tests: return flags & IsLocalFile;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • ...
21307
565 QString toLocalFile(QUrl::FormattingOptions options) const;-
566-
567 QString mergePaths(const QString &relativePath) const;-
568-
569 QAtomicInt ref;-
570 int port;-
571-
572 QString scheme;-
573 QString userName;-
574 QString password;-
575 QString host;-
576 QString path;-
577 QString query;-
578 QString fragment;-
579-
580 Error *error;-
581-
582 // not used for:-
583 // - Port (port == -1 means absence)-
584 // - Path (there's no path delimiter, so we optimize its use out of existence)-
585 // Schemes are never supposed to be empty, but we keep the flag anyway-
586 uchar sectionIsPresent;-
587 uchar flags;-
588-
589 // 32-bit: 2 bytes tail padding available-
590 // 64-bit: 6 bytes tail padding available-
591};-
592#undef colon_uchar-
593-
594inline QUrlPrivate::QUrlPrivate()-
595 : ref(1), port(-1),-
596 error(0),-
597 sectionIsPresent(0),-
598 flags(0)-
599{-
600}
executed 24302 times by 55 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
24302
601-
602inline QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)-
603 : ref(1), port(copy.port),-
604 scheme(copy.scheme),-
605 userName(copy.userName),-
606 password(copy.password),-
607 host(copy.host),-
608 path(copy.path),-
609 query(copy.query),-
610 fragment(copy.fragment),-
611 error(copy.cloneError()),-
612 sectionIsPresent(copy.sectionIsPresent),-
613 flags(copy.flags)-
614{-
615}
executed 9132 times by 17 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
9132
616-
617inline QUrlPrivate::~QUrlPrivate()-
618{-
619 delete error;-
620}
executed 33428 times by 62 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
33428
621-
622inline QUrlPrivate::Error *QUrlPrivate::cloneError() const-
623{-
624 return error ? new Error(*error) : 0;
executed 9132 times by 17 tests: return error ? new Error(*error) : 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
9132
625}-
626-
627inline void QUrlPrivate::clearError()-
628{-
629 delete error;-
630 error = 0;-
631}
executed 46907 times by 55 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
46907
632-
633inline void QUrlPrivate::setError(ErrorCode errorCode, const QString &source, int supplement)-
634{-
635 if (error) {
errorDescription
TRUEevaluated 41 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 263 times by 8 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkRequest
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
41-263
636 // don't overwrite an error set in a previous section during parsing-
637 return;
executed 41 times by 5 tests: return;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
41
638 }-
639 error = new Error;-
640 error->code = errorCode;-
641 error->source = source;-
642 error->position = supplement;-
643}
executed 263 times by 8 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkRequest
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
263
644-
645// From RFC 3986, Appendix A Collected ABNF for URI-
646// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]-
647//[...]-
648// scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )-
649//-
650// authority = [ userinfo "@" ] host [ ":" port ]-
651// userinfo = *( unreserved / pct-encoded / sub-delims / ":" )-
652// host = IP-literal / IPv4address / reg-name-
653// port = *DIGIT-
654//[...]-
655// reg-name = *( unreserved / pct-encoded / sub-delims )-
656//[..]-
657// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"-
658//-
659// query = *( pchar / "/" / "?" )-
660//-
661// fragment = *( pchar / "/" / "?" )-
662//-
663// pct-encoded = "%" HEXDIG HEXDIG-
664//-
665// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"-
666// reserved = gen-delims / sub-delims-
667// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"-
668// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"-
669// / "*" / "+" / "," / ";" / "="-
670// the path component has a complex ABNF that basically boils down to-
671// slash-separated segments of "pchar"-
672-
673// The above is the strict definition of the URL components and we mostly-
674// adhere to it, with few exceptions. QUrl obeys the following behavior:-
675// - percent-encoding sequences always use uppercase HEXDIG;-
676// - unreserved characters are *always* decoded, no exceptions;-
677// - the space character and bytes with the high bit set are controlled by-
678// the EncodeSpaces and EncodeUnicode bits;-
679// - control characters, the percent sign itself, and bytes with the high-
680// bit set that don't form valid UTF-8 sequences are always encoded,-
681// except in FullyDecoded mode;-
682// - sub-delims are always left alone, except in FullyDecoded mode;-
683// - gen-delim change behavior depending on which section of the URL (or-
684// the entire URL) we're looking at; see below;-
685// - characters not mentioned above, like "<", and ">", are usually-
686// decoded in individual sections of the URL, but encoded when the full-
687// URL is put together (we can change on subjective definition of-
688// "pretty").-
689//-
690// The behavior for the delimiters bears some explanation. The spec says in-
691// section 2.2:-
692// URIs that differ in the replacement of a reserved character with its-
693// corresponding percent-encoded octet are not equivalent.-
694// (note: QUrl API mistakenly uses the "reserved" term, so we will refer to-
695// them here as "delimiters").-
696//-
697// For that reason, we cannot encode delimiters found in decoded form and we-
698// cannot decode the ones found in encoded form if that would change the-
699// interpretation. Conversely, we *can* perform the transformation if it would-
700// not change the interpretation. From the last component of a URL to the first,-
701// here are the gen-delims we can unambiguously transform when the field is-
702// taken in isolation:-
703// - fragment: none, since it's the last-
704// - query: "#" is unambiguous-
705// - path: "#" and "?" are unambiguous-
706// - host: completely special but never ambiguous, see setHost() below.-
707// - password: the "#", "?", "/", "[", "]" and "@" characters are unambiguous-
708// - username: the "#", "?", "/", "[", "]", "@", and ":" characters are unambiguous-
709// - scheme: doesn't accept any delimiter, see setScheme() below.-
710//-
711// Internally, QUrl stores each component in the format that corresponds to the-
712// default mode (PrettyDecoded). It deviates from the "strict" FullyEncoded-
713// mode in the following way:-
714// - spaces are decoded-
715// - valid UTF-8 sequences are decoded-
716// - gen-delims that can be unambiguously transformed are decoded-
717// - characters controlled by DecodeReserved are often decoded, though this behavior-
718// can change depending on the subjective definition of "pretty"-
719//-
720// Note that the list of gen-delims that we can transform is different for the-
721// user info (user name + password) and the authority (user info + host +-
722// port).-
723-
724-
725// list the recoding table modifications to be used with the recodeFromUser and-
726// appendToUser functions, according to the rules above. Spaces and UTF-8-
727// sequences are handled outside the tables.-
728-
729// the encodedXXX tables are run with the delimiters set to "leave" by default;-
730// the decodedXXX tables are run with the delimiters set to "decode" by default-
731// (except for the query, which doesn't use these functions)-
732-
733#define decode(x) ushort(x)-
734#define leave(x) ushort(0x100 | (x))-
735#define encode(x) ushort(0x200 | (x))-
736-
737static const ushort userNameInIsolation[] = {-
738 decode(':'), // 0-
739 decode('@'), // 1-
740 decode(']'), // 2-
741 decode('['), // 3-
742 decode('/'), // 4-
743 decode('?'), // 5-
744 decode('#'), // 6-
745-
746 decode('"'), // 7-
747 decode('<'),-
748 decode('>'),-
749 decode('^'),-
750 decode('\\'),-
751 decode('|'),-
752 decode('{'),-
753 decode('}'),-
754 0-
755};-
756static const ushort * const passwordInIsolation = userNameInIsolation + 1;-
757static const ushort * const pathInIsolation = userNameInIsolation + 5;-
758static const ushort * const queryInIsolation = userNameInIsolation + 6;-
759static const ushort * const fragmentInIsolation = userNameInIsolation + 7;-
760-
761static const ushort userNameInUserInfo[] = {-
762 encode(':'), // 0-
763 decode('@'), // 1-
764 decode(']'), // 2-
765 decode('['), // 3-
766 decode('/'), // 4-
767 decode('?'), // 5-
768 decode('#'), // 6-
769-
770 decode('"'), // 7-
771 decode('<'),-
772 decode('>'),-
773 decode('^'),-
774 decode('\\'),-
775 decode('|'),-
776 decode('{'),-
777 decode('}'),-
778 0-
779};-
780static const ushort * const passwordInUserInfo = userNameInUserInfo + 1;-
781-
782static const ushort userNameInAuthority[] = {-
783 encode(':'), // 0-
784 encode('@'), // 1-
785 encode(']'), // 2-
786 encode('['), // 3-
787 decode('/'), // 4-
788 decode('?'), // 5-
789 decode('#'), // 6-
790-
791 decode('"'), // 7-
792 decode('<'),-
793 decode('>'),-
794 decode('^'),-
795 decode('\\'),-
796 decode('|'),-
797 decode('{'),-
798 decode('}'),-
799 0-
800};-
801static const ushort * const passwordInAuthority = userNameInAuthority + 1;-
802-
803static const ushort userNameInUrl[] = {-
804 encode(':'), // 0-
805 encode('@'), // 1-
806 encode(']'), // 2-
807 encode('['), // 3-
808 encode('/'), // 4-
809 encode('?'), // 5-
810 encode('#'), // 6-
811-
812 // no need to list encode(x) for the other characters-
813 0-
814};-
815static const ushort * const passwordInUrl = userNameInUrl + 1;-
816static const ushort * const pathInUrl = userNameInUrl + 5;-
817static const ushort * const queryInUrl = userNameInUrl + 6;-
818static const ushort * const fragmentInUrl = userNameInUrl + 6;-
819-
820static inline void parseDecodedComponent(QString &data)-
821{-
822 data.replace(QLatin1Char('%'), QLatin1String("%25"));-
823}
executed 14930 times by 40 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSidebar
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • ...
14930
824-
825static inline QString-
826recodeFromUser(const QString &input, const ushort *actions, int from, int to)-
827{-
828 QString output;-
829 const QChar *begin = input.constData() + from;-
830 const QChar *end = input.constData() + to;-
831 if (qt_urlRecode(output, begin, end, 0, actions))
qt_urlRecode(o...d, 0, actions)Description
TRUEevaluated 197 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 19883 times by 35 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • ...
197-19883
832 return output;
executed 197 times by 6 tests: return output;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
197
833-
834 return input.mid(from, to - from);
executed 19883 times by 35 tests: return input.mid(from, to - from);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • ...
19883
835}-
836-
837// appendXXXX functions: copy from the internal form to the external, user form.-
838// the internal value is stored in its PrettyDecoded form, so that case is easy.-
839static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,-
840 const ushort *actions)-
841{-
842 if (options == QUrl::PrettyDecoded) {
options == QUrl::PrettyDecodedDescription
TRUEevaluated 291 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 25323 times by 33 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
291-25323
843 appendTo += value;-
844 return;
executed 291 times by 4 tests: return;
Executed by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
291
845 }-
846-
847 if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions))
!qt_urlRecode(...ions, actions)Description
TRUEevaluated 24378 times by 33 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
FALSEevaluated 945 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
945-24378
848 appendTo += value;
executed 24378 times by 33 tests: appendTo += value;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
24378
849}
executed 25323 times by 33 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
25323
850-
851inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
852{-
853 if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
(options & QUr...RemoveUserInfoDescription
TRUEevaluated 4548 times by 17 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 1081 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
1081-4548
854 appendUserInfo(appendTo, options, appendingTo);-
855-
856 // add '@' only if we added anything-
857 if (hasUserName() || (hasPassword() && (options & QUrl::RemovePassword) == 0))
hasUserName()Description
TRUEevaluated 627 times by 5 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 3921 times by 16 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
hasPassword()Description
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 3823 times by 16 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
(options & QUr...Password) == 0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 91 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
7-3921
858 appendTo += QLatin1Char('@');
executed 634 times by 5 tests: appendTo += QLatin1Char('@');
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
634
859 }
executed 4548 times by 17 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
4548
860 appendHost(appendTo, options);-
861 if (!(options & QUrl::RemovePort) && port != -1)
!(options & QUrl::RemovePort)Description
TRUEevaluated 5625 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
port != -1Description
TRUEevaluated 1782 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 3843 times by 15 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
4-5625
862 appendTo += QLatin1Char(':') + QString::number(port);
executed 1782 times by 9 tests: appendTo += QLatin1Char(':') + QString::number(port);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
1782
863}
executed 5629 times by 20 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
5629
864-
865inline void QUrlPrivate::appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
866{-
867 if (Q_LIKELY(!hasUserInfo()))
__builtin_expe...Info()), true)Description
TRUEevaluated 6106 times by 19 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 790 times by 5 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
790-6106
868 return;
executed 6106 times by 19 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
6106
869-
870 const ushort *userNameActions;-
871 const ushort *passwordActions;-
872 if (options & QUrl::EncodeDelimiters) {
options & QUrl...codeDelimitersDescription
TRUEevaluated 605 times by 5 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 185 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
185-605
873 userNameActions = userNameInUrl;-
874 passwordActions = passwordInUrl;-
875 } else {
executed 605 times by 5 tests: end of block
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
605
876 switch (appendingTo) {-
877 case UserInfo:
executed 57 times by 2 tests: case UserInfo:
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
57
878 userNameActions = userNameInUserInfo;-
879 passwordActions = passwordInUserInfo;-
880 break;
executed 57 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
57
881-
882 case Authority:
executed 25 times by 1 test: case Authority:
Executed by:
  • tst_QUrl
25
883 userNameActions = userNameInAuthority;-
884 passwordActions = passwordInAuthority;-
885 break;
executed 25 times by 1 test: break;
Executed by:
  • tst_QUrl
25
886-
887 case FullUrl:
executed 103 times by 2 tests: case FullUrl:
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
103
888 userNameActions = userNameInUrl;-
889 passwordActions = passwordInUrl;-
890 break;
executed 103 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
103
891-
892 default:
never executed: default:
0
893 // can't happen-
894 Q_UNREACHABLE();-
895 break;
never executed: break;
0
896 }-
897 }-
898-
899 if (!qt_urlRecode(appendTo, userName.constData(), userName.constEnd(), options, userNameActions))
!qt_urlRecode(...erNameActions)Description
TRUEevaluated 723 times by 5 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 67 times by 1 test
Evaluated by:
  • tst_QUrl
67-723
900 appendTo += userName;
executed 723 times by 5 tests: appendTo += userName;
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
723
901 if (options & QUrl::RemovePassword || !hasPassword()) {
!hasPassword()Description
TRUEevaluated 191 times by 5 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 225 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
191-225
902 return;
executed 565 times by 5 tests: return;
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
565
903 } else {-
904 appendTo += QLatin1Char(':');-
905 if (!qt_urlRecode(appendTo, password.constData(), password.constEnd(), options, passwordActions))
!qt_urlRecode(...sswordActions)Description
TRUEevaluated 168 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 57 times by 1 test
Evaluated by:
  • tst_QUrl
57-168
906 appendTo += password;
executed 168 times by 2 tests: appendTo += password;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
168
907 }
executed 225 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
225
908}-
909-
910inline void QUrlPrivate::appendUserName(QString &appendTo, QUrl::FormattingOptions options) const-
911{-
912 // only called from QUrl::userName()-
913 appendToUser(appendTo, userName, options,-
914 options & QUrl::EncodeDelimiters ? userNameInUrl : userNameInIsolation);-
915}
executed 783 times by 3 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
783
916-
917inline void QUrlPrivate::appendPassword(QString &appendTo, QUrl::FormattingOptions options) const-
918{-
919 // only called from QUrl::password()-
920 appendToUser(appendTo, password, options,-
921 options & QUrl::EncodeDelimiters ? passwordInUrl : passwordInIsolation);-
922}
executed 577 times by 6 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
577
923-
924inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
925{-
926 QString thePath = path;-
927 if (options & QUrl::NormalizePathSegments) {
options & QUrl...zePathSegmentsDescription
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 22596 times by 33 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
19-22596
928 thePath = qt_normalizePathSegments(path, false);-
929 }
executed 19 times by 1 test: end of block
Executed by:
  • tst_QUrl
19
930 if (options & QUrl::RemoveFilename) {
options & QUrl::RemoveFilenameDescription
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 22561 times by 33 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
54-22561
931 const int slash = path.lastIndexOf(QLatin1Char('/'));-
932 if (slash == -1)
slash == -1Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 49 times by 1 test
Evaluated by:
  • tst_QUrl
5-49
933 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QUrl
5
934 thePath = path.left(slash+1);-
935 }
executed 49 times by 1 test: end of block
Executed by:
  • tst_QUrl
49
936 // check if we need to remove trailing slashes-
937 if (options & QUrl::StripTrailingSlash) {
options & QUrl...pTrailingSlashDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 22566 times by 33 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
44-22566
938 while (thePath.length() > 1 && thePath.endsWith(QLatin1Char('/')))
thePath.length() > 1Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QUrl
thePath.endsWi...tin1Char('/'))Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QUrl
16-58
939 thePath.chop(1);
executed 30 times by 1 test: thePath.chop(1);
Executed by:
  • tst_QUrl
30
940 }
executed 44 times by 1 test: end of block
Executed by:
  • tst_QUrl
44
941-
942 appendToUser(appendTo, thePath, options,-
943 appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? pathInUrl : pathInIsolation);-
944-
945}
executed 22610 times by 33 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • ...
22610
946-
947inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
948{-
949 appendToUser(appendTo, fragment, options,-
950 options & QUrl::EncodeDelimiters ? fragmentInUrl :-
951 appendingTo == FullUrl ? 0 : fragmentInIsolation);-
952}
executed 920 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
920
953-
954inline void QUrlPrivate::appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
955{-
956 appendToUser(appendTo, query, options,-
957 appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? queryInUrl : queryInIsolation);-
958}
executed 724 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
724
959-
960// setXXX functions-
961-
962inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetError)-
963{-
964 // schemes are strictly RFC-compliant:-
965 // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )-
966 // we also lowercase the scheme-
967-
968 // schemes in URLs are not allowed to be empty, but they can be in-
969 // "Relative URIs" which QUrl also supports. QUrl::setScheme does-
970 // not call us with len == 0, so this can only be from parse()-
971 scheme.clear();-
972 if (len == 0)
len == 0Description
TRUEevaluated 6 times by 4 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QUrl
FALSEevaluated 12241 times by 33 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
6-12241
973 return false;
executed 6 times by 4 tests: return false;
Executed by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QUrl
6
974-
975 sectionIsPresent |= Scheme;-
976-
977 // validate it:-
978 int needsLowercasing = -1;-
979 const ushort *p = reinterpret_cast<const ushort *>(value.constData());-
980 for (int i = 0; i < len; ++i) {
i < lenDescription
TRUEevaluated 51343 times by 33 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
FALSEevaluated 12112 times by 33 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
12112-51343
981 if (p[i] >= 'a' && p[i] <= 'z')
p[i] >= 'a'Description
TRUEevaluated 50436 times by 33 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
FALSEevaluated 907 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
  • tst_Spdy
p[i] <= 'z'Description
TRUEevaluated 50418 times by 33 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
18-50436
982 continue;
executed 50418 times by 33 tests: continue;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
50418
983 if (p[i] >= 'A' && p[i] <= 'Z') {
p[i] >= 'A'Description
TRUEevaluated 308 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 617 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
  • tst_Spdy
p[i] <= 'Z'Description
TRUEevaluated 272 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QUrl
36-617
984 needsLowercasing = i;-
985 continue;
executed 272 times by 1 test: continue;
Executed by:
  • tst_QUrl
272
986 }-
987 if (i) {
iDescription
TRUEevaluated 615 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 38 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
38-615
988 if (p[i] >= '0' && p[i] <= '9')
p[i] >= '0'Description
TRUEevaluated 192 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 423 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
p[i] <= '9'Description
TRUEevaluated 145 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_QUrl
47-423
989 continue;
executed 145 times by 4 tests: continue;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
145
990 if (p[i] == '+' || p[i] == '-' || p[i] == '.')
p[i] == '+'Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 462 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
p[i] == '-'Description
TRUEevaluated 361 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 101 times by 1 test
Evaluated by:
  • tst_QUrl
p[i] == '.'Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 91 times by 1 test
Evaluated by:
  • tst_QUrl
8-462
991 continue;
executed 379 times by 3 tests: continue;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
379
992 }
executed 91 times by 1 test: end of block
Executed by:
  • tst_QUrl
91
993-
994 // found something else-
995 // don't call setError needlessly:-
996 // if we've been called from parse(), it will try to recover-
997 if (doSetError)
doSetErrorDescription
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 55 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
55-74
998 setError(InvalidSchemeError, value, i);
executed 74 times by 1 test: setError(InvalidSchemeError, value, i);
Executed by:
  • tst_QUrl
74
999 return false;
executed 129 times by 2 tests: return false;
Executed by:
  • tst_QNetworkRequest
  • tst_QUrl
129
1000 }-
1001-
1002 scheme = value.left(len);-
1003-
1004 if (needsLowercasing != -1) {
needsLowercasing != -1Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 12079 times by 33 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
33-12079
1005 // schemes are ASCII only, so we don't need the full Unicode toLower-
1006 QChar *schemeData = scheme.data(); // force detaching here-
1007 for (int i = needsLowercasing; i >= 0; --i) {
i >= 0Description
TRUEevaluated 192 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 33 times by 1 test
Evaluated by:
  • tst_QUrl
33-192
1008 ushort c = schemeData[i].unicode();-
1009 if (c >= 'A' && c <= 'Z')
c >= 'A'Description
TRUEevaluated 180 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrl
c <= 'Z'Description
TRUEevaluated 178 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-180
1010 schemeData[i] = c + 0x20;
executed 178 times by 1 test: schemeData[i] = c + 0x20;
Executed by:
  • tst_QUrl
178
1011 }
executed 192 times by 1 test: end of block
Executed by:
  • tst_QUrl
192
1012 }
executed 33 times by 1 test: end of block
Executed by:
  • tst_QUrl
33
1013-
1014 // did we set to the file protocol?-
1015 if (scheme == fileScheme()
scheme == fileScheme()Description
TRUEevaluated 6542 times by 15 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
FALSEevaluated 5570 times by 22 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
5570-6542
1016#ifdef Q_OS_WIN-
1017 || scheme == webDavScheme()-
1018#endif-
1019 ) {-
1020 flags |= IsLocalFile;-
1021 } else {
executed 6542 times by 15 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
6542
1022 flags &= ~IsLocalFile;-
1023 }
executed 5570 times by 22 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
5570
1024 return true;
executed 12112 times by 33 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
12112
1025}-
1026-
1027inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode)-
1028{-
1029 sectionIsPresent &= ~Authority;-
1030 sectionIsPresent |= Host;-
1031-
1032 // we never actually _loop_-
1033 while (from != end) {
from != endDescription
TRUEevaluated 4922 times by 22 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
FALSEevaluated 618 times by 9 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QTextDocument
  • tst_QUrl
  • tst_languageChange
  • tst_qfileopenevent
618-4922
1034 int userInfoIndex = auth.indexOf(QLatin1Char('@'), from);-
1035 if (uint(userInfoIndex) < uint(end)) {
uint(userInfoI...x) < uint(end)Description
TRUEevaluated 166 times by 4 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 4756 times by 21 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
166-4756
1036 setUserInfo(auth, from, userInfoIndex);-
1037 if (mode == QUrl::StrictMode && !validateComponent(UserInfo, auth, from, userInfoIndex))
mode == QUrl::StrictModeDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 158 times by 4 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
!validateCompo...userInfoIndex)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-158
1038 break;
executed 7 times by 1 test: break;
Executed by:
  • tst_QUrl
7
1039 from = userInfoIndex + 1;-
1040 }
executed 159 times by 4 tests: end of block
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
159
1041-
1042 int colonIndex = auth.lastIndexOf(QLatin1Char(':'), end - 1);-
1043 if (colonIndex < from)
colonIndex < fromDescription
TRUEevaluated 4076 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
FALSEevaluated 839 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
839-4076
1044 colonIndex = -1;
executed 4076 times by 20 tests: colonIndex = -1;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
4076
1045-
1046 if (uint(colonIndex) < uint(end)) {
uint(colonIndex) < uint(end)Description
TRUEevaluated 839 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
FALSEevaluated 4076 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
839-4076
1047 if (auth.at(from).unicode() == '[') {
auth.at(from).unicode() == '['Description
TRUEevaluated 65 times by 4 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 774 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
65-774
1048 // check if colonIndex isn't inside the "[...]" part-
1049 int closingBracket = auth.indexOf(QLatin1Char(']'), from);-
1050 if (uint(closingBracket) > uint(colonIndex))
uint(closingBr...nt(colonIndex)Description
TRUEevaluated 59 times by 4 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
6-59
1051 colonIndex = -1;
executed 59 times by 4 tests: colonIndex = -1;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
59
1052 }
executed 65 times by 4 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
65
1053 }
executed 839 times by 6 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
839
1054-
1055 if (colonIndex == end - 1) {
colonIndex == end - 1Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 4903 times by 22 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
12-4903
1056 // found a colon but no digits after it-
1057 port = -1;-
1058 } else if (uint(colonIndex) < uint(end)) {
executed 12 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
uint(colonIndex) < uint(end)Description
TRUEevaluated 768 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
FALSEevaluated 4135 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
12-4135
1059 unsigned long x = 0;-
1060 for (int i = colonIndex + 1; i < end; ++i) {
i < endDescription
TRUEevaluated 3040 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
FALSEevaluated 761 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
761-3040
1061 ushort c = auth.at(i).unicode();-
1062 if (c >= '0' && c <= '9') {
c >= '0'Description
TRUEevaluated 3039 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
c <= '9'Description
TRUEevaluated 3033 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
1-3039
1063 x *= 10;-
1064 x += c - '0';-
1065 } else {
executed 3033 times by 6 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
3033
1066 x = ulong(-1); // x != ushort(x)-
1067 break;
executed 7 times by 1 test: break;
Executed by:
  • tst_QUrl
7
1068 }-
1069 }-
1070 if (x == ushort(x)) {
x == ushort(x)Description
TRUEevaluated 758 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrl
10-758
1071 port = ushort(x);-
1072 } else {
executed 758 times by 6 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
758
1073 setError(InvalidPortError, auth, colonIndex + 1);-
1074 if (mode == QUrl::StrictMode)
mode == QUrl::StrictModeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
4-6
1075 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QUrl
4
1076 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUrl
6
1077 } else {-
1078 port = -1;-
1079 }
executed 4135 times by 20 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
4135
1080-
1081 setHost(auth, from, qMin<uint>(end, colonIndex), mode);-
1082 if (mode == QUrl::StrictMode && !validateComponent(Host, auth, from, qMin<uint>(end, colonIndex))) {
mode == QUrl::StrictModeDescription
TRUEevaluated 86 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
FALSEevaluated 4825 times by 22 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
!validateCompo..., colonIndex))Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 80 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
6-4825
1083 // clear host too-
1084 sectionIsPresent &= ~Authority;-
1085 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QUrl
6
1086 }-
1087-
1088 // success-
1089 return;
executed 4905 times by 22 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
4905
1090 }-
1091 // clear all sections but host-
1092 sectionIsPresent &= ~Authority | Host;-
1093 userName.clear();-
1094 password.clear();-
1095 host.clear();-
1096 port = -1;-
1097}
executed 635 times by 9 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QTextDocument
  • tst_QUrl
  • tst_languageChange
  • tst_qfileopenevent
635
1098-
1099inline void QUrlPrivate::setUserInfo(const QString &userInfo, int from, int end)-
1100{-
1101 int delimIndex = userInfo.indexOf(QLatin1Char(':'), from);-
1102 setUserName(userInfo, from, qMin<uint>(delimIndex, end));-
1103-
1104 if (uint(delimIndex) >= uint(end)) {
uint(delimIndex) >= uint(end)Description
TRUEevaluated 87 times by 4 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 130 times by 4 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
87-130
1105 password.clear();-
1106 sectionIsPresent &= ~Password;-
1107 } else {
executed 87 times by 4 tests: end of block
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
87
1108 setPassword(userInfo, delimIndex + 1, end);-
1109 }
executed 130 times by 4 tests: end of block
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
130
1110}-
1111-
1112inline void QUrlPrivate::setUserName(const QString &value, int from, int end)-
1113{-
1114 sectionIsPresent |= UserName;-
1115 userName = recodeFromUser(value, userNameInIsolation, from, end);-
1116}
executed 2114 times by 5 tests: end of block
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
2114
1117-
1118inline void QUrlPrivate::setPassword(const QString &value, int from, int end)-
1119{-
1120 sectionIsPresent |= Password;-
1121 password = recodeFromUser(value, passwordInIsolation, from, end);-
1122}
executed 583 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
583
1123-
1124inline void QUrlPrivate::setPath(const QString &value, int from, int end)-
1125{-
1126 // sectionIsPresent |= Path; // not used, save some cycles-
1127 path = recodeFromUser(value, pathInIsolation, from, end);-
1128}
executed 15047 times by 35 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • ...
15047
1129-
1130inline void QUrlPrivate::setFragment(const QString &value, int from, int end)-
1131{-
1132 sectionIsPresent |= Fragment;-
1133 fragment = recodeFromUser(value, fragmentInIsolation, from, end);-
1134}
executed 1832 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
1832
1135-
1136inline void QUrlPrivate::setQuery(const QString &value, int from, int iend)-
1137{-
1138 sectionIsPresent |= Query;-
1139 query = recodeFromUser(value, queryInIsolation, from, iend);-
1140}
executed 504 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
504
1141-
1142// Host handling-
1143// The RFC says the host is:-
1144// host = IP-literal / IPv4address / reg-name-
1145// IP-literal = "[" ( IPv6address / IPvFuture ) "]"-
1146// IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )-
1147// [a strict definition of IPv6Address and IPv4Address]-
1148// reg-name = *( unreserved / pct-encoded / sub-delims )-
1149//-
1150// We deviate from the standard in all but IPvFuture. For IPvFuture we accept-
1151// and store only exactly what the RFC says we should. No percent-encoding is-
1152// permitted in this field, so Unicode characters and space aren't either.-
1153//-
1154// For IPv4 addresses, we accept broken addresses like inet_aton does (that is,-
1155// less than three dots). However, we correct the address to the proper form-
1156// and store the corrected address. After correction, we comply to the RFC and-
1157// it's exclusively composed of unreserved characters.-
1158//-
1159// For IPv6 addresses, we accept addresses including trailing (embedded) IPv4-
1160// addresses, the so-called v4-compat and v4-mapped addresses. We also store-
1161// those addresses like that in the hostname field, which violates the spec.-
1162// IPv6 hosts are stored with the square brackets in the QString. It also-
1163// requires no transformation in any way.-
1164//-
1165// As for registered names, it's the other way around: we accept only valid-
1166// hostnames as specified by STD 3 and IDNA. That means everything we accept is-
1167// valid in the RFC definition above, but there are many valid reg-names-
1168// according to the RFC that we do not accept in the name of security. Since we-
1169// do accept IDNA, reg-names are subject to ACE encoding and decoding, which is-
1170// specified by the DecodeUnicode flag. The hostname is stored in its Unicode form.-
1171-
1172inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions options) const-
1173{-
1174 // EncodeUnicode is the only flag that matters-
1175 if ((options & QUrl::FullyDecoded) == QUrl::FullyDecoded)
(options & QUr...::FullyDecodedDescription
TRUEevaluated 9958 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
FALSEevaluated 5683 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
5683-9958
1176 options = 0;
executed 9958 times by 34 tests: options = 0;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
9958
1177 else-
1178 options &= QUrl::EncodeUnicode;
executed 5683 times by 20 tests: options &= QUrl::EncodeUnicode;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
5683
1179 if (host.isEmpty())
host.isEmpty()Description
TRUEevaluated 1229 times by 21 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextDocument
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_Spdy
  • tst_qfileopenevent
FALSEevaluated 14412 times by 41 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileSelector
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • ...
1229-14412
1180 return;
executed 1229 times by 21 tests: return;
Executed by:
  • tst_NetworkSelfTest
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextDocument
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_Spdy
  • tst_qfileopenevent
1229
1181 if (host.at(0).unicode() == '[') {
host.at(0).unicode() == '['Description
TRUEevaluated 187 times by 7 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
FALSEevaluated 14225 times by 41 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileSelector
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • ...
187-14225
1182 // IPv6Address and IPvFuture address never require any transformation-
1183 appendTo += host;-
1184 } else {
executed 187 times by 7 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
187
1185 // this is either an IPv4Address or a reg-name-
1186 // if it is a reg-name, it is already stored in Unicode form-
1187 if (options & QUrl::EncodeUnicode && !(options & 0x4000000))
!(options & 0x4000000)Description
TRUEevaluated 3829 times by 17 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_selftests - unknown status
FALSEnever evaluated
0-3829
1188 appendTo += qt_ACE_do(host, ToAceOnly, AllowLeadingDot);
executed 3829 times by 17 tests: appendTo += qt_ACE_do(host, ToAceOnly, AllowLeadingDot);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_selftests - unknown status
3829
1189 else-
1190 appendTo += host;
executed 10396 times by 37 tests: appendTo += host;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • ...
10396
1191 }-
1192}-
1193-
1194// the whole IPvFuture is passed and parsed here, including brackets;-
1195// returns null if the parsing was successful, or the QChar of the first failure-
1196static const QChar *parseIpFuture(QString &host, const QChar *begin, const QChar *end, QUrl::ParsingMode mode)-
1197{-
1198 // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )-
1199 static const char acceptable[] =-
1200 "!$&'()*+,;=" // sub-delims-
1201 ":" // ":"-
1202 "-._~"; // unreserved-
1203-
1204 // the brackets and the "v" have been checked-
1205 const QChar *const origBegin = begin;-
1206 if (begin[3].unicode() != '.')
begin[3].unicode() != '.'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QUrl
3-28
1207 return &begin[3];
executed 3 times by 1 test: return &begin[3];
Executed by:
  • tst_QUrl
3
1208 if ((begin[2].unicode() >= 'A' && begin[2].unicode() <= 'F') ||
begin[2].unicode() >= 'A'Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
begin[2].unicode() <= 'F'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-23
1209 (begin[2].unicode() >= 'a' && begin[2].unicode() <= 'f') ||
begin[2].unicode() >= 'a'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
begin[2].unicode() <= 'f'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-23
1210 (begin[2].unicode() >= '0' && begin[2].unicode() <= '9')) {
begin[2].unicode() >= '0'Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
begin[2].unicode() <= '9'Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
0-24
1211 // this is so unlikely that we'll just go down the slow path-
1212 // decode the whole string, skipping the "[vH." and "]" which we already know to be there-
1213 host += QString::fromRawData(begin, 4);-
1214-
1215 // uppercase the version, if necessary-
1216 if (begin[2].unicode() >= 'a')
begin[2].unicode() >= 'a'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QUrl
1-26
1217 host[host.length() - 2] = begin[2].unicode() - 0x20;
executed 1 time by 1 test: host[host.length() - 2] = begin[2].unicode() - 0x20;
Executed by:
  • tst_QUrl
1
1218-
1219 begin += 4;-
1220 --end;-
1221-
1222 QString decoded;-
1223 if (mode == QUrl::TolerantMode && qt_urlRecode(decoded, begin, end, QUrl::FullyDecoded, 0)) {
mode == QUrl::TolerantModeDescription
TRUEevaluated 25 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
qt_urlRecode(d...llyDecoded, 0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 19 times by 1 test
Evaluated by:
  • tst_QUrl
2-25
1224 begin = decoded.constBegin();-
1225 end = decoded.constEnd();-
1226 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUrl
6
1227-
1228 for ( ; begin != end; ++begin) {
begin != endDescription
TRUEevaluated 123 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
18-123
1229 if (begin->unicode() >= 'A' && begin->unicode() <= 'Z')
begin->unicode() >= 'A'Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 83 times by 1 test
Evaluated by:
  • tst_QUrl
begin->unicode() <= 'Z'Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QUrl
12-83
1230 host += *begin;
executed 12 times by 1 test: host += *begin;
Executed by:
  • tst_QUrl
12
1231 else if (begin->unicode() >= 'a' && begin->unicode() <= 'z')
begin->unicode() >= 'a'Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 88 times by 1 test
Evaluated by:
  • tst_QUrl
begin->unicode() <= 'z'Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
7-88
1232 host += *begin;
executed 16 times by 1 test: host += *begin;
Executed by:
  • tst_QUrl
16
1233 else if (begin->unicode() >= '0' && begin->unicode() <= '9')
begin->unicode() >= '0'Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_QUrl
begin->unicode() <= '9'Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QUrl
22-48
1234 host += *begin;
executed 22 times by 1 test: host += *begin;
Executed by:
  • tst_QUrl
22
1235 else if (begin->unicode() < 0x80 && strchr(acceptable, begin->unicode()) != 0)
begin->unicode() < 0x80Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
strchr(accepta...nicode()) != 0Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
1-72
1236 host += *begin;
executed 64 times by 1 test: host += *begin;
Executed by:
  • tst_QUrl
64
1237 else-
1238 return decoded.isEmpty() ? begin : &origBegin[2];
executed 9 times by 1 test: return decoded.isEmpty() ? begin : &origBegin[2];
Executed by:
  • tst_QUrl
9
1239 }-
1240 host += QLatin1Char(']');-
1241 return 0;
executed 18 times by 1 test: return 0;
Executed by:
  • tst_QUrl
18
1242 }-
1243 return &origBegin[2];
executed 1 time by 1 test: return &origBegin[2];
Executed by:
  • tst_QUrl
1
1244}-
1245-
1246// ONLY the IPv6 address is parsed here, WITHOUT the brackets-
1247static const QChar *parseIp6(QString &host, const QChar *begin, const QChar *end, QUrl::ParsingMode mode)-
1248{-
1249 QIPAddressUtils::IPv6Address address;-
1250 const QChar *ret = QIPAddressUtils::parseIp6(address, begin, end);-
1251 if (ret) {
retDescription
TRUEevaluated 44 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 112 times by 7 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
44-112
1252 // this struct is kept in automatic storage because it's only 4 bytes-
1253 const ushort decodeColon[] = { decode(':'), 0 };-
1254-
1255 // IPv6 failed parsing, check if it was a percent-encoded character in-
1256 // the middle and try again-
1257 QString decoded;-
1258 if (mode == QUrl::TolerantMode && qt_urlRecode(decoded, begin, end, 0, decodeColon)) {
mode == QUrl::TolerantModeDescription
TRUEevaluated 36 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
qt_urlRecode(d..., decodeColon)Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 32 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
4-36
1259 // recurse-
1260 // if the parsing fails again, the qt_urlRecode above will return 0-
1261 ret = parseIp6(host, decoded.constBegin(), decoded.constEnd(), mode);-
1262-
1263 // we can't return ret, otherwise it would be dangling-
1264 return ret ? end : 0;
executed 4 times by 2 tests: return ret ? end : 0;
Executed by:
  • tst_QUrl
  • tst_QUrlInternal
4
1265 }-
1266-
1267 // no transformation, nothing to re-parse-
1268 return ret;
executed 40 times by 5 tests: return ret;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
40
1269 }-
1270-
1271 host.reserve(host.size() + (end - begin));-
1272 host += QLatin1Char('[');-
1273 QIPAddressUtils::toString(host, address);-
1274 host += QLatin1Char(']');-
1275 return 0;
executed 112 times by 7 tests: return 0;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
112
1276}-
1277-
1278inline bool QUrlPrivate::setHost(const QString &value, int from, int iend, QUrl::ParsingMode mode)-
1279{-
1280 const QChar *begin = value.constData() + from;-
1281 const QChar *end = value.constData() + iend;-
1282-
1283 const int len = end - begin;-
1284 host.clear();-
1285 sectionIsPresent |= Host;-
1286 if (len == 0)
len == 0Description
TRUEevaluated 184 times by 7 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
FALSEevaluated 11801 times by 43 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileSelector
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • ...
184-11801
1287 return true;
executed 184 times by 7 tests: return true;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
184
1288-
1289 if (begin[0].unicode() == '[') {
begin[0].unicode() == '['Description
TRUEevaluated 184 times by 9 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 11617 times by 43 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileSelector
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • ...
184-11617
1290 // IPv6Address or IPvFuture-
1291 // smallest IPv6 address is "[::]" (len = 4)-
1292 // smallest IPvFuture address is "[v7.X]" (len = 6)-
1293 if (end[-1].unicode() != ']') {
end[-1].unicode() != ']'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 183 times by 9 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
1-183
1294 setError(HostMissingEndBracket, value);-
1295 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QUrl
1
1296 }-
1297-
1298 if (len > 5 && begin[1].unicode() == 'v') {
len > 5Description
TRUEevaluated 126 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 57 times by 6 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
begin[1].unicode() == 'v'Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 95 times by 6 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
31-126
1299 const QChar *c = parseIpFuture(host, begin, end, mode);-
1300 if (c)
cDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
13-18
1301 setError(InvalidIPvFutureError, value, c - value.constData());
executed 13 times by 1 test: setError(InvalidIPvFutureError, value, c - value.constData());
Executed by:
  • tst_QUrl
13
1302 return !c;
executed 31 times by 1 test: return !c;
Executed by:
  • tst_QUrl
31
1303 } else if (begin[1].unicode() == 'v') {
begin[1].unicode() == 'v'Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 146 times by 9 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
6-146
1304 setError(InvalidIPvFutureError, value, from);-
1305 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUrl
6
1306-
1307 const QChar *c = parseIp6(host, begin + 1, end - 1, mode);-
1308 if (!c)
!cDescription
TRUEevaluated 112 times by 7 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
FALSEevaluated 40 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
40-112
1309 return true;
executed 112 times by 7 tests: return true;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
112
1310-
1311 if (c == end - 1)
c == end - 1Description
TRUEevaluated 28 times by 3 tests
Evaluated by:
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 12 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
12-28
1312 setError(InvalidIPv6AddressError, value, from);
executed 28 times by 3 tests: setError(InvalidIPv6AddressError, value, from);
Executed by:
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
28
1313 else-
1314 setError(InvalidCharacterInIPv6Error, value, c - value.constData());
executed 12 times by 4 tests: setError(InvalidCharacterInIPv6Error, value, c - value.constData());
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
12
1315 return false;
executed 40 times by 5 tests: return false;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
40
1316 }-
1317-
1318 // check if it's an IPv4 address-
1319 QIPAddressUtils::IPv4Address ip4;-
1320 if (QIPAddressUtils::parseIp4(ip4, begin, end)) {
QIPAddressUtil...4, begin, end)Description
TRUEevaluated 1234 times by 20 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSslSocket
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlSimpleReader
  • tst_Spdy
FALSEevaluated 10383 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
1234-10383
1321 // yes, it was-
1322 QIPAddressUtils::toString(host, ip4);-
1323 return true;
executed 1234 times by 20 tests: return true;
Executed by:
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSslSocket
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlSimpleReader
  • tst_Spdy
1234
1324 }-
1325-
1326 // This is probably a reg-name.-
1327 // But it can also be an encoded string that, when decoded becomes one-
1328 // of the types above.-
1329 //-
1330 // Two types of encoding are possible:-
1331 // percent encoding (e.g., "%31%30%2E%30%2E%30%2E%31" -> "10.0.0.1")-
1332 // Unicode encoding (some non-ASCII characters case-fold to digits-
1333 // when nameprepping is done)-
1334 //-
1335 // The qt_ACE_do function below applies nameprepping and the STD3 check.-
1336 // That means a Unicode string may become an IPv4 address, but it cannot-
1337 // produce a '[' or a '%'.-
1338-
1339 // check for percent-encoding first-
1340 QString s;-
1341 if (mode == QUrl::TolerantMode && qt_urlRecode(s, begin, end, 0, 0)) {
mode == QUrl::TolerantModeDescription
TRUEevaluated 10255 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
FALSEevaluated 128 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
qt_urlRecode(s...in, end, 0, 0)Description
TRUEevaluated 54 times by 2 tests
Evaluated by:
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 10201 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
54-10255
1342 // something was decoded-
1343 // anything encoded left?-
1344 int pos = s.indexOf(QChar(0x25)); // '%'-
1345 if (pos != -1) {
pos != -1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlInternal
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QUrl
4-50
1346 setError(InvalidRegNameError, s, pos);-
1347 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_QUrlInternal
4
1348 }-
1349-
1350 // recurse-
1351 return setHost(s, 0, s.length(), QUrl::StrictMode);
executed 50 times by 1 test: return setHost(s, 0, s.length(), QUrl::StrictMode);
Executed by:
  • tst_QUrl
50
1352 }-
1353-
1354 s = qt_ACE_do(QString::fromRawData(begin, len), NormalizeAce, ForbidLeadingDot);-
1355 if (s.isEmpty()) {
s.isEmpty()Description
TRUEevaluated 114 times by 7 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 10215 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
114-10215
1356 setError(InvalidRegNameError, value);-
1357 return false;
executed 114 times by 7 tests: return false;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
114
1358 }-
1359-
1360 // check IPv4 again-
1361 if (QIPAddressUtils::parseIp4(ip4, s.constBegin(), s.constEnd())) {
QIPAddressUtil... s.constEnd())Description
TRUEnever evaluated
FALSEevaluated 10215 times by 37 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
0-10215
1362 QIPAddressUtils::toString(host, ip4);-
1363 } else {
never executed: end of block
0
1364 host = s;-
1365 }
executed 10215 times by 37 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
10215
1366 return true;
executed 10215 times by 37 tests: return true;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
10215
1367}-
1368-
1369inline void QUrlPrivate::parse(const QString &url, QUrl::ParsingMode parsingMode)-
1370{-
1371 // URI-reference = URI / relative-ref-
1372 // URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]-
1373 // relative-ref = relative-part [ "?" query ] [ "#" fragment ]-
1374 // hier-part = "//" authority path-abempty-
1375 // / other path types-
1376 // relative-part = "//" authority path-abempty-
1377 // / other path types here-
1378-
1379 sectionIsPresent = 0;-
1380 flags = 0;-
1381 clearError();-
1382-
1383 // find the important delimiters-
1384 int colon = -1;-
1385 int question = -1;-
1386 int hash = -1;-
1387 const int len = url.length();-
1388 const QChar *const begin = url.constData();-
1389 const ushort *const data = reinterpret_cast<const ushort *>(begin);-
1390-
1391 for (int i = 0; i < len; ++i) {
i < lenDescription
TRUEevaluated 250109 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
FALSEevaluated 9845 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
9845-250109
1392 uint uc = data[i];-
1393 if (uc == '#' && hash == -1) {
uc == '#'Description
TRUEevaluated 136 times by 4 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 249973 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
hash == -1Description
TRUEevaluated 136 times by 4 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QTextBrowser
  • tst_QUrl
FALSEnever evaluated
0-249973
1394 hash = i;-
1395-
1396 // nothing more to be found-
1397 break;
executed 136 times by 4 tests: break;
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QTextBrowser
  • tst_QUrl
136
1398 }-
1399-
1400 if (question == -1) {
question == -1Description
TRUEevaluated 246645 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
FALSEevaluated 3328 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
3328-246645
1401 if (uc == ':' && colon == -1)
uc == ':'Description
TRUEevaluated 7343 times by 30 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • ...
FALSEevaluated 239302 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
colon == -1Description
TRUEevaluated 6197 times by 30 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • ...
FALSEevaluated 1146 times by 7 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
1146-239302
1402 colon = i;
executed 6197 times by 30 tests: colon = i;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • ...
6197
1403 else if (uc == '?')
uc == '?'Description
TRUEevaluated 345 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 240103 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
345-240103
1404 question = i;
executed 345 times by 5 tests: question = i;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
345
1405 }
executed 246645 times by 34 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
246645
1406 }
executed 249973 times by 34 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
249973
1407-
1408 // check if we have a scheme-
1409 int hierStart;-
1410 if (colon != -1 && setScheme(url, colon, /* don't set error */ false)) {
colon != -1Description
TRUEevaluated 6197 times by 30 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • ...
FALSEevaluated 3784 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlStream
setScheme(url, colon, false)Description
TRUEevaluated 6136 times by 28 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 61 times by 5 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QUrl
61-6197
1411 hierStart = colon + 1;-
1412 } else {
executed 6136 times by 28 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
6136
1413 // recover from a failed scheme: it might not have been a scheme at all-
1414 scheme.clear();-
1415 sectionIsPresent = 0;-
1416 hierStart = 0;-
1417 }
executed 3845 times by 16 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlStream
3845
1418-
1419 int pathStart;-
1420 int hierEnd = qMin<uint>(qMin<uint>(question, hash), len);-
1421 if (hierEnd - hierStart >= 2 && data[hierStart] == '/' && data[hierStart + 1] == '/') {
hierEnd - hierStart >= 2Description
TRUEevaluated 9308 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
FALSEevaluated 673 times by 13 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
data[hierStart] == '/'Description
TRUEevaluated 5623 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • ...
FALSEevaluated 3685 times by 13 tests
Evaluated by:
  • tst_QDataUrl
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
data[hierStart + 1] == '/'Description
TRUEevaluated 5509 times by 28 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 114 times by 5 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
114-9308
1422 // we have an authority, it ends at the first slash after these-
1423 int authorityEnd = hierEnd;-
1424 for (int i = hierStart + 2; i < authorityEnd ; ++i) {
i < authorityEndDescription
TRUEevaluated 86564 times by 28 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 2868 times by 13 tests
Evaluated by:
  • tst_QDataUrl
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_selftests - unknown status
2868-86564
1425 if (data[i] == '/') {
data[i] == '/'Description
TRUEevaluated 2641 times by 22 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
FALSEevaluated 83923 times by 22 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
2641-83923
1426 authorityEnd = i;-
1427 break;
executed 2641 times by 22 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
2641
1428 }-
1429 }
executed 83923 times by 22 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_selftests - unknown status
83923
1430-
1431 setAuthority(url, hierStart + 2, authorityEnd, parsingMode);-
1432-
1433 // even if we failed to set the authority properly, let's try to recover-
1434 pathStart = authorityEnd;-
1435 setPath(url, pathStart, hierEnd);-
1436 } else {
executed 5509 times by 28 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
5509
1437 userName.clear();-
1438 password.clear();-
1439 host.clear();-
1440 port = -1;-
1441 pathStart = hierStart;-
1442-
1443 if (hierStart < hierEnd)
hierStart < hierEndDescription
TRUEevaluated 3830 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QDataUrl
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlStream
FALSEevaluated 642 times by 13 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
642-3830
1444 setPath(url, hierStart, hierEnd);
executed 3830 times by 16 tests: setPath(url, hierStart, hierEnd);
Executed by:
  • tst_NetworkSelfTest
  • tst_QDataUrl
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlStream
3830
1445 else-
1446 path.clear();
executed 642 times by 13 tests: path.clear();
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
642
1447 }-
1448-
1449 if (uint(question) < uint(hash))
uint(question) < uint(hash)Description
TRUEevaluated 345 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 9636 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
345-9636
1450 setQuery(url, question + 1, qMin<uint>(hash, len));
executed 345 times by 5 tests: setQuery(url, question + 1, qMin<uint>(hash, len));
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
345
1451-
1452 if (hash != -1)
hash != -1Description
TRUEevaluated 136 times by 4 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 9845 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
136-9845
1453 setFragment(url, hash + 1, len);
executed 136 times by 4 tests: setFragment(url, hash + 1, len);
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QTextBrowser
  • tst_QUrl
136
1454-
1455 if (error || parsingMode == QUrl::TolerantMode)
errorDescription
TRUEevaluated 71 times by 2 tests
Evaluated by:
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 9910 times by 33 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
parsingMode ==...::TolerantModeDescription
TRUEevaluated 9841 times by 33 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
FALSEevaluated 69 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
69-9910
1456 return;
executed 9912 times by 34 tests: return;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
9912
1457-
1458 // The parsing so far was partially tolerant of errors, except for the-
1459 // scheme parser (which is always strict) and the authority (which was-
1460 // executed in strict mode).-
1461 // If we haven't found any errors so far, continue the strict-mode parsing-
1462 // from the path component onwards.-
1463-
1464 if (!validateComponent(Path, url, pathStart, hierEnd))
!validateCompo...tart, hierEnd)Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
FALSEevaluated 64 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
5-64
1465 return;
executed 5 times by 2 tests: return;
Executed by:
  • tst_QNetworkRequest
  • tst_QUrl
5
1466 if (uint(question) < uint(hash) && !validateComponent(Query, url, question + 1, qMin<uint>(hash, len)))
uint(question) < uint(hash)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 63 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
!validateCompo...t>(hash, len))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-63
1467 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QUrl
1
1468 if (hash != -1)
hash != -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 62 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
1-62
1469 validateComponent(Fragment, url, hash + 1, len);
executed 1 time by 1 test: validateComponent(Fragment, url, hash + 1, len);
Executed by:
  • tst_QUrl
1
1470}
executed 63 times by 4 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
63
1471-
1472QString QUrlPrivate::toLocalFile(QUrl::FormattingOptions options) const-
1473{-
1474 QString tmp;-
1475 QString ourPath;-
1476 appendPath(ourPath, options, QUrlPrivate::Path);-
1477-
1478 // magic for shared drive on windows-
1479 if (!host.isEmpty()) {
!host.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 10627 times by 15 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
4-10627
1480 tmp = QLatin1String("//") + host;-
1481#ifdef Q_OS_WIN // QTBUG-42346, WebDAV is visible as local file on Windows only.-
1482 if (scheme == webDavScheme())-
1483 tmp += webDavSslTag();-
1484#endif-
1485 if (!ourPath.isEmpty() && !ourPath.startsWith(QLatin1Char('/')))
!ourPath.isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
!ourPath.start...tin1Char('/'))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
1-3
1486 tmp += QLatin1Char('/');
executed 1 time by 1 test: tmp += QLatin1Char('/');
Executed by:
  • tst_QUrl
1
1487 tmp += ourPath;-
1488 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_QUrl
4
1489 tmp = ourPath;-
1490#ifdef Q_OS_WIN-
1491 // magic for drives on windows-
1492 if (ourPath.length() > 2 && ourPath.at(0) == QLatin1Char('/') && ourPath.at(2) == QLatin1Char(':'))-
1493 tmp.remove(0, 1);-
1494#endif-
1495 }
executed 10627 times by 15 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
10627
1496 return tmp;
executed 10631 times by 15 tests: return tmp;
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
10631
1497}-
1498-
1499/*-
1500 From http://www.ietf.org/rfc/rfc3986.txt, 5.2.3: Merge paths-
1501-
1502 Returns a merge of the current path with the relative path passed-
1503 as argument.-
1504-
1505 Note: \a relativePath is relative (does not start with '/').-
1506*/-
1507inline QString QUrlPrivate::mergePaths(const QString &relativePath) const-
1508{-
1509 // If the base URI has a defined authority component and an empty-
1510 // path, then return a string consisting of "/" concatenated with-
1511 // the reference's path; otherwise,-
1512 if (!host.isEmpty() && path.isEmpty())
!host.isEmpty()Description
TRUEevaluated 1043 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 2346 times by 4 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
path.isEmpty()Description
TRUEevaluated 1000 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
43-2346
1513 return QLatin1Char('/') + relativePath;
executed 1000 times by 1 test: return QLatin1Char('/') + relativePath;
Executed by:
  • tst_QUrl
1000
1514-
1515 // Return a string consisting of the reference's path component-
1516 // appended to all but the last segment of the base URI's path-
1517 // (i.e., excluding any characters after the right-most "/" in the-
1518 // base URI path, or excluding the entire base URI path if it does-
1519 // not contain any "/" characters).-
1520 QString newPath;-
1521 if (!path.contains(QLatin1Char('/')))
!path.contains...tin1Char('/'))Description
TRUEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 2370 times by 4 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
19-2370
1522 newPath = relativePath;
executed 19 times by 2 tests: newPath = relativePath;
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
19
1523 else-
1524 newPath = path.leftRef(path.lastIndexOf(QLatin1Char('/')) + 1) + relativePath;
executed 2370 times by 4 tests: newPath = path.leftRef(path.lastIndexOf(QLatin1Char('/')) + 1) + relativePath;
Executed by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
2370
1525-
1526 return newPath;
executed 2389 times by 4 tests: return newPath;
Executed by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
2389
1527}-
1528-
1529/*-
1530 From http://www.ietf.org/rfc/rfc3986.txt, 5.2.4: Remove dot segments-
1531-
1532 Removes unnecessary ../ and ./ from the path. Used for normalizing-
1533 the URL.-
1534*/-
1535static void removeDotsFromPath(QString *path)-
1536{-
1537 // The input buffer is initialized with the now-appended path-
1538 // components and the output buffer is initialized to the empty-
1539 // string.-
1540 QChar *out = path->data();-
1541 const QChar *in = out;-
1542 const QChar *end = out + path->size();-
1543-
1544 // If the input buffer consists only of-
1545 // "." or "..", then remove that from the input-
1546 // buffer;-
1547 if (path->size() == 1 && in[0].unicode() == '.')
path->size() == 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 4482 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
in[0].unicode() == '.'Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
0-4482
1548 ++in;
never executed: ++in;
0
1549 else if (path->size() == 2 && in[0].unicode() == '.' && in[1].unicode() == '.')
path->size() == 2Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 4483 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
in[0].unicode() == '.'Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
in[1].unicode() == '.'Description
TRUEnever evaluated
FALSEnever evaluated
0-4483
1550 in += 2;
never executed: in += 2;
0
1551 // While the input buffer is not empty, loop:-
1552 while (in < end) {
in < endDescription
TRUEevaluated 37799 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 4482 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
4482-37799
1553-
1554 // otherwise, if the input buffer begins with a prefix of "../" or "./",-
1555 // then remove that prefix from the input buffer;-
1556 if (path->size() >= 2 && in[0].unicode() == '.' && in[1].unicode() == '/')
path->size() >= 2Description
TRUEevaluated 37795 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
in[0].unicode() == '.'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 37794 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
in[1].unicode() == '/'Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
0-37795
1557 in += 2;
never executed: in += 2;
0
1558 else if (path->size() >= 3 && in[0].unicode() == '.'
path->size() >= 3Description
TRUEevaluated 37792 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
in[0].unicode() == '.'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 37791 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
1-37792
1559 && in[1].unicode() == '.' && in[2].unicode() == '/')
in[1].unicode() == '.'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
in[2].unicode() == '/'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-1
1560 in += 3;
executed 1 time by 1 test: in += 3;
Executed by:
  • tst_QUrl
1
1561-
1562 // otherwise, if the input buffer begins with a prefix of-
1563 // "/./" or "/.", where "." is a complete path segment,-
1564 // then replace that prefix with "/" in the input buffer;-
1565 if (in <= end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'
in <= end - 3Description
TRUEevaluated 37746 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 53 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QUrl
  • tst_QXmlStream
in[0].unicode() == '/'Description
TRUEevaluated 37715 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 31 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
in[1].unicode() == '.'Description
TRUEevaluated 46 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
FALSEevaluated 37669 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
31-37746
1566 && in[2].unicode() == '/') {
in[2].unicode() == '/'Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 39 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
7-39
1567 in += 2;-
1568 continue;
executed 7 times by 1 test: continue;
Executed by:
  • tst_QUrl
7
1569 } else if (in == end - 2 && in[0].unicode() == '/' && in[1].unicode() == '.') {
in == end - 2Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 37763 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
in[0].unicode() == '/'Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
in[1].unicode() == '.'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QUrl
0-37763
1570 *out++ = QLatin1Char('/');-
1571 in += 2;-
1572 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QUrl
2
1573 }-
1574-
1575 // otherwise, if the input buffer begins with a prefix-
1576 // of "/../" or "/..", where ".." is a complete path-
1577 // segment, then replace that prefix with "/" in the-
1578 // input buffer and remove the last //segment and its-
1579 // preceding "/" (if any) from the output buffer;-
1580 if (in <= end - 4 && in[0].unicode() == '/' && in[1].unicode() == '.'
in <= end - 4Description
TRUEevaluated 37733 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 57 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QUrl
  • tst_QXmlStream
in[0].unicode() == '/'Description
TRUEevaluated 37702 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 31 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
in[1].unicode() == '.'Description
TRUEevaluated 36 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
FALSEevaluated 37666 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
31-37733
1581 && in[2].unicode() == '.' && in[3].unicode() == '/') {
in[2].unicode() == '.'Description
TRUEevaluated 36 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
FALSEnever evaluated
in[3].unicode() == '/'Description
TRUEevaluated 35 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
0-36
1582 while (out > path->constData() && (--out)->unicode() != '/')
out > path->constData()Description
TRUEevaluated 111 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
(--out)->unicode() != '/'Description
TRUEevaluated 84 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
FALSEevaluated 27 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
8-111
1583 ;
executed 84 times by 3 tests: ;
Executed by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
84
1584 if (out == path->constData() && out->unicode() != '/')
out == path->constData()Description
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 21 times by 3 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
out->unicode() != '/'Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QUrl
3-21
1585 ++in;
executed 3 times by 2 tests: ++in;
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
3
1586 in += 3;-
1587 continue;
executed 35 times by 3 tests: continue;
Executed by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
35
1588 } else if (in == end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'
in == end - 3Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 37749 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
in[0].unicode() == '/'Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
in[1].unicode() == '.'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
0-37749
1589 && in[2].unicode() == '.') {
in[2].unicode() == '.'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-2
1590 while (out > path->constData() && (--out)->unicode() != '/')
out > path->constData()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
(--out)->unicode() != '/'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
0-4
1591 ;
executed 2 times by 1 test: ;
Executed by:
  • tst_QUrl
2
1592 if (out->unicode() == '/')
out->unicode() == '/'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-2
1593 ++out;
executed 2 times by 1 test: ++out;
Executed by:
  • tst_QUrl
2
1594 in += 3;-
1595 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QUrl
2
1596 }-
1597-
1598 // otherwise move the first path segment in-
1599 // the input buffer to the end of the output-
1600 // buffer, including the initial "/" character-
1601 // (if any) and any subsequent characters up-
1602 // to, but not including, the next "/"-
1603 // character or the end of the input buffer.-
1604 *out++ = *in++;-
1605 while (in < end && in->unicode() != '/')
in < endDescription
TRUEevaluated 267871 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 3480 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
in->unicode() != '/'Description
TRUEevaluated 233598 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 34273 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
3480-267871
1606 *out++ = *in++;
executed 233598 times by 5 tests: *out++ = *in++;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
233598
1607 }
executed 37753 times by 5 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
37753
1608 path->truncate(out - path->constData());-
1609}
executed 4486 times by 5 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
4486
1610-
1611inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, int *position) const-
1612{-
1613 Q_ASSERT(!source == !position);-
1614 if (error) {
errorDescription
TRUEevaluated 464 times by 3 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 15857 times by 30 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • ...
464-15857
1615 if (source) {
sourceDescription
TRUEevaluated 195 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 269 times by 3 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
  • tst_QUrlInternal
195-269
1616 *source = error->source;-
1617 *position = error->position;-
1618 }
executed 195 times by 1 test: end of block
Executed by:
  • tst_QUrl
195
1619 return error->code;
executed 464 times by 3 tests: return error->code;
Executed by:
  • tst_QNetworkRequest
  • tst_QUrl
  • tst_QUrlInternal
464
1620 }-
1621-
1622 // There are two more cases of invalid URLs that QUrl recognizes and they-
1623 // are only possible with constructed URLs (setXXX methods), not with-
1624 // parsing. Therefore, they are tested here.-
1625 //-
1626 // The two cases are a non-empty path that doesn't start with a slash and:-
1627 // - with an authority-
1628 // - without an authority, without scheme but the path with a colon before-
1629 // the first slash-
1630 // Those cases are considered invalid because toString() would produce a URL-
1631 // that wouldn't be parsed back to the same QUrl.-
1632-
1633 if (path.isEmpty() || path.at(0) == QLatin1Char('/'))
path.isEmpty()Description
TRUEevaluated 4511 times by 18 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_selftests - unknown status
FALSEevaluated 11346 times by 27 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
path.at(0) == QLatin1Char('/')Description
TRUEevaluated 10621 times by 22 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
FALSEevaluated 725 times by 13 tests
Evaluated by:
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
725-11346
1634 return NoError;
executed 15132 times by 26 tests: return NoError;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • ...
15132
1635 if (sectionIsPresent & QUrlPrivate::Host) {
sectionIsPrese...lPrivate::HostDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 719 times by 13 tests
Evaluated by:
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
6-719
1636 if (source) {
sourceDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
1-5
1637 *source = path;-
1638 *position = 0;-
1639 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUrl
1
1640 return AuthorityPresentAndPathIsRelative;
executed 6 times by 1 test: return AuthorityPresentAndPathIsRelative;
Executed by:
  • tst_QUrl
6
1641 }-
1642 if (sectionIsPresent & QUrlPrivate::Scheme)
sectionIsPrese...rivate::SchemeDescription
TRUEevaluated 360 times by 6 tests
Evaluated by:
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 359 times by 9 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
359-360
1643 return NoError;
executed 360 times by 6 tests: return NoError;
Executed by:
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
360
1644-
1645 // check for a path of "text:text/"-
1646 for (int i = 0; i < path.length(); ++i) {
i < path.length()Description
TRUEevaluated 4073 times by 9 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
FALSEevaluated 214 times by 7 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
214-4073
1647 ushort c = path.at(i).unicode();-
1648 if (c == '/') {
c == '/'Description
TRUEevaluated 68 times by 4 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
FALSEevaluated 4005 times by 9 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
68-4005
1649 // found the slash before the colon-
1650 return NoError;
executed 68 times by 4 tests: return NoError;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
68
1651 }-
1652 if (c == ':') {
c == ':'Description
TRUEevaluated 77 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
FALSEevaluated 3928 times by 9 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
77-3928
1653 // found the colon before the slash, it's invalid-
1654 if (source) {
sourceDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 71 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
6-71
1655 *source = path;-
1656 *position = i;-
1657 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUrl
6
1658 return RelativeUrlPathContainsColonBeforeSlash;
executed 77 times by 2 tests: return RelativeUrlPathContainsColonBeforeSlash;
Executed by:
  • tst_QNetworkRequest
  • tst_QUrl
77
1659 }-
1660 }
executed 3928 times by 9 tests: end of block
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
3928
1661 return NoError;
executed 214 times by 7 tests: return NoError;
Executed by:
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QVariant
214
1662}-
1663-
1664bool QUrlPrivate::validateComponent(QUrlPrivate::Section section, const QString &input,-
1665 int begin, int end)-
1666{-
1667 // What we need to look out for, that the regular parser tolerates:-
1668 // - percent signs not followed by two hex digits-
1669 // - forbidden characters, which should always appear encoded-
1670 // '"' / '<' / '>' / '\' / '^' / '`' / '{' / '|' / '}' / BKSP-
1671 // control characters-
1672 // - delimiters not allowed in certain positions-
1673 // . scheme: parser is already strict-
1674 // . user info: gen-delims except ":" disallowed ("/" / "?" / "#" / "[" / "]" / "@")-
1675 // . host: parser is stricter than the standard-
1676 // . port: parser is stricter than the standard-
1677 // . path: all delimiters allowed-
1678 // . fragment: all delimiters allowed-
1679 // . query: all delimiters allowed-
1680 static const char forbidden[] = "\"<>\\^`{|}\x7F";-
1681 static const char forbiddenUserInfo[] = ":/?#[]@";-
1682-
1683 Q_ASSERT(section != Authority && section != Hierarchy && section != FullUrl);-
1684-
1685 const ushort *const data = reinterpret_cast<const ushort *>(input.constData());-
1686 for (uint i = uint(begin); i < uint(end); ++i) {
i < uint(end)Description
TRUEevaluated 3620 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
FALSEevaluated 147 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
147-3620
1687 uint uc = data[i];-
1688 if (uc >= 0x80)
uc >= 0x80Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3609 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
11-3609
1689 continue;
executed 11 times by 1 test: continue;
Executed by:
  • tst_QUrl
11
1690-
1691 bool error = false;-
1692 if ((uc == '%' && (uint(end) < i + 2 || !isHex(data[i + 1]) || !isHex(data[i + 2])))
uc == '%'Description
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
FALSEevaluated 3576 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
uint(end) < i + 2Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
!isHex(data[i + 1])Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
!isHex(data[i + 2])Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
1-3576
1693 || uc <= 0x20 || strchr(forbidden, uc)) {
uc <= 0x20Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3589 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
strchr(forbidden, uc)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3575 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
4-3589
1694 // found an error-
1695 error = true;-
1696 } else if (section & UserInfo) {
executed 34 times by 2 tests: end of block
Executed by:
  • tst_QNetworkRequest
  • tst_QUrl
section & UserInfoDescription
TRUEevaluated 75 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3500 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
34-3500
1697 if (section == UserInfo && strchr(forbiddenUserInfo + 1, uc))
section == UserInfoDescription
TRUEevaluated 53 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_QUrl
strchr(forbidd...rInfo + 1, uc)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_QUrl
1-53
1698 error = true;
executed 1 time by 1 test: error = true;
Executed by:
  • tst_QUrl
1
1699 else if (section != UserInfo && strchr(forbiddenUserInfo, uc))
section != UserInfoDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_QUrl
strchr(forbiddenUserInfo, uc)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
4-52
1700 error = true;
executed 4 times by 1 test: error = true;
Executed by:
  • tst_QUrl
4
1701 }
executed 75 times by 1 test: end of block
Executed by:
  • tst_QUrl
75
1702-
1703 if (!error)
!errorDescription
TRUEevaluated 3570 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
FALSEevaluated 39 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
39-3570
1704 continue;
executed 3570 times by 4 tests: continue;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
3570
1705-
1706 ErrorCode errorCode = ErrorCode(int(section) << 8);-
1707 if (section == UserInfo) {
section == UserInfoDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QNetworkRequest
  • tst_QUrl
12-27
1708 // is it the user name or the password?-
1709 errorCode = InvalidUserNameError;-
1710 for (uint j = uint(begin); j < i; ++j)
j < iDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUrl
9-41
1711 if (data[j] == ':') {
data[j] == ':'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_QUrl
3-38
1712 errorCode = InvalidPasswordError;-
1713 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QUrl
3
1714 }-
1715 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QUrl
12
1716-
1717 setError(errorCode, input, i);-
1718 return false;
executed 39 times by 2 tests: return false;
Executed by:
  • tst_QNetworkRequest
  • tst_QUrl
39
1719 }-
1720-
1721 // no errors-
1722 return true;
executed 147 times by 4 tests: return true;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
147
1723}-
1724-
1725#if 0-
1726inline void QUrlPrivate::validate() const-
1727{-
1728 QUrlPrivate *that = (QUrlPrivate *)this;-
1729 that->encodedOriginal = that->toEncoded(); // may detach-
1730 parse(ParseOnly);-
1731-
1732 QURL_SETFLAG(that->stateFlags, Validated);-
1733-
1734 if (!isValid)-
1735 return;-
1736-
1737 QString auth = authority(); // causes the non-encoded forms to be valid-
1738-
1739 // authority() calls canonicalHost() which sets this-
1740 if (!isHostValid)-
1741 return;-
1742-
1743 if (scheme == QLatin1String("mailto")) {-
1744 if (!host.isEmpty() || port != -1 || !userName.isEmpty() || !password.isEmpty()) {-
1745 that->isValid = false;-
1746 that->errorInfo.setParams(0, QT_TRANSLATE_NOOP(QUrl, "expected empty host, username,"-
1747 "port and password"),-
1748 0, 0);-
1749 }-
1750 } else if (scheme == ftpScheme() || scheme == httpScheme()) {-
1751 if (host.isEmpty() && !(path.isEmpty() && encodedPath.isEmpty())) {-
1752 that->isValid = false;-
1753 that->errorInfo.setParams(0, QT_TRANSLATE_NOOP(QUrl, "the host is empty, but not the path"),-
1754 0, 0);-
1755 }-
1756 }-
1757}-
1758#endif-
1759-
1760/*!-
1761 \macro QT_NO_URL_CAST_FROM_STRING-
1762 \relates QUrl-
1763-
1764 Disables automatic conversions from QString (or char *) to QUrl.-
1765-
1766 Compiling your code with this define is useful when you have a lot of-
1767 code that uses QString for file names and you wish to convert it to-
1768 use QUrl for network transparency. In any code that uses QUrl, it can-
1769 help avoid missing QUrl::resolved() calls, and other misuses of-
1770 QString to QUrl conversions.-
1771-
1772 \oldcode-
1773 url = filename; // probably not what you want-
1774 \newcode-
1775 url = QUrl::fromLocalFile(filename);-
1776 url = baseurl.resolved(QUrl(filename));-
1777 \endcode-
1778-
1779 \sa QT_NO_CAST_FROM_ASCII-
1780*/-
1781-
1782-
1783/*!-
1784 Constructs a URL by parsing \a url. QUrl will automatically percent encode-
1785 all characters that are not allowed in a URL and decode the percent-encoded-
1786 sequences that represent an unreserved character (letters, digits, hyphens,-
1787 undercores, dots and tildes). All other characters are left in their-
1788 original forms.-
1789-
1790 Parses the \a url using the parser mode \a parsingMode. In TolerantMode-
1791 (the default), QUrl will correct certain mistakes, notably the presence of-
1792 a percent character ('%') not followed by two hexadecimal digits, and it-
1793 will accept any character in any position. In StrictMode, encoding mistakes-
1794 will not be tolerated and QUrl will also check that certain forbidden-
1795 characters are not present in unencoded form. If an error is detected in-
1796 StrictMode, isValid() will return false. The parsing mode DecodedMode is not-
1797 permitted in this context.-
1798-
1799 Example:-
1800-
1801 \snippet code/src_corelib_io_qurl.cpp 0-
1802-
1803 To construct a URL from an encoded string, you can also use fromEncoded():-
1804-
1805 \snippet code/src_corelib_io_qurl.cpp 1-
1806-
1807 Both functions are equivalent and, in Qt 5, both functions accept encoded-
1808 data. Usually, the choice of the QUrl constructor or setUrl() versus-
1809 fromEncoded() will depend on the source data: the constructor and setUrl()-
1810 take a QString, whereas fromEncoded takes a QByteArray.-
1811-
1812 \sa setUrl(), fromEncoded(), TolerantMode-
1813*/-
1814QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0)-
1815{-
1816 setUrl(url, parsingMode);-
1817}
executed 8717 times by 34 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
8717
1818-
1819/*!-
1820 Constructs an empty QUrl object.-
1821*/-
1822QUrl::QUrl() : d(0)-
1823{-
1824}
executed 45822 times by 85 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QErrorMessage
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • ...
45822
1825-
1826/*!-
1827 Constructs a copy of \a other.-
1828*/-
1829QUrl::QUrl(const QUrl &other) : d(other.d)-
1830{-
1831 if (d)
dDescription
TRUEevaluated 63243 times by 50 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • ...
FALSEevaluated 10185 times by 24 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_selftests - unknown status
10185-63243
1832 d->ref.ref();
executed 63243 times by 50 tests: d->ref.ref();
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • ...
63243
1833}
executed 73428 times by 52 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • ...
73428
1834-
1835/*!-
1836 Destructor; called immediately before the object is deleted.-
1837*/-
1838QUrl::~QUrl()-
1839{-
1840 if (d && !d->ref.deref())
dDescription
TRUEevaluated 94490 times by 62 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
FALSEevaluated 37727 times by 83 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QItemDelegate
  • tst_QLabel
  • tst_QMainWindow
  • tst_QMdiArea
  • ...
!d->ref.deref()Description
TRUEevaluated 32655 times by 62 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
FALSEevaluated 61835 times by 52 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QObject
  • ...
32655-94490
1841 delete d;
executed 32655 times by 62 tests: delete d;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
32655
1842}
executed 132217 times by 98 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCompleter
  • tst_QDataUrl
  • tst_QDataWidgetMapper
  • tst_QErrorMessage
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • ...
132217
1843-
1844/*!-
1845 Returns \c true if the URL is non-empty and valid; otherwise returns \c false.-
1846-
1847 The URL is run through a conformance test. Every part of the URL-
1848 must conform to the standard encoding rules of the URI standard-
1849 for the URL to be reported as valid.-
1850-
1851 \snippet code/src_corelib_io_qurl.cpp 2-
1852*/-
1853bool QUrl::isValid() const-
1854{-
1855 if (isEmpty()) {
isEmpty()Description
TRUEevaluated 318 times by 15 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_qdesktopservices
  • tst_selftests - unknown status
FALSEevaluated 16108 times by 31 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • ...
318-16108
1856 // also catches d == 0-
1857 return false;
executed 318 times by 15 tests: return false;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_qdesktopservices
  • tst_selftests - unknown status
318
1858 }-
1859 return d->validityError() == QUrlPrivate::NoError;
executed 16108 times by 31 tests: return d->validityError() == QUrlPrivate::NoError;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • tst_QVariant
  • ...
16108
1860}-
1861-
1862/*!-
1863 Returns \c true if the URL has no data; otherwise returns \c false.-
1864-
1865 \sa clear()-
1866*/-
1867bool QUrl::isEmpty() const-
1868{-
1869 if (!d) return true;
executed 915 times by 17 tests: return true;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_selftests - unknown status
!dDescription
TRUEevaluated 915 times by 17 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_selftests - unknown status
FALSEevaluated 16753 times by 32 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
915-16753
1870 return d->isEmpty();
executed 16753 times by 32 tests: return d->isEmpty();
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • ...
16753
1871}-
1872-
1873/*!-
1874 Resets the content of the QUrl. After calling this function, the-
1875 QUrl is equal to one that has been constructed with the default-
1876 empty constructor.-
1877-
1878 \sa isEmpty()-
1879*/-
1880void QUrl::clear()-
1881{-
1882 if (d && !d->ref.deref())
dDescription
TRUEevaluated 109 times by 3 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QUrl
FALSEnever evaluated
!d->ref.deref()Description
TRUEevaluated 109 times by 3 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QUrl
FALSEnever evaluated
0-109
1883 delete d;
executed 109 times by 3 tests: delete d;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QUrl
109
1884 d = 0;-
1885}
executed 109 times by 3 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QUrl
109
1886-
1887/*!-
1888 Parses \a url and sets this object to that value. QUrl will automatically-
1889 percent encode all characters that are not allowed in a URL and decode the-
1890 percent-encoded sequences that represent an unreserved character (letters,-
1891 digits, hyphens, undercores, dots and tildes). All other characters are-
1892 left in their original forms.-
1893-
1894 Parses the \a url using the parser mode \a parsingMode. In TolerantMode-
1895 (the default), QUrl will correct certain mistakes, notably the presence of-
1896 a percent character ('%') not followed by two hexadecimal digits, and it-
1897 will accept any character in any position. In StrictMode, encoding mistakes-
1898 will not be tolerated and QUrl will also check that certain forbidden-
1899 characters are not present in unencoded form. If an error is detected in-
1900 StrictMode, isValid() will return false. The parsing mode DecodedMode is-
1901 not permitted in this context and will produce a run-time warning.-
1902-
1903 \sa url(), toString()-
1904*/-
1905void QUrl::setUrl(const QString &url, ParsingMode parsingMode)-
1906{-
1907 if (parsingMode == DecodedMode) {
parsingMode == DecodedModeDescription
TRUEnever evaluated
FALSEevaluated 9971 times by 34 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
0-9971
1908 qWarning("QUrl: QUrl::DecodedMode is not permitted when parsing a full URL");-
1909 } else {
never executed: end of block
0
1910 detach();-
1911 d->parse(url, parsingMode);-
1912 }
executed 9971 times by 34 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • ...
9971
1913}-
1914-
1915/*!-
1916 \fn void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode)-
1917 \deprecated-
1918 Constructs a URL by parsing the contents of \a encodedUrl.-
1919-
1920 \a encodedUrl is assumed to be a URL string in percent encoded-
1921 form, containing only ASCII characters.-
1922-
1923 The parsing mode \a parsingMode is used for parsing \a encodedUrl.-
1924-
1925 \obsolete Use setUrl(QString::fromUtf8(encodedUrl), parsingMode)-
1926-
1927 \sa setUrl()-
1928*/-
1929-
1930/*!-
1931 Sets the scheme of the URL to \a scheme. As a scheme can only-
1932 contain ASCII characters, no conversion or decoding is done on the-
1933 input. It must also start with an ASCII letter.-
1934-
1935 The scheme describes the type (or protocol) of the URL. It's-
1936 represented by one or more ASCII characters at the start the URL.-
1937-
1938 A scheme is strictly \l {http://www.ietf.org/rfc/rfc3986.txt} {RFC 3986}-compliant:-
1939 \tt {scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )}-
1940-
1941 The following example shows a URL where the scheme is "ftp":-
1942-
1943 \image qurl-authority2.png-
1944-
1945 To set the scheme, the following call is used:-
1946 \code-
1947 QUrl url;-
1948 url.setScheme("ftp");-
1949 \endcode-
1950-
1951 The scheme can also be empty, in which case the URL is interpreted-
1952 as relative.-
1953-
1954 \sa scheme(), isRelative()-
1955*/-
1956void QUrl::setScheme(const QString &scheme)-
1957{-
1958 detach();-
1959 d->clearError();-
1960 if (scheme.isEmpty()) {
scheme.isEmpty()Description
TRUEevaluated 6202 times by 26 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • ...
FALSEevaluated 6050 times by 18 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qfileopenevent
6050-6202
1961 // schemes are not allowed to be empty-
1962 d->sectionIsPresent &= ~QUrlPrivate::Scheme;-
1963 d->flags &= ~QUrlPrivate::IsLocalFile;-
1964 d->scheme.clear();-
1965 } else {
executed 6202 times by 26 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • ...
6202
1966 d->setScheme(scheme, scheme.length(), /* do set error */ true);-
1967 }
executed 6050 times by 18 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qfileopenevent
6050
1968}-
1969-
1970/*!-
1971 Returns the scheme of the URL. If an empty string is returned,-
1972 this means the scheme is undefined and the URL is then relative.-
1973-
1974 The scheme can only contain US-ASCII letters or digits, which means it-
1975 cannot contain any character that would otherwise require encoding.-
1976 Additionally, schemes are always returned in lowercase form.-
1977-
1978 \sa setScheme(), isRelative()-
1979*/-
1980QString QUrl::scheme() const-
1981{-
1982 if (!d) return QString();
executed 561 times by 10 tests: return QString();
Executed by:
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
  • tst_qdesktopservices
!dDescription
TRUEevaluated 561 times by 10 tests
Evaluated by:
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
  • tst_qdesktopservices
FALSEevaluated 11016 times by 27 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • ...
561-11016
1983-
1984 return d->scheme;
executed 11016 times by 27 tests: return d->scheme;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • ...
11016
1985}-
1986-
1987/*!-
1988 Sets the authority of the URL to \a authority.-
1989-
1990 The authority of a URL is the combination of user info, a host-
1991 name and a port. All of these elements are optional; an empty-
1992 authority is therefore valid.-
1993-
1994 The user info and host are separated by a '@', and the host and-
1995 port are separated by a ':'. If the user info is empty, the '@'-
1996 must be omitted; although a stray ':' is permitted if the port is-
1997 empty.-
1998-
1999 The following example shows a valid authority string:-
2000-
2001 \image qurl-authority.png-
2002-
2003 The \a authority data is interpreted according to \a mode: in StrictMode,-
2004 any '%' characters must be followed by exactly two hexadecimal characters-
2005 and some characters (including space) are not allowed in undecoded form. In-
2006 TolerantMode (the default), all characters are accepted in undecoded form-
2007 and the tolerant parser will correct stray '%' not followed by two hex-
2008 characters.-
2009-
2010 This function does not allow \a mode to be QUrl::DecodedMode. To set fully-
2011 decoded data, call setUserName(), setPassword(), setHost() and setPort()-
2012 individually.-
2013-
2014 \sa setUserInfo(), setHost(), setPort()-
2015*/-
2016void QUrl::setAuthority(const QString &authority, ParsingMode mode)-
2017{-
2018 detach();-
2019 d->clearError();-
2020-
2021 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • tst_QUrl
0-31
2022 qWarning("QUrl::setAuthority(): QUrl::DecodedMode is not permitted in this function");-
2023 return;
never executed: return;
0
2024 }-
2025-
2026 d->setAuthority(authority, 0, authority.length(), mode);-
2027 if (authority.isNull()) {
authority.isNull()Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
13-18
2028 // QUrlPrivate::setAuthority cleared almost everything-
2029 // but it leaves the Host bit set-
2030 d->sectionIsPresent &= ~QUrlPrivate::Authority;-
2031 }
executed 13 times by 1 test: end of block
Executed by:
  • tst_QUrl
13
2032}
executed 31 times by 1 test: end of block
Executed by:
  • tst_QUrl
31
2033-
2034/*!-
2035 Returns the authority of the URL if it is defined; otherwise-
2036 an empty string is returned.-
2037-
2038 This function returns an unambiguous value, which may contain that-
2039 characters still percent-encoded, plus some control sequences not-
2040 representable in decoded form in QString.-
2041-
2042 The \a options argument controls how to format the user info component. The-
2043 value of QUrl::FullyDecoded is not permitted in this function. If you need-
2044 to obtain fully decoded data, call userName(), password(), host() and-
2045 port() individually.-
2046-
2047 \sa setAuthority(), userInfo(), userName(), password(), host(), port()-
2048*/-
2049QString QUrl::authority(ComponentFormattingOptions options) const-
2050{-
2051 QString result;-
2052 if (!d)
!dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 177 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
1-177
2053 return result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_QUrl
1
2054-
2055 if (options == QUrl::FullyDecoded) {
options == QUrl::FullyDecodedDescription
TRUEnever evaluated
FALSEevaluated 177 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
0-177
2056 qWarning("QUrl::authority(): QUrl::FullyDecoded is not permitted in this function");-
2057 return result;
never executed: return result;
0
2058 }-
2059-
2060 d->appendAuthority(result, options, QUrlPrivate::Authority);-
2061 return result;
executed 177 times by 3 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
177
2062}-
2063-
2064/*!-
2065 Sets the user info of the URL to \a userInfo. The user info is an-
2066 optional part of the authority of the URL, as described in-
2067 setAuthority().-
2068-
2069 The user info consists of a user name and optionally a password,-
2070 separated by a ':'. If the password is empty, the colon must be-
2071 omitted. The following example shows a valid user info string:-
2072-
2073 \image qurl-authority3.png-
2074-
2075 The \a userInfo data is interpreted according to \a mode: in StrictMode,-
2076 any '%' characters must be followed by exactly two hexadecimal characters-
2077 and some characters (including space) are not allowed in undecoded form. In-
2078 TolerantMode (the default), all characters are accepted in undecoded form-
2079 and the tolerant parser will correct stray '%' not followed by two hex-
2080 characters.-
2081-
2082 This function does not allow \a mode to be QUrl::DecodedMode. To set fully-
2083 decoded data, call setUserName() and setPassword() individually.-
2084-
2085 \sa userInfo(), setUserName(), setPassword(), setAuthority()-
2086*/-
2087void QUrl::setUserInfo(const QString &userInfo, ParsingMode mode)-
2088{-
2089 detach();-
2090 d->clearError();-
2091 QString trimmed = userInfo.trimmed();-
2092 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEnever evaluated
FALSEevaluated 51 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
0-51
2093 qWarning("QUrl::setUserInfo(): QUrl::DecodedMode is not permitted in this function");-
2094 return;
never executed: return;
0
2095 }-
2096-
2097 d->setUserInfo(trimmed, 0, trimmed.length());-
2098 if (userInfo.isNull()) {
userInfo.isNull()Description
TRUEevaluated 41 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
10-41
2099 // QUrlPrivate::setUserInfo cleared almost everything-
2100 // but it leaves the UserName bit set-
2101 d->sectionIsPresent &= ~QUrlPrivate::UserInfo;-
2102 } else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::UserInfo, userInfo)) {
executed 41 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
mode == StrictModeDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
!d->validateCo...nfo, userInfo)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-41
2103 d->sectionIsPresent &= ~QUrlPrivate::UserInfo;-
2104 d->userName.clear();-
2105 d->password.clear();-
2106 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QUrl
5
2107}
executed 51 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
51
2108-
2109/*!-
2110 Returns the user info of the URL, or an empty string if the user-
2111 info is undefined.-
2112-
2113 This function returns an unambiguous value, which may contain that-
2114 characters still percent-encoded, plus some control sequences not-
2115 representable in decoded form in QString.-
2116-
2117 The \a options argument controls how to format the user info component. The-
2118 value of QUrl::FullyDecoded is not permitted in this function. If you need-
2119 to obtain fully decoded data, call userName() and password() individually.-
2120-
2121 \sa setUserInfo(), userName(), password(), authority()-
2122*/-
2123QString QUrl::userInfo(ComponentFormattingOptions options) const-
2124{-
2125 QString result;-
2126 if (!d)
!dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2348 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
1-2348
2127 return result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_QUrl
1
2128-
2129 if (options == QUrl::FullyDecoded) {
options == QUrl::FullyDecodedDescription
TRUEnever evaluated
FALSEevaluated 2348 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
0-2348
2130 qWarning("QUrl::userInfo(): QUrl::FullyDecoded is not permitted in this function");-
2131 return result;
never executed: return result;
0
2132 }-
2133-
2134 d->appendUserInfo(result, options, QUrlPrivate::UserInfo);-
2135 return result;
executed 2348 times by 9 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
2348
2136}-
2137-
2138/*!-
2139 Sets the URL's user name to \a userName. The \a userName is part-
2140 of the user info element in the authority of the URL, as described-
2141 in setUserInfo().-
2142-
2143 The \a userName data is interpreted according to \a mode: in StrictMode,-
2144 any '%' characters must be followed by exactly two hexadecimal characters-
2145 and some characters (including space) are not allowed in undecoded form. In-
2146 TolerantMode (the default), all characters are accepted in undecoded form-
2147 and the tolerant parser will correct stray '%' not followed by two hex-
2148 characters. In DecodedMode, '%' stand for themselves and encoded characters-
2149 are not possible.-
2150-
2151 QUrl::DecodedMode should be used when setting the user name from a data-
2152 source which is not a URL, such as a password dialog shown to the user or-
2153 with a user name obtained by calling userName() with the QUrl::FullyDecoded-
2154 formatting option.-
2155-
2156 \sa userName(), setUserInfo()-
2157*/-
2158void QUrl::setUserName(const QString &userName, ParsingMode mode)-
2159{-
2160 detach();-
2161 d->clearError();-
2162-
2163 QString data = userName;-
2164 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEevaluated 1888 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUrl
9-1888
2165 parseDecodedComponent(data);-
2166 mode = TolerantMode;-
2167 }
executed 1888 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
1888
2168-
2169 d->setUserName(data, 0, data.length());-
2170 if (userName.isNull())
userName.isNull()Description
TRUEevaluated 532 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 1365 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
532-1365
2171 d->sectionIsPresent &= ~QUrlPrivate::UserName;
executed 532 times by 3 tests: d->sectionIsPresent &= ~QUrlPrivate::UserName;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
532
2172 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::UserName, userName))
mode == StrictModeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1361 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
!d->validateCo...ame, userName)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-1361
2173 d->userName.clear();
executed 4 times by 1 test: d->userName.clear();
Executed by:
  • tst_QUrl
4
2174}
executed 1897 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
1897
2175-
2176/*!-
2177 Returns the user name of the URL if it is defined; otherwise-
2178 an empty string is returned.-
2179-
2180 The \a options argument controls how to format the user name component. All-
2181 values produce an unambiguous result. With QUrl::FullyDecoded, all-
2182 percent-encoded sequences are decoded; otherwise, the returned value may-
2183 contain some percent-encoded sequences for some control sequences not-
2184 representable in decoded form in QString.-
2185-
2186 Note that QUrl::FullyDecoded may cause data loss if those non-representable-
2187 sequences are present. It is recommended to use that value when the result-
2188 will be used in a non-URL context, such as setting in QAuthenticator or-
2189 negotiating a login.-
2190-
2191 \sa setUserName(), userInfo()-
2192*/-
2193QString QUrl::userName(ComponentFormattingOptions options) const-
2194{-
2195 QString result;-
2196 if (d)
dDescription
TRUEevaluated 783 times by 3 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-783
2197 d->appendUserName(result, options);
executed 783 times by 3 tests: d->appendUserName(result, options);
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
783
2198 return result;
executed 785 times by 3 tests: return result;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
785
2199}-
2200-
2201/*!-
2202 \fn void QUrl::setEncodedUserName(const QByteArray &userName)-
2203 \deprecated-
2204 \since 4.4-
2205-
2206 Sets the URL's user name to the percent-encoded \a userName. The \a-
2207 userName is part of the user info element in the authority of the-
2208 URL, as described in setUserInfo().-
2209-
2210 \obsolete Use setUserName(QString::fromUtf8(userName))-
2211-
2212 \sa setUserName(), encodedUserName(), setUserInfo()-
2213*/-
2214-
2215/*!-
2216 \fn QByteArray QUrl::encodedUserName() const-
2217 \deprecated-
2218 \since 4.4-
2219-
2220 Returns the user name of the URL if it is defined; otherwise-
2221 an empty string is returned. The returned value will have its-
2222 non-ASCII and other control characters percent-encoded, as in-
2223 toEncoded().-
2224-
2225 \obsolete Use userName(QUrl::FullyEncoded).toLatin1()-
2226-
2227 \sa setEncodedUserName()-
2228*/-
2229-
2230/*!-
2231 Sets the URL's password to \a password. The \a password is part of-
2232 the user info element in the authority of the URL, as described in-
2233 setUserInfo().-
2234-
2235 The \a password data is interpreted according to \a mode: in StrictMode,-
2236 any '%' characters must be followed by exactly two hexadecimal characters-
2237 and some characters (including space) are not allowed in undecoded form. In-
2238 TolerantMode, all characters are accepted in undecoded form and the-
2239 tolerant parser will correct stray '%' not followed by two hex characters.-
2240 In DecodedMode, '%' stand for themselves and encoded characters are not-
2241 possible.-
2242-
2243 QUrl::DecodedMode should be used when setting the password from a data-
2244 source which is not a URL, such as a password dialog shown to the user or-
2245 with a password obtained by calling password() with the QUrl::FullyDecoded-
2246 formatting option.-
2247-
2248 \sa password(), setUserInfo()-
2249*/-
2250void QUrl::setPassword(const QString &password, ParsingMode mode)-
2251{-
2252 detach();-
2253 d->clearError();-
2254-
2255 QString data = password;-
2256 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEevaluated 446 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
7-446
2257 parseDecodedComponent(data);-
2258 mode = TolerantMode;-
2259 }
executed 446 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
446
2260-
2261 d->setPassword(data, 0, data.length());-
2262 if (password.isNull())
password.isNull()Description
TRUEevaluated 437 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
16-437
2263 d->sectionIsPresent &= ~QUrlPrivate::Password;
executed 437 times by 5 tests: d->sectionIsPresent &= ~QUrlPrivate::Password;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
437
2264 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Password, password))
mode == StrictModeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
!d->validateCo...ord, password)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-12
2265 d->password.clear();
executed 4 times by 1 test: d->password.clear();
Executed by:
  • tst_QUrl
4
2266}
executed 453 times by 5 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
453
2267-
2268/*!-
2269 Returns the password of the URL if it is defined; otherwise-
2270 an empty string is returned.-
2271-
2272 The \a options argument controls how to format the user name component. All-
2273 values produce an unambiguous result. With QUrl::FullyDecoded, all-
2274 percent-encoded sequences are decoded; otherwise, the returned value may-
2275 contain some percent-encoded sequences for some control sequences not-
2276 representable in decoded form in QString.-
2277-
2278 Note that QUrl::FullyDecoded may cause data loss if those non-representable-
2279 sequences are present. It is recommended to use that value when the result-
2280 will be used in a non-URL context, such as setting in QAuthenticator or-
2281 negotiating a login.-
2282-
2283 \sa setPassword()-
2284*/-
2285QString QUrl::password(ComponentFormattingOptions options) const-
2286{-
2287 QString result;-
2288 if (d)
dDescription
TRUEevaluated 577 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-577
2289 d->appendPassword(result, options);
executed 577 times by 6 tests: d->appendPassword(result, options);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
577
2290 return result;
executed 579 times by 6 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
579
2291}-
2292-
2293/*!-
2294 \fn void QUrl::setEncodedPassword(const QByteArray &password)-
2295 \deprecated-
2296 \since 4.4-
2297-
2298 Sets the URL's password to the percent-encoded \a password. The \a-
2299 password is part of the user info element in the authority of the-
2300 URL, as described in setUserInfo().-
2301-
2302 \obsolete Use setPassword(QString::fromUtf8(password));-
2303-
2304 \sa setPassword(), encodedPassword(), setUserInfo()-
2305*/-
2306-
2307/*!-
2308 \fn QByteArray QUrl::encodedPassword() const-
2309 \deprecated-
2310 \since 4.4-
2311-
2312 Returns the password of the URL if it is defined; otherwise an-
2313 empty string is returned. The returned value will have its-
2314 non-ASCII and other control characters percent-encoded, as in-
2315 toEncoded().-
2316-
2317 \obsolete Use password(QUrl::FullyEncoded).toLatin1()-
2318-
2319 \sa setEncodedPassword(), toEncoded()-
2320*/-
2321-
2322/*!-
2323 Sets the host of the URL to \a host. The host is part of the-
2324 authority.-
2325-
2326 The \a host data is interpreted according to \a mode: in StrictMode,-
2327 any '%' characters must be followed by exactly two hexadecimal characters-
2328 and some characters (including space) are not allowed in undecoded form. In-
2329 TolerantMode, all characters are accepted in undecoded form and the-
2330 tolerant parser will correct stray '%' not followed by two hex characters.-
2331 In DecodedMode, '%' stand for themselves and encoded characters are not-
2332 possible.-
2333-
2334 Note that, in all cases, the result of the parsing must be a valid hostname-
2335 according to STD 3 rules, as modified by the Internationalized Resource-
2336 Identifiers specification (RFC 3987). Invalid hostnames are not permitted-
2337 and will cause isValid() to become false.-
2338-
2339 \sa host(), setAuthority()-
2340*/-
2341void QUrl::setHost(const QString &host, ParsingMode mode)-
2342{-
2343 detach();-
2344 d->clearError();-
2345-
2346 QString data = host;-
2347 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEevaluated 6938 times by 27 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • ...
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
5-6938
2348 parseDecodedComponent(data);-
2349 mode = TolerantMode;-
2350 }
executed 6938 times by 27 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • ...
6938
2351-
2352 if (d->setHost(data, 0, data.length(), mode)) {
d->setHost(dat...ength(), mode)Description
TRUEevaluated 6862 times by 27 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • ...
FALSEevaluated 81 times by 7 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
81-6862
2353 if (host.isNull())
host.isNull()Description
TRUEevaluated 181 times by 7 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
FALSEevaluated 6681 times by 27 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • ...
181-6681
2354 d->sectionIsPresent &= ~QUrlPrivate::Host;
executed 181 times by 7 tests: d->sectionIsPresent &= ~QUrlPrivate::Host;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
181
2355 } else if (!data.startsWith(QLatin1Char('['))) {
executed 6862 times by 27 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • ...
!data.startsWi...tin1Char('['))Description
TRUEevaluated 81 times by 7 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEnever evaluated
0-6862
2356 // setHost failed, it might be IPv6 or IPvFuture in need of bracketing-
2357 Q_ASSERT(d->error);-
2358-
2359 data.prepend(QLatin1Char('['));-
2360 data.append(QLatin1Char(']'));-
2361 if (!d->setHost(data, 0, data.length(), mode)) {
!d->setHost(da...ength(), mode)Description
TRUEevaluated 27 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 54 times by 5 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
27-54
2362 // failed again-
2363 if (data.contains(QLatin1Char(':'))) {
data.contains(...tin1Char(':'))Description
TRUEevaluated 8 times by 4 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrlInternal
  • tst_Spdy
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QUrl
  • tst_QUrlInternal
8-19
2364 // source data contains ':', so it's an IPv6 error-
2365 d->error->code = QUrlPrivate::InvalidIPv6AddressError;-
2366 }
executed 8 times by 4 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrlInternal
  • tst_Spdy
8
2367 } else {
executed 27 times by 5 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
27
2368 // succeeded-
2369 d->clearError();-
2370 }
executed 54 times by 5 tests: end of block
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
54
2371 }-
2372}
executed 6943 times by 27 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QUrlInternal
  • ...
6943
2373-
2374/*!-
2375 Returns the host of the URL if it is defined; otherwise-
2376 an empty string is returned.-
2377-
2378 The \a options argument controls how the hostname will be formatted. The-
2379 QUrl::EncodeUnicode option will cause this function to return the hostname-
2380 in the ASCII-Compatible Encoding (ACE) form, which is suitable for use in-
2381 channels that are not 8-bit clean or that require the legacy hostname (such-
2382 as DNS requests or in HTTP request headers). If that flag is not present,-
2383 this function returns the International Domain Name (IDN) in Unicode form,-
2384 according to the list of permissible top-level domains (see-
2385 idnWhitelist()).-
2386-
2387 All other flags are ignored. Host names cannot contain control or percent-
2388 characters, so the returned value can be considered fully decoded.-
2389-
2390 \sa setHost(), idnWhitelist(), setIdnWhitelist(), authority()-
2391*/-
2392QString QUrl::host(ComponentFormattingOptions options) const-
2393{-
2394 QString result;-
2395 if (d) {
dDescription
TRUEevaluated 10012 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
FALSEevaluated 2578 times by 20 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QXmlSimpleReader
2578-10012
2396 d->appendHost(result, options);-
2397 if (result.startsWith(QLatin1Char('[')))
result.startsW...tin1Char('['))Description
TRUEevaluated 53 times by 7 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
FALSEevaluated 9959 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
53-9959
2398 result = result.mid(1, result.length() - 2);
executed 53 times by 7 tests: result = result.mid(1, result.length() - 2);
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
53
2399 }
executed 10012 times by 34 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
10012
2400 return result;
executed 12590 times by 34 tests: return result;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
12590
2401}-
2402-
2403/*!-
2404 \fn void QUrl::setEncodedHost(const QByteArray &host)-
2405 \deprecated-
2406 \since 4.4-
2407-
2408 Sets the URL's host to the ACE- or percent-encoded \a host. The \a-
2409 host is part of the user info element in the authority of the-
2410 URL, as described in setAuthority().-
2411-
2412 \obsolete Use setHost(QString::fromUtf8(host)).-
2413-
2414 \sa setHost(), encodedHost(), setAuthority(), fromAce()-
2415*/-
2416-
2417/*!-
2418 \fn QByteArray QUrl::encodedHost() const-
2419 \deprecated-
2420 \since 4.4-
2421-
2422 Returns the host part of the URL if it is defined; otherwise-
2423 an empty string is returned.-
2424-
2425 Note: encodedHost() does not return percent-encoded hostnames. Instead,-
2426 the ACE-encoded (bare ASCII in Punycode encoding) form will be-
2427 returned for any non-ASCII hostname.-
2428-
2429 This function is equivalent to calling QUrl::toAce() on the return-
2430 value of host().-
2431-
2432 \obsolete Use host(QUrl::FullyEncoded).toLatin1() or toAce(host()).-
2433-
2434 \sa setEncodedHost()-
2435*/-
2436-
2437/*!-
2438 Sets the port of the URL to \a port. The port is part of the-
2439 authority of the URL, as described in setAuthority().-
2440-
2441 \a port must be between 0 and 65535 inclusive. Setting the-
2442 port to -1 indicates that the port is unspecified.-
2443*/-
2444void QUrl::setPort(int port)-
2445{-
2446 detach();-
2447 d->clearError();-
2448-
2449 if (port < -1 || port > 65535) {
port < -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 7721 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • ...
port > 65535Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 7719 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • ...
1-7721
2450 d->setError(QUrlPrivate::InvalidPortError, QString::number(port), 0);-
2451 port = -1;-
2452 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUrl
3
2453-
2454 d->port = port;-
2455}
executed 7722 times by 30 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • ...
7722
2456-
2457/*!-
2458 \since 4.1-
2459-
2460 Returns the port of the URL, or \a defaultPort if the port is-
2461 unspecified.-
2462-
2463 Example:-
2464-
2465 \snippet code/src_corelib_io_qurl.cpp 3-
2466*/-
2467int QUrl::port(int defaultPort) const-
2468{-
2469 if (!d) return defaultPort;
executed 1 time by 1 test: return defaultPort;
Executed by:
  • tst_QUrl
!dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 4125 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
1-4125
2470 return d->port == -1 ? defaultPort : d->port;
executed 4125 times by 9 tests: return d->port == -1 ? defaultPort : d->port;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
4125
2471}-
2472-
2473/*!-
2474 Sets the path of the URL to \a path. The path is the part of the-
2475 URL that comes after the authority but before the query string.-
2476-
2477 \image qurl-ftppath.png-
2478-
2479 For non-hierarchical schemes, the path will be everything-
2480 following the scheme declaration, as in the following example:-
2481-
2482 \image qurl-mailtopath.png-
2483-
2484 The \a path data is interpreted according to \a mode: in StrictMode,-
2485 any '%' characters must be followed by exactly two hexadecimal characters-
2486 and some characters (including space) are not allowed in undecoded form. In-
2487 TolerantMode (the default), all characters are accepted in undecoded form and the-
2488 tolerant parser will correct stray '%' not followed by two hex characters.-
2489 In DecodedMode, '%' stand for themselves and encoded characters are not-
2490 possible.-
2491-
2492 QUrl::DecodedMode should be used when setting the path from a data source-
2493 which is not a URL, such as a dialog shown to the user or with a path-
2494 obtained by calling path() with the QUrl::FullyDecoded formatting option.-
2495-
2496 \sa path()-
2497*/-
2498void QUrl::setPath(const QString &path, ParsingMode mode)-
2499{-
2500 detach();-
2501 d->clearError();-
2502-
2503 QString data = path;-
2504 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEevaluated 5656 times by 16 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qfileopenevent
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrl
12-5656
2505 parseDecodedComponent(data);-
2506 mode = TolerantMode;-
2507 }
executed 5656 times by 16 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qfileopenevent
5656
2508-
2509 int from = 0;-
2510 while (from < data.length() - 2 && data.midRef(from, 2) == QLatin1String("//"))
from < data.length() - 2Description
TRUEevaluated 5334 times by 11 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
FALSEevaluated 336 times by 10 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
data.midRef(fr...n1String("//")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 5332 times by 11 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
2-5334
2511 ++from;
executed 2 times by 1 test: ++from;
Executed by:
  • tst_QUrl
2
2512 d->setPath(data, from, data.length());-
2513-
2514 // optimized out, since there is no path delimiter-
2515// if (path.isNull())-
2516// d->sectionIsPresent &= ~QUrlPrivate::Path;-
2517// else-
2518 if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Path, path))
mode == StrictModeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 5664 times by 16 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qfileopenevent
!d->validateCo...e::Path, path)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-5664
2519 d->path.clear();
executed 2 times by 1 test: d->path.clear();
Executed by:
  • tst_QUrl
2
2520}
executed 5668 times by 16 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qfileopenevent
5668
2521-
2522/*!-
2523 Returns the path of the URL.-
2524-
2525 The \a options argument controls how to format the path component. All-
2526 values produce an unambiguous result. With QUrl::FullyDecoded, all-
2527 percent-encoded sequences are decoded; otherwise, the returned value may-
2528 contain some percent-encoded sequences for some control sequences not-
2529 representable in decoded form in QString.-
2530-
2531 Note that QUrl::FullyDecoded may cause data loss if those non-representable-
2532 sequences are present. It is recommended to use that value when the result-
2533 will be used in a non-URL context, such as sending to an FTP server.-
2534-
2535 \sa setPath()-
2536*/-
2537QString QUrl::path(ComponentFormattingOptions options) const-
2538{-
2539 QString result;-
2540 if (d)
dDescription
TRUEevaluated 4771 times by 19 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBrowser
  • tst_QUrl
7-4771
2541 d->appendPath(result, options, QUrlPrivate::Path);
executed 4771 times by 19 tests: d->appendPath(result, options, QUrlPrivate::Path);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
4771
2542 return result;
executed 4778 times by 20 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
4778
2543}-
2544-
2545/*!-
2546 \fn void QUrl::setEncodedPath(const QByteArray &path)-
2547 \deprecated-
2548 \since 4.4-
2549-
2550 Sets the URL's path to the percent-encoded \a path. The path is-
2551 the part of the URL that comes after the authority but before the-
2552 query string.-
2553-
2554 \image qurl-ftppath.png-
2555-
2556 For non-hierarchical schemes, the path will be everything-
2557 following the scheme declaration, as in the following example:-
2558-
2559 \image qurl-mailtopath.png-
2560-
2561 \obsolete Use setPath(QString::fromUtf8(path)).-
2562-
2563 \sa setPath(), encodedPath(), setUserInfo()-
2564*/-
2565-
2566/*!-
2567 \fn QByteArray QUrl::encodedPath() const-
2568 \deprecated-
2569 \since 4.4-
2570-
2571 Returns the path of the URL if it is defined; otherwise an-
2572 empty string is returned. The returned value will have its-
2573 non-ASCII and other control characters percent-encoded, as in-
2574 toEncoded().-
2575-
2576 \obsolete Use path(QUrl::FullyEncoded).toLatin1().-
2577-
2578 \sa setEncodedPath(), toEncoded()-
2579*/-
2580-
2581/*!-
2582 \since 5.2-
2583-
2584 Returns the name of the file, excluding the directory path.-
2585-
2586 Note that, if this QUrl object is given a path ending in a slash, the name of the file is considered empty.-
2587-
2588 If the path doesn't contain any slash, it is fully returned as the fileName.-
2589-
2590 Example:-
2591-
2592 \snippet code/src_corelib_io_qurl.cpp 7-
2593-
2594 The \a options argument controls how to format the file name component. All-
2595 values produce an unambiguous result. With QUrl::FullyDecoded, all-
2596 percent-encoded sequences are decoded; otherwise, the returned value may-
2597 contain some percent-encoded sequences for some control sequences not-
2598 representable in decoded form in QString.-
2599-
2600 \sa path()-
2601*/-
2602QString QUrl::fileName(ComponentFormattingOptions options) const-
2603{-
2604 const QString ourPath = path(options);-
2605 const int slash = ourPath.lastIndexOf(QLatin1Char('/'));-
2606 if (slash == -1)
slash == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QUrl
2-15
2607 return ourPath;
executed 2 times by 1 test: return ourPath;
Executed by:
  • tst_QUrl
2
2608 return ourPath.mid(slash + 1);
executed 15 times by 1 test: return ourPath.mid(slash + 1);
Executed by:
  • tst_QUrl
15
2609}-
2610-
2611/*!-
2612 \since 4.2-
2613-
2614 Returns \c true if this URL contains a Query (i.e., if ? was seen on it).-
2615-
2616 \sa setQuery(), query(), hasFragment()-
2617*/-
2618bool QUrl::hasQuery() const-
2619{-
2620 if (!d) return false;
never executed: return false;
!dDescription
TRUEnever evaluated
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
0-26
2621 return d->hasQuery();
executed 26 times by 2 tests: return d->hasQuery();
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
26
2622}-
2623-
2624/*!-
2625 Sets the query string of the URL to \a query.-
2626-
2627 This function is useful if you need to pass a query string that-
2628 does not fit into the key-value pattern, or that uses a different-
2629 scheme for encoding special characters than what is suggested by-
2630 QUrl.-
2631-
2632 Passing a value of QString() to \a query (a null QString) unsets-
2633 the query completely. However, passing a value of QString("")-
2634 will set the query to an empty value, as if the original URL-
2635 had a lone "?".-
2636-
2637 The \a query data is interpreted according to \a mode: in StrictMode,-
2638 any '%' characters must be followed by exactly two hexadecimal characters-
2639 and some characters (including space) are not allowed in undecoded form. In-
2640 TolerantMode, all characters are accepted in undecoded form and the-
2641 tolerant parser will correct stray '%' not followed by two hex characters.-
2642 In DecodedMode, '%' stand for themselves and encoded characters are not-
2643 possible.-
2644-
2645 Query strings often contain percent-encoded sequences, so use of-
2646 DecodedMode is discouraged. One special sequence to be aware of is that of-
2647 the plus character ('+'). QUrl does not convert spaces to plus characters,-
2648 even though HTML forms posted by web browsers do. In order to represent an-
2649 actual plus character in a query, the sequence "%2B" is usually used. This-
2650 function will leave "%2B" sequences untouched in TolerantMode or-
2651 StrictMode.-
2652-
2653 \sa query(), hasQuery()-
2654*/-
2655void QUrl::setQuery(const QString &query, ParsingMode mode)-
2656{-
2657 detach();-
2658 d->clearError();-
2659-
2660 QString data = query;-
2661 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 158 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
1-158
2662 parseDecodedComponent(data);-
2663 mode = TolerantMode;-
2664 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUrl
1
2665-
2666 d->setQuery(data, 0, data.length());-
2667 if (query.isNull())
query.isNull()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 152 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
7-152
2668 d->sectionIsPresent &= ~QUrlPrivate::Query;
executed 7 times by 1 test: d->sectionIsPresent &= ~QUrlPrivate::Query;
Executed by:
  • tst_QUrl
7
2669 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Query, query))
mode == StrictModeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 150 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
!d->validateCo...:Query, query)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-150
2670 d->query.clear();
executed 2 times by 1 test: d->query.clear();
Executed by:
  • tst_QUrl
2
2671}
executed 159 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
159
2672-
2673/*!-
2674 \fn void QUrl::setEncodedQuery(const QByteArray &query)-
2675 \deprecated-
2676-
2677 Sets the query string of the URL to \a query. The string is-
2678 inserted as-is, and no further encoding is performed when calling-
2679 toEncoded().-
2680-
2681 This function is useful if you need to pass a query string that-
2682 does not fit into the key-value pattern, or that uses a different-
2683 scheme for encoding special characters than what is suggested by-
2684 QUrl.-
2685-
2686 Passing a value of QByteArray() to \a query (a null QByteArray) unsets-
2687 the query completely. However, passing a value of QByteArray("")-
2688 will set the query to an empty value, as if the original URL-
2689 had a lone "?".-
2690-
2691 \obsolete Use setQuery, which has the same null / empty behavior.-
2692-
2693 \sa encodedQuery(), hasQuery()-
2694*/-
2695-
2696/*!-
2697 \overload-
2698 \since 5.0-
2699 Sets the query string of the URL to \a query.-
2700-
2701 This function reconstructs the query string from the QUrlQuery object and-
2702 sets on this QUrl object. This function does not have parsing parameters-
2703 because the QUrlQuery contains data that is already parsed.-
2704-
2705 \sa query(), hasQuery()-
2706*/-
2707void QUrl::setQuery(const QUrlQuery &query)-
2708{-
2709 detach();-
2710 d->clearError();-
2711-
2712 // we know the data is in the right format-
2713 d->query = query.toString();-
2714 if (query.isEmpty())
query.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2715 d->sectionIsPresent &= ~QUrlPrivate::Query;
never executed: d->sectionIsPresent &= ~QUrlPrivate::Query;
0
2716 else-
2717 d->sectionIsPresent |= QUrlPrivate::Query;
never executed: d->sectionIsPresent |= QUrlPrivate::Query;
0
2718}-
2719-
2720/*!-
2721 \fn void QUrl::setQueryItems(const QList<QPair<QString, QString> > &query)-
2722 \deprecated-
2723-
2724 Sets the query string of the URL to an encoded version of \a-
2725 query. The contents of \a query are converted to a string-
2726 internally, each pair delimited by the character returned by-
2727 \l {QUrlQuery::queryPairDelimiter()}{queryPairDelimiter()}, and the key and value are delimited by-
2728 \l {QUrlQuery::queryValueDelimiter()}{queryValueDelimiter()}-
2729-
2730 \note This method does not encode spaces (ASCII 0x20) as plus (+) signs,-
2731 like HTML forms do. If you need that kind of encoding, you must encode-
2732 the value yourself and use QUrl::setEncodedQueryItems.-
2733-
2734 \obsolete Use QUrlQuery and setQuery().-
2735-
2736 \sa queryItems(), setEncodedQueryItems()-
2737*/-
2738-
2739/*!-
2740 \fn void QUrl::setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query)-
2741 \deprecated-
2742 \since 4.4-
2743-
2744 Sets the query string of the URL to the encoded version of \a-
2745 query. The contents of \a query are converted to a string-
2746 internally, each pair delimited by the character returned by-
2747 \l {QUrlQuery::queryPairDelimiter()}{queryPairDelimiter()}, and the key and value are delimited by-
2748 \l {QUrlQuery::queryValueDelimiter()}{queryValueDelimiter()}.-
2749-
2750 \obsolete Use QUrlQuery and setQuery().-
2751-
2752 \sa encodedQueryItems(), setQueryItems()-
2753*/-
2754-
2755/*!-
2756 \fn void QUrl::addQueryItem(const QString &key, const QString &value)-
2757 \deprecated-
2758-
2759 Inserts the pair \a key = \a value into the query string of the-
2760 URL.-
2761-
2762 The key-value pair is encoded before it is added to the query. The-
2763 pair is converted into separate strings internally. The \a key and-
2764 \a value is first encoded into UTF-8 and then delimited by the-
2765 character returned by \l {QUrlQuery::queryValueDelimiter()}{queryValueDelimiter()}.-
2766 Each key-value pair is delimited by the character returned by-
2767 \l {QUrlQuery::queryPairDelimiter()}{queryPairDelimiter()}-
2768-
2769 \note This method does not encode spaces (ASCII 0x20) as plus (+) signs,-
2770 like HTML forms do. If you need that kind of encoding, you must encode-
2771 the value yourself and use QUrl::addEncodedQueryItem.-
2772-
2773 \obsolete Use QUrlQuery and setQuery().-
2774-
2775 \sa addEncodedQueryItem()-
2776*/-
2777-
2778/*!-
2779 \fn void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value)-
2780 \deprecated-
2781 \since 4.4-
2782-
2783 Inserts the pair \a key = \a value into the query string of the-
2784 URL.-
2785-
2786 \obsolete Use QUrlQuery and setQuery().-
2787-
2788 \sa addQueryItem()-
2789*/-
2790-
2791/*!-
2792 \fn QList<QPair<QString, QString> > QUrl::queryItems() const-
2793 \deprecated-
2794-
2795 Returns the query string of the URL, as a map of keys and values.-
2796-
2797 \note This method does not decode spaces plus (+) signs as spaces (ASCII-
2798 0x20), like HTML forms do. If you need that kind of decoding, you must-
2799 use QUrl::encodedQueryItems and decode the data yourself.-
2800-
2801 \obsolete Use QUrlQuery.-
2802-
2803 \sa setQueryItems(), setEncodedQuery()-
2804*/-
2805-
2806/*!-
2807 \fn QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const-
2808 \deprecated-
2809 \since 4.4-
2810-
2811 Returns the query string of the URL, as a map of encoded keys and values.-
2812-
2813 \obsolete Use QUrlQuery.-
2814-
2815 \sa setEncodedQueryItems(), setQueryItems(), setEncodedQuery()-
2816*/-
2817-
2818/*!-
2819 \fn bool QUrl::hasQueryItem(const QString &key) const-
2820 \deprecated-
2821-
2822 Returns \c true if there is a query string pair whose key is equal-
2823 to \a key from the URL.-
2824-
2825 \obsolete Use QUrlQuery.-
2826-
2827 \sa hasEncodedQueryItem()-
2828*/-
2829-
2830/*!-
2831 \fn bool QUrl::hasEncodedQueryItem(const QByteArray &key) const-
2832 \deprecated-
2833 \since 4.4-
2834-
2835 Returns \c true if there is a query string pair whose key is equal-
2836 to \a key from the URL.-
2837-
2838 \obsolete Use QUrlQuery.-
2839-
2840 \sa hasQueryItem()-
2841*/-
2842-
2843/*!-
2844 \fn QString QUrl::queryItemValue(const QString &key) const-
2845 \deprecated-
2846-
2847 Returns the first query string value whose key is equal to \a key-
2848 from the URL.-
2849-
2850 \note This method does not decode spaces plus (+) signs as spaces (ASCII-
2851 0x20), like HTML forms do. If you need that kind of decoding, you must-
2852 use QUrl::encodedQueryItemValue and decode the data yourself.-
2853-
2854 \obsolete Use QUrlQuery.-
2855-
2856 \sa allQueryItemValues()-
2857*/-
2858-
2859/*!-
2860 \fn QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const-
2861 \deprecated-
2862 \since 4.4-
2863-
2864 Returns the first query string value whose key is equal to \a key-
2865 from the URL.-
2866-
2867 \obsolete Use QUrlQuery.-
2868-
2869 \sa queryItemValue(), allQueryItemValues()-
2870*/-
2871-
2872/*!-
2873 \fn QStringList QUrl::allQueryItemValues(const QString &key) const-
2874 \deprecated-
2875-
2876 Returns the a list of query string values whose key is equal to-
2877 \a key from the URL.-
2878-
2879 \note This method does not decode spaces plus (+) signs as spaces (ASCII-
2880 0x20), like HTML forms do. If you need that kind of decoding, you must-
2881 use QUrl::allEncodedQueryItemValues and decode the data yourself.-
2882-
2883 \obsolete Use QUrlQuery.-
2884-
2885 \sa queryItemValue()-
2886*/-
2887-
2888/*!-
2889 \fn QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const-
2890 \deprecated-
2891 \since 4.4-
2892-
2893 Returns the a list of query string values whose key is equal to-
2894 \a key from the URL.-
2895-
2896 \obsolete Use QUrlQuery.-
2897-
2898 \sa allQueryItemValues(), queryItemValue(), encodedQueryItemValue()-
2899*/-
2900-
2901/*!-
2902 \fn void QUrl::removeQueryItem(const QString &key)-
2903 \deprecated-
2904-
2905 Removes the first query string pair whose key is equal to \a key-
2906 from the URL.-
2907-
2908 \obsolete Use QUrlQuery.-
2909-
2910 \sa removeAllQueryItems()-
2911*/-
2912-
2913/*!-
2914 \fn void QUrl::removeEncodedQueryItem(const QByteArray &key)-
2915 \deprecated-
2916 \since 4.4-
2917-
2918 Removes the first query string pair whose key is equal to \a key-
2919 from the URL.-
2920-
2921 \obsolete Use QUrlQuery.-
2922-
2923 \sa removeQueryItem(), removeAllQueryItems()-
2924*/-
2925-
2926/*!-
2927 \fn void QUrl::removeAllQueryItems(const QString &key)-
2928 \deprecated-
2929-
2930 Removes all the query string pairs whose key is equal to \a key-
2931 from the URL.-
2932-
2933 \obsolete Use QUrlQuery.-
2934-
2935 \sa removeQueryItem()-
2936*/-
2937-
2938/*!-
2939 \fn void QUrl::removeAllEncodedQueryItems(const QByteArray &key)-
2940 \deprecated-
2941 \since 4.4-
2942-
2943 Removes all the query string pairs whose key is equal to \a key-
2944 from the URL.-
2945-
2946 \obsolete Use QUrlQuery.-
2947-
2948 \sa removeQueryItem()-
2949*/-
2950-
2951/*!-
2952 \fn QByteArray QUrl::encodedQuery() const-
2953 \deprecated-
2954-
2955 Returns the query string of the URL in percent encoded form.-
2956-
2957 \obsolete Use query(QUrl::FullyEncoded).toLatin1()-
2958-
2959 \sa setEncodedQuery(), query()-
2960*/-
2961-
2962/*!-
2963 Returns the query string of the URL if there's a query string, or an empty-
2964 result if not. To determine if the parsed URL contained a query string, use-
2965 hasQuery().-
2966-
2967 The \a options argument controls how to format the query component. All-
2968 values produce an unambiguous result. With QUrl::FullyDecoded, all-
2969 percent-encoded sequences are decoded; otherwise, the returned value may-
2970 contain some percent-encoded sequences for some control sequences not-
2971 representable in decoded form in QString.-
2972-
2973 Note that use of QUrl::FullyDecoded in queries is discouraged, as queries-
2974 often contain data that is supposed to remain percent-encoded, including-
2975 the use of the "%2B" sequence to represent a plus character ('+').-
2976-
2977 \sa setQuery(), hasQuery()-
2978*/-
2979QString QUrl::query(ComponentFormattingOptions options) const-
2980{-
2981 QString result;-
2982 if (d) {
dDescription
TRUEevaluated 189 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-189
2983 d->appendQuery(result, options, QUrlPrivate::Query);-
2984 if (d->hasQuery() && result.isNull())
d->hasQuery()Description
TRUEevaluated 166 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
result.isNull()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 164 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
2-166
2985 result.detach();
executed 2 times by 1 test: result.detach();
Executed by:
  • tst_QUrl
2
2986 }
executed 189 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
189
2987 return result;
executed 191 times by 3 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
191
2988}-
2989-
2990/*!-
2991 Sets the fragment of the URL to \a fragment. The fragment is the-
2992 last part of the URL, represented by a '#' followed by a string of-
2993 characters. It is typically used in HTTP for referring to a-
2994 certain link or point on a page:-
2995-
2996 \image qurl-fragment.png-
2997-
2998 The fragment is sometimes also referred to as the URL "reference".-
2999-
3000 Passing an argument of QString() (a null QString) will unset the fragment.-
3001 Passing an argument of QString("") (an empty but not null QString) will set the-
3002 fragment to an empty string (as if the original URL had a lone "#").-
3003-
3004 The \a fragment data is interpreted according to \a mode: in StrictMode,-
3005 any '%' characters must be followed by exactly two hexadecimal characters-
3006 and some characters (including space) are not allowed in undecoded form. In-
3007 TolerantMode, all characters are accepted in undecoded form and the-
3008 tolerant parser will correct stray '%' not followed by two hex characters.-
3009 In DecodedMode, '%' stand for themselves and encoded characters are not-
3010 possible.-
3011-
3012 QUrl::DecodedMode should be used when setting the fragment from a data-
3013 source which is not a URL or with a fragment obtained by calling-
3014 fragment() with the QUrl::FullyDecoded formatting option.-
3015-
3016 \sa fragment(), hasFragment()-
3017*/-
3018void QUrl::setFragment(const QString &fragment, ParsingMode mode)-
3019{-
3020 detach();-
3021 d->clearError();-
3022-
3023 QString data = fragment;-
3024 if (mode == DecodedMode) {
mode == DecodedModeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1695 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
1-1695
3025 parseDecodedComponent(data);-
3026 mode = TolerantMode;-
3027 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUrl
1
3028-
3029 d->setFragment(data, 0, data.length());-
3030 if (fragment.isNull())
fragment.isNull()Description
TRUEevaluated 1029 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 667 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
667-1029
3031 d->sectionIsPresent &= ~QUrlPrivate::Fragment;
executed 1029 times by 8 tests: d->sectionIsPresent &= ~QUrlPrivate::Fragment;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
1029
3032 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Fragment, fragment))
mode == StrictModeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 665 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
!d->validateCo...ent, fragment)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-665
3033 d->fragment.clear();
executed 2 times by 1 test: d->fragment.clear();
Executed by:
  • tst_QUrl
2
3034}
executed 1696 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
1696
3035-
3036/*!-
3037 Returns the fragment of the URL. To determine if the parsed URL contained a-
3038 fragment, use hasFragment().-
3039-
3040 The \a options argument controls how to format the fragment component. All-
3041 values produce an unambiguous result. With QUrl::FullyDecoded, all-
3042 percent-encoded sequences are decoded; otherwise, the returned value may-
3043 contain some percent-encoded sequences for some control sequences not-
3044 representable in decoded form in QString.-
3045-
3046 Note that QUrl::FullyDecoded may cause data loss if those non-representable-
3047 sequences are present. It is recommended to use that value when the result-
3048 will be used in a non-URL context.-
3049-
3050 \sa setFragment(), hasFragment()-
3051*/-
3052QString QUrl::fragment(ComponentFormattingOptions options) const-
3053{-
3054 QString result;-
3055 if (d) {
dDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-128
3056 d->appendFragment(result, options, QUrlPrivate::Fragment);-
3057 if (d->hasFragment() && result.isNull())
d->hasFragment()Description
TRUEevaluated 59 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
result.isNull()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 57 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
2-69
3058 result.detach();
executed 2 times by 1 test: result.detach();
Executed by:
  • tst_QUrl
2
3059 }
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
128
3060 return result;
executed 130 times by 2 tests: return result;
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
130
3061}-
3062-
3063/*!-
3064 \fn void QUrl::setEncodedFragment(const QByteArray &fragment)-
3065 \deprecated-
3066 \since 4.4-
3067-
3068 Sets the URL's fragment to the percent-encoded \a fragment. The fragment is the-
3069 last part of the URL, represented by a '#' followed by a string of-
3070 characters. It is typically used in HTTP for referring to a-
3071 certain link or point on a page:-
3072-
3073 \image qurl-fragment.png-
3074-
3075 The fragment is sometimes also referred to as the URL "reference".-
3076-
3077 Passing an argument of QByteArray() (a null QByteArray) will unset the fragment.-
3078 Passing an argument of QByteArray("") (an empty but not null QByteArray)-
3079 will set the fragment to an empty string (as if the original URL-
3080 had a lone "#").-
3081-
3082 \obsolete Use setFragment(), which has the same behavior of null / empty.-
3083-
3084 \sa setFragment(), encodedFragment()-
3085*/-
3086-
3087/*!-
3088 \fn QByteArray QUrl::encodedFragment() const-
3089 \deprecated-
3090 \since 4.4-
3091-
3092 Returns the fragment of the URL if it is defined; otherwise an-
3093 empty string is returned. The returned value will have its-
3094 non-ASCII and other control characters percent-encoded, as in-
3095 toEncoded().-
3096-
3097 \obsolete Use query(QUrl::FullyEncoded).toLatin1().-
3098-
3099 \sa setEncodedFragment(), toEncoded()-
3100*/-
3101-
3102/*!-
3103 \since 4.2-
3104-
3105 Returns \c true if this URL contains a fragment (i.e., if # was seen on it).-
3106-
3107 \sa fragment(), setFragment()-
3108*/-
3109bool QUrl::hasFragment() const-
3110{-
3111 if (!d) return false;
never executed: return false;
!dDescription
TRUEnever evaluated
FALSEevaluated 137 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
0-137
3112 return d->hasFragment();
executed 137 times by 6 tests: return d->hasFragment();
Executed by:
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
137
3113}-
3114-
3115/*!-
3116 \since 4.8-
3117-
3118 Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net).-
3119 Note that the return value is prefixed with a '.' unless the-
3120 URL does not contain a valid TLD, in which case the function returns-
3121 an empty string.-
3122-
3123 Note that this function considers a TLD to be any domain that allows users-
3124 to register subdomains under, including many home, dynamic DNS websites and-
3125 blogging providers. This is useful for determining whether two websites-
3126 belong to the same infrastructure and communication should be allowed, such-
3127 as browser cookies: two domains should be considered part of the same-
3128 website if they share at least one label in addition to the value-
3129 returned by this function.-
3130-
3131 \list-
3132 \li \c{foo.co.uk} and \c{foo.com} do not share a top-level domain-
3133 \li \c{foo.co.uk} and \c{bar.co.uk} share the \c{.co.uk} domain, but the next label is different-
3134 \li \c{www.foo.co.uk} and \c{ftp.foo.co.uk} share the same top-level domain and one more label,-
3135 so they are considered part of the same site-
3136 \endlist-
3137-
3138 If \a options includes EncodeUnicode, the returned string will be in-
3139 ASCII Compatible Encoding.-
3140*/-
3141QString QUrl::topLevelDomain(ComponentFormattingOptions options) const-
3142{-
3143 QString tld = qTopLevelDomain(host());-
3144 if (options & EncodeUnicode) {
options & EncodeUnicodeDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
18
3145 return qt_ACE_do(tld, ToAceOnly, AllowLeadingDot);
executed 18 times by 1 test: return qt_ACE_do(tld, ToAceOnly, AllowLeadingDot);
Executed by:
  • tst_QUrl
18
3146 }-
3147 return tld;
executed 18 times by 1 test: return tld;
Executed by:
  • tst_QUrl
18
3148}-
3149-
3150/*!-
3151 Returns the result of the merge of this URL with \a relative. This-
3152 URL is used as a base to convert \a relative to an absolute URL.-
3153-
3154 If \a relative is not a relative URL, this function will return \a-
3155 relative directly. Otherwise, the paths of the two URLs are-
3156 merged, and the new URL returned has the scheme and authority of-
3157 the base URL, but with the merged path, as in the following-
3158 example:-
3159-
3160 \snippet code/src_corelib_io_qurl.cpp 5-
3161-
3162 Calling resolved() with ".." returns a QUrl whose directory is-
3163 one level higher than the original. Similarly, calling resolved()-
3164 with "../.." removes two levels from the path. If \a relative is-
3165 "/", the path becomes "/".-
3166-
3167 \sa isRelative()-
3168*/-
3169QUrl QUrl::resolved(const QUrl &relative) const-
3170{-
3171 if (!d) return relative;
executed 150 times by 7 tests: return relative;
Executed by:
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
!dDescription
TRUEevaluated 150 times by 7 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
FALSEevaluated 4486 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
150-4486
3172 if (!relative.d) return *this;
never executed: return *this;
!relative.dDescription
TRUEnever evaluated
FALSEevaluated 4486 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
0-4486
3173-
3174 QUrl t;-
3175 // Compatibility hack (mostly for qtdeclarative) : treat "file:relative.txt" as relative even though QUrl::isRelative() says false-
3176 if (!relative.d->scheme.isEmpty() && (!relative.isLocalFile() || QDir::isAbsolutePath(relative.d->path))) {
!relative.d->scheme.isEmpty()Description
TRUEevaluated 1084 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 3402 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
!relative.isLocalFile()Description
TRUEevaluated 1053 times by 2 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QUrl
FALSEevaluated 31 times by 1 test
Evaluated by:
  • tst_QTextBrowser
QDir::isAbsolu...ative.d->path)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QTextBrowser
FALSEevaluated 21 times by 1 test
Evaluated by:
  • tst_QTextBrowser
10-3402
3177 t = relative;-
3178 t.detach();-
3179 } else {
executed 1063 times by 3 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QUrl
1063
3180 if (relative.d->hasAuthority()) {
relative.d->hasAuthority()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3421 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
2-3421
3181 t = relative;-
3182 t.detach();-
3183 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_QUrl
2
3184 t.d = new QUrlPrivate;-
3185-
3186 // copy the authority-
3187 t.d->userName = d->userName;-
3188 t.d->password = d->password;-
3189 t.d->host = d->host;-
3190 t.d->port = d->port;-
3191 t.d->sectionIsPresent = d->sectionIsPresent & QUrlPrivate::Authority;-
3192-
3193 if (relative.d->path.isEmpty()) {
relative.d->path.isEmpty()Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 3416 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
5-3416
3194 t.d->path = d->path;-
3195 if (relative.d->hasQuery()) {
relative.d->hasQuery()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
1-4
3196 t.d->query = relative.d->query;-
3197 t.d->sectionIsPresent |= QUrlPrivate::Query;-
3198 } else if (d->hasQuery()) {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUrl
d->hasQuery()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBrowser
1-2
3199 t.d->query = d->query;-
3200 t.d->sectionIsPresent |= QUrlPrivate::Query;-
3201 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QUrl
2
3202 } else {
executed 5 times by 2 tests: end of block
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
5
3203 t.d->path = relative.d->path.startsWith(QLatin1Char('/'))
relative.d->pa...tin1Char('/'))Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QUrl
FALSEevaluated 3389 times by 4 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
27-3389
3204 ? relative.d->path-
3205 : d->mergePaths(relative.d->path);-
3206 if (relative.d->hasQuery()) {
relative.d->hasQuery()Description
TRUEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QUrl
FALSEevaluated 3391 times by 4 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
25-3391
3207 t.d->query = relative.d->query;-
3208 t.d->sectionIsPresent |= QUrlPrivate::Query;-
3209 }
executed 25 times by 2 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QUrl
25
3210 }
executed 3416 times by 5 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
3416
3211 }-
3212 t.d->scheme = d->scheme;-
3213 if (d->hasScheme())
d->hasScheme()Description
TRUEevaluated 3411 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
12-3411
3214 t.d->sectionIsPresent |= QUrlPrivate::Scheme;
executed 3411 times by 5 tests: t.d->sectionIsPresent |= QUrlPrivate::Scheme;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
3411
3215 else-
3216 t.d->sectionIsPresent &= ~QUrlPrivate::Scheme;
executed 12 times by 2 tests: t.d->sectionIsPresent &= ~QUrlPrivate::Scheme;
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
12
3217 t.d->flags |= d->flags & QUrlPrivate::IsLocalFile;-
3218 }
executed 3423 times by 5 tests: end of block
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
3423
3219 t.d->fragment = relative.d->fragment;-
3220 if (relative.d->hasFragment())
relative.d->hasFragment()Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 4476 times by 5 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
10-4476
3221 t.d->sectionIsPresent |= QUrlPrivate::Fragment;
executed 10 times by 2 tests: t.d->sectionIsPresent |= QUrlPrivate::Fragment;
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
10
3222 else-
3223 t.d->sectionIsPresent &= ~QUrlPrivate::Fragment;
executed 4476 times by 5 tests: t.d->sectionIsPresent &= ~QUrlPrivate::Fragment;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
4476
3224-
3225 removeDotsFromPath(&t.d->path);-
3226-
3227#if defined(QURL_DEBUG)-
3228 qDebug("QUrl(\"%s\").resolved(\"%s\") = \"%s\"",-
3229 qPrintable(url()),-
3230 qPrintable(relative.url()),-
3231 qPrintable(t.url()));-
3232#endif-
3233 return t;
executed 4486 times by 5 tests: return t;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlStream
4486
3234}-
3235-
3236/*!-
3237 Returns \c true if the URL is relative; otherwise returns \c false. A URL is-
3238 relative reference if its scheme is undefined; this function is therefore-
3239 equivalent to calling scheme().isEmpty().-
3240-
3241 Relative references are defined in RFC 3986 section 4.2.-
3242*/-
3243bool QUrl::isRelative() const-
3244{-
3245 if (!d) return true;
executed 3 times by 1 test: return true;
Executed by:
  • tst_QTextBrowser
!dDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QTextBrowser
FALSEevaluated 424 times by 7 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
3-424
3246 return !d->hasScheme();
executed 424 times by 7 tests: return !d->hasScheme();
Executed by:
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
424
3247}-
3248-
3249/*!-
3250 Returns a string representation of the URL. The output can be customized by-
3251 passing flags with \a options. The option QUrl::FullyDecoded is not-
3252 permitted in this function since it would generate ambiguous data.-
3253-
3254 The resulting QString can be passed back to a QUrl later on.-
3255-
3256 Synonym for toString(options).-
3257-
3258 \sa FormattingOptions, toEncoded(), toString()-
3259*/-
3260QString QUrl::url(FormattingOptions options) const-
3261{-
3262 return toString(options);
executed 43 times by 3 tests: return toString(options);
Executed by:
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
43
3263}-
3264-
3265/*!-
3266 Returns a string representation of the URL. The output can be customized by-
3267 passing flags with \a options. The option QUrl::FullyDecoded is not-
3268 permitted in this function since it would generate ambiguous data.-
3269-
3270 The default formatting option is \l{QUrl::FormattingOptions}{PrettyDecoded}.-
3271-
3272 \sa FormattingOptions, url(), setUrl()-
3273*/-
3274QString QUrl::toString(FormattingOptions options) const-
3275{-
3276 QString url;-
3277 if (!isValid()) {
!isValid()Description
TRUEevaluated 149 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
FALSEevaluated 9039 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
149-9039
3278 // also catches isEmpty()-
3279 return url;
executed 149 times by 5 tests: return url;
Executed by:
  • tst_QFileDialog2
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
149
3280 }-
3281 if (options == QUrl::FullyDecoded) {
options == QUrl::FullyDecodedDescription
TRUEnever evaluated
FALSEevaluated 9039 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
0-9039
3282 qWarning("QUrl: QUrl::FullyDecoded is not permitted when reconstructing the full URL");-
3283 options = QUrl::PrettyDecoded;-
3284 }
never executed: end of block
0
3285-
3286 // return just the path if:-
3287 // - QUrl::PreferLocalFile is passed-
3288 // - QUrl::RemovePath isn't passed (rather stupid if the user did...)-
3289 // - there's no query or fragment to return-
3290 // that is, either they aren't present, or we're removing them-
3291 // - it's a local file-
3292 if (options.testFlag(QUrl::PreferLocalFile) && !options.testFlag(QUrl::RemovePath)
options.testFl...eferLocalFile)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 9032 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
!options.testF...l::RemovePath)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-9032
3293 && (!d->hasQuery() || options.testFlag(QUrl::RemoveQuery))
!d->hasQuery()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
options.testFl...::RemoveQuery)Description
TRUEnever evaluated
FALSEnever evaluated
0-7
3294 && (!d->hasFragment() || options.testFlag(QUrl::RemoveFragment))
!d->hasFragment()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
options.testFl...emoveFragment)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
0-6
3295 && isLocalFile()) {
isLocalFile()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-4
3296 url = d->toLocalFile(options);-
3297 return url;
executed 4 times by 1 test: return url;
Executed by:
  • tst_QUrl
4
3298 }-
3299-
3300 // for the full URL, we consider that the reserved characters are prettier if encoded-
3301 if (options & DecodeReserved)
options & DecodeReservedDescription
TRUEevaluated 35 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 9000 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
35-9000
3302 options &= ~EncodeReserved;
executed 35 times by 1 test: options &= ~EncodeReserved;
Executed by:
  • tst_QUrl
35
3303 else-
3304 options |= EncodeReserved;
executed 9000 times by 28 tests: options |= EncodeReserved;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
9000
3305-
3306 if (!(options & QUrl::RemoveScheme) && d->hasScheme())
!(options & QU...:RemoveScheme)Description
TRUEevaluated 7044 times by 27 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • ...
FALSEevaluated 1991 times by 10 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
d->hasScheme()Description
TRUEevaluated 6834 times by 25 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 210 times by 6 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
210-7044
3307 url += d->scheme + QLatin1Char(':');
executed 6834 times by 25 tests: url += d->scheme + QLatin1Char(':');
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
6834
3308-
3309 bool pathIsAbsolute = d->path.startsWith(QLatin1Char('/'));-
3310 if (!((options & QUrl::RemoveAuthority) == QUrl::RemoveAuthority) && d->hasAuthority()) {
!((options & Q...moveAuthority)Description
TRUEevaluated 7073 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 1962 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
d->hasAuthority()Description
TRUEevaluated 5452 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 1621 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
1621-7073
3311 url += QLatin1String("//");-
3312 d->appendAuthority(url, options, QUrlPrivate::FullUrl);-
3313 } else if (isLocalFile() && pathIsAbsolute) {
executed 5452 times by 20 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
isLocalFile()Description
TRUEevaluated 1323 times by 9 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
FALSEevaluated 2260 times by 15 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
pathIsAbsoluteDescription
TRUEevaluated 1038 times by 9 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
FALSEevaluated 285 times by 6 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
285-5452
3314 // Comply with the XDG file URI spec, which requires triple slashes.-
3315 url += QLatin1String("//");-
3316 }
executed 1038 times by 9 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
1038
3317-
3318 if (!(options & QUrl::RemovePath))
!(options & QUrl::RemovePath)Description
TRUEevaluated 7129 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 1906 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
1906-7129
3319 d->appendPath(url, options, QUrlPrivate::FullUrl);
executed 7129 times by 28 tests: d->appendPath(url, options, QUrlPrivate::FullUrl);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
7129
3320-
3321 if (!(options & QUrl::RemoveQuery) && d->hasQuery()) {
!(options & QUrl::RemoveQuery)Description
TRUEevaluated 7121 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 1914 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
d->hasQuery()Description
TRUEevaluated 535 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 6586 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
535-7121
3322 url += QLatin1Char('?');-
3323 d->appendQuery(url, options, QUrlPrivate::FullUrl);-
3324 }
executed 535 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
535
3325 if (!(options & QUrl::RemoveFragment) && d->hasFragment()) {
!(options & QU...emoveFragment)Description
TRUEevaluated 6032 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 3003 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
d->hasFragment()Description
TRUEevaluated 792 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 5240 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
792-6032
3326 url += QLatin1Char('#');-
3327 d->appendFragment(url, options, QUrlPrivate::FullUrl);-
3328 }
executed 792 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
792
3329-
3330 return url;
executed 9035 times by 28 tests: return url;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
9035
3331}-
3332-
3333/*!-
3334 \since 5.0-
3335-
3336 Returns a human-displayable string representation of the URL.-
3337 The output can be customized by passing flags with \a options.-
3338 The option RemovePassword is always enabled, since passwords-
3339 should never be shown back to users.-
3340-
3341 With the default options, the resulting QString can be passed back-
3342 to a QUrl later on, but any password that was present initially will-
3343 be lost.-
3344-
3345 \sa FormattingOptions, toEncoded(), toString()-
3346*/-
3347-
3348QString QUrl::toDisplayString(FormattingOptions options) const-
3349{-
3350 return toString(options | RemovePassword);
executed 227 times by 4 tests: return toString(options | RemovePassword);
Executed by:
  • tst_QMimeData
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QVariant
227
3351}-
3352-
3353/*!-
3354 \since 5.2-
3355-
3356 Returns an adjusted version of the URL.-
3357 The output can be customized by passing flags with \a options.-
3358-
3359 The encoding options from QUrl::ComponentFormattingOption don't make-
3360 much sense for this method, nor does QUrl::PreferLocalFile.-
3361-
3362 This is always equivalent to QUrl(url.toString(options)).-
3363-
3364 \sa FormattingOptions, toEncoded(), toString()-
3365*/-
3366QUrl QUrl::adjusted(QUrl::FormattingOptions options) const-
3367{-
3368 if (!isValid()) {
!isValid()Description
TRUEnever evaluated
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_QUrl
0-66
3369 // also catches isEmpty()-
3370 return QUrl();
never executed: return QUrl();
0
3371 }-
3372 QUrl that = *this;-
3373 if (options & RemoveScheme)
options & RemoveSchemeDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_QUrl
8-58
3374 that.setScheme(QString());
executed 8 times by 1 test: that.setScheme(QString());
Executed by:
  • tst_QUrl
8
3375 if ((options & RemoveAuthority) == RemoveAuthority) {
(options & Rem...emoveAuthorityDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_QUrl
8-58
3376 that.setAuthority(QString());-
3377 } else {
executed 8 times by 1 test: end of block
Executed by:
  • tst_QUrl
8
3378 if ((options & RemoveUserInfo) == RemoveUserInfo)
(options & Rem...RemoveUserInfoDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_QUrl
3-55
3379 that.setUserInfo(QString());
executed 3 times by 1 test: that.setUserInfo(QString());
Executed by:
  • tst_QUrl
3
3380 else if (options & RemovePassword)
options & RemovePasswordDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QUrl
5-50
3381 that.setPassword(QString());
executed 5 times by 1 test: that.setPassword(QString());
Executed by:
  • tst_QUrl
5
3382 if (options & RemovePort)
options & RemovePortDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_QUrl
4-54
3383 that.setPort(-1);
executed 4 times by 1 test: that.setPort(-1);
Executed by:
  • tst_QUrl
4
3384 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_QUrl
58
3385 if (options & RemoveQuery)
options & RemoveQueryDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_QUrl
4-62
3386 that.setQuery(QString());
executed 4 times by 1 test: that.setQuery(QString());
Executed by:
  • tst_QUrl
4
3387 if (options & RemoveFragment)
options & RemoveFragmentDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_QUrl
4-62
3388 that.setFragment(QString());
executed 4 times by 1 test: that.setFragment(QString());
Executed by:
  • tst_QUrl
4
3389 if (options & RemovePath) {
options & RemovePathDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_QUrl
4-62
3390 that.setPath(QString());-
3391 } else if (options & (StripTrailingSlash | RemoveFilename | NormalizePathSegments)) {
executed 4 times by 1 test: end of block
Executed by:
  • tst_QUrl
options & (Str...ePathSegments)Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_QUrl
4-40
3392 that.detach();-
3393 QString path;-
3394 d->appendPath(path, options | FullyEncoded, QUrlPrivate::Path);-
3395 that.d->setPath(path, 0, path.length());-
3396 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_QUrl
40
3397 return that;
executed 66 times by 1 test: return that;
Executed by:
  • tst_QUrl
66
3398}-
3399-
3400/*!-
3401 Returns the encoded representation of the URL if it's valid;-
3402 otherwise an empty QByteArray is returned. The output can be-
3403 customized by passing flags with \a options.-
3404-
3405 The user info, path and fragment are all converted to UTF-8, and-
3406 all non-ASCII characters are then percent encoded. The host name-
3407 is encoded using Punycode.-
3408*/-
3409QByteArray QUrl::toEncoded(FormattingOptions options) const-
3410{-
3411 options &= ~(FullyDecoded | FullyEncoded);-
3412 QString stringForm = toString(options | FullyEncoded);-
3413 return stringForm.toLatin1();
executed 5103 times by 21 tests: return stringForm.toLatin1();
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_selftests - unknown status
5103
3414}-
3415-
3416/*!-
3417 \fn QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode parsingMode)-
3418-
3419 Parses \a input and returns the corresponding QUrl. \a input is-
3420 assumed to be in encoded form, containing only ASCII characters.-
3421-
3422 Parses the URL using \a parsingMode. See setUrl() for more information on-
3423 this parameter. QUrl::DecodedMode is not permitted in this context.-
3424-
3425 \sa toEncoded(), setUrl()-
3426*/-
3427QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)-
3428{-
3429 return QUrl(QString::fromUtf8(input.constData(), input.size()), mode);
executed 301 times by 6 tests: return QUrl(QString::fromUtf8(input.constData(), input.size()), mode);
Executed by:
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QUrl
301
3430}-
3431-
3432/*!-
3433 Returns a decoded copy of \a input. \a input is first decoded from-
3434 percent encoding, then converted from UTF-8 to unicode.-
3435*/-
3436QString QUrl::fromPercentEncoding(const QByteArray &input)-
3437{-
3438 QByteArray ba = QByteArray::fromPercentEncoding(input);-
3439 return QString::fromUtf8(ba, ba.size());
executed 39 times by 2 tests: return QString::fromUtf8(ba, ba.size());
Executed by:
  • tst_QUrl
  • tst_QUrlInternal
39
3440}-
3441-
3442/*!-
3443 Returns an encoded copy of \a input. \a input is first converted-
3444 to UTF-8, and all ASCII-characters that are not in the unreserved group-
3445 are percent encoded. To prevent characters from being percent encoded-
3446 pass them to \a exclude. To force characters to be percent encoded pass-
3447 them to \a include.-
3448-
3449 Unreserved is defined as:-
3450 \tt {ALPHA / DIGIT / "-" / "." / "_" / "~"}-
3451-
3452 \snippet code/src_corelib_io_qurl.cpp 6-
3453*/-
3454QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclude, const QByteArray &include)-
3455{-
3456 return input.toUtf8().toPercentEncoding(exclude, include);
executed 13 times by 1 test: return input.toUtf8().toPercentEncoding(exclude, include);
Executed by:
  • tst_QUrl
13
3457}-
3458-
3459/*! \fn QUrl QUrl::fromCFURL(CFURLRef url)-
3460 \since 5.2-
3461-
3462 Constructs a QUrl containing a copy of the CFURL \a url.-
3463*/-
3464-
3465/*! \fn CFURLRef QUrl::toCFURL() const-
3466 \since 5.2-
3467-
3468 Creates a CFURL from a QUrl. The caller owns the CFURL and is-
3469 responsible for releasing it.-
3470*/-
3471-
3472/*!-
3473 \fn QUrl QUrl::fromNSURL(const NSURL *url)-
3474 \since 5.2-
3475-
3476 Constructs a QUrl containing a copy of the NSURL \a url.-
3477*/-
3478-
3479/*!-
3480 \fn NSURL* QUrl::toNSURL() const-
3481 \since 5.2-
3482-
3483 Creates a NSURL from a QUrl. The NSURL is autoreleased.-
3484*/-
3485-
3486/*!-
3487 \internal-
3488 \since 5.0-
3489 Used in the setEncodedXXX compatibility functions. Converts \a ba to-
3490 QString form.-
3491*/-
3492QString QUrl::fromEncodedComponent_helper(const QByteArray &ba)-
3493{-
3494 return qt_urlRecodeByteArray(ba);
executed 34 times by 1 test: return qt_urlRecodeByteArray(ba);
Executed by:
  • tst_QUrl
34
3495}-
3496-
3497/*!-
3498 \fn QByteArray QUrl::toPunycode(const QString &uc)-
3499 \obsolete-
3500 Returns a \a uc in Punycode encoding.-
3501-
3502 Punycode is a Unicode encoding used for internationalized domain-
3503 names, as defined in RFC3492. If you want to convert a domain name from-
3504 Unicode to its ASCII-compatible representation, use toAce().-
3505*/-
3506-
3507/*!-
3508 \fn QString QUrl::fromPunycode(const QByteArray &pc)-
3509 \obsolete-
3510 Returns the Punycode decoded representation of \a pc.-
3511-
3512 Punycode is a Unicode encoding used for internationalized domain-
3513 names, as defined in RFC3492. If you want to convert a domain from-
3514 its ASCII-compatible encoding to the Unicode representation, use-
3515 fromAce().-
3516*/-
3517-
3518/*!-
3519 \since 4.2-
3520-
3521 Returns the Unicode form of the given domain name-
3522 \a domain, which is encoded in the ASCII Compatible Encoding (ACE).-
3523 The result of this function is considered equivalent to \a domain.-
3524-
3525 If the value in \a domain cannot be encoded, it will be converted-
3526 to QString and returned.-
3527-
3528 The ASCII Compatible Encoding (ACE) is defined by RFC 3490, RFC 3491-
3529 and RFC 3492. It is part of the Internationalizing Domain Names in-
3530 Applications (IDNA) specification, which allows for domain names-
3531 (like \c "example.com") to be written using international-
3532 characters.-
3533*/-
3534QString QUrl::fromAce(const QByteArray &domain)-
3535{-
3536 return qt_ACE_do(QString::fromLatin1(domain), NormalizeAce, ForbidLeadingDot /*FIXME: make configurable*/);
executed 389 times by 8 tests: return qt_ACE_do(QString::fromLatin1(domain), NormalizeAce, ForbidLeadingDot );
Executed by:
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QHostInfo
  • tst_QNetworkCookie
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
389
3537}-
3538-
3539/*!-
3540 \since 4.2-
3541-
3542 Returns the ASCII Compatible Encoding of the given domain name \a domain.-
3543 The result of this function is considered equivalent to \a domain.-
3544-
3545 The ASCII-Compatible Encoding (ACE) is defined by RFC 3490, RFC 3491-
3546 and RFC 3492. It is part of the Internationalizing Domain Names in-
3547 Applications (IDNA) specification, which allows for domain names-
3548 (like \c "example.com") to be written using international-
3549 characters.-
3550-
3551 This function returns an empty QByteArray if \a domain is not a valid-
3552 hostname. Note, in particular, that IPv6 literals are not valid domain-
3553 names.-
3554*/-
3555QByteArray QUrl::toAce(const QString &domain)-
3556{-
3557 QString result = qt_ACE_do(domain, ToAceOnly, ForbidLeadingDot /*FIXME: make configurable*/);-
3558 return result.toLatin1();
executed 5865 times by 30 tests: return result.toLatin1();
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookie
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
5865
3559}-
3560-
3561/*!-
3562 \internal-
3563-
3564 Returns \c true if this URL is "less than" the given \a url. This-
3565 provides a means of ordering URLs.-
3566*/-
3567bool QUrl::operator <(const QUrl &url) const-
3568{-
3569 if (!d || !url.d) {
!dDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 155 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
!url.dDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 147 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
8-155
3570 bool thisIsEmpty = !d || d->isEmpty();
!dDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
d->isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
3-18
3571 bool thatIsEmpty = !url.d || url.d->isEmpty();
!url.dDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUrl
url.d->isEmpty()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
4-17
3572-
3573 // sort an empty URL first-
3574 return thisIsEmpty && !thatIsEmpty;
executed 26 times by 1 test: return thisIsEmpty && !thatIsEmpty;
Executed by:
  • tst_QUrl
26
3575 }-
3576-
3577 int cmp;-
3578 cmp = d->scheme.compare(url.d->scheme);-
3579 if (cmp != 0)
cmp != 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 130 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
17-130
3580 return cmp < 0;
executed 17 times by 1 test: return cmp < 0;
Executed by:
  • tst_QUrl
17
3581-
3582 cmp = d->userName.compare(url.d->userName);-
3583 if (cmp != 0)
cmp != 0Description
TRUEnever evaluated
FALSEevaluated 130 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
0-130
3584 return cmp < 0;
never executed: return cmp < 0;
0
3585-
3586 cmp = d->password.compare(url.d->password);-
3587 if (cmp != 0)
cmp != 0Description
TRUEnever evaluated
FALSEevaluated 130 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
0-130
3588 return cmp < 0;
never executed: return cmp < 0;
0
3589-
3590 cmp = d->host.compare(url.d->host);-
3591 if (cmp != 0)
cmp != 0Description
TRUEnever evaluated
FALSEevaluated 130 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
0-130
3592 return cmp < 0;
never executed: return cmp < 0;
0
3593-
3594 if (d->port != url.d->port)
d->port != url.d->portDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 122 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
8-122
3595 return d->port < url.d->port;
executed 8 times by 1 test: return d->port < url.d->port;
Executed by:
  • tst_QUrl
8
3596-
3597 cmp = d->path.compare(url.d->path);-
3598 if (cmp != 0)
cmp != 0Description
TRUEevaluated 21 times by 3 tests
Evaluated by:
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
FALSEevaluated 101 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
21-101
3599 return cmp < 0;
executed 21 times by 3 tests: return cmp < 0;
Executed by:
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
21
3600-
3601 if (d->hasQuery() != url.d->hasQuery())
d->hasQuery() ....d->hasQuery()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 93 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
8-93
3602 return url.d->hasQuery();
executed 8 times by 1 test: return url.d->hasQuery();
Executed by:
  • tst_QUrl
8
3603-
3604 cmp = d->query.compare(url.d->query);-
3605 if (cmp != 0)
cmp != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 92 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
1-92
3606 return cmp < 0;
executed 1 time by 1 test: return cmp < 0;
Executed by:
  • tst_QUrl
1
3607-
3608 if (d->hasFragment() != url.d->hasFragment())
d->hasFragment...>hasFragment()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 84 times by 6 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
8-84
3609 return url.d->hasFragment();
executed 8 times by 1 test: return url.d->hasFragment();
Executed by:
  • tst_QUrl
8
3610-
3611 cmp = d->fragment.compare(url.d->fragment);-
3612 return cmp < 0;
executed 84 times by 6 tests: return cmp < 0;
Executed by:
  • tst_QPlainTextEdit
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextDocumentLayout
  • tst_QTextEdit
  • tst_QUrl
84
3613}-
3614-
3615/*!-
3616 Returns \c true if this URL and the given \a url are equal;-
3617 otherwise returns \c false.-
3618*/-
3619bool QUrl::operator ==(const QUrl &url) const-
3620{-
3621 if (!d && !url.d)
!dDescription
TRUEevaluated 277 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
FALSEevaluated 3019 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
!url.dDescription
TRUEevaluated 133 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
FALSEevaluated 144 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
133-3019
3622 return true;
executed 133 times by 9 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
133
3623 if (!d)
!dDescription
TRUEevaluated 144 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
FALSEevaluated 3019 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
144-3019
3624 return url.d->isEmpty();
executed 144 times by 7 tests: return url.d->isEmpty();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
144
3625 if (!url.d)
!url.dDescription
TRUEevaluated 375 times by 7 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_selftests - unknown status
FALSEevaluated 2644 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
375-2644
3626 return d->isEmpty();
executed 375 times by 7 tests: return d->isEmpty();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_selftests - unknown status
375
3627-
3628 // First, compare which sections are present, since it speeds up the-
3629 // processing considerably. We just have to ignore the host-is-present flag-
3630 // for local files (the "file" protocol), due to the requirements of the-
3631 // XDG file URI specification.-
3632 int mask = QUrlPrivate::FullUrl;-
3633 if (isLocalFile())
isLocalFile()Description
TRUEevaluated 1968 times by 10 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_languageChange
FALSEevaluated 676 times by 15 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_selftests - unknown status
676-1968
3634 mask &= ~QUrlPrivate::Host;
executed 1968 times by 10 tests: mask &= ~QUrlPrivate::Host;
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_languageChange
1968
3635 return (d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask) &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3636 d->scheme == url.d->scheme &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3637 d->userName == url.d->userName &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3638 d->password == url.d->password &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3639 d->host == url.d->host &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3640 d->port == url.d->port &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3641 d->path == url.d->path &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3642 d->query == url.d->query &&
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3643 d->fragment == url.d->fragment;
executed 2644 times by 20 tests: 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;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
  • tst_selftests - unknown status
2644
3644}-
3645-
3646/*!-
3647 \since 5.2-
3648-
3649 Returns \c true if this URL and the given \a url are equal after-
3650 applying \a options to both; otherwise returns \c false.-
3651-
3652 This is equivalent to calling adjusted(options) on both URLs-
3653 and comparing the resulting urls, but faster.-
3654-
3655*/-
3656bool QUrl::matches(const QUrl &url, FormattingOptions options) const-
3657{-
3658 if (!d && !url.d)
!dDescription
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QUrl
!url.dDescription
TRUEnever evaluated
FALSEnever evaluated
0-34
3659 return true;
never executed: return true;
0
3660 if (!d)
!dDescription
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QUrl
0-34
3661 return url.d->isEmpty();
never executed: return url.d->isEmpty();
0
3662 if (!url.d)
!url.dDescription
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QUrl
0-34
3663 return d->isEmpty();
never executed: return d->isEmpty();
0
3664-
3665 // First, compare which sections are present, since it speeds up the-
3666 // processing considerably. We just have to ignore the host-is-present flag-
3667 // for local files (the "file" protocol), due to the requirements of the-
3668 // XDG file URI specification.-
3669 int mask = QUrlPrivate::FullUrl;-
3670 if (isLocalFile())
isLocalFile()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QUrl
2-32
3671 mask &= ~QUrlPrivate::Host;
executed 2 times by 1 test: mask &= ~QUrlPrivate::Host;
Executed by:
  • tst_QUrl
2
3672-
3673 if (options & QUrl::RemoveScheme)
options & QUrl::RemoveSchemeDescription
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QUrl
0-34
3674 mask &= ~QUrlPrivate::Scheme;
never executed: mask &= ~QUrlPrivate::Scheme;
0
3675 else if (d->scheme != url.d->scheme)
d->scheme != url.d->schemeDescription
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QUrl
0-34
3676 return false;
never executed: return false;
0
3677-
3678 if (options & QUrl::RemovePassword)
options & QUrl::RemovePasswordDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QUrl
10-24
3679 mask &= ~QUrlPrivate::Password;
executed 10 times by 1 test: mask &= ~QUrlPrivate::Password;
Executed by:
  • tst_QUrl
10
3680 else if (d->password != url.d->password)
d->password != url.d->passwordDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
1-23
3681 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QUrl
1
3682-
3683 if (options & QUrl::RemoveUserInfo)
options & QUrl::RemoveUserInfoDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
10-23
3684 mask &= ~QUrlPrivate::UserName;
executed 10 times by 1 test: mask &= ~QUrlPrivate::UserName;
Executed by:
  • tst_QUrl
10
3685 else if (d->userName != url.d->userName)
d->userName != url.d->userNameDescription
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
0-23
3686 return false;
never executed: return false;
0
3687-
3688 if (options & QUrl::RemovePort)
options & QUrl::RemovePortDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QUrl
8-25
3689 mask &= ~QUrlPrivate::Port;
executed 8 times by 1 test: mask &= ~QUrlPrivate::Port;
Executed by:
  • tst_QUrl
8
3690 else if (d->port != url.d->port)
d->port != url.d->portDescription
TRUEnever evaluated
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QUrl
0-25
3691 return false;
never executed: return false;
0
3692-
3693 if (options & QUrl::RemoveAuthority)
options & QUrl...emoveAuthorityDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QUrl
10-23
3694 mask &= ~QUrlPrivate::Host;
executed 10 times by 1 test: mask &= ~QUrlPrivate::Host;
Executed by:
  • tst_QUrl
10
3695 else if (d->host != url.d->host)
d->host != url.d->hostDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 21 times by 1 test
Evaluated by:
  • tst_QUrl
2-21
3696 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QUrl
2
3697-
3698 if (options & QUrl::RemoveQuery)
options & QUrl::RemoveQueryDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QUrl
4-27
3699 mask &= ~QUrlPrivate::Query;
executed 4 times by 1 test: mask &= ~QUrlPrivate::Query;
Executed by:
  • tst_QUrl
4
3700 else if (d->query != url.d->query)
d->query != url.d->queryDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QUrl
2-25
3701 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QUrl
2
3702-
3703 if (options & QUrl::RemoveFragment)
options & QUrl::RemoveFragmentDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QUrl
3-26
3704 mask &= ~QUrlPrivate::Fragment;
executed 3 times by 1 test: mask &= ~QUrlPrivate::Fragment;
Executed by:
  • tst_QUrl
3
3705 else if (d->fragment != url.d->fragment)
d->fragment != url.d->fragmentDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QUrl
1-25
3706 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QUrl
1
3707-
3708 if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask))
(d->sectionIsP...resent & mask)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QUrl
1-27
3709 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QUrl
1
3710-
3711 if (options & QUrl::RemovePath)
options & QUrl::RemovePathDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_QUrl
5-22
3712 return true;
executed 5 times by 1 test: return true;
Executed by:
  • tst_QUrl
5
3713-
3714 // Compare paths, after applying path-related options-
3715 QString path1;-
3716 d->appendPath(path1, options, QUrlPrivate::Path);-
3717 QString path2;-
3718 url.d->appendPath(path2, options, QUrlPrivate::Path);-
3719 return path1 == path2;
executed 22 times by 1 test: return path1 == path2;
Executed by:
  • tst_QUrl
22
3720}-
3721-
3722/*!-
3723 Returns \c true if this URL and the given \a url are not equal;-
3724 otherwise returns \c false.-
3725*/-
3726bool QUrl::operator !=(const QUrl &url) const-
3727{-
3728 return !(*this == url);
executed 120 times by 4 tests: return !(*this == url);
Executed by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
120
3729}-
3730-
3731/*!-
3732 Assigns the specified \a url to this object.-
3733*/-
3734QUrl &QUrl::operator =(const QUrl &url)-
3735{-
3736 if (!d) {
!dDescription
TRUEevaluated 9279 times by 21 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
FALSEevaluated 2607 times by 7 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QXmlStream
  • tst_languageChange
2607-9279
3737 if (url.d) {
url.dDescription
TRUEevaluated 7068 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
FALSEevaluated 2211 times by 14 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
2211-7068
3738 url.d->ref.ref();-
3739 d = url.d;-
3740 }
executed 7068 times by 20 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
7068
3741 } else {
executed 9279 times by 21 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
9279
3742 if (url.d)
url.dDescription
TRUEevaluated 2499 times by 7 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QXmlStream
  • tst_languageChange
FALSEevaluated 108 times by 2 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
108-2499
3743 qAtomicAssign(d, url.d);
executed 2499 times by 7 tests: qAtomicAssign(d, url.d);
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QXmlStream
  • tst_languageChange
2499
3744 else-
3745 clear();
executed 108 times by 2 tests: clear();
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
108
3746 }-
3747 return *this;
executed 11886 times by 21 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
11886
3748}-
3749-
3750/*!-
3751 Assigns the specified \a url to this object.-
3752*/-
3753QUrl &QUrl::operator =(const QString &url)-
3754{-
3755 if (url.isEmpty()) {
url.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QNetworkReply
0-10
3756 clear();-
3757 } else {
never executed: end of block
0
3758 detach();-
3759 d->parse(url, TolerantMode);-
3760 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
10
3761 return *this;
executed 10 times by 1 test: return *this;
Executed by:
  • tst_QNetworkReply
10
3762}-
3763-
3764/*!-
3765 \fn void QUrl::swap(QUrl &other)-
3766 \since 4.8-
3767-
3768 Swaps URL \a other with this URL. This operation is very-
3769 fast and never fails.-
3770*/-
3771-
3772/*!-
3773 \internal-
3774-
3775 Forces a detach.-
3776*/-
3777void QUrl::detach()-
3778{-
3779 if (!d)
!dDescription
TRUEevaluated 20881 times by 55 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
FALSEevaluated 28079 times by 46 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPlainTextEdit
  • ...
20881-28079
3780 d = new QUrlPrivate;
executed 20881 times by 55 tests: d = new QUrlPrivate;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • ...
20881
3781 else-
3782 qAtomicDetach(d);
executed 28079 times by 46 tests: qAtomicDetach(d);
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QMetaType
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPlainTextEdit
  • ...
28079
3783}-
3784-
3785/*!-
3786 \internal-
3787*/-
3788bool QUrl::isDetached() const-
3789{-
3790 return !d || d->ref.load() == 1;
never executed: return !d || d->ref.load() == 1;
0
3791}-
3792-
3793-
3794/*!-
3795 Returns a QUrl representation of \a localFile, interpreted as a local-
3796 file. This function accepts paths separated by slashes as well as the-
3797 native separator for this platform.-
3798-
3799 This function also accepts paths with a doubled leading slash (or-
3800 backslash) to indicate a remote file, as in-
3801 "//servername/path/to/file.txt". Note that only certain platforms can-
3802 actually open this file using QFile::open().-
3803-
3804 An empty \a localFile leads to an empty URL (since Qt 5.4).-
3805-
3806 \sa toLocalFile(), isLocalFile(), QDir::toNativeSeparators()-
3807*/-
3808QUrl QUrl::fromLocalFile(const QString &localFile)-
3809{-
3810 QUrl url;-
3811 if (localFile.isEmpty())
localFile.isEmpty()Description
TRUEevaluated 209 times by 4 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QUrl
  • tst_languageChange
FALSEevaluated 5328 times by 11 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
209-5328
3812 return url;
executed 209 times by 4 tests: return url;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QUrl
  • tst_languageChange
209
3813 QString scheme = fileScheme();-
3814 QString deslashified = QDir::fromNativeSeparators(localFile);-
3815-
3816 // magic for drives on windows-
3817 if (deslashified.length() > 1 && deslashified.at(1) == QLatin1Char(':') && deslashified.at(0) != QLatin1Char('/')) {
deslashified.length() > 1Description
TRUEevaluated 5263 times by 11 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
FALSEevaluated 65 times by 4 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QSidebar
  • tst_QUrl
deslashified.a...atin1Char(':')Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 5262 times by 11 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
deslashified.a...atin1Char('/')Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-5263
3818 deslashified.prepend(QLatin1Char('/'));-
3819 } else if (deslashified.startsWith(QLatin1String("//"))) {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUrl
deslashified.s...1String("//"))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 5323 times by 11 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
1-5323
3820 // magic for shared drive on windows-
3821 int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2);-
3822 QString hostSpec = deslashified.mid(2, indexOfPath - 2);-
3823 // Check for Windows-specific WebDAV specification: "//host@SSL/path".-
3824 if (hostSpec.endsWith(webDavSslTag(), Qt::CaseInsensitive)) {
hostSpec.endsW...seInsensitive)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
1-3
3825 hostSpec.chop(4);-
3826 scheme = webDavScheme();-
3827 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QUrl
1
3828 url.setHost(hostSpec);-
3829-
3830 if (indexOfPath > 2)
indexOfPath > 2Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-3
3831 deslashified = deslashified.right(deslashified.length() - indexOfPath);
executed 3 times by 1 test: deslashified = deslashified.right(deslashified.length() - indexOfPath);
Executed by:
  • tst_QUrl
3
3832 else-
3833 deslashified.clear();
executed 1 time by 1 test: deslashified.clear();
Executed by:
  • tst_QUrl
1
3834 }-
3835-
3836 url.setScheme(scheme);-
3837 url.setPath(deslashified, DecodedMode);-
3838 return url;
executed 5328 times by 11 tests: return url;
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
5328
3839}-
3840-
3841/*!-
3842 Returns the path of this URL formatted as a local file path. The path-
3843 returned will use forward slashes, even if it was originally created-
3844 from one with backslashes.-
3845-
3846 If this URL contains a non-empty hostname, it will be encoded in the-
3847 returned value in the form found on SMB networks (for example,-
3848 "//servername/path/to/file.txt").-
3849-
3850 Note: if the path component of this URL contains a non-UTF-8 binary-
3851 sequence (such as %80), the behaviour of this function is undefined.-
3852-
3853 \sa fromLocalFile(), isLocalFile()-
3854*/-
3855QString QUrl::toLocalFile() const-
3856{-
3857 // the call to isLocalFile() also ensures that we're parsed-
3858 if (!isLocalFile())
!isLocalFile()Description
TRUEevaluated 1120 times by 8 tests
Evaluated by:
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
FALSEevaluated 10627 times by 15 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
1120-10627
3859 return QString();
executed 1120 times by 8 tests: return QString();
Executed by:
  • tst_QFiledialog
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
1120
3860-
3861 return d->toLocalFile(QUrl::FullyDecoded);
executed 10627 times by 15 tests: return d->toLocalFile(QUrl::FullyDecoded);
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
10627
3862}-
3863-
3864/*!-
3865 \since 4.8-
3866 Returns \c true if this URL is pointing to a local file path. A URL is a-
3867 local file path if the scheme is "file".-
3868-
3869 Note that this function considers URLs with hostnames to be local file-
3870 paths, even if the eventual file path cannot be opened with-
3871 QFile::open().-
3872-
3873 \sa fromLocalFile(), toLocalFile()-
3874*/-
3875bool QUrl::isLocalFile() const-
3876{-
3877 return d && d->isLocalFile();
executed 21421 times by 35 tests: return d && d->isLocalFile();
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextDocument
  • ...
21421
3878}-
3879-
3880/*!-
3881 Returns \c true if this URL is a parent of \a childUrl. \a childUrl is a child-
3882 of this URL if the two URLs share the same scheme and authority,-
3883 and this URL's path is a parent of the path of \a childUrl.-
3884*/-
3885bool QUrl::isParentOf(const QUrl &childUrl) const-
3886{-
3887 QString childPath = childUrl.path();-
3888-
3889 if (!d)
!dDescription
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrl
0-5
3890 return ((childUrl.scheme().isEmpty())
never executed: return ((childUrl.scheme().isEmpty()) && (childUrl.authority().isEmpty()) && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
0
3891 && (childUrl.authority().isEmpty())
never executed: return ((childUrl.scheme().isEmpty()) && (childUrl.authority().isEmpty()) && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
0
3892 && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
never executed: return ((childUrl.scheme().isEmpty()) && (childUrl.authority().isEmpty()) && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
0
3893-
3894 QString ourPath = path();-
3895-
3896 return ((childUrl.scheme().isEmpty() || d->scheme == childUrl.scheme())
executed 5 times by 1 test: 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('/'))));
Executed by:
  • tst_QUrl
5
3897 && (childUrl.authority().isEmpty() || authority() == childUrl.authority())
executed 5 times by 1 test: 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('/'))));
Executed by:
  • tst_QUrl
5
3898 && childPath.startsWith(ourPath)
executed 5 times by 1 test: 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('/'))));
Executed by:
  • tst_QUrl
5
3899 && ((ourPath.endsWith(QLatin1Char('/')) && childPath.length() > ourPath.length())
executed 5 times by 1 test: 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('/'))));
Executed by:
  • tst_QUrl
5
3900 || (!ourPath.endsWith(QLatin1Char('/'))
executed 5 times by 1 test: 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('/'))));
Executed by:
  • tst_QUrl
5
3901 && childPath.length() > ourPath.length() && childPath.at(ourPath.length()) == QLatin1Char('/'))));
executed 5 times by 1 test: 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('/'))));
Executed by:
  • tst_QUrl
5
3902}-
3903-
3904-
3905#ifndef QT_NO_DATASTREAM-
3906/*! \relates QUrl-
3907-
3908 Writes url \a url to the stream \a out and returns a reference-
3909 to the stream.-
3910-
3911 \sa{Serializing Qt Data Types}{Format of the QDataStream operators}-
3912*/-
3913QDataStream &operator<<(QDataStream &out, const QUrl &url)-
3914{-
3915 QByteArray u;-
3916 if (url.isValid())
url.isValid()Description
TRUEevaluated 102 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QUrl
  • tst_QVariant
5-102
3917 u = url.toEncoded();
executed 102 times by 6 tests: u = url.toEncoded();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
102
3918 out << u;-
3919 return out;
executed 107 times by 8 tests: return out;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QVariant
107
3920}-
3921-
3922/*! \relates QUrl-
3923-
3924 Reads a url into \a url from the stream \a in and returns a-
3925 reference to the stream.-
3926-
3927 \sa{Serializing Qt Data Types}{Format of the QDataStream operators}-
3928*/-
3929QDataStream &operator>>(QDataStream &in, QUrl &url)-
3930{-
3931 QByteArray u;-
3932 in >> u;-
3933 url.setUrl(QString::fromLatin1(u));-
3934 return in;
executed 106 times by 8 tests: return in;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QVariant
106
3935}-
3936#endif // QT_NO_DATASTREAM-
3937-
3938#ifndef QT_NO_DEBUG_STREAM-
3939QDebug operator<<(QDebug d, const QUrl &url)-
3940{-
3941 QDebugStateSaver saver(d);-
3942 d.nospace() << "QUrl(" << url.toDisplayString() << ')';-
3943 return d;
executed 217 times by 2 tests: return d;
Executed by:
  • tst_QNetworkReply
  • tst_QVariant
217
3944}-
3945#endif-
3946-
3947static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, int errorPosition)-
3948{-
3949 QChar c = uint(errorPosition) < uint(errorSource.length()) ?
uint(errorPosi...urce.length())Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 94 times by 1 test
Evaluated by:
  • tst_QUrl
94-108
3950 errorSource.at(errorPosition) : QChar(QChar::Null);-
3951-
3952 switch (errorCode) {-
3953 case QUrlPrivate::NoError:
never executed: case QUrlPrivate::NoError:
0
3954 Q_ASSERT_X(false, "QUrl::errorString",-
3955 "Impossible: QUrl::errorString should have treated this condition");-
3956 Q_UNREACHABLE();-
3957 return QString();
never executed: return QString();
0
3958-
3959 case QUrlPrivate::InvalidSchemeError: {
never executed: case QUrlPrivate::InvalidSchemeError:
0
3960 QString msg = QStringLiteral("Invalid scheme (character '%1' not permitted)");
never executed: return qstring_literal_temp;
0
3961 return msg.arg(c);
never executed: return msg.arg(c);
0
3962 }-
3963-
3964 case QUrlPrivate::InvalidUserNameError:
executed 10 times by 1 test: case QUrlPrivate::InvalidUserNameError:
Executed by:
  • tst_QUrl
10
3965 return QString(QStringLiteral("Invalid user name (character '%1' not permitted)"))
executed 10 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid user name (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid user name (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
executed 10 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
10
3966 .arg(c);
executed 10 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid user name (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid user name (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
10
3967-
3968 case QUrlPrivate::InvalidPasswordError:
executed 5 times by 1 test: case QUrlPrivate::InvalidPasswordError:
Executed by:
  • tst_QUrl
5
3969 return QString(QStringLiteral("Invalid password (character '%1' not permitted)"))
executed 5 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid password (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid password (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
executed 5 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
5
3970 .arg(c);
executed 5 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid password (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid password (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
5
3971-
3972 case QUrlPrivate::InvalidRegNameError:
executed 89 times by 1 test: case QUrlPrivate::InvalidRegNameError:
Executed by:
  • tst_QUrl
89
3973 if (errorPosition != -1)
errorPosition != -1Description
TRUEnever evaluated
FALSEevaluated 89 times by 1 test
Evaluated by:
  • tst_QUrl
0-89
3974 return QString(QStringLiteral("Invalid hostname (character '%1' not permitted)"))
never executed: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid hostname (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid hostname (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
never executed: return qstring_literal_temp;
0
3975 .arg(c);
never executed: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid hostname (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid hostname (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
0
3976 else-
3977 return QStringLiteral("Invalid hostname (contains invalid characters)");
executed 89 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Invalid hostname (contains invalid characters)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid hostname (contains invalid characters)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 89 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
89
3978 case QUrlPrivate::InvalidIPv4AddressError:
never executed: case QUrlPrivate::InvalidIPv4AddressError:
0
3979 return QString(); // doesn't happen yet
never executed: return QString();
0
3980 case QUrlPrivate::InvalidIPv6AddressError:
executed 5 times by 1 test: case QUrlPrivate::InvalidIPv6AddressError:
Executed by:
  • tst_QUrl
5
3981 return QStringLiteral("Invalid IPv6 address");
executed 5 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Invalid IPv6 address")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid IPv6 address" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 5 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
5
3982 case QUrlPrivate::InvalidCharacterInIPv6Error:
executed 15 times by 1 test: case QUrlPrivate::InvalidCharacterInIPv6Error:
Executed by:
  • tst_QUrl
15
3983 return QStringLiteral("Invalid IPv6 address (character '%1' not permitted)").arg(c);
executed 15 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Invalid IPv6 address (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid IPv6 address (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(c);
Executed by:
  • tst_QUrl
executed 15 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
15
3984 case QUrlPrivate::InvalidIPvFutureError:
executed 25 times by 1 test: case QUrlPrivate::InvalidIPvFutureError:
Executed by:
  • tst_QUrl
25
3985 return QStringLiteral("Invalid IPvFuture address (character '%1' not permitted)").arg(c);
executed 25 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Invalid IPvFuture address (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid IPvFuture address (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(c);
Executed by:
  • tst_QUrl
executed 25 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
25
3986 case QUrlPrivate::HostMissingEndBracket:
executed 5 times by 1 test: case QUrlPrivate::HostMissingEndBracket:
Executed by:
  • tst_QUrl
5
3987 return QStringLiteral("Expected ']' to match '[' in hostname");
executed 5 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Expected ']' to match '[' in hostname")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Expected ']' to match '[' in hostname" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 5 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
5
3988-
3989 case QUrlPrivate::InvalidPortError:
executed 21 times by 1 test: case QUrlPrivate::InvalidPortError:
Executed by:
  • tst_QUrl
21
3990 return QStringLiteral("Invalid port or port number out of range");
executed 21 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Invalid port or port number out of range")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid port or port number out of range" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 21 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
21
3991 case QUrlPrivate::PortEmptyError:
never executed: case QUrlPrivate::PortEmptyError:
0
3992 return QStringLiteral("Port field was empty");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "Port field was empty")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Port field was empty" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
3993-
3994 case QUrlPrivate::InvalidPathError:
executed 10 times by 1 test: case QUrlPrivate::InvalidPathError:
Executed by:
  • tst_QUrl
10
3995 return QString(QStringLiteral("Invalid path (character '%1' not permitted)"))
executed 10 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid path (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid path (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
executed 10 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
10
3996 .arg(c);
executed 10 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid path (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid path (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
10
3997-
3998 case QUrlPrivate::InvalidQueryError:
executed 5 times by 1 test: case QUrlPrivate::InvalidQueryError:
Executed by:
  • tst_QUrl
5
3999 return QString(QStringLiteral("Invalid query (character '%1' not permitted)"))
executed 5 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid query (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid query (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
executed 5 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
5
4000 .arg(c);
executed 5 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid query (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid query (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
5
4001-
4002 case QUrlPrivate::InvalidFragmentError:
executed 5 times by 1 test: case QUrlPrivate::InvalidFragmentError:
Executed by:
  • tst_QUrl
5
4003 return QString(QStringLiteral("Invalid fragment (character '%1' not permitted)"))
executed 5 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid fragment (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid fragment (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
executed 5 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
5
4004 .arg(c);
executed 5 times by 1 test: return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid fragment (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid fragment (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) .arg(c);
Executed by:
  • tst_QUrl
5
4005-
4006 case QUrlPrivate::AuthorityPresentAndPathIsRelative:
executed 1 time by 1 test: case QUrlPrivate::AuthorityPresentAndPathIsRelative:
Executed by:
  • tst_QUrl
1
4007 return QStringLiteral("Path component is relative and authority is present");
executed 1 time by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Path component is relative and authority is present")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Path component is relative and authority is present" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 1 time by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
1
4008 case QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash:
executed 6 times by 1 test: case QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash:
Executed by:
  • tst_QUrl
6
4009 return QStringLiteral("Relative URL's path component contains ':' before any '/'");
executed 6 times by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "Relative URL's path component contains ':' before any '/'")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Relative URL's path component contains ':' before any '/'" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QUrl
executed 6 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
6
4010 }-
4011-
4012 Q_ASSERT_X(false, "QUrl::errorString", "Cannot happen, unknown error");-
4013 Q_UNREACHABLE();-
4014 return QString();
never executed: return QString();
0
4015}-
4016-
4017static inline void appendComponentIfPresent(QString &msg, bool present, const char *componentName,-
4018 const QString &component)-
4019{-
4020 if (present) {
presentDescription
TRUEevaluated 371 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1043 times by 1 test
Evaluated by:
  • tst_QUrl
371-1043
4021 msg += QLatin1String(componentName);-
4022 msg += QLatin1Char('"');-
4023 msg += component;-
4024 msg += QLatin1String("\",");-
4025 }
executed 371 times by 1 test: end of block
Executed by:
  • tst_QUrl
371
4026}
executed 1414 times by 1 test: end of block
Executed by:
  • tst_QUrl
1414
4027-
4028/*!-
4029 \since 4.2-
4030-
4031 Returns an error message if the last operation that modified this QUrl-
4032 object ran into a parsing error. If no error was detected, this function-
4033 returns an empty string and isValid() returns \c true.-
4034-
4035 The error message returned by this function is technical in nature and may-
4036 not be understood by end users. It is mostly useful to developers trying to-
4037 understand why QUrl will not accept some input.-
4038-
4039 \sa QUrl::ParsingMode-
4040*/-
4041QString QUrl::errorString() const-
4042{-
4043 QString msg;-
4044 if (!d)
!dDescription
TRUEevaluated 130 times by 6 tests
Evaluated by:
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
FALSEevaluated 213 times by 2 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QUrl
130-213
4045 return msg;
executed 130 times by 6 tests: return msg;
Executed by:
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
130
4046-
4047 QString errorSource;-
4048 int errorPosition = 0;-
4049 QUrlPrivate::ErrorCode errorCode = d->validityError(&errorSource, &errorPosition);-
4050 if (errorCode == QUrlPrivate::NoError)
errorCode == Q...ivate::NoErrorDescription
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QUrl
FALSEevaluated 202 times by 1 test
Evaluated by:
  • tst_QUrl
11-202
4051 return msg;
executed 11 times by 2 tests: return msg;
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QUrl
11
4052-
4053 msg += errorMessage(errorCode, errorSource, errorPosition);-
4054 msg += QLatin1String("; source was \"");-
4055 msg += errorSource;-
4056 msg += QLatin1String("\";");-
4057 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Scheme,-
4058 " scheme = ", d->scheme);-
4059 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::UserInfo,-
4060 " userinfo = ", userInfo());-
4061 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Host,-
4062 " host = ", d->host);-
4063 appendComponentIfPresent(msg, d->port != -1,-
4064 " port = ", QString::number(d->port));-
4065 appendComponentIfPresent(msg, !d->path.isEmpty(),-
4066 " path = ", d->path);-
4067 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Query,-
4068 " query = ", d->query);-
4069 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Fragment,-
4070 " fragment = ", d->fragment);-
4071 if (msg.endsWith(QLatin1Char(',')))
msg.endsWith(QLatin1Char(','))Description
TRUEevaluated 201 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-201
4072 msg.chop(1);
executed 201 times by 1 test: msg.chop(1);
Executed by:
  • tst_QUrl
201
4073 return msg;
executed 202 times by 1 test: return msg;
Executed by:
  • tst_QUrl
202
4074}-
4075-
4076/*!-
4077 \since 5.1-
4078-
4079 Converts a list of \a urls into a list of QString objects, using toString(\a options).-
4080*/-
4081QStringList QUrl::toStringList(const QList<QUrl> &urls, FormattingOptions options)-
4082{-
4083 QStringList lst;-
4084 lst.reserve(urls.size());-
4085 for (const QUrl &url : urls)-
4086 lst.append(url.toString(options));
executed 465 times by 5 tests: lst.append(url.toString(options));
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
465
4087 return lst;
executed 235 times by 5 tests: return lst;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
235
4088-
4089}-
4090-
4091/*!-
4092 \since 5.1-
4093-
4094 Converts a list of strings representing \a urls into a list of urls, using QUrl(str, \a mode).-
4095 Note that this means all strings must be urls, not for instance local paths.-
4096*/-
4097QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode)-
4098{-
4099 QList<QUrl> lst;-
4100 lst.reserve(urls.size());-
4101 for (const QString &str : urls)-
4102 lst.append(QUrl(str, mode));
executed 507 times by 5 tests: lst.append(QUrl(str, mode));
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
507
4103 return lst;
executed 255 times by 5 tests: return lst;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
255
4104}-
4105-
4106/*!-
4107 \typedef QUrl::DataPtr-
4108 \internal-
4109*/-
4110-
4111/*!-
4112 \fn DataPtr &QUrl::data_ptr()-
4113 \internal-
4114*/-
4115-
4116/*!-
4117 Returns the hash value for the \a url. If specified, \a seed is used to-
4118 initialize the hash.-
4119-
4120 \relates QHash-
4121 \since 5.0-
4122*/-
4123uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW-
4124{-
4125 if (!url.d)
!url.dDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
3-7
4126 return qHash(-1, seed); // the hash of an unset port (-1)
executed 3 times by 1 test: return qHash(-1, seed);
Executed by:
  • tst_QUrl
3
4127-
4128 return qHash(url.d->scheme) ^
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4129 qHash(url.d->userName) ^
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4130 qHash(url.d->password) ^
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4131 qHash(url.d->host) ^
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4132 qHash(url.d->port, seed) ^
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4133 qHash(url.d->path) ^
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4134 qHash(url.d->query) ^
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4135 qHash(url.d->fragment);
executed 7 times by 1 test: 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);
Executed by:
  • tst_QUrl
7
4136}-
4137-
4138static QUrl adjustFtpPath(QUrl url)-
4139{-
4140 if (url.scheme() == ftpScheme()) {
url.scheme() == ftpScheme()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 31 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
3-31
4141 QString path = url.path(QUrl::PrettyDecoded);-
4142 if (path.startsWith(QLatin1String("//")))
path.startsWit...1String("//"))Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-2
4143 url.setPath(QLatin1String("/%2F") + path.midRef(2), QUrl::TolerantMode);
executed 2 times by 1 test: url.setPath(QLatin1String("/%2F") + path.midRef(2), QUrl::TolerantMode);
Executed by:
  • tst_QUrl
2
4144 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUrl
3
4145 return url;
executed 34 times by 2 tests: return url;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
34
4146}-
4147-
4148static bool isIp6(const QString &text)-
4149{-
4150 QIPAddressUtils::IPv6Address address;-
4151 return !text.isEmpty() && QIPAddressUtils::parseIp6(address, text.begin(), text.end()) == 0;
executed 104 times by 2 tests: return !text.isEmpty() && QIPAddressUtils::parseIp6(address, text.begin(), text.end()) == 0;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
104
4152}-
4153-
4154// The following code has the following copyright:-
4155/*-
4156 Copyright (C) Research In Motion Limited 2009. All rights reserved.-
4157-
4158Redistribution and use in source and binary forms, with or without-
4159modification, are permitted provided that the following conditions are met:-
4160 * Redistributions of source code must retain the above copyright-
4161 notice, this list of conditions and the following disclaimer.-
4162 * Redistributions in binary form must reproduce the above copyright-
4163 notice, this list of conditions and the following disclaimer in the-
4164 documentation and/or other materials provided with the distribution.-
4165 * Neither the name of Research In Motion Limited nor the-
4166 contributors may be used to endorse or promote products derived-
4167 derived from this software without specific prior written permission.-
4168-
4169THIS SOFTWARE IS PROVIDED BY Research In Motion Limited ''AS IS'' AND ANY-
4170EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED-
4171WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE-
4172DISCLAIMED. IN NO EVENT SHALL Research In Motion Limited BE LIABLE FOR ANY-
4173DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES-
4174(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;-
4175LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND-
4176ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-
4177(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS-
4178SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.-
4179-
4180*/-
4181-
4182-
4183/*!-
4184 Returns a valid URL from a user supplied \a userInput string if one can be-
4185 deducted. In the case that is not possible, an invalid QUrl() is returned.-
4186-
4187 This overload takes a \a workingDirectory path, in order to be able to-
4188 handle relative paths. This is especially useful when handling command-
4189 line arguments.-
4190 If \a workingDirectory is empty, no handling of relative paths will be done,-
4191 so this method will behave like its one argument overload.-
4192-
4193 By default, an input string that looks like a relative path will only be treated-
4194 as such if the file actually exists in the given working directory.-
4195-
4196 If the application can handle files that don't exist yet, it should pass the-
4197 flag AssumeLocalFile in \a options.-
4198-
4199 \since 5.4-
4200*/-
4201QUrl QUrl::fromUserInput(const QString &userInput, const QString &workingDirectory,-
4202 UserInputResolutionOptions options)-
4203{-
4204 QString trimmedString = userInput.trimmed();-
4205-
4206 if (trimmedString.isEmpty())
trimmedString.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QUrl
2-44
4207 return QUrl();
executed 2 times by 1 test: return QUrl();
Executed by:
  • tst_QUrl
2
4208-
4209-
4210 // Check for IPv6 addresses, since a path starting with ":" is absolute (a resource)-
4211 // and IPv6 addresses can start with "c:" too-
4212 if (isIp6(trimmedString)) {
isIp6(trimmedString)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QUrl
12-32
4213 QUrl url;-
4214 url.setHost(trimmedString);-
4215 url.setScheme(QStringLiteral("http"));
executed 12 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
12
4216 return url;
executed 12 times by 1 test: return url;
Executed by:
  • tst_QUrl
12
4217 }-
4218-
4219 QUrl url = QUrl(trimmedString, QUrl::TolerantMode);-
4220 // Check both QUrl::isRelative (to detect full URLs) and QDir::isAbsolutePath (since on Windows drive letters can be interpreted as schemes)-
4221 if (url.isRelative() && !QDir::isAbsolutePath(trimmedString)) {
url.isRelative()Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
!QDir::isAbsol...trimmedString)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
2-30
4222 QFileInfo fileInfo(QDir(workingDirectory), trimmedString);-
4223 if ((options & AssumeLocalFile) || fileInfo.exists())
fileInfo.exists()Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
3-11
4224 return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
executed 25 times by 1 test: return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
Executed by:
  • tst_QUrl
25
4225 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUrl
3
4226-
4227 return fromUserInput(trimmedString);
executed 7 times by 1 test: return fromUserInput(trimmedString);
Executed by:
  • tst_QUrl
7
4228}-
4229-
4230/*!-
4231 Returns a valid URL from a user supplied \a userInput string if one can be-
4232 deducted. In the case that is not possible, an invalid QUrl() is returned.-
4233-
4234 \since 4.6-
4235-
4236 Most applications that can browse the web, allow the user to input a URL-
4237 in the form of a plain string. This string can be manually typed into-
4238 a location bar, obtained from the clipboard, or passed in via command-
4239 line arguments.-
4240-
4241 When the string is not already a valid URL, a best guess is performed,-
4242 making various web related assumptions.-
4243-
4244 In the case the string corresponds to a valid file path on the system,-
4245 a file:// URL is constructed, using QUrl::fromLocalFile().-
4246-
4247 If that is not the case, an attempt is made to turn the string into a-
4248 http:// or ftp:// URL. The latter in the case the string starts with-
4249 'ftp'. The result is then passed through QUrl's tolerant parser, and-
4250 in the case or success, a valid QUrl is returned, or else a QUrl().-
4251-
4252 \section1 Examples:-
4253-
4254 \list-
4255 \li qt-project.org becomes http://qt-project.org-
4256 \li ftp.qt-project.org becomes ftp://ftp.qt-project.org-
4257 \li hostname becomes http://hostname-
4258 \li /home/user/test.html becomes file:///home/user/test.html-
4259 \endlist-
4260*/-
4261QUrl QUrl::fromUserInput(const QString &userInput)-
4262{-
4263 QString trimmedString = userInput.trimmed();-
4264-
4265 // Check for IPv6 addresses, since a path starting with ":" is absolute (a resource)-
4266 // and IPv6 addresses can start with "c:" too-
4267 if (isIp6(trimmedString)) {
isIp6(trimmedString)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 54 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
6-54
4268 QUrl url;-
4269 url.setHost(trimmedString);-
4270 url.setScheme(QStringLiteral("http"));
executed 6 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QUrl
6
4271 return url;
executed 6 times by 1 test: return url;
Executed by:
  • tst_QUrl
6
4272 }-
4273-
4274 // Check first for files, since on Windows drive letters can be interpretted as schemes-
4275 if (QDir::isAbsolutePath(trimmedString))
QDir::isAbsolu...trimmedString)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 35 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
19-35
4276 return QUrl::fromLocalFile(trimmedString);
executed 19 times by 1 test: return QUrl::fromLocalFile(trimmedString);
Executed by:
  • tst_QUrl
19
4277-
4278 QUrl url = QUrl(trimmedString, QUrl::TolerantMode);-
4279 QUrl urlPrepended = QUrl(QLatin1String("http://") + trimmedString, QUrl::TolerantMode);-
4280-
4281 // Check the most common case of a valid url with a scheme-
4282 // We check if the port would be valid by adding the scheme to handle the case host:port-
4283 // where the host would be interpretted as the scheme-
4284 if (url.isValid()
url.isValid()Description
TRUEevaluated 34 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-34
4285 && !url.scheme().isEmpty()
!url.scheme().isEmpty()Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QUrl
16-18
4286 && urlPrepended.port() == -1)
urlPrepended.port() == -1Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
3-15
4287 return adjustFtpPath(url);
executed 15 times by 2 tests: return adjustFtpPath(url);
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
15
4288-
4289 // Else, try the prepended one and adjust the scheme from the host name-
4290 if (urlPrepended.isValid() && (!urlPrepended.host().isEmpty() || !urlPrepended.path().isEmpty()))
urlPrepended.isValid()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
!urlPrepended.host().isEmpty()Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
!urlPrepended.path().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
0-20
4291 {-
4292 int dotIndex = trimmedString.indexOf(QLatin1Char('.'));-
4293 const QString hostscheme = trimmedString.left(dotIndex).toLower();-
4294 if (hostscheme == ftpScheme())
hostscheme == ftpScheme()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QUrl
2-17
4295 urlPrepended.setScheme(ftpScheme());
executed 2 times by 1 test: urlPrepended.setScheme(ftpScheme());
Executed by:
  • tst_QUrl
2
4296 return adjustFtpPath(urlPrepended);
executed 19 times by 1 test: return adjustFtpPath(urlPrepended);
Executed by:
  • tst_QUrl
19
4297 }-
4298-
4299 return QUrl();
executed 1 time by 1 test: return QUrl();
Executed by:
  • tst_QUrl
1
4300}-
4301// end of BSD code-
4302-
4303QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9