qbytearray.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qbytearray.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Copyright (C) 2014 Intel Corporation.-
5** Contact: http://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL21$-
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 http://www.qt.io/terms-conditions. For further-
16** information use the contact form at http://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 2.1 or version 3 as published by the Free-
21** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
22** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
23** following information to ensure the GNU Lesser General Public License-
24** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
25** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
26**-
27** As a special exception, The Qt Company gives you certain additional-
28** rights. These rights are described in The Qt Company LGPL Exception-
29** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
30**-
31** $QT_END_LICENSE$-
32**-
33****************************************************************************/-
34-
35#include "qbytearray.h"-
36#include "qbytearraymatcher.h"-
37#include "qtools_p.h"-
38#include "qstring.h"-
39#include "qlist.h"-
40#include "qlocale.h"-
41#include "qlocale_p.h"-
42#include "qstringalgorithms_p.h"-
43#include "qscopedpointer.h"-
44#include "qbytearray_p.h"-
45#include <qdatastream.h>-
46#include <qmath.h>-
47-
48#ifndef QT_NO_COMPRESS-
49#include <zconf.h>-
50#include <zlib.h>-
51#endif-
52#include <ctype.h>-
53#include <limits.h>-
54#include <string.h>-
55#include <stdlib.h>-
56-
57#define IS_RAW_DATA(d) ((d)->offset != sizeof(QByteArrayData))-
58-
59QT_BEGIN_NAMESPACE-
60-
61// Latin 1 case system, used by QByteArray::to{Upper,Lower}() and qstr(n)icmp():-
62/*-
63#!/usr/bin/perl -l-
64use feature "unicode_strings";-
65for (0..255) {-
66 $up = uc(chr($_));-
67 $up = chr($_) if ord($up) > 0x100 || length $up > 1;-
68 printf "0x%02x,", ord($up);-
69 print "" if ($_ & 0xf) == 0xf;-
70}-
71*/-
72static const uchar latin1_uppercased[256] = {-
73 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,-
74 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,-
75 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,-
76 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,-
77 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,-
78 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,-
79 0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,-
80 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x7b,0x7c,0x7d,0x7e,0x7f,-
81 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,-
82 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,-
83 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,-
84 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,-
85 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,-
86 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,-
87 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,-
88 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xf7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xff-
89};-
90-
91/*-
92#!/usr/bin/perl -l-
93use feature "unicode_strings";-
94for (0..255) {-
95 $up = lc(chr($_));-
96 $up = chr($_) if ord($up) > 0x100 || length $up > 1;-
97 printf "0x%02x,", ord($up);-
98 print "" if ($_ & 0xf) == 0xf;-
99}-
100*/-
101static const uchar latin1_lowercased[256] = {-
102 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,-
103 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,-
104 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,-
105 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,-
106 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,-
107 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x5b,0x5c,0x5d,0x5e,0x5f,-
108 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,-
109 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,-
110 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,-
111 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,-
112 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,-
113 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,-
114 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,-
115 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xd7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xdf,-
116 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,-
117 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff-
118};-
119-
120int qFindByteArray(-
121 const char *haystack0, int haystackLen, int from,-
122 const char *needle0, int needleLen);-
123-
124-
125int qAllocMore(int alloc, int extra) Q_DECL_NOTHROW-
126{-
127 Q_ASSERT(alloc >= 0 && extra >= 0 && extra <= MaxAllocSize);-
128 Q_ASSERT_X(alloc <= MaxAllocSize - extra, "qAllocMore", "Requested size is too large!");-
129-
130 unsigned nalloc = qNextPowerOfTwo(alloc + extra);-
131-
132 Q_ASSERT(nalloc > unsigned(alloc + extra));-
133-
134 return nalloc - extra;
executed 16905179 times by 741 tests: return nalloc - extra;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
16905179
135}-
136-
137/*****************************************************************************-
138 Safe and portable C string functions; extensions to standard string.h-
139 *****************************************************************************/-
140-
141/*! \relates QByteArray-
142-
143 Returns a duplicate string.-
144-
145 Allocates space for a copy of \a src, copies it, and returns a-
146 pointer to the copy. If \a src is 0, it immediately returns 0.-
147-
148 Ownership is passed to the caller, so the returned string must be-
149 deleted using \c delete[].-
150*/-
151-
152char *qstrdup(const char *src)-
153{-
154 if (!src)
!srcDescription
TRUEevaluated 17644 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractProxyModel
  • tst_QDockWidget
  • tst_QGraphicsItem
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QHeaderView
  • tst_QKeyEvent
  • tst_QLibrary
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QPicture
  • tst_QPlainTextEdit
  • tst_QPluginLoader
  • tst_QSizePolicy
  • tst_QStandardItem
  • tst_QStandardItemModel
  • tst_QString
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QToolBar
FALSEevaluated 1132234 times by 535 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
17644-1132234
155 return 0;
executed 17644 times by 23 tests: return 0;
Executed by:
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractProxyModel
  • tst_QDockWidget
  • tst_QGraphicsItem
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QHeaderView
  • tst_QKeyEvent
  • tst_QLibrary
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QPicture
  • tst_QPlainTextEdit
  • tst_QPluginLoader
  • tst_QSizePolicy
  • tst_QStandardItem
  • tst_QStandardItemModel
  • tst_QString
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QToolBar
17644
156 char *dst = new char[strlen(src) + 1];-
157 return qstrcpy(dst, src);
executed 1132234 times by 535 tests: return qstrcpy(dst, src);
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
1132234
158}-
159-
160/*! \relates QByteArray-
161-
162 Copies all the characters up to and including the '\\0' from \a-
163 src into \a dst and returns a pointer to \a dst. If \a src is 0,-
164 it immediately returns 0.-
165-
166 This function assumes that \a dst is large enough to hold the-
167 contents of \a src.-
168-
169 \sa qstrncpy()-
170*/-
171-
172char *qstrcpy(char *dst, const char *src)-
173{-
174 if (!src)
!srcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 1134973 times by 535 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
2-1134973
175 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • tst_QByteArray
2
176#if defined(_MSC_VER) && _MSC_VER >= 1400-
177 const int len = int(strlen(src));-
178 // This is actually not secure!!! It will be fixed-
179 // properly in a later release!-
180 if (len >= 0 && strcpy_s(dst, len+1, src) == 0)-
181 return dst;-
182 return 0;-
183#else-
184 return strcpy(dst, src);
executed 1134973 times by 535 tests: return strcpy(dst, src);
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
1134973
185#endif-
186}-
187-
188/*! \relates QByteArray-
189-
190 A safe \c strncpy() function.-
191-
192 Copies at most \a len bytes from \a src (stopping at \a len or the-
193 terminating '\\0' whichever comes first) into \a dst and returns a-
194 pointer to \a dst. Guarantees that \a dst is '\\0'-terminated. If-
195 \a src or \a dst is 0, returns 0 immediately.-
196-
197 This function assumes that \a dst is at least \a len characters-
198 long.-
199-
200 \note When compiling with Visual C++ compiler version 14.00-
201 (Visual C++ 2005) or later, internally the function strncpy_s-
202 will be used.-
203-
204 \sa qstrcpy()-
205*/-
206-
207char *qstrncpy(char *dst, const char *src, uint len)-
208{-
209 if (!src || !dst)
!srcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 202 times by 4 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_selftests - unknown status
!dstDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 200 times by 4 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_selftests - unknown status
2-202
210 return 0;
executed 4 times by 1 test: return 0;
Executed by:
  • tst_QByteArray
4
211 if (len > 0) {
len > 0Description
TRUEevaluated 199 times by 4 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_selftests - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-199
212#if defined(_MSC_VER) && _MSC_VER >= 1400-
213 strncpy_s(dst, len, src, len - 1);-
214#else-
215 strncpy(dst, src, len);-
216#endif-
217 dst[len-1] = '\0';-
218 }
executed 199 times by 4 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_selftests - unknown status
199
219 return dst;
executed 200 times by 4 tests: return dst;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_selftests - unknown status
200
220}-
221-
222/*! \fn uint qstrlen(const char *str)-
223 \relates QByteArray-
224-
225 A safe \c strlen() function.-
226-
227 Returns the number of characters that precede the terminating '\\0',-
228 or 0 if \a str is 0.-
229-
230 \sa qstrnlen()-
231*/-
232-
233/*! \fn uint qstrnlen(const char *str, uint maxlen)-
234 \relates QByteArray-
235 \since 4.2-
236-
237 A safe \c strnlen() function.-
238-
239 Returns the number of characters that precede the terminating '\\0', but-
240 at most \a maxlen. If \a str is 0, returns 0.-
241-
242 \sa qstrlen()-
243*/-
244-
245/*!-
246 \relates QByteArray-
247-
248 A safe \c strcmp() function.-
249-
250 Compares \a str1 and \a str2. Returns a negative value if \a str1-
251 is less than \a str2, 0 if \a str1 is equal to \a str2 or a-
252 positive value if \a str1 is greater than \a str2.-
253-
254 Special case 1: Returns 0 if \a str1 and \a str2 are both 0.-
255-
256 Special case 2: Returns an arbitrary non-zero value if \a str1 is 0-
257 or \a str2 is 0 (but not both).-
258-
259 \sa qstrncmp(), qstricmp(), qstrnicmp(), {8-bit Character Comparisons}-
260*/-
261int qstrcmp(const char *str1, const char *str2)-
262{-
263 return (str1 && str2) ? strcmp(str1, str2)
executed 496335 times by 196 tests: return (str1 && str2) ? strcmp(str1, str2) : (str1 ? 1 : (str2 ? -1 : 0));
Executed by:
  • tst_Compiler
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAtomicPointer
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QClipboard
  • tst_QColor
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
str1Description
TRUEevaluated 496323 times by 196 tests
Evaluated by:
  • tst_Compiler
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAtomicPointer
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QClipboard
  • tst_QColor
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
FALSEevaluated 12 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QVariant
  • tst_qmessagehandler
str2Description
TRUEevaluated 496323 times by 196 tests
Evaluated by:
  • tst_Compiler
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAtomicPointer
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QClipboard
  • tst_QColor
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
FALSEnever evaluated
0-496335
264 : (str1 ? 1 : (str2 ? -1 : 0));
executed 496335 times by 196 tests: return (str1 && str2) ? strcmp(str1, str2) : (str1 ? 1 : (str2 ? -1 : 0));
Executed by:
  • tst_Compiler
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAtomicPointer
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QClipboard
  • tst_QColor
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
str1Description
TRUEnever evaluated
FALSEevaluated 12 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QVariant
  • tst_qmessagehandler
str2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDBusAbstractAdaptor
FALSEevaluated 10 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QVariant
  • tst_qmessagehandler
0-496335
265}-
266-
267/*! \fn int qstrncmp(const char *str1, const char *str2, uint len);-
268-
269 \relates QByteArray-
270-
271 A safe \c strncmp() function.-
272-
273 Compares at most \a len bytes of \a str1 and \a str2.-
274-
275 Returns a negative value if \a str1 is less than \a str2, 0 if \a-
276 str1 is equal to \a str2 or a positive value if \a str1 is greater-
277 than \a str2.-
278-
279 Special case 1: Returns 0 if \a str1 and \a str2 are both 0.-
280-
281 Special case 2: Returns a random non-zero value if \a str1 is 0-
282 or \a str2 is 0 (but not both).-
283-
284 \sa qstrcmp(), qstricmp(), qstrnicmp(), {8-bit Character Comparisons}-
285*/-
286-
287/*! \relates QByteArray-
288-
289 A safe \c stricmp() function.-
290-
291 Compares \a str1 and \a str2 ignoring the case of the-
292 characters. The encoding of the strings is assumed to be Latin-1.-
293-
294 Returns a negative value if \a str1 is less than \a str2, 0 if \a-
295 str1 is equal to \a str2 or a positive value if \a str1 is greater-
296 than \a str2.-
297-
298 Special case 1: Returns 0 if \a str1 and \a str2 are both 0.-
299-
300 Special case 2: Returns a random non-zero value if \a str1 is 0-
301 or \a str2 is 0 (but not both).-
302-
303 \sa qstrcmp(), qstrncmp(), qstrnicmp(), {8-bit Character Comparisons}-
304*/-
305-
306int qstricmp(const char *str1, const char *str2)-
307{-
308 const uchar *s1 = reinterpret_cast<const uchar *>(str1);-
309 const uchar *s2 = reinterpret_cast<const uchar *>(str2);-
310 int res;-
311 uchar c;-
312 if (!s1 || !s2)
!s1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 230632 times by 47 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • ...
!s2Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 230631 times by 47 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • ...
1-230632
313 return s1 ? 1 : (s2 ? -1 : 0);
executed 3 times by 1 test: return s1 ? 1 : (s2 ? -1 : 0);
Executed by:
  • tst_QByteArray
s1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
s2Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-3
314 for (; !(res = (c = latin1_lowercased[*s1]) - latin1_lowercased[*s2]); s1++, s2++)
!(res = (c = l...wercased[*s2])Description
TRUEevaluated 354989 times by 19 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSettings
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
FALSEevaluated 215220 times by 47 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • ...
215220-354989
315 if (!c) // strings are equal
!cDescription
TRUEevaluated 15411 times by 18 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSettings
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 339578 times by 19 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSettings
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
15411-339578
316 break;
executed 15411 times by 18 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSettings
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QXmlInputSource
  • tst_Spdy
15411
317 return res;
executed 230631 times by 47 tests: return res;
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • ...
230631
318}-
319-
320/*! \relates QByteArray-
321-
322 A safe \c strnicmp() function.-
323-
324 Compares at most \a len bytes of \a str1 and \a str2 ignoring the-
325 case of the characters. The encoding of the strings is assumed to-
326 be Latin-1.-
327-
328 Returns a negative value if \a str1 is less than \a str2, 0 if \a str1-
329 is equal to \a str2 or a positive value if \a str1 is greater than \a-
330 str2.-
331-
332 Special case 1: Returns 0 if \a str1 and \a str2 are both 0.-
333-
334 Special case 2: Returns a random non-zero value if \a str1 is 0-
335 or \a str2 is 0 (but not both).-
336-
337 \sa qstrcmp(), qstrncmp(), qstricmp(), {8-bit Character Comparisons}-
338*/-
339-
340int qstrnicmp(const char *str1, const char *str2, uint len)-
341{-
342 const uchar *s1 = reinterpret_cast<const uchar *>(str1);-
343 const uchar *s2 = reinterpret_cast<const uchar *>(str2);-
344 int res;-
345 uchar c;-
346 if (!s1 || !s2)
!s1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 799 times by 8 tests
Evaluated by:
  • tst_QByteArray
  • tst_QGlobal
  • tst_QSettings
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_selftests - unknown status
!s2Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 798 times by 8 tests
Evaluated by:
  • tst_QByteArray
  • tst_QGlobal
  • tst_QSettings
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_selftests - unknown status
1-799
347 return s1 ? 1 : (s2 ? -1 : 0);
executed 3 times by 1 test: return s1 ? 1 : (s2 ? -1 : 0);
Executed by:
  • tst_QByteArray
s1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
s2Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-3
348 for (; len--; s1++, s2++) {
len--Description
TRUEevaluated 918 times by 8 tests
Evaluated by:
  • tst_QByteArray
  • tst_QGlobal
  • tst_QSettings
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_selftests - unknown status
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QTextCodec
10-918
349 if ((res = (c = latin1_lowercased[*s1]) - latin1_lowercased[*s2]))
(res = (c = la...wercased[*s2])Description
TRUEevaluated 787 times by 7 tests
Evaluated by:
  • tst_QGlobal
  • tst_QSettings
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_selftests - unknown status
FALSEevaluated 131 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QTextCodec
  • tst_QXmlStream
131-787
350 return res;
executed 787 times by 7 tests: return res;
Executed by:
  • tst_QGlobal
  • tst_QSettings
  • tst_QTextCodec
  • tst_QTextStream
  • tst_QXmlSimpleReader
  • tst_QXmlStream
  • tst_selftests - unknown status
787
351 if (!c) // strings are equal
!cDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 130 times by 2 tests
Evaluated by:
  • tst_QTextCodec
  • tst_QXmlStream
1-130
352 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QByteArray
1
353 }
executed 130 times by 2 tests: end of block
Executed by:
  • tst_QTextCodec
  • tst_QXmlStream
130
354 return 0;
executed 11 times by 2 tests: return 0;
Executed by:
  • tst_QByteArray
  • tst_QTextCodec
11
355}-
356-
357/*!-
358 \internal-
359 */-
360int qstrcmp(const QByteArray &str1, const char *str2)-
361{-
362 if (!str2)
!str2Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 1384521 times by 545 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
32-1384521
363 return str1.isEmpty() ? 0 : +1;
executed 32 times by 1 test: return str1.isEmpty() ? 0 : +1;
Executed by:
  • tst_QByteArray
str1.isEmpty()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QByteArray
8-32
364-
365 const char *str1data = str1.constData();-
366 const char *str1end = str1data + str1.length();-
367 for ( ; str1data < str1end && *str2; ++str1data, ++str2) {
str1data < str1endDescription
TRUEevaluated 5265278 times by 545 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
FALSEevaluated 453468 times by 284 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAtomicInteger_Gcc_char
  • tst_QAtomicInteger_Gcc_char16_t
  • tst_QAtomicInteger_Gcc_char32_t
  • tst_QAtomicInteger_Gcc_int
  • tst_QAtomicInteger_Gcc_long
  • tst_QAtomicInteger_Gcc_qlonglong
  • tst_QAtomicInteger_Gcc_qptrdiff
  • tst_QAtomicInteger_Gcc_quintptr
  • tst_QAtomicInteger_Gcc_qulonglong
  • tst_QAtomicInteger_Gcc_schar
  • tst_QAtomicInteger_Gcc_short
  • ...
*str2Description
TRUEevaluated 5264970 times by 545 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
FALSEevaluated 308 times by 31 tests
Evaluated by:
  • tst_QByteArray
  • tst_QByteArrayList
  • tst_QFlags
  • tst_QGraphicsScene
  • tst_QGraphicsWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QLinkedList
  • tst_QList
  • tst_QList_StrictIterators
  • tst_QMap
  • tst_QMap_StrictIterators
  • tst_QMimeDatabase
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QSet
  • tst_QStateMachine
  • tst_QSystemSemaphore
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTreeWidgetItemIterator
  • ...
308-5265278
368 int diff = int(uchar(*str1data)) - uchar(*str2);-
369 if (diff)
diffDescription
TRUEevaluated 930745 times by 544 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
FALSEevaluated 4334225 times by 443 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAtomicInt
  • tst_QAtomicInteger_Gcc_char
  • ...
930745-4334225
370 // found a difference-
371 return diff;
executed 930745 times by 544 tests: return diff;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
930745
372 }
executed 4334225 times by 443 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAtomicInt
  • tst_QAtomicInteger_Gcc_char
  • ...
4334225
373-
374 // Why did we stop?-
375 if (*str2 != '\0')
*str2 != '\0'Description
TRUEevaluated 2367 times by 165 tests
Evaluated by:
  • tst_LargeFile
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
FALSEevaluated 451409 times by 257 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAtomicInteger_Gcc_char
  • tst_QAtomicInteger_Gcc_char16_t
  • tst_QAtomicInteger_Gcc_char32_t
  • tst_QAtomicInteger_Gcc_int
  • tst_QAtomicInteger_Gcc_long
  • tst_QAtomicInteger_Gcc_qlonglong
  • tst_QAtomicInteger_Gcc_qptrdiff
  • tst_QAtomicInteger_Gcc_quintptr
  • tst_QAtomicInteger_Gcc_qulonglong
  • tst_QAtomicInteger_Gcc_schar
  • tst_QAtomicInteger_Gcc_short
  • tst_QAtomicInteger_Gcc_uchar
  • tst_QAtomicInteger_Gcc_uint
  • ...
2367-451409
376 // not the null, so we stopped because str1 is shorter-
377 return -1;
executed 2367 times by 165 tests: return -1;
Executed by:
  • tst_LargeFile
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
2367
378 if (str1data < str1end)
str1data < str1endDescription
TRUEevaluated 308 times by 31 tests
Evaluated by:
  • tst_QByteArray
  • tst_QByteArrayList
  • tst_QFlags
  • tst_QGraphicsScene
  • tst_QGraphicsWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QLinkedList
  • tst_QList
  • tst_QList_StrictIterators
  • tst_QMap
  • tst_QMap_StrictIterators
  • tst_QMimeDatabase
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QSet
  • tst_QStateMachine
  • tst_QSystemSemaphore
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTreeWidgetItemIterator
  • ...
FALSEevaluated 451101 times by 241 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAtomicInteger_Gcc_char
  • tst_QAtomicInteger_Gcc_char16_t
  • tst_QAtomicInteger_Gcc_char32_t
  • tst_QAtomicInteger_Gcc_int
  • tst_QAtomicInteger_Gcc_long
  • tst_QAtomicInteger_Gcc_qlonglong
  • tst_QAtomicInteger_Gcc_qptrdiff
  • tst_QAtomicInteger_Gcc_quintptr
  • tst_QAtomicInteger_Gcc_qulonglong
  • tst_QAtomicInteger_Gcc_schar
  • tst_QAtomicInteger_Gcc_short
  • tst_QAtomicInteger_Gcc_uchar
  • tst_QAtomicInteger_Gcc_uint
  • ...
308-451101
379 // we haven't reached the end, so str1 must be longer-
380 return +1;
executed 308 times by 31 tests: return +1;
Executed by:
  • tst_QByteArray
  • tst_QByteArrayList
  • tst_QFlags
  • tst_QGraphicsScene
  • tst_QGraphicsWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QImage
  • tst_QImageReader
  • tst_QLinkedList
  • tst_QList
  • tst_QList_StrictIterators
  • tst_QMap
  • tst_QMap_StrictIterators
  • tst_QMimeDatabase
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QPainter
  • tst_QSet
  • tst_QStateMachine
  • tst_QSystemSemaphore
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTreeWidgetItemIterator
  • ...
308
381 return 0;
executed 451101 times by 241 tests: return 0;
Executed by:
  • tst_Collections
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAtomicInteger_Gcc_char
  • tst_QAtomicInteger_Gcc_char16_t
  • tst_QAtomicInteger_Gcc_char32_t
  • tst_QAtomicInteger_Gcc_int
  • tst_QAtomicInteger_Gcc_long
  • tst_QAtomicInteger_Gcc_qlonglong
  • tst_QAtomicInteger_Gcc_qptrdiff
  • tst_QAtomicInteger_Gcc_quintptr
  • tst_QAtomicInteger_Gcc_qulonglong
  • tst_QAtomicInteger_Gcc_schar
  • tst_QAtomicInteger_Gcc_short
  • tst_QAtomicInteger_Gcc_uchar
  • tst_QAtomicInteger_Gcc_uint
  • ...
451101
382}-
383-
384/*!-
385 \internal-
386 */-
387int qstrcmp(const QByteArray &str1, const QByteArray &str2)-
388{-
389 int l1 = str1.length();-
390 int l2 = str2.length();-
391 int ret = memcmp(str1.constData(), str2.constData(), qMin(l1, l2));-
392 if (ret != 0)
ret != 0Description
TRUEevaluated 5395567 times by 82 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingCall
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGestureRecognizer
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • ...
FALSEevaluated 42393 times by 66 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QAction
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGestureRecognizer
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMetaObjectBuilder
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • ...
42393-5395567
393 return ret;
executed 5395567 times by 82 tests: return ret;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingCall
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGestureRecognizer
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • ...
5395567
394-
395 // they matched qMin(l1, l2) bytes-
396 // so the longer one is lexically after the shorter one-
397 return l1 - l2;
executed 42393 times by 66 tests: return l1 - l2;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAccessibility
  • tst_QAction
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGestureRecognizer
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QItemView
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMetaObjectBuilder
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • ...
42393
398}-
399-
400// the CRC table below is created by the following piece of code-
401#if 0-
402static void createCRC16Table() // build CRC16 lookup table-
403{-
404 unsigned int i;-
405 unsigned int j;-
406 unsigned short crc_tbl[16];-
407 unsigned int v0, v1, v2, v3;-
408 for (i = 0; i < 16; i++) {-
409 v0 = i & 1;-
410 v1 = (i >> 1) & 1;-
411 v2 = (i >> 2) & 1;-
412 v3 = (i >> 3) & 1;-
413 j = 0;-
414#undef SET_BIT-
415#define SET_BIT(x, b, v) (x) |= (v) << (b)-
416 SET_BIT(j, 0, v0);-
417 SET_BIT(j, 7, v0);-
418 SET_BIT(j, 12, v0);-
419 SET_BIT(j, 1, v1);-
420 SET_BIT(j, 8, v1);-
421 SET_BIT(j, 13, v1);-
422 SET_BIT(j, 2, v2);-
423 SET_BIT(j, 9, v2);-
424 SET_BIT(j, 14, v2);-
425 SET_BIT(j, 3, v3);-
426 SET_BIT(j, 10, v3);-
427 SET_BIT(j, 15, v3);-
428 crc_tbl[i] = j;-
429 }-
430 printf("static const quint16 crc_tbl[16] = {\n");-
431 for (int i = 0; i < 16; i +=4)-
432 printf(" 0x%04x, 0x%04x, 0x%04x, 0x%04x,\n", crc_tbl[i], crc_tbl[i+1], crc_tbl[i+2], crc_tbl[i+3]);-
433 printf("};\n");-
434}-
435#endif-
436-
437static const quint16 crc_tbl[16] = {-
438 0x0000, 0x1081, 0x2102, 0x3183,-
439 0x4204, 0x5285, 0x6306, 0x7387,-
440 0x8408, 0x9489, 0xa50a, 0xb58b,-
441 0xc60c, 0xd68d, 0xe70e, 0xf78f-
442};-
443-
444/*!-
445 \relates QByteArray-
446-
447 Returns the CRC-16 checksum of the first \a len bytes of \a data.-
448-
449 The checksum is independent of the byte order (endianness).-
450-
451 \note This function is a 16-bit cache conserving (16 entry table)-
452 implementation of the CRC-16-CCITT algorithm.-
453*/-
454-
455quint16 qChecksum(const char *data, uint len)-
456{-
457 quint16 crc = 0xffff;-
458 uchar c;-
459 const uchar *p = reinterpret_cast<const uchar *>(data);-
460 while (len--) {
len--Description
TRUEevaluated 9971 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QPicture
  • tst_QPrinter
FALSEevaluated 45 times by 3 tests
Evaluated by:
  • tst_QDataStream
  • tst_QPicture
  • tst_QPrinter
45-9971
461 c = *p++;-
462 crc = ((crc >> 4) & 0x0fff) ^ crc_tbl[((crc ^ c) & 15)];-
463 c >>= 4;-
464 crc = ((crc >> 4) & 0x0fff) ^ crc_tbl[((crc ^ c) & 15)];-
465 }
executed 9971 times by 3 tests: end of block
Executed by:
  • tst_QDataStream
  • tst_QPicture
  • tst_QPrinter
9971
466 return ~crc & 0xffff;
executed 45 times by 3 tests: return ~crc & 0xffff;
Executed by:
  • tst_QDataStream
  • tst_QPicture
  • tst_QPrinter
45
467}-
468-
469/*!-
470 \fn QByteArray qCompress(const QByteArray& data, int compressionLevel)-
471-
472 \relates QByteArray-
473-
474 Compresses the \a data byte array and returns the compressed data-
475 in a new byte array.-
476-
477 The \a compressionLevel parameter specifies how much compression-
478 should be used. Valid values are between 0 and 9, with 9-
479 corresponding to the greatest compression (i.e. smaller compressed-
480 data) at the cost of using a slower algorithm. Smaller values (8,-
481 7, ..., 1) provide successively less compression at slightly-
482 faster speeds. The value 0 corresponds to no compression at all.-
483 The default value is -1, which specifies zlib's default-
484 compression.-
485-
486 \sa qUncompress()-
487*/-
488-
489/*! \relates QByteArray-
490-
491 \overload-
492-
493 Compresses the first \a nbytes of \a data at compression level-
494 \a compressionLevel and returns the compressed data in a new byte array.-
495*/-
496-
497#ifndef QT_NO_COMPRESS-
498QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel)-
499{-
500 if (nbytes == 0) {
nbytes == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
1-21
501 return QByteArray(4, '\0');
executed 1 time by 1 test: return QByteArray(4, '\0');
Executed by:
  • tst_QByteArray
1
502 }-
503 if (!data) {
!dataDescription
TRUEnever evaluated
FALSEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
0-21
504 qWarning("qCompress: Data is null");-
505 return QByteArray();
never executed: return QByteArray();
0
506 }-
507 if (compressionLevel < -1 || compressionLevel > 9)
compressionLevel < -1Description
TRUEnever evaluated
FALSEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
compressionLevel > 9Description
TRUEnever evaluated
FALSEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
0-21
508 compressionLevel = -1;
never executed: compressionLevel = -1;
0
509-
510 ulong len = nbytes + nbytes / 100 + 13;-
511 QByteArray bazip;-
512 int res;-
513 do {-
514 bazip.resize(len + 4);-
515 res = ::compress2((uchar*)bazip.data()+4, &len, data, nbytes, compressionLevel);-
516-
517 switch (res) {-
518 case Z_OK:
executed 21 times by 4 tests: case 0:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
21
519 bazip.resize(len + 4);-
520 bazip[0] = (nbytes & 0xff000000) >> 24;-
521 bazip[1] = (nbytes & 0x00ff0000) >> 16;-
522 bazip[2] = (nbytes & 0x0000ff00) >> 8;-
523 bazip[3] = (nbytes & 0x000000ff);-
524 break;
executed 21 times by 4 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
21
525 case Z_MEM_ERROR:
never executed: case (-4):
0
526 qWarning("qCompress: Z_MEM_ERROR: Not enough memory");-
527 bazip.resize(0);-
528 break;
never executed: break;
0
529 case Z_BUF_ERROR:
never executed: case (-5):
0
530 len *= 2;-
531 break;
never executed: break;
0
532 }-
533 } while (res == Z_BUF_ERROR);
executed 21 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
res == (-5)Description
TRUEnever evaluated
FALSEevaluated 21 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
0-21
534-
535 return bazip;
executed 21 times by 4 tests: return bazip;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
  • tst_QSettings
21
536}-
537#endif-
538-
539/*!-
540 \fn QByteArray qUncompress(const QByteArray &data)-
541-
542 \relates QByteArray-
543-
544 Uncompresses the \a data byte array and returns a new byte array-
545 with the uncompressed data.-
546-
547 Returns an empty QByteArray if the input data was corrupt.-
548-
549 This function will uncompress data compressed with qCompress()-
550 from this and any earlier Qt version, back to Qt 3.1 when this-
551 feature was added.-
552-
553 \b{Note:} If you want to use this function to uncompress external-
554 data that was compressed using zlib, you first need to prepend a four-
555 byte header to the byte array containing the data. The header must-
556 contain the expected length (in bytes) of the uncompressed data,-
557 expressed as an unsigned, big-endian, 32-bit integer.-
558-
559 \sa qCompress()-
560*/-
561-
562/*! \relates QByteArray-
563-
564 \overload-
565-
566 Uncompresses the first \a nbytes of \a data and returns a new byte-
567 array with the uncompressed data.-
568*/-
569-
570#ifndef QT_NO_COMPRESS-
571QByteArray qUncompress(const uchar* data, int nbytes)-
572{-
573 if (!data) {
!dataDescription
TRUEnever evaluated
FALSEevaluated 704 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QIcon
  • tst_QImageReader
  • tst_QKeySequence
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QResourceEngine
  • tst_Selftests
  • tst_rcc
0-704
574 qWarning("qUncompress: Data is null");-
575 return QByteArray();
never executed: return QByteArray();
0
576 }-
577 if (nbytes <= 4) {
nbytes <= 4Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 691 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QIcon
  • tst_QImageReader
  • tst_QKeySequence
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QResourceEngine
  • tst_Selftests
  • tst_rcc
13-691
578 if (nbytes < 4 || (data[0]!=0 || data[1]!=0 || data[2]!=0 || data[3]!=0))
nbytes < 4Description
TRUEnever evaluated
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QByteArray
data[0]!=0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
data[1]!=0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
data[2]!=0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
data[3]!=0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
0-13
579 qWarning("qUncompress: Input data is corrupted");
executed 11 times by 1 test: QMessageLogger(__FILE__, 579, __PRETTY_FUNCTION__).warning("qUncompress: Input data is corrupted");
Executed by:
  • tst_QByteArray
11
580 return QByteArray();
executed 13 times by 1 test: return QByteArray();
Executed by:
  • tst_QByteArray
13
581 }-
582 ulong expectedSize = uint((data[0] << 24) | (data[1] << 16) |-
583 (data[2] << 8) | (data[3] ));-
584 ulong len = qMax(expectedSize, 1ul);-
585 QScopedPointer<QByteArray::Data, QScopedPointerPodDeleter> d;-
586-
587 forever {-
588 ulong alloc = len;-
589 if (len >= (1u << 31u) - sizeof(QByteArray::Data)) {
len >= (1u << ...teArray::Data)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 684 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QIcon
  • tst_QImageReader
  • tst_QKeySequence
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QResourceEngine
  • tst_Selftests
  • tst_rcc
7-684
590 //QByteArray does not support that huge size anyway.-
591 qWarning("qUncompress: Input data is corrupted");-
592 return QByteArray();
executed 7 times by 1 test: return QByteArray();
Executed by:
  • tst_QByteArray
7
593 }-
594 QByteArray::Data *p = static_cast<QByteArray::Data *>(::realloc(d.data(), sizeof(QByteArray::Data) + alloc + 1));-
595 if (!p) {
!pDescription
TRUEnever evaluated
FALSEevaluated 684 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QIcon
  • tst_QImageReader
  • tst_QKeySequence
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QResourceEngine
  • tst_Selftests
  • tst_rcc
0-684
596 // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS-
597 qWarning("qUncompress: could not allocate enough memory to uncompress data");-
598 return QByteArray();
never executed: return QByteArray();
0
599 }-
600 d.take(); // realloc was successful-
601 d.reset(p);-
602 d->offset = sizeof(QByteArrayData);-
603 d->size = 0; // Shut up valgrind "uninitialized variable" warning-
604-
605 int res = ::uncompress((uchar*)d->data(), &len,-
606 data+4, nbytes-4);-
607-
608 switch (res) {-
609 case Z_OK:
executed 679 times by 12 tests: case 0:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QIcon
  • tst_QImageReader
  • tst_QKeySequence
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QResourceEngine
  • tst_Selftests
  • tst_rcc
679
610 if (len != alloc) {
len != allocDescription
TRUEnever evaluated
FALSEevaluated 679 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QIcon
  • tst_QImageReader
  • tst_QKeySequence
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QResourceEngine
  • tst_Selftests
  • tst_rcc
0-679
611 if (len >= (1u << 31u) - sizeof(QByteArray::Data)) {
len >= (1u << ...teArray::Data)Description
TRUEnever evaluated
FALSEnever evaluated
0
612 //QByteArray does not support that huge size anyway.-
613 qWarning("qUncompress: Input data is corrupted");-
614 return QByteArray();
never executed: return QByteArray();
0
615 }-
616 QByteArray::Data *p = static_cast<QByteArray::Data *>(::realloc(d.data(), sizeof(QByteArray::Data) + len + 1));-
617 if (!p) {
!pDescription
TRUEnever evaluated
FALSEnever evaluated
0
618 // we are not allowed to crash here when compiling with QT_NO_EXCEPTIONS-
619 qWarning("qUncompress: could not allocate enough memory to uncompress data");-
620 return QByteArray();
never executed: return QByteArray();
0
621 }-
622 d.take(); // realloc was successful-
623 d.reset(p);-
624 }
never executed: end of block
0
625 d->ref.initializeOwned();-
626 d->size = len;-
627 d->alloc = uint(len) + 1u;-
628 d->capacityReserved = false;-
629 d->offset = sizeof(QByteArrayData);-
630 d->data()[len] = 0;-
631-
632 {-
633 QByteArrayDataPtr dataPtr = { d.take() };-
634 return QByteArray(dataPtr);
executed 679 times by 12 tests: return QByteArray(dataPtr);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QIcon
  • tst_QImageReader
  • tst_QKeySequence
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QResourceEngine
  • tst_Selftests
  • tst_rcc
679
635 }-
636-
637 case Z_MEM_ERROR:
never executed: case (-4):
0
638 qWarning("qUncompress: Z_MEM_ERROR: Not enough memory");-
639 return QByteArray();
never executed: return QByteArray();
0
640-
641 case Z_BUF_ERROR:
never executed: case (-5):
0
642 len *= 2;-
643 continue;
never executed: continue;
0
644-
645 case Z_DATA_ERROR:
executed 5 times by 1 test: case (-3):
Executed by:
  • tst_QByteArray
5
646 qWarning("qUncompress: Z_DATA_ERROR: Input data is corrupted");-
647 return QByteArray();
executed 5 times by 1 test: return QByteArray();
Executed by:
  • tst_QByteArray
5
648 }-
649 }
never executed: end of block
0
650}
never executed: end of block
0
651#endif-
652-
653static inline bool qIsUpper(char c)-
654{-
655 return c >= 'A' && c <= 'Z';
executed 217 times by 3 tests: return c >= 'A' && c <= 'Z';
Executed by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
c >= 'A'Description
TRUEevaluated 217 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
FALSEnever evaluated
c <= 'Z'Description
TRUEnever evaluated
FALSEevaluated 217 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
0-217
656}-
657-
658static inline char qToLower(char c)-
659{-
660 if (c >= 'A' && c <= 'Z')
c >= 'A'Description
TRUEevaluated 217 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
FALSEnever evaluated
c <= 'Z'Description
TRUEnever evaluated
FALSEevaluated 217 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
0-217
661 return c - 'A' + 'a';
never executed: return c - 'A' + 'a';
0
662 else-
663 return c;
executed 217 times by 3 tests: return c;
Executed by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
217
664}-
665-
666/*!-
667 \class QByteArray-
668 \inmodule QtCore-
669 \brief The QByteArray class provides an array of bytes.-
670-
671 \ingroup tools-
672 \ingroup shared-
673 \ingroup string-processing-
674-
675 \reentrant-
676-
677 QByteArray can be used to store both raw bytes (including '\\0's)-
678 and traditional 8-bit '\\0'-terminated strings. Using QByteArray-
679 is much more convenient than using \c{const char *}. Behind the-
680 scenes, it always ensures that the data is followed by a '\\0'-
681 terminator, and uses \l{implicit sharing} (copy-on-write) to-
682 reduce memory usage and avoid needless copying of data.-
683-
684 In addition to QByteArray, Qt also provides the QString class to-
685 store string data. For most purposes, QString is the class you-
686 want to use. It stores 16-bit Unicode characters, making it easy-
687 to store non-ASCII/non-Latin-1 characters in your application.-
688 Furthermore, QString is used throughout in the Qt API. The two-
689 main cases where QByteArray is appropriate are when you need to-
690 store raw binary data, and when memory conservation is critical-
691 (e.g., with Qt for Embedded Linux).-
692-
693 One way to initialize a QByteArray is simply to pass a \c{const-
694 char *} to its constructor. For example, the following code-
695 creates a byte array of size 5 containing the data "Hello":-
696-
697 \snippet code/src_corelib_tools_qbytearray.cpp 0-
698-
699 Although the size() is 5, the byte array also maintains an extra-
700 '\\0' character at the end so that if a function is used that-
701 asks for a pointer to the underlying data (e.g. a call to-
702 data()), the data pointed to is guaranteed to be-
703 '\\0'-terminated.-
704-
705 QByteArray makes a deep copy of the \c{const char *} data, so you-
706 can modify it later without experiencing side effects. (If for-
707 performance reasons you don't want to take a deep copy of the-
708 character data, use QByteArray::fromRawData() instead.)-
709-
710 Another approach is to set the size of the array using resize()-
711 and to initialize the data byte per byte. QByteArray uses 0-based-
712 indexes, just like C++ arrays. To access the byte at a particular-
713 index position, you can use operator[](). On non-const byte-
714 arrays, operator[]() returns a reference to a byte that can be-
715 used on the left side of an assignment. For example:-
716-
717 \snippet code/src_corelib_tools_qbytearray.cpp 1-
718-
719 For read-only access, an alternative syntax is to use at():-
720-
721 \snippet code/src_corelib_tools_qbytearray.cpp 2-
722-
723 at() can be faster than operator[](), because it never causes a-
724 \l{deep copy} to occur.-
725-
726 To extract many bytes at a time, use left(), right(), or mid().-
727-
728 A QByteArray can embed '\\0' bytes. The size() function always-
729 returns the size of the whole array, including embedded '\\0'-
730 bytes, but excluding the terminating '\\0' added by QByteArray.-
731 For example:-
732-
733 \snippet code/src_corelib_tools_qbytearray.cpp 48-
734-
735 If you want to obtain the length of the data up to and-
736 excluding the first '\\0' character, call qstrlen() on the byte-
737 array.-
738-
739 After a call to resize(), newly allocated bytes have undefined-
740 values. To set all the bytes to a particular value, call fill().-
741-
742 To obtain a pointer to the actual character data, call data() or-
743 constData(). These functions return a pointer to the beginning of the data.-
744 The pointer is guaranteed to remain valid until a non-const function is-
745 called on the QByteArray. It is also guaranteed that the data ends with a-
746 '\\0' byte unless the QByteArray was created from a \l{fromRawData()}{raw-
747 data}. This '\\0' byte is automatically provided by QByteArray and is not-
748 counted in size().-
749-
750 QByteArray provides the following basic functions for modifying-
751 the byte data: append(), prepend(), insert(), replace(), and-
752 remove(). For example:-
753-
754 \snippet code/src_corelib_tools_qbytearray.cpp 3-
755-
756 The replace() and remove() functions' first two arguments are the-
757 position from which to start erasing and the number of bytes that-
758 should be erased.-
759-
760 When you append() data to a non-empty array, the array will be-
761 reallocated and the new data copied to it. You can avoid this-
762 behavior by calling reserve(), which preallocates a certain amount-
763 of memory. You can also call capacity() to find out how much-
764 memory QByteArray actually allocated. Data appended to an empty-
765 array is not copied.-
766-
767 A frequent requirement is to remove whitespace characters from a-
768 byte array ('\\n', '\\t', ' ', etc.). If you want to remove-
769 whitespace from both ends of a QByteArray, use trimmed(). If you-
770 want to remove whitespace from both ends and replace multiple-
771 consecutive whitespaces with a single space character within the-
772 byte array, use simplified().-
773-
774 If you want to find all occurrences of a particular character or-
775 substring in a QByteArray, use indexOf() or lastIndexOf(). The-
776 former searches forward starting from a given index position, the-
777 latter searches backward. Both return the index position of the-
778 character or substring if they find it; otherwise, they return -1.-
779 For example, here's a typical loop that finds all occurrences of a-
780 particular substring:-
781-
782 \snippet code/src_corelib_tools_qbytearray.cpp 4-
783-
784 If you simply want to check whether a QByteArray contains a-
785 particular character or substring, use contains(). If you want to-
786 find out how many times a particular character or substring-
787 occurs in the byte array, use count(). If you want to replace all-
788 occurrences of a particular value with another, use one of the-
789 two-parameter replace() overloads.-
790-
791 \l{QByteArray}s can be compared using overloaded operators such as-
792 operator<(), operator<=(), operator==(), operator>=(), and so on.-
793 The comparison is based exclusively on the numeric values-
794 of the characters and is very fast, but is not what a human would-
795 expect. QString::localeAwareCompare() is a better choice for-
796 sorting user-interface strings.-
797-
798 For historical reasons, QByteArray distinguishes between a null-
799 byte array and an empty byte array. A \e null byte array is a-
800 byte array that is initialized using QByteArray's default-
801 constructor or by passing (const char *)0 to the constructor. An-
802 \e empty byte array is any byte array with size 0. A null byte-
803 array is always empty, but an empty byte array isn't necessarily-
804 null:-
805-
806 \snippet code/src_corelib_tools_qbytearray.cpp 5-
807-
808 All functions except isNull() treat null byte arrays the same as-
809 empty byte arrays. For example, data() returns a pointer to a-
810 '\\0' character for a null byte array (\e not a null pointer),-
811 and QByteArray() compares equal to QByteArray(""). We recommend-
812 that you always use isEmpty() and avoid isNull().-
813-
814 \section1 Notes on Locale-
815-
816 \section2 Number-String Conversions-
817-
818 Functions that perform conversions between numeric data types and-
819 strings are performed in the C locale, irrespective of the user's-
820 locale settings. Use QString to perform locale-aware conversions-
821 between numbers and strings.-
822-
823 \section2 8-bit Character Comparisons-
824-
825 In QByteArray, the notion of uppercase and lowercase and of which-
826 character is greater than or less than another character is-
827 locale dependent. This affects functions that support a case-
828 insensitive option or that compare or lowercase or uppercase-
829 their arguments. Case insensitive operations and comparisons will-
830 be accurate if both strings contain only ASCII characters. (If \c-
831 $LC_CTYPE is set, most Unix systems do "the right thing".)-
832 Functions that this affects include contains(), indexOf(),-
833 lastIndexOf(), operator<(), operator<=(), operator>(),-
834 operator>=(), toLower() and toUpper().-
835-
836 This issue does not apply to \l{QString}s since they represent-
837 characters using Unicode.-
838-
839 \sa QString, QBitArray-
840*/-
841-
842/*!-
843 \enum QByteArray::Base64Option-
844 \since 5.2-
845-
846 This enum contains the options available for encoding and decoding Base64.-
847 Base64 is defined by \l{RFC 4648}, with the following options:-
848-
849 \value Base64Encoding (default) The regular Base64 alphabet, called simply "base64"-
850 \value Base64UrlEncoding An alternate alphabet, called "base64url", which replaces two-
851 characters in the alphabet to be more friendly to URLs.-
852 \value KeepTrailingEquals (default) Keeps the trailing padding equal signs at the end-
853 of the encoded data, so the data is always a size multiple of-
854 four.-
855 \value OmitTrailingEquals Omits adding the padding equal signs at the end of the encoded-
856 data.-
857-
858 QByteArray::fromBase64() ignores the KeepTrailingEquals and-
859 OmitTrailingEquals options and will not flag errors in case they are-
860 missing or if there are too many of them.-
861*/-
862-
863/*! \fn QByteArray::iterator QByteArray::begin()-
864-
865 Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first character in-
866 the byte-array.-
867-
868 \sa constBegin(), end()-
869*/-
870-
871/*! \fn QByteArray::const_iterator QByteArray::begin() const-
872-
873 \overload begin()-
874*/-
875-
876/*! \fn QByteArray::const_iterator QByteArray::cbegin() const-
877 \since 5.0-
878-
879 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character-
880 in the byte-array.-
881-
882 \sa begin(), cend()-
883*/-
884-
885/*! \fn QByteArray::const_iterator QByteArray::constBegin() const-
886-
887 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character-
888 in the byte-array.-
889-
890 \sa begin(), constEnd()-
891*/-
892-
893/*! \fn QByteArray::iterator QByteArray::end()-
894-
895 Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary character-
896 after the last character in the byte-array.-
897-
898 \sa begin(), constEnd()-
899*/-
900-
901/*! \fn QByteArray::const_iterator QByteArray::end() const-
902-
903 \overload end()-
904*/-
905-
906/*! \fn QByteArray::const_iterator QByteArray::cend() const-
907 \since 5.0-
908-
909 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary-
910 character after the last character in the list.-
911-
912 \sa cbegin(), end()-
913*/-
914-
915/*! \fn QByteArray::const_iterator QByteArray::constEnd() const-
916-
917 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary-
918 character after the last character in the list.-
919-
920 \sa constBegin(), end()-
921*/-
922-
923/*! \fn QByteArray::reverse_iterator QByteArray::rbegin()-
924 \since 5.6-
925-
926 Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first-
927 character in the byte-array, in reverse order.-
928-
929 \sa begin(), crbegin(), rend()-
930*/-
931-
932/*! \fn QByteArray::const_reverse_iterator QByteArray::rbegin() const-
933 \since 5.6-
934 \overload-
935*/-
936-
937/*! \fn QByteArray::const_reverse_iterator QByteArray::crbegin() const-
938 \since 5.6-
939-
940 Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first-
941 character in the byte-array, in reverse order.-
942-
943 \sa begin(), rbegin(), rend()-
944*/-
945-
946/*! \fn QByteArray::reverse_iterator QByteArray::rend()-
947 \since 5.6-
948-
949 Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past-
950 the last character in the byte-array, in reverse order.-
951-
952 \sa end(), crend(), rbegin()-
953*/-
954-
955/*! \fn QByteArray::const_reverse_iterator QByteArray::rend() const-
956 \since 5.6-
957 \overload-
958*/-
959-
960/*! \fn QByteArray::const_reverse_iterator QByteArray::crend() const-
961 \since 5.6-
962-
963 Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one-
964 past the last character in the byte-array, in reverse order.-
965-
966 \sa end(), rend(), rbegin()-
967*/-
968-
969/*! \fn void QByteArray::push_back(const QByteArray &other)-
970-
971 This function is provided for STL compatibility. It is equivalent-
972 to append(\a other).-
973*/-
974-
975/*! \fn void QByteArray::push_back(const char *str)-
976-
977 \overload-
978-
979 Same as append(\a str).-
980*/-
981-
982/*! \fn void QByteArray::push_back(char ch)-
983-
984 \overload-
985-
986 Same as append(\a ch).-
987*/-
988-
989/*! \fn void QByteArray::push_front(const QByteArray &other)-
990-
991 This function is provided for STL compatibility. It is equivalent-
992 to prepend(\a other).-
993*/-
994-
995/*! \fn void QByteArray::push_front(const char *str)-
996-
997 \overload-
998-
999 Same as prepend(\a str).-
1000*/-
1001-
1002/*! \fn void QByteArray::push_front(char ch)-
1003-
1004 \overload-
1005-
1006 Same as prepend(\a ch).-
1007*/-
1008-
1009/*! \fn QByteArray::QByteArray(const QByteArray &other)-
1010-
1011 Constructs a copy of \a other.-
1012-
1013 This operation takes \l{constant time}, because QByteArray is-
1014 \l{implicitly shared}. This makes returning a QByteArray from a-
1015 function very fast. If a shared instance is modified, it will be-
1016 copied (copy-on-write), taking \l{linear time}.-
1017-
1018 \sa operator=()-
1019*/-
1020-
1021/*!-
1022 \fn QByteArray::QByteArray(QByteArray &&other)-
1023-
1024 Move-constructs a QByteArray instance, making it point at the same-
1025 object that \a other was pointing to.-
1026-
1027 \since 5.2-
1028*/-
1029-
1030/*! \fn QByteArray::QByteArray(QByteArrayDataPtr dd)-
1031-
1032 \internal-
1033-
1034 Constructs a byte array pointing to the same data as \a dd.-
1035*/-
1036-
1037/*! \fn QByteArray::~QByteArray()-
1038 Destroys the byte array.-
1039*/-
1040-
1041/*!-
1042 Assigns \a other to this byte array and returns a reference to-
1043 this byte array.-
1044*/-
1045QByteArray &QByteArray::operator=(const QByteArray & other) Q_DECL_NOTHROW-
1046{-
1047 other.d->ref.ref();-
1048 if (!d->ref.deref())
!d->ref.deref()Description
TRUEevaluated 118255 times by 76 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsScene
  • tst_QGraphicsWidget
  • ...
FALSEevaluated 1082925 times by 418 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • ...
118255-1082925
1049 Data::deallocate(d);
executed 118255 times by 76 tests: Data::deallocate(d);
Executed by:
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsScene
  • tst_QGraphicsWidget
  • ...
118255
1050 d = other.d;-
1051 return *this;
executed 1201180 times by 420 tests: return *this;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • ...
1201180
1052}-
1053-
1054-
1055/*!-
1056 \overload-
1057-
1058 Assigns \a str to this byte array.-
1059*/-
1060-
1061QByteArray &QByteArray::operator=(const char *str)-
1062{-
1063 Data *x;-
1064 if (!str) {
!strDescription
TRUEevaluated 424 times by 2 tests
Evaluated by:
  • tst_QPicture
  • tst_QTimeZone
FALSEevaluated 397458 times by 196 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
424-397458
1065 x = Data::sharedNull();-
1066 } else if (!*str) {
executed 424 times by 2 tests: end of block
Executed by:
  • tst_QPicture
  • tst_QTimeZone
!*strDescription
TRUEevaluated 47294 times by 8 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDBusMarshall
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QNetworkReply
  • tst_QRawFont
  • tst_Spdy
FALSEevaluated 350164 times by 195 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
424-350164
1067 x = Data::allocate(0);-
1068 } else {
executed 47294 times by 8 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QDBusMarshall
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QNetworkReply
  • tst_QRawFont
  • tst_Spdy
47294
1069 const int len = int(strlen(str));-
1070 const uint fullLen = len + 1;-
1071 if (d->ref.isShared() || fullLen > d->alloc
d->ref.isShared()Description
TRUEevaluated 269116 times by 188 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • ...
FALSEevaluated 81048 times by 41 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QDataStream
  • tst_QDebug
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QMetaObjectBuilder
  • tst_QNetworkReply
  • tst_QPrinter
  • ...
fullLen > d->allocDescription
TRUEevaluated 26593 times by 37 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QDataStream
  • tst_QDebug
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QImage
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QMetaObjectBuilder
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QProcess
  • tst_QRegion
  • tst_QSaveFile
  • tst_QSettings
  • ...
FALSEevaluated 54455 times by 38 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QDataStream
  • tst_QDebug
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QRegion
  • ...
26593-269116
1072 || (len < d->size && fullLen < uint(d->alloc >> 1)))
len < d->sizeDescription
TRUEevaluated 7626 times by 35 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QDataStream
  • tst_QDebug
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QImage
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QRegion
  • tst_QSizeGrip
  • tst_QStringBuilder3
  • ...
FALSEevaluated 46829 times by 35 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QDataStream
  • tst_QDebug
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QRegion
  • tst_QSettings
  • ...
fullLen < uint(d->alloc >> 1)Description
TRUEevaluated 7618 times by 34 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QImage
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QRegion
  • tst_QSizeGrip
  • tst_QStringBuilder3
  • tst_QStringBuilder4
  • ...
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QDebug
  • tst_QImage
8-46829
1073 reallocData(fullLen, d->detachFlags());
executed 303327 times by 195 tests: reallocData(fullLen, d->detachFlags());
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
303327
1074 x = d;-
1075 memcpy(x->data(), str, fullLen); // include null terminator-
1076 x->size = len;-
1077 }
executed 350164 times by 195 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
350164
1078 x->ref.ref();-
1079 if (!d->ref.deref())
!d->ref.deref()Description
TRUEevaluated 46017 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPicture
FALSEevaluated 351865 times by 196 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
46017-351865
1080 Data::deallocate(d);
executed 46017 times by 5 tests: Data::deallocate(d);
Executed by:
  • tst_QByteArray
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QPicture
46017
1081 d = x;-
1082 return *this;
executed 397882 times by 196 tests: return *this;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
397882
1083}-
1084-
1085/*!-
1086 \fn QByteArray &QByteArray::operator=(QByteArray &&other)-
1087-
1088 Move-assigns \a other to this QByteArray instance.-
1089-
1090 \since 5.2-
1091*/-
1092-
1093/*! \fn void QByteArray::swap(QByteArray &other)-
1094 \since 4.8-
1095-
1096 Swaps byte array \a other with this byte array. This operation is very-
1097 fast and never fails.-
1098*/-
1099-
1100/*! \fn int QByteArray::size() const-
1101-
1102 Returns the number of bytes in this byte array.-
1103-
1104 The last byte in the byte array is at position size() - 1. In addition,-
1105 QByteArray ensures that the byte at position size() is always '\\0', so-
1106 that you can use the return value of data() and constData() as arguments to-
1107 functions that expect '\\0'-terminated strings. If the QByteArray object-
1108 was created from a \l{fromRawData()}{raw data} that didn't include the-
1109 trailing null-termination character then QByteArray doesn't add it-
1110 automaticall unless the \l{deep copy} is created.-
1111-
1112 Example:-
1113 \snippet code/src_corelib_tools_qbytearray.cpp 6-
1114-
1115 \sa isEmpty(), resize()-
1116*/-
1117-
1118/*! \fn bool QByteArray::isEmpty() const-
1119-
1120 Returns \c true if the byte array has size 0; otherwise returns \c false.-
1121-
1122 Example:-
1123 \snippet code/src_corelib_tools_qbytearray.cpp 7-
1124-
1125 \sa size()-
1126*/-
1127-
1128/*! \fn int QByteArray::capacity() const-
1129-
1130 Returns the maximum number of bytes that can be stored in the-
1131 byte array without forcing a reallocation.-
1132-
1133 The sole purpose of this function is to provide a means of fine-
1134 tuning QByteArray's memory usage. In general, you will rarely-
1135 ever need to call this function. If you want to know how many-
1136 bytes are in the byte array, call size().-
1137-
1138 \sa reserve(), squeeze()-
1139*/-
1140-
1141/*! \fn void QByteArray::reserve(int size)-
1142-
1143 Attempts to allocate memory for at least \a size bytes. If you-
1144 know in advance how large the byte array will be, you can call-
1145 this function, and if you call resize() often you are likely to-
1146 get better performance. If \a size is an underestimate, the worst-
1147 that will happen is that the QByteArray will be a bit slower.-
1148-
1149 The sole purpose of this function is to provide a means of fine-
1150 tuning QByteArray's memory usage. In general, you will rarely-
1151 ever need to call this function. If you want to change the size-
1152 of the byte array, call resize().-
1153-
1154 \sa squeeze(), capacity()-
1155*/-
1156-
1157/*! \fn void QByteArray::squeeze()-
1158-
1159 Releases any memory not required to store the array's data.-
1160-
1161 The sole purpose of this function is to provide a means of fine-
1162 tuning QByteArray's memory usage. In general, you will rarely-
1163 ever need to call this function.-
1164-
1165 \sa reserve(), capacity()-
1166*/-
1167-
1168/*! \fn QByteArray::operator const char *() const-
1169 \fn QByteArray::operator const void *() const-
1170-
1171 \obsolete Use constData() instead.-
1172-
1173 Returns a pointer to the data stored in the byte array. The-
1174 pointer can be used to access the bytes that compose the array.-
1175 The data is '\\0'-terminated. The pointer remains valid as long-
1176 as the array isn't reallocated or destroyed.-
1177-
1178 This operator is mostly useful to pass a byte array to a function-
1179 that accepts a \c{const char *}.-
1180-
1181 You can disable this operator by defining \c-
1182 QT_NO_CAST_FROM_BYTEARRAY when you compile your applications.-
1183-
1184 Note: A QByteArray can store any byte values including '\\0's,-
1185 but most functions that take \c{char *} arguments assume that the-
1186 data ends at the first '\\0' they encounter.-
1187-
1188 \sa constData()-
1189*/-
1190-
1191/*!-
1192 \macro QT_NO_CAST_FROM_BYTEARRAY-
1193 \relates QByteArray-
1194-
1195 Disables automatic conversions from QByteArray to-
1196 const char * or const void *.-
1197-
1198 \sa QT_NO_CAST_TO_ASCII, QT_NO_CAST_FROM_ASCII-
1199*/-
1200-
1201/*! \fn char *QByteArray::data()-
1202-
1203 Returns a pointer to the data stored in the byte array. The-
1204 pointer can be used to access and modify the bytes that compose-
1205 the array. The data is '\\0'-terminated, i.e. the number of-
1206 bytes in the returned character string is size() + 1 for the-
1207 '\\0' terminator.-
1208-
1209 Example:-
1210 \snippet code/src_corelib_tools_qbytearray.cpp 8-
1211-
1212 The pointer remains valid as long as the byte array isn't-
1213 reallocated or destroyed. For read-only access, constData() is-
1214 faster because it never causes a \l{deep copy} to occur.-
1215-
1216 This function is mostly useful to pass a byte array to a function-
1217 that accepts a \c{const char *}.-
1218-
1219 The following example makes a copy of the char* returned by-
1220 data(), but it will corrupt the heap and cause a crash because it-
1221 does not allocate a byte for the '\\0' at the end:-
1222-
1223 \snippet code/src_corelib_tools_qbytearray.cpp 46-
1224-
1225 This one allocates the correct amount of space:-
1226-
1227 \snippet code/src_corelib_tools_qbytearray.cpp 47-
1228-
1229 Note: A QByteArray can store any byte values including '\\0's,-
1230 but most functions that take \c{char *} arguments assume that the-
1231 data ends at the first '\\0' they encounter.-
1232-
1233 \sa constData(), operator[]()-
1234*/-
1235-
1236/*! \fn const char *QByteArray::data() const-
1237-
1238 \overload-
1239*/-
1240-
1241/*! \fn const char *QByteArray::constData() const-
1242-
1243 Returns a pointer to the data stored in the byte array. The pointer can be-
1244 used to access the bytes that compose the array. The data is-
1245 '\\0'-terminated unless the QByteArray object was created from raw data.-
1246 The pointer remains valid as long as the byte array isn't reallocated or-
1247 destroyed.-
1248-
1249 This function is mostly useful to pass a byte array to a function-
1250 that accepts a \c{const char *}.-
1251-
1252 Note: A QByteArray can store any byte values including '\\0's,-
1253 but most functions that take \c{char *} arguments assume that the-
1254 data ends at the first '\\0' they encounter.-
1255-
1256 \sa data(), operator[](), fromRawData()-
1257*/-
1258-
1259/*! \fn void QByteArray::detach()-
1260-
1261 \internal-
1262*/-
1263-
1264/*! \fn bool QByteArray::isDetached() const-
1265-
1266 \internal-
1267*/-
1268-
1269/*! \fn bool QByteArray::isSharedWith(const QByteArray &other) const-
1270-
1271 \internal-
1272*/-
1273-
1274/*! \fn char QByteArray::at(int i) const-
1275-
1276 Returns the character at index position \a i in the byte array.-
1277-
1278 \a i must be a valid index position in the byte array (i.e., 0 <=-
1279 \a i < size()).-
1280-
1281 \sa operator[]()-
1282*/-
1283-
1284/*! \fn QByteRef QByteArray::operator[](int i)-
1285-
1286 Returns the byte at index position \a i as a modifiable reference.-
1287-
1288 If an assignment is made beyond the end of the byte array, the-
1289 array is extended with resize() before the assignment takes-
1290 place.-
1291-
1292 Example:-
1293 \snippet code/src_corelib_tools_qbytearray.cpp 9-
1294-
1295 The return value is of type QByteRef, a helper class for-
1296 QByteArray. When you get an object of type QByteRef, you can use-
1297 it as if it were a char &. If you assign to it, the assignment-
1298 will apply to the character in the QByteArray from which you got-
1299 the reference.-
1300-
1301 \sa at()-
1302*/-
1303-
1304/*! \fn char QByteArray::operator[](int i) const-
1305-
1306 \overload-
1307-
1308 Same as at(\a i).-
1309*/-
1310-
1311/*! \fn QByteRef QByteArray::operator[](uint i)-
1312-
1313 \overload-
1314*/-
1315-
1316/*! \fn char QByteArray::operator[](uint i) const-
1317-
1318 \overload-
1319*/-
1320-
1321/*! \fn bool QByteArray::contains(const QByteArray &ba) const-
1322-
1323 Returns \c true if the byte array contains an occurrence of the byte-
1324 array \a ba; otherwise returns \c false.-
1325-
1326 \sa indexOf(), count()-
1327*/-
1328-
1329/*! \fn bool QByteArray::contains(const char *str) const-
1330-
1331 \overload-
1332-
1333 Returns \c true if the byte array contains the string \a str;-
1334 otherwise returns \c false.-
1335*/-
1336-
1337/*! \fn bool QByteArray::contains(char ch) const-
1338-
1339 \overload-
1340-
1341 Returns \c true if the byte array contains the character \a ch;-
1342 otherwise returns \c false.-
1343*/-
1344-
1345/*!-
1346-
1347 Truncates the byte array at index position \a pos.-
1348-
1349 If \a pos is beyond the end of the array, nothing happens.-
1350-
1351 Example:-
1352 \snippet code/src_corelib_tools_qbytearray.cpp 10-
1353-
1354 \sa chop(), resize(), left()-
1355*/-
1356void QByteArray::truncate(int pos)-
1357{-
1358 if (pos < d->size)
pos < d->sizeDescription
TRUEevaluated 153886 times by 258 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCheckBox
  • tst_QColorDialog
  • ...
FALSEevaluated 3948 times by 27 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusMarshall
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QMimeDatabase
  • tst_QNetworkCookie
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QUrl
  • tst_QUrlInternal
  • tst_Spdy
  • tst_Utf8
  • ...
3948-153886
1359 resize(pos);
executed 153886 times by 258 tests: resize(pos);
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCheckBox
  • tst_QColorDialog
  • ...
153886
1360}
executed 157834 times by 259 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCheckBox
  • tst_QColorDialog
  • ...
157834
1361-
1362/*!-
1363-
1364 Removes \a n bytes from the end of the byte array.-
1365-
1366 If \a n is greater than size(), the result is an empty byte-
1367 array.-
1368-
1369 Example:-
1370 \snippet code/src_corelib_tools_qbytearray.cpp 11-
1371-
1372 \sa truncate(), resize(), left()-
1373*/-
1374-
1375void QByteArray::chop(int n)-
1376{-
1377 if (n > 0)
n > 0Description
TRUEevaluated 5229 times by 16 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QDebug
  • tst_QHttpNetworkConnection
  • tst_QLockFile
  • tst_QMetaObject
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QVariant
  • tst_Spdy
  • tst_qmessagehandler
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-5229
1378 resize(d->size - n);
executed 5229 times by 16 tests: resize(d->size - n);
Executed by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QDebug
  • tst_QHttpNetworkConnection
  • tst_QLockFile
  • tst_QMetaObject
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QVariant
  • tst_Spdy
  • tst_qmessagehandler
5229
1379}
executed 5230 times by 16 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QDebug
  • tst_QHttpNetworkConnection
  • tst_QLockFile
  • tst_QMetaObject
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QProcess
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QVariant
  • tst_Spdy
  • tst_qmessagehandler
5230
1380-
1381-
1382/*! \fn QByteArray &QByteArray::operator+=(const QByteArray &ba)-
1383-
1384 Appends the byte array \a ba onto the end of this byte array and-
1385 returns a reference to this byte array.-
1386-
1387 Example:-
1388 \snippet code/src_corelib_tools_qbytearray.cpp 12-
1389-
1390 Note: QByteArray is an \l{implicitly shared} class. Consequently,-
1391 if \e this is an empty QByteArray, then \e this will just share-
1392 the data held in \a ba. In this case, no copying of data is done,-
1393 taking \l{constant time}. If a shared instance is modified, it will-
1394 be copied (copy-on-write), taking \l{linear time}.-
1395-
1396 If \e this is not an empty QByteArray, a deep copy of the data is-
1397 performed, taking \l{linear time}.-
1398-
1399 This operation typically does not suffer from allocation overhead,-
1400 because QByteArray preallocates extra space at the end of the data-
1401 so that it may grow without reallocating for each append operation.-
1402-
1403 \sa append(), prepend()-
1404*/-
1405-
1406/*! \fn QByteArray &QByteArray::operator+=(const QString &str)-
1407-
1408 \overload-
1409-
1410 Appends the string \a str onto the end of this byte array and-
1411 returns a reference to this byte array. The Unicode data is-
1412 converted into 8-bit characters using QString::toUtf8().-
1413-
1414 You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you-
1415 compile your applications. You then need to call QString::toUtf8() (or-
1416 QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to-
1417 convert the data to \c{const char *}.-
1418*/-
1419-
1420/*! \fn QByteArray &QByteArray::operator+=(const char *str)-
1421-
1422 \overload-
1423-
1424 Appends the string \a str onto the end of this byte array and-
1425 returns a reference to this byte array.-
1426*/-
1427-
1428/*! \fn QByteArray &QByteArray::operator+=(char ch)-
1429-
1430 \overload-
1431-
1432 Appends the character \a ch onto the end of this byte array and-
1433 returns a reference to this byte array.-
1434*/-
1435-
1436/*! \fn int QByteArray::length() const-
1437-
1438 Same as size().-
1439*/-
1440-
1441/*! \fn bool QByteArray::isNull() const-
1442-
1443 Returns \c true if this byte array is null; otherwise returns \c false.-
1444-
1445 Example:-
1446 \snippet code/src_corelib_tools_qbytearray.cpp 13-
1447-
1448 Qt makes a distinction between null byte arrays and empty byte-
1449 arrays for historical reasons. For most applications, what-
1450 matters is whether or not a byte array contains any data,-
1451 and this can be determined using isEmpty().-
1452-
1453 \sa isEmpty()-
1454*/-
1455-
1456/*! \fn QByteArray::QByteArray()-
1457-
1458 Constructs an empty byte array.-
1459-
1460 \sa isEmpty()-
1461*/-
1462-
1463/*!-
1464 Constructs a byte array containing the first \a size bytes of-
1465 array \a data.-
1466-
1467 If \a data is 0, a null byte array is constructed.-
1468-
1469 If \a size is negative, \a data is assumed to point to a nul-terminated-
1470 string and its length is determined dynamically. The terminating-
1471 nul-character is not considered part of the byte array.-
1472-
1473 QByteArray makes a deep copy of the string data.-
1474-
1475 \sa fromRawData()-
1476*/-
1477-
1478QByteArray::QByteArray(const char *data, int size)-
1479{-
1480 if (!data) {
!dataDescription
TRUEevaluated 437565 times by 366 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • ...
FALSEevaluated 7673525 times by 425 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
437565-7673525
1481 d = Data::sharedNull();-
1482 } else {
executed 437565 times by 366 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • ...
437565
1483 if (size < 0)
size < 0Description
TRUEevaluated 5048596 times by 397 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • ...
FALSEevaluated 2624543 times by 346 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
2624543-5048596
1484 size = int(strlen(data));
executed 5048596 times by 397 tests: size = int(strlen(data));
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • ...
5048596
1485 if (!size) {
!sizeDescription
TRUEevaluated 2642687 times by 58 tests
Evaluated by:
  • tst_Collections
  • tst_QAccessibility
  • tst_QApplication
  • tst_QByteArray
  • tst_QByteArrayList
  • tst_QChar
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGetPutEnv
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QHashFunctions
  • tst_QImageReader
  • tst_QItemView
  • ...
FALSEevaluated 5031125 times by 422 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
2642687-5031125
1486 d = Data::allocate(0);-
1487 } else {
executed 2642687 times by 58 tests: end of block
Executed by:
  • tst_Collections
  • tst_QAccessibility
  • tst_QApplication
  • tst_QByteArray
  • tst_QByteArrayList
  • tst_QChar
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGetPutEnv
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QHashFunctions
  • tst_QImageReader
  • tst_QItemView
  • ...
2642687
1488 d = Data::allocate(uint(size) + 1u);-
1489 Q_CHECK_PTR(d);
never executed: qBadAlloc();
!(d)Description
TRUEnever evaluated
FALSEevaluated 5031125 times by 422 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
0-5031125
1490 d->size = size;-
1491 memcpy(d->data(), data, size);-
1492 d->data()[size] = '\0';-
1493 }
executed 5031125 times by 422 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
5031125
1494 }-
1495}-
1496-
1497/*!-
1498 Constructs a byte array of size \a size with every byte set to-
1499 character \a ch.-
1500-
1501 \sa fill()-
1502*/-
1503-
1504QByteArray::QByteArray(int size, char ch)-
1505{-
1506 if (size <= 0) {
size <= 0Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QUdpSocket
FALSEevaluated 19381 times by 65 tests
Evaluated by:
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QDataStream
  • tst_QDir
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • ...
5-19381
1507 d = Data::allocate(0);-
1508 } else {
executed 5 times by 2 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QUdpSocket
5
1509 d = Data::allocate(uint(size) + 1u);-
1510 Q_CHECK_PTR(d);
never executed: qBadAlloc();
!(d)Description
TRUEnever evaluated
FALSEevaluated 19381 times by 65 tests
Evaluated by:
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QDataStream
  • tst_QDir
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • ...
0-19381
1511 d->size = size;-
1512 memset(d->data(), ch, size);-
1513 d->data()[size] = '\0';-
1514 }
executed 19381 times by 65 tests: end of block
Executed by:
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QDataStream
  • tst_QDir
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileSystemModel
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • ...
19381
1515}-
1516-
1517/*!-
1518 \internal-
1519-
1520 Constructs a byte array of size \a size with uninitialized contents.-
1521*/-
1522-
1523QByteArray::QByteArray(int size, Qt::Initialization)-
1524{-
1525 d = Data::allocate(uint(size) + 1u);-
1526 Q_CHECK_PTR(d);
never executed: qBadAlloc();
!(d)Description
TRUEnever evaluated
FALSEevaluated 1053964 times by 569 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
0-1053964
1527 d->size = size;-
1528 d->data()[size] = '\0';-
1529}
executed 1053964 times by 569 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
1053964
1530-
1531/*!-
1532 Sets the size of the byte array to \a size bytes.-
1533-
1534 If \a size is greater than the current size, the byte array is-
1535 extended to make it \a size bytes with the extra bytes added to-
1536 the end. The new bytes are uninitialized.-
1537-
1538 If \a size is less than the current size, bytes are removed from-
1539 the end.-
1540-
1541 \sa size(), truncate()-
1542*/-
1543void QByteArray::resize(int size)-
1544{-
1545 if (size < 0)
size < 0Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QLockFile
FALSEevaluated 1917130 times by 440 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
9-1917130
1546 size = 0;
executed 9 times by 2 tests: size = 0;
Executed by:
  • tst_QByteArray
  • tst_QLockFile
9
1547-
1548 if (IS_RAW_DATA(d) && !d->ref.isShared() && size < d->size) {
((d)->offset !...yteArrayData))Description
TRUEevaluated 21 times by 7 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingReply
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
FALSEevaluated 1917118 times by 440 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
!d->ref.isShared()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 20 times by 7 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingReply
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
size < d->sizeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEnever evaluated
0-1917118
1549 d->size = size;-
1550 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QByteArray
1
1551 }-
1552-
1553 if (size == 0 && !d->capacityReserved) {
size == 0Description
TRUEevaluated 52798 times by 185 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
FALSEevaluated 1864340 times by 439 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
!d->capacityReservedDescription
TRUEevaluated 52790 times by 185 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QSslSocket
8-1864340
1554 Data *x = Data::allocate(0);-
1555 if (!d->ref.deref())
!d->ref.deref()Description
TRUEevaluated 15520 times by 174 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • ...
FALSEevaluated 37270 times by 32 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QBitArray
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDebug
  • tst_QFile
  • tst_QFtp
  • tst_QGuiVariant
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QLCDNumber
  • tst_QLockFile
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QPicture
  • tst_QPrinter
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QString
  • tst_QTcpSocket
  • tst_QTextBoundaryFinder
  • ...
15520-37270
1556 Data::deallocate(d);
executed 15520 times by 174 tests: Data::deallocate(d);
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • ...
15520
1557 d = x;-
1558 } else if (d->size == 0 && d->ref.isStatic()) {
executed 52790 times by 185 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
d->size == 0Description
TRUEevaluated 204142 times by 257 tests
Evaluated by:
  • tst_Lancelot
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • ...
FALSEevaluated 1660206 times by 439 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
d->ref.isStatic()Description
TRUEevaluated 203227 times by 257 tests
Evaluated by:
  • tst_Lancelot
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • ...
FALSEevaluated 915 times by 15 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QBitArray
  • tst_QByteArray
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_Spdy
915-1660206
1559 //-
1560 // Optimize the idiom:-
1561 // QByteArray a;-
1562 // a.resize(sz);-
1563 // ...-
1564 // which is used in place of the Qt 3 idiom:-
1565 // QByteArray a(sz);-
1566 //-
1567 Data *x = Data::allocate(uint(size) + 1u);-
1568 Q_CHECK_PTR(x);
never executed: qBadAlloc();
!(x)Description
TRUEnever evaluated
FALSEevaluated 203227 times by 257 tests
Evaluated by:
  • tst_Lancelot
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • ...
0-203227
1569 x->size = size;-
1570 x->data()[size] = '\0';-
1571 d = x;-
1572 } else {
executed 203227 times by 257 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • ...
203227
1573 if (d->ref.isShared() || uint(size) + 1u > d->alloc
d->ref.isShared()Description
TRUEevaluated 158 times by 16 tests
Evaluated by:
  • tst_Collections
  • tst_QBitArray
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingReply
  • tst_QMessageAuthenticationCode
  • tst_QPlainTextEdit
  • tst_QRingBuffer
  • tst_QString
  • tst_QTextEdit
  • tst_QUrl
  • tst_QUrlInternal
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
FALSEevaluated 1660963 times by 438 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
uint(size) + 1u > d->allocDescription
TRUEevaluated 167988 times by 109 tests
Evaluated by:
  • tst_Collections
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QCssParser
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDebug
  • tst_QDockWidget
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFont
  • tst_QFtp
  • ...
FALSEevaluated 1492975 times by 435 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
158-1660963
1574 || (!d->capacityReserved && size < d->size
!d->capacityReservedDescription
TRUEevaluated 1452250 times by 435 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
FALSEevaluated 40725 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QRingBuffer
  • tst_QSettings
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStringBuilder1
  • tst_QStringBuilder2
  • tst_QStringBuilder3
  • tst_QStringBuilder4
  • tst_QStyleSheetStyle
  • tst_QTcpServer
  • tst_QTcpSocket
  • ...
size < d->sizeDescription
TRUEevaluated 1166984 times by 426 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • ...
FALSEevaluated 285266 times by 168 tests
Evaluated by:
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDataStream
  • ...
40725-1452250
1575 && uint(size) + 1u < uint(d->alloc >> 1)))
uint(size) + 1...d->alloc >> 1)Description
TRUEevaluated 805544 times by 418 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • ...
FALSEevaluated 361440 times by 164 tests
Evaluated by:
  • tst_Collections
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QChar
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusMarshall
  • tst_QDBusPendingCall
  • ...
361440-805544
1576 reallocData(uint(size) + 1u, d->detachFlags() | Data::Grow);
executed 973690 times by 430 tests: reallocData(uint(size) + 1u, d->detachFlags() | Data::Grow);
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • ...
973690
1577 if (d->alloc) {
d->allocDescription
TRUEevaluated 1661121 times by 439 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
FALSEnever evaluated
0-1661121
1578 d->size = size;-
1579 d->data()[size] = '\0';-
1580 }
executed 1661121 times by 439 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
1661121
1581 }
executed 1661121 times by 439 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
1661121
1582}-
1583-
1584/*!-
1585 Sets every byte in the byte array to character \a ch. If \a size-
1586 is different from -1 (the default), the byte array is resized to-
1587 size \a size beforehand.-
1588-
1589 Example:-
1590 \snippet code/src_corelib_tools_qbytearray.cpp 14-
1591-
1592 \sa resize()-
1593*/-
1594-
1595QByteArray &QByteArray::fill(char ch, int size)-
1596{-
1597 resize(size < 0 ? d->size : size);-
1598 if (d->size)
d->sizeDescription
TRUEevaluated 3411 times by 8 tests
Evaluated by:
  • tst_QBuffer
  • tst_QByteArray
  • tst_QDataStream
  • tst_QFtp
  • tst_QMimeDatabase
  • tst_QRawFont
  • tst_QSslSocket
  • tst_QTextCodec
FALSEnever evaluated
0-3411
1599 memset(d->data(), ch, d->size);
executed 3411 times by 8 tests: memset(d->data(), ch, d->size);
Executed by:
  • tst_QBuffer
  • tst_QByteArray
  • tst_QDataStream
  • tst_QFtp
  • tst_QMimeDatabase
  • tst_QRawFont
  • tst_QSslSocket
  • tst_QTextCodec
3411
1600 return *this;
executed 3411 times by 8 tests: return *this;
Executed by:
  • tst_QBuffer
  • tst_QByteArray
  • tst_QDataStream
  • tst_QFtp
  • tst_QMimeDatabase
  • tst_QRawFont
  • tst_QSslSocket
  • tst_QTextCodec
3411
1601}-
1602-
1603void QByteArray::reallocData(uint alloc, Data::AllocationOptions options)-
1604{-
1605 if (d->ref.isShared() || IS_RAW_DATA(d)) {
d->ref.isShared()Description
TRUEevaluated 1503034 times by 572 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEevaluated 1564631 times by 438 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
((d)->offset !...yteArrayData))Description
TRUEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QStringBuilder3
  • tst_QStringBuilder4
FALSEevaluated 1564626 times by 438 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
5-1564631
1606 Data *x = Data::allocate(alloc, options);-
1607 Q_CHECK_PTR(x);
never executed: qBadAlloc();
!(x)Description
TRUEnever evaluated
FALSEevaluated 1503039 times by 572 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-1503039
1608 x->size = qMin(int(alloc) - 1, d->size);-
1609 ::memcpy(x->data(), d->data(), x->size);-
1610 x->data()[x->size] = '\0';-
1611 if (!d->ref.deref())
!d->ref.deref()Description
TRUEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QStringBuilder3
  • tst_QStringBuilder4
FALSEevaluated 1503034 times by 572 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
5-1503034
1612 Data::deallocate(d);
executed 5 times by 3 tests: Data::deallocate(d);
Executed by:
  • tst_QByteArray
  • tst_QStringBuilder3
  • tst_QStringBuilder4
5
1613 d = x;-
1614 } else {
executed 1503039 times by 572 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1503039
1615 if (options & Data::Grow) {
options & Data::GrowDescription
TRUEevaluated 1526283 times by 437 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
FALSEevaluated 38343 times by 53 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QDataStream
  • tst_QDebug
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • ...
38343-1526283
1616 if (alloc > MaxByteArraySize)
alloc > MaxByteArraySizeDescription
TRUEnever evaluated
FALSEevaluated 1526283 times by 437 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
0-1526283
1617 qBadAlloc();
never executed: qBadAlloc();
0
1618 alloc = qAllocMore(alloc, sizeof(Data));-
1619 }
executed 1526283 times by 437 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
1526283
1620 Data *x = static_cast<Data *>(::realloc(d, sizeof(Data) + alloc));-
1621 Q_CHECK_PTR(x);
never executed: qBadAlloc();
!(x)Description
TRUEnever evaluated
FALSEevaluated 1564626 times by 438 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
0-1564626
1622 x->alloc = alloc;-
1623 x->capacityReserved = (options & Data::CapacityReserved) ? 1 : 0;
(options & Dat...acityReserved)Description
TRUEevaluated 11404 times by 54 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusMarshall
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QItemSelectionModel
  • tst_QMetaObject
  • tst_QMetaType
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • ...
FALSEevaluated 1553222 times by 438 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
11404-1553222
1624 d = x;-
1625 }
executed 1564626 times by 438 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • ...
1564626
1626}-
1627-
1628void QByteArray::expand(int i)-
1629{-
1630 resize(qMax(i + 1, d->size));-
1631}
executed 2113 times by 10 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_Spdy
2113
1632-
1633/*!-
1634 \internal-
1635 Return a QByteArray that is sure to be NUL-terminated.-
1636-
1637 By default, all QByteArray have an extra NUL at the end,-
1638 guaranteeing that assumption. However, if QByteArray::fromRawData-
1639 is used, then the NUL is there only if the user put it there. We-
1640 can't be sure.-
1641*/-
1642QByteArray QByteArray::nulTerminated() const-
1643{-
1644 // is this fromRawData?-
1645 if (!IS_RAW_DATA(d))
!((d)->offset ...yteArrayData))Description
TRUEevaluated 206644 times by 72 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFtp
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QLockFile
  • ...
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QByteArray
6-206644
1646 return *this; // no, then we're sure we're zero terminated
executed 206644 times by 72 tests: return *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFtp
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QLockFile
  • ...
206644
1647-
1648 QByteArray copy(*this);-
1649 copy.detach();-
1650 return copy;
executed 6 times by 1 test: return copy;
Executed by:
  • tst_QByteArray
6
1651}-
1652-
1653/*!-
1654 Prepends the byte array \a ba to this byte array and returns a-
1655 reference to this byte array.-
1656-
1657 Example:-
1658 \snippet code/src_corelib_tools_qbytearray.cpp 15-
1659-
1660 This is the same as insert(0, \a ba).-
1661-
1662 Note: QByteArray is an \l{implicitly shared} class. Consequently,-
1663 if \e this is an empty QByteArray, then \e this will just share-
1664 the data held in \a ba. In this case, no copying of data is done,-
1665 taking \l{constant time}. If a shared instance is modified, it will-
1666 be copied (copy-on-write), taking \l{linear time}.-
1667-
1668 If \e this is not an empty QByteArray, a deep copy of the data is-
1669 performed, taking \l{linear time}.-
1670-
1671 \sa append(), insert()-
1672*/-
1673-
1674QByteArray &QByteArray::prepend(const QByteArray &ba)-
1675{-
1676 if (d->size == 0 && d->ref.isStatic() && !IS_RAW_DATA(ba.d)) {
d->size == 0Description
TRUEevaluated 17348 times by 7 tests
Evaluated by:
  • tst_QByteArray
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QRingBuffer
  • tst_QSizePolicy
  • tst_QWidget
FALSEevaluated 1252 times by 17 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QFtp
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QRingBuffer
  • tst_QSizePolicy
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_Spdy
d->ref.isStatic()Description
TRUEevaluated 17348 times by 7 tests
Evaluated by:
  • tst_QByteArray
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QRingBuffer
  • tst_QSizePolicy
  • tst_QWidget
FALSEnever evaluated
!((ba.d)->offs...yteArrayData))Description
TRUEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QNetworkReply
  • tst_QRingBuffer
FALSEevaluated 17333 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QSizePolicy
  • tst_QWidget
0-17348
1677 *this = ba;-
1678 } else if (ba.d->size != 0) {
executed 15 times by 3 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QNetworkReply
  • tst_QRingBuffer
ba.d->size != 0Description
TRUEevaluated 17877 times by 12 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QRingBuffer
  • tst_QSizePolicy
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QWidget
FALSEevaluated 708 times by 9 tests
Evaluated by:
  • tst_QByteArray
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_Spdy
15-17877
1679 QByteArray tmp = *this;-
1680 *this = ba;-
1681 append(tmp);-
1682 }
executed 17877 times by 12 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QRingBuffer
  • tst_QSizePolicy
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QWidget
17877
1683 return *this;
executed 18600 times by 18 tests: return *this;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QFtp
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QRingBuffer
  • tst_QSizePolicy
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QWidget
  • tst_Spdy
18600
1684}-
1685-
1686/*!-
1687 \overload-
1688-
1689 Prepends the string \a str to this byte array.-
1690*/-
1691-
1692QByteArray &QByteArray::prepend(const char *str)-
1693{-
1694 return prepend(str, qstrlen(str));
executed 318 times by 7 tests: return prepend(str, qstrlen(str));
Executed by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
  • tst_Selftests
  • tst_Utf8
318
1695}-
1696-
1697/*!-
1698 \overload-
1699 \since 4.6-
1700-
1701 Prepends \a len bytes of the string \a str to this byte array.-
1702*/-
1703-
1704QByteArray &QByteArray::prepend(const char *str, int len)-
1705{-
1706 if (str) {
strDescription
TRUEevaluated 318 times by 7 tests
Evaluated by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
  • tst_Selftests
  • tst_Utf8
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QByteArray
9-318
1707 if (d->ref.isShared() || uint(d->size + len) + 1u > d->alloc)
d->ref.isShared()Description
TRUEevaluated 215 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_Selftests
  • tst_Utf8
FALSEevaluated 103 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
uint(d->size +... 1u > d->allocDescription
TRUEevaluated 34 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
FALSEevaluated 69 times by 3 tests
Evaluated by:
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
34-215
1708 reallocData(uint(d->size + len) + 1u, d->detachFlags() | Data::Grow);
executed 249 times by 7 tests: reallocData(uint(d->size + len) + 1u, d->detachFlags() | Data::Grow);
Executed by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
  • tst_Selftests
  • tst_Utf8
249
1709 memmove(d->data()+len, d->data(), d->size);-
1710 memcpy(d->data(), str, len);-
1711 d->size += len;-
1712 d->data()[d->size] = '\0';-
1713 }
executed 318 times by 7 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
  • tst_Selftests
  • tst_Utf8
318
1714 return *this;
executed 327 times by 7 tests: return *this;
Executed by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QObject
  • tst_Selftests
  • tst_Utf8
327
1715}-
1716-
1717/*!-
1718 \overload-
1719-
1720 Prepends the character \a ch to this byte array.-
1721*/-
1722-
1723QByteArray &QByteArray::prepend(char ch)-
1724{-
1725 if (d->ref.isShared() || uint(d->size) + 2u > d->alloc)
d->ref.isShared()Description
TRUEevaluated 32 times by 6 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QSettings
  • tst_QSizePolicy
FALSEevaluated 638 times by 11 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaEnum
  • tst_QNetworkReply
  • tst_QSettings
  • tst_languageChange
uint(d->size) + 2u > d->allocDescription
TRUEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSettings
FALSEevaluated 575 times by 11 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaEnum
  • tst_QNetworkReply
  • tst_QSettings
  • tst_languageChange
32-638
1726 reallocData(uint(d->size) + 2u, d->detachFlags() | Data::Grow);
executed 95 times by 8 tests: reallocData(uint(d->size) + 2u, d->detachFlags() | Data::Grow);
Executed by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QSizePolicy
95
1727 memmove(d->data()+1, d->data(), d->size);-
1728 d->data()[0] = ch;-
1729 ++d->size;-
1730 d->data()[d->size] = '\0';-
1731 return *this;
executed 670 times by 13 tests: return *this;
Executed by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaEnum
  • tst_QMetaObject
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QSizePolicy
  • tst_languageChange
670
1732}-
1733-
1734/*!-
1735 Appends the byte array \a ba onto the end of this byte array.-
1736-
1737 Example:-
1738 \snippet code/src_corelib_tools_qbytearray.cpp 16-
1739-
1740 This is the same as insert(size(), \a ba).-
1741-
1742 Note: QByteArray is an \l{implicitly shared} class. Consequently,-
1743 if \e this is an empty QByteArray, then \e this will just share-
1744 the data held in \a ba. In this case, no copying of data is done,-
1745 taking \l{constant time}. If a shared instance is modified, it will-
1746 be copied (copy-on-write), taking \l{linear time}.-
1747-
1748 If \e this is not an empty QByteArray, a deep copy of the data is-
1749 performed, taking \l{linear time}.-
1750-
1751 This operation typically does not suffer from allocation overhead,-
1752 because QByteArray preallocates extra space at the end of the data-
1753 so that it may grow without reallocating for each append operation.-
1754-
1755 \sa operator+=(), prepend(), insert()-
1756*/-
1757-
1758QByteArray &QByteArray::append(const QByteArray &ba)-
1759{-
1760 if (d->size == 0 && d->ref.isStatic() && !IS_RAW_DATA(ba.d)) {
d->size == 0Description
TRUEevaluated 257012 times by 545 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEevaluated 840231 times by 358 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • ...
d->ref.isStatic()Description
TRUEevaluated 212551 times by 328 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBuffer
  • ...
FALSEevaluated 44461 times by 537 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
!((ba.d)->offs...yteArrayData))Description
TRUEevaluated 212495 times by 328 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBuffer
  • ...
FALSEevaluated 56 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QSslCertificate
56-840231
1761 *this = ba;-
1762 } else if (ba.d->size != 0) {
executed 212495 times by 328 tests: end of block
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBuffer
  • ...
ba.d->size != 0Description
TRUEevaluated 846609 times by 571 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEevaluated 38139 times by 162 tests
Evaluated by:
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractSlider
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
38139-846609
1763 if (d->ref.isShared() || uint(d->size + ba.d->size) + 1u > d->alloc)
d->ref.isShared()Description
TRUEevaluated 104358 times by 188 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDir
  • ...
FALSEevaluated 742251 times by 546 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
uint(d->size +... 1u > d->allocDescription
TRUEevaluated 425156 times by 149 tests
Evaluated by:
  • tst_Collections
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCssParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • ...
FALSEevaluated 317095 times by 546 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
104358-742251
1764 reallocData(uint(d->size + ba.d->size) + 1u, d->detachFlags() | Data::Grow);
executed 529514 times by 248 tests: reallocData(uint(d->size + ba.d->size) + 1u, d->detachFlags() | Data::Grow);
Executed by:
  • tst_Collections
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
529514
1765 memcpy(d->data() + d->size, ba.d->data(), ba.d->size);-
1766 d->size += ba.d->size;-
1767 d->data()[d->size] = '\0';-
1768 }
executed 846609 times by 571 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
846609
1769 return *this;
executed 1097243 times by 572 tests: return *this;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1097243
1770}-
1771-
1772/*! \fn QByteArray &QByteArray::append(const QString &str)-
1773-
1774 \overload-
1775-
1776 Appends the string \a str to this byte array. The Unicode data is-
1777 converted into 8-bit characters using QString::toUtf8().-
1778-
1779 You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you-
1780 compile your applications. You then need to call QString::toUtf8() (or-
1781 QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to-
1782 convert the data to \c{const char *}.-
1783*/-
1784-
1785/*!-
1786 \overload-
1787-
1788 Appends the string \a str to this byte array.-
1789*/-
1790-
1791QByteArray& QByteArray::append(const char *str)-
1792{-
1793 if (str) {
strDescription
TRUEevaluated 214177 times by 182 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractSlider
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • ...
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrlInternal
17-214177
1794 const int len = int(strlen(str));-
1795 if (d->ref.isShared() || uint(d->size + len) + 1u > d->alloc)
d->ref.isShared()Description
TRUEevaluated 96083 times by 49 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QApplication
  • tst_QByteArray
  • tst_QComboBox
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusLocalCalls
  • tst_QDBusMetaType
  • tst_QDataStream
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • tst_QGraphicsView
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMdiArea
  • tst_QMetaObject
  • tst_QMimeDatabase
  • ...
FALSEevaluated 118094 times by 166 tests
Evaluated by:
  • tst_Gestures
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractSlider
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • ...
uint(d->size +... 1u > d->allocDescription
TRUEevaluated 21565 times by 78 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • ...
FALSEevaluated 96529 times by 159 tests
Evaluated by:
  • tst_Gestures
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractSlider
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • ...
21565-118094
1796 reallocData(uint(d->size + len) + 1u, d->detachFlags() | Data::Grow);
executed 117648 times by 100 tests: reallocData(uint(d->size + len) + 1u, d->detachFlags() | Data::Grow);
Executed by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusMarshall
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDataStream
  • ...
117648
1797 memcpy(d->data() + d->size, str, len + 1); // include null terminator-
1798 d->size += len;-
1799 }
executed 214177 times by 182 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractSlider
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • ...
214177
1800 return *this;
executed 214194 times by 182 tests: return *this;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractSlider
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • ...
214194
1801}-
1802-
1803/*!-
1804 \overload append()-
1805-
1806 Appends the first \a len characters of the string \a str to this byte-
1807 array and returns a reference to this byte array.-
1808-
1809 If \a len is negative, the length of the string will be determined-
1810 automatically using qstrlen(). If \a len is zero or \a str is-
1811 null, nothing is appended to the byte array. Ensure that \a len is-
1812 \e not longer than \a str.-
1813*/-
1814-
1815QByteArray &QByteArray::append(const char *str, int len)-
1816{-
1817 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEevaluated 456365 times by 265 tests
Evaluated by:
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • ...
0-456365
1818 len = qstrlen(str);
never executed: len = qstrlen(str);
0
1819 if (str && len) {
strDescription
TRUEevaluated 456362 times by 265 tests
Evaluated by:
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • ...
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArrayList
lenDescription
TRUEevaluated 456358 times by 265 tests
Evaluated by:
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • ...
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArrayList
3-456362
1820 if (d->ref.isShared() || uint(d->size + len) + 1u > d->alloc)
d->ref.isShared()Description
TRUEevaluated 446063 times by 100 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • ...
FALSEevaluated 10295 times by 240 tests
Evaluated by:
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QByteArrayList
  • tst_QCalendarWidget
  • ...
uint(d->size +... 1u > d->allocDescription
TRUEevaluated 20 times by 3 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QByteArray
  • tst_QRingBuffer
FALSEevaluated 10275 times by 239 tests
Evaluated by:
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QByteArrayList
  • tst_QCalendarWidget
  • tst_QCheckBox
  • ...
20-446063
1821 reallocData(uint(d->size + len) + 1u, d->detachFlags() | Data::Grow);
executed 446083 times by 100 tests: reallocData(uint(d->size + len) + 1u, d->detachFlags() | Data::Grow);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • ...
446083
1822 memcpy(d->data() + d->size, str, len); // include null terminator-
1823 d->size += len;-
1824 d->data()[d->size] = '\0';-
1825 }
executed 456358 times by 265 tests: end of block
Executed by:
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • ...
456358
1826 return *this;
executed 456365 times by 265 tests: return *this;
Executed by:
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • ...
456365
1827}-
1828-
1829/*!-
1830 \overload-
1831-
1832 Appends the character \a ch to this byte array.-
1833*/-
1834-
1835QByteArray& QByteArray::append(char ch)-
1836{-
1837 if (d->ref.isShared() || uint(d->size) + 2u > d->alloc)
d->ref.isShared()Description
TRUEevaluated 64485 times by 198 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • ...
FALSEevaluated 18040340 times by 547 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
uint(d->size) + 2u > d->allocDescription
TRUEevaluated 105913 times by 111 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractSlider
  • tst_QAction
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QCryptographicHash
  • tst_QCssParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • tst_QDateTime
  • tst_QDir
  • tst_QDirIterator
  • tst_QDirModel
  • ...
FALSEevaluated 17934427 times by 546 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
64485-18040340
1838 reallocData(uint(d->size) + 2u, d->detachFlags() | Data::Grow);
executed 170398 times by 226 tests: reallocData(uint(d->size) + 2u, d->detachFlags() | Data::Grow);
Executed by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
170398
1839 d->data()[d->size++] = ch;-
1840 d->data()[d->size] = '\0';-
1841 return *this;
executed 18104825 times by 572 tests: return *this;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
18104825
1842}-
1843-
1844/*!-
1845 \internal-
1846 Inserts \a len bytes from the array \a arr at position \a pos and returns a-
1847 reference the modified byte array.-
1848*/-
1849static inline QByteArray &qbytearray_insert(QByteArray *ba,-
1850 int pos, const char *arr, int len)-
1851{-
1852 Q_ASSERT(pos >= 0);-
1853-
1854 if (pos < 0 || len <= 0 || arr == 0)
pos < 0Description
TRUEnever evaluated
FALSEevaluated 120032 times by 9 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
len <= 0Description
TRUEnever evaluated
FALSEevaluated 120032 times by 9 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
arr == 0Description
TRUEnever evaluated
FALSEevaluated 120032 times by 9 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
0-120032
1855 return *ba;
never executed: return *ba;
0
1856-
1857 int oldsize = ba->size();-
1858 ba->resize(qMax(pos, oldsize) + len);-
1859 char *dst = ba->data();-
1860 if (pos > oldsize)
pos > oldsizeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 120030 times by 9 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
2-120030
1861 ::memset(dst + oldsize, 0x20, pos - oldsize);
executed 2 times by 1 test: ::memset(dst + oldsize, 0x20, pos - oldsize);
Executed by:
  • tst_QByteArray
2
1862 else-
1863 ::memmove(dst + pos + len, dst + pos, oldsize - pos);
executed 120030 times by 9 tests: ::memmove(dst + pos + len, dst + pos, oldsize - pos);
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
120030
1864 memcpy(dst + pos, arr, len);-
1865 return *ba;
executed 120032 times by 9 tests: return *ba;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QByteArrayMatcher
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
120032
1866}-
1867-
1868/*!-
1869 Inserts the byte array \a ba at index position \a i and returns a-
1870 reference to this byte array.-
1871-
1872 Example:-
1873 \snippet code/src_corelib_tools_qbytearray.cpp 17-
1874-
1875 \sa append(), prepend(), replace(), remove()-
1876*/-
1877-
1878QByteArray &QByteArray::insert(int i, const QByteArray &ba)-
1879{-
1880 QByteArray copy(ba);-
1881 return qbytearray_insert(this, i, copy.d->data(), copy.d->size);
executed 12 times by 2 tests: return qbytearray_insert(this, i, copy.d->data(), copy.d->size);
Executed by:
  • tst_Collections
  • tst_QByteArray
12
1882}-
1883-
1884/*!-
1885 \fn QByteArray &QByteArray::insert(int i, const QString &str)-
1886-
1887 \overload-
1888-
1889 Inserts the string \a str at index position \a i in the byte-
1890 array. The Unicode data is converted into 8-bit characters using-
1891 QString::toUtf8().-
1892-
1893 If \a i is greater than size(), the array is first extended using-
1894 resize().-
1895-
1896 You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you-
1897 compile your applications. You then need to call QString::toUtf8() (or-
1898 QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to-
1899 convert the data to \c{const char *}.-
1900*/-
1901-
1902/*!-
1903 \overload-
1904-
1905 Inserts the string \a str at position \a i in the byte array.-
1906-
1907 If \a i is greater than size(), the array is first extended using-
1908 resize().-
1909*/-
1910-
1911QByteArray &QByteArray::insert(int i, const char *str)-
1912{-
1913 return qbytearray_insert(this, i, str, qstrlen(str));
executed 14 times by 2 tests: return qbytearray_insert(this, i, str, qstrlen(str));
Executed by:
  • tst_QByteArray
  • tst_QByteArrayMatcher
14
1914}-
1915-
1916/*!-
1917 \overload-
1918 \since 4.6-
1919-
1920 Inserts \a len bytes of the string \a str at position-
1921 \a i in the byte array.-
1922-
1923 If \a i is greater than size(), the array is first extended using-
1924 resize().-
1925*/-
1926-
1927QByteArray &QByteArray::insert(int i, const char *str, int len)-
1928{-
1929 return qbytearray_insert(this, i, str, len);
executed 1 time by 1 test: return qbytearray_insert(this, i, str, len);
Executed by:
  • tst_QByteArray
1
1930}-
1931-
1932/*!-
1933 \overload-
1934-
1935 Inserts character \a ch at index position \a i in the byte array.-
1936 If \a i is greater than size(), the array is first extended using-
1937 resize().-
1938*/-
1939-
1940QByteArray &QByteArray::insert(int i, char ch)-
1941{-
1942 return qbytearray_insert(this, i, &ch, 1);
executed 1303 times by 6 tests: return qbytearray_insert(this, i, &ch, 1);
Executed by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QSslKey
1303
1943}-
1944-
1945/*!-
1946 Removes \a len bytes from the array, starting at index position \a-
1947 pos, and returns a reference to the array.-
1948-
1949 If \a pos is out of range, nothing happens. If \a pos is valid,-
1950 but \a pos + \a len is larger than the size of the array, the-
1951 array is truncated at position \a pos.-
1952-
1953 Example:-
1954 \snippet code/src_corelib_tools_qbytearray.cpp 18-
1955-
1956 \sa insert(), replace()-
1957*/-
1958-
1959QByteArray &QByteArray::remove(int pos, int len)-
1960{-
1961 if (len <= 0 || uint(pos) >= uint(d->size))
len <= 0Description
TRUEevaluated 194 times by 15 tests
Evaluated by:
  • tst_Collections
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
  • tst_qmessagehandler
FALSEevaluated 269460 times by 21 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QFtp
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaObject
  • tst_QMovie
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPixmap
  • tst_QRingBuffer
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QState
  • tst_QStateMachine
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
  • tst_qmessagehandler
uint(pos) >= uint(d->size)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 269457 times by 21 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QFtp
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaObject
  • tst_QMovie
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPixmap
  • tst_QRingBuffer
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QState
  • tst_QStateMachine
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
  • tst_qmessagehandler
3-269460
1962 return *this;
executed 197 times by 15 tests: return *this;
Executed by:
  • tst_Collections
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QProcess
  • tst_QRingBuffer
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
  • tst_qmessagehandler
197
1963 detach();-
1964 if (len >= d->size - pos) {
len >= d->size - posDescription
TRUEevaluated 4166 times by 14 tests
Evaluated by:
  • tst_QByteArray
  • tst_QFtp
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QMovie
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPixmap
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_Spdy
  • tst_qmessagehandler
FALSEevaluated 265291 times by 14 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaObject
  • tst_QMovie
  • tst_QObject
  • tst_QPixmap
  • tst_QRingBuffer
  • tst_QSslCertificate
  • tst_QState
  • tst_QStateMachine
  • tst_Selftests
  • tst_qmessagehandler
4166-265291
1965 resize(pos);-
1966 } else {
executed 4166 times by 14 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QFtp
  • tst_QImageReader
  • tst_QMetaObject
  • tst_QMovie
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPixmap
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_Spdy
  • tst_qmessagehandler
4166
1967 memmove(d->data() + pos, d->data() + pos + len, d->size - pos - len);-
1968 resize(d->size - len);-
1969 }
executed 265291 times by 14 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaObject
  • tst_QMovie
  • tst_QObject
  • tst_QPixmap
  • tst_QRingBuffer
  • tst_QSslCertificate
  • tst_QState
  • tst_QStateMachine
  • tst_Selftests
  • tst_qmessagehandler
265291
1970 return *this;
executed 269457 times by 21 tests: return *this;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QFtp
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMetaObject
  • tst_QMovie
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPixmap
  • tst_QRingBuffer
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QState
  • tst_QStateMachine
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
  • tst_qmessagehandler
269457
1971}-
1972-
1973/*!-
1974 Replaces \a len bytes from index position \a pos with the byte-
1975 array \a after, and returns a reference to this byte array.-
1976-
1977 Example:-
1978 \snippet code/src_corelib_tools_qbytearray.cpp 19-
1979-
1980 \sa insert(), remove()-
1981*/-
1982-
1983QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after)-
1984{-
1985 if (len == after.d->size && (pos + len <= d->size)) {
len == after.d->sizeDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
(pos + len <= d->size)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-8
1986 detach();-
1987 memmove(d->data() + pos, after.d->data(), len*sizeof(char));-
1988 return *this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QByteArray
2
1989 } else {-
1990 QByteArray copy(after);-
1991 // ### optimize me-
1992 remove(pos, len);-
1993 return insert(pos, copy);
executed 9 times by 2 tests: return insert(pos, copy);
Executed by:
  • tst_Collections
  • tst_QByteArray
9
1994 }-
1995}-
1996-
1997/*! \fn QByteArray &QByteArray::replace(int pos, int len, const char *after)-
1998-
1999 \overload-
2000-
2001 Replaces \a len bytes from index position \a pos with the zero terminated-
2002 string \a after.-
2003-
2004 Notice: this can change the length of the byte array.-
2005*/-
2006QByteArray &QByteArray::replace(int pos, int len, const char *after)-
2007{-
2008 return replace(pos,len,after,qstrlen(after));
executed 118703 times by 3 tests: return replace(pos,len,after,qstrlen(after));
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_Selftests
118703
2009}-
2010-
2011/*! \fn QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen)-
2012-
2013 \overload-
2014-
2015 Replaces \a len bytes from index position \a pos with \a alen bytes-
2016 from the string \a after. \a after is allowed to have '\\0' characters.-
2017-
2018 \since 4.7-
2019*/-
2020QByteArray &QByteArray::replace(int pos, int len, const char *after, int alen)-
2021{-
2022 if (len == alen && (pos + len <= d->size)) {
len == alenDescription
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QByteArray
FALSEevaluated 118701 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_Selftests
(pos + len <= d->size)Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QByteArray
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-118701
2023 detach();-
2024 memcpy(d->data() + pos, after, len*sizeof(char));-
2025 return *this;
executed 12 times by 2 tests: return *this;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QByteArray
12
2026 } else {-
2027 remove(pos, len);-
2028 return qbytearray_insert(this, pos, after, alen);
executed 118702 times by 3 tests: return qbytearray_insert(this, pos, after, alen);
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_Selftests
118702
2029 }-
2030}-
2031-
2032// ### optimize all other replace method, by offering-
2033// QByteArray::replace(const char *before, int blen, const char *after, int alen)-
2034-
2035/*!-
2036 \overload-
2037-
2038 Replaces every occurrence of the byte array \a before with the-
2039 byte array \a after.-
2040-
2041 Example:-
2042 \snippet code/src_corelib_tools_qbytearray.cpp 20-
2043*/-
2044-
2045QByteArray &QByteArray::replace(const QByteArray &before, const QByteArray &after)-
2046{-
2047 if (isNull() || before.d == after.d)
isNull()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_Collections
before.d == after.dDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_Collections
0-3
2048 return *this;
never executed: return *this;
0
2049-
2050 QByteArray aft = after;-
2051 if (after.d == d)
after.d == dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_Collections
1-2
2052 aft.detach();
executed 2 times by 1 test: aft.detach();
Executed by:
  • tst_Collections
2
2053-
2054 return replace(before.constData(), before.size(), aft.constData(), aft.size());
executed 3 times by 1 test: return replace(before.constData(), before.size(), aft.constData(), aft.size());
Executed by:
  • tst_Collections
3
2055}-
2056-
2057/*!-
2058 \fn QByteArray &QByteArray::replace(const char *before, const QByteArray &after)-
2059 \overload-
2060-
2061 Replaces every occurrence of the string \a before with the-
2062 byte array \a after.-
2063*/-
2064-
2065QByteArray &QByteArray::replace(const char *c, const QByteArray &after)-
2066{-
2067 QByteArray aft = after;-
2068 if (after.d == d)
after.d == dDescription
TRUEnever evaluated
FALSEnever evaluated
0
2069 aft.detach();
never executed: aft.detach();
0
2070-
2071 return replace(c, qstrlen(c), aft.constData(), aft.size());
never executed: return replace(c, qstrlen(c), aft.constData(), aft.size());
0
2072}-
2073-
2074/*!-
2075 \fn QByteArray &QByteArray::replace(const char *before, int bsize, const char *after, int asize)-
2076 \overload-
2077-
2078 Replaces every occurrence of the string \a before with the string \a after.-
2079 Since the sizes of the strings are given by \a bsize and \a asize, they-
2080 may contain zero characters and do not need to be zero-terminated.-
2081*/-
2082-
2083QByteArray &QByteArray::replace(const char *before, int bsize, const char *after, int asize)-
2084{-
2085 if (isNull() || (before == after && bsize == asize))
isNull()Description
TRUEnever evaluated
FALSEevaluated 2072 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
before == afterDescription
TRUEnever evaluated
FALSEevaluated 2072 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
bsize == asizeDescription
TRUEnever evaluated
FALSEnever evaluated
0-2072
2086 return *this;
never executed: return *this;
0
2087-
2088 // protect against before or after being part of this-
2089 const char *a = after;-
2090 const char *b = before;-
2091 if (after >= d->data() && after < d->data() + d->size) {
after >= d->data()Description
TRUEevaluated 162 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_qlogging - unknown status
  • tst_qmessagehandler
FALSEevaluated 1910 times by 6 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
after < d->data() + d->sizeDescription
TRUEnever evaluated
FALSEevaluated 162 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_qlogging - unknown status
  • tst_qmessagehandler
0-1910
2092 char *copy = (char *)malloc(asize);-
2093 Q_CHECK_PTR(copy);
never executed: qBadAlloc();
!(copy)Description
TRUEnever evaluated
FALSEnever evaluated
0
2094 memcpy(copy, after, asize);-
2095 a = copy;-
2096 }
never executed: end of block
0
2097 if (before >= d->data() && before < d->data() + d->size) {
before >= d->data()Description
TRUEevaluated 2072 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
FALSEnever evaluated
before < d->data() + d->sizeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 2070 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
0-2072
2098 char *copy = (char *)malloc(bsize);-
2099 Q_CHECK_PTR(copy);
never executed: qBadAlloc();
!(copy)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
0-2
2100 memcpy(copy, before, bsize);-
2101 b = copy;-
2102 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_Collections
2
2103-
2104 QByteArrayMatcher matcher(before, bsize);-
2105 int index = 0;-
2106 int len = d->size;-
2107 char *d = data();-
2108-
2109 if (bsize == asize) {
bsize == asizeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 2071 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
1-2071
2110 if (bsize) {
bsizeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_Collections
FALSEnever evaluated
0-1
2111 while ((index = matcher.indexIn(*this, index)) != -1) {
(index = match... index)) != -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_Collections
1
2112 memcpy(d + index, after, asize);-
2113 index += bsize;-
2114 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_Collections
1
2115 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_Collections
1
2116 } else if (asize < bsize) {
executed 1 time by 1 test: end of block
Executed by:
  • tst_Collections
asize < bsizeDescription
TRUEevaluated 2069 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
1-2069
2117 uint to = 0;-
2118 uint movestart = 0;-
2119 uint num = 0;-
2120 while ((index = matcher.indexIn(*this, index)) != -1) {
(index = match... index)) != -1Description
TRUEevaluated 41 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
FALSEevaluated 2069 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
41-2069
2121 if (num) {
numDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
14-27
2122 int msize = index - movestart;-
2123 if (msize > 0) {
msize > 0Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QByteArray
0-14
2124 memmove(d + to, d + movestart, msize);-
2125 to += msize;-
2126 }
never executed: end of block
0
2127 } else {
executed 14 times by 1 test: end of block
Executed by:
  • tst_QByteArray
14
2128 to = index;-
2129 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
27
2130 if (asize) {
asizeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_QByteArray
1-40
2131 memcpy(d + to, after, asize);-
2132 to += asize;-
2133 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_Collections
1
2134 index += bsize;-
2135 movestart = index;-
2136 num++;-
2137 }
executed 41 times by 2 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
41
2138 if (num) {
numDescription
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
FALSEevaluated 2042 times by 7 tests
Evaluated by:
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
27-2042
2139 int msize = len - movestart;-
2140 if (msize > 0)
msize > 0Description
TRUEnever evaluated
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
0-27
2141 memmove(d + to, d + movestart, msize);
never executed: memmove(d + to, d + movestart, msize);
0
2142 resize(len - num*(bsize-asize));-
2143 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
27
2144 } else {
executed 2069 times by 8 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
2069
2145 // the most complex case. We don't want to lose performance by doing repeated-
2146 // copies and reallocs of the string.-
2147 while (index != -1) {
index != -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
2
2148 uint indices[4096];-
2149 uint pos = 0;-
2150 while(pos < 4095) {
pos < 4095Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_Collections
FALSEnever evaluated
0-8
2151 index = matcher.indexIn(*this, index);-
2152 if (index == -1)
index == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_Collections
2-6
2153 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_Collections
2
2154 indices[pos++] = index;-
2155 index += bsize;-
2156 // avoid infinite loop-
2157 if (!bsize)
!bsizeDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_Collections
0-6
2158 index++;
never executed: index++;
0
2159 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_Collections
6
2160 if (!pos)
!posDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
0-2
2161 break;
never executed: break;
0
2162-
2163 // we have a table of replacement positions, use them for fast replacing-
2164 int adjust = pos*(asize-bsize);-
2165 // index has to be adjusted in case we get back into the loop above.-
2166 if (index != -1)
index != -1Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
0-2
2167 index += adjust;
never executed: index += adjust;
0
2168 int newlen = len + adjust;-
2169 int moveend = len;-
2170 if (newlen > len) {
newlen > lenDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
FALSEnever evaluated
0-2
2171 resize(newlen);-
2172 len = newlen;-
2173 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_Collections
2
2174 d = this->d->data();-
2175-
2176 while(pos) {
posDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
2-6
2177 pos--;-
2178 int movestart = indices[pos] + bsize;-
2179 int insertstart = indices[pos] + pos*(asize-bsize);-
2180 int moveto = insertstart + asize;-
2181 memmove(d + moveto, d + movestart, (moveend - movestart));-
2182 if (asize)
asizeDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_Collections
FALSEnever evaluated
0-6
2183 memcpy(d + insertstart, after, asize);
executed 6 times by 1 test: memcpy(d + insertstart, after, asize);
Executed by:
  • tst_Collections
6
2184 moveend = movestart - bsize;-
2185 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_Collections
6
2186 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_Collections
2
2187 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_Collections
2
2188-
2189 if (a != after)
a != afterDescription
TRUEnever evaluated
FALSEevaluated 2072 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
0-2072
2190 ::free(const_cast<char *>(a));
never executed: ::free(const_cast<char *>(a));
0
2191 if (b != before)
b != beforeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 2070 times by 8 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
2-2070
2192 ::free(const_cast<char *>(b));
executed 2 times by 1 test: ::free(const_cast<char *>(b));
Executed by:
  • tst_Collections
2
2193-
2194-
2195 return *this;
executed 2072 times by 8 tests: return *this;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QResourceEngine
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_Selftests
  • tst_qlogging - unknown status
  • tst_qmessagehandler
2072
2196}-
2197-
2198-
2199/*!-
2200 \fn QByteArray &QByteArray::replace(const QByteArray &before, const char *after)-
2201 \overload-
2202-
2203 Replaces every occurrence of the byte array \a before with the-
2204 string \a after.-
2205*/-
2206-
2207/*! \fn QByteArray &QByteArray::replace(const QString &before, const QByteArray &after)-
2208-
2209 \overload-
2210-
2211 Replaces every occurrence of the string \a before with the byte-
2212 array \a after. The Unicode data is converted into 8-bit-
2213 characters using QString::toUtf8().-
2214-
2215 You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you-
2216 compile your applications. You then need to call QString::toUtf8() (or-
2217 QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to-
2218 convert the data to \c{const char *}.-
2219*/-
2220-
2221/*! \fn QByteArray &QByteArray::replace(const QString &before, const char *after)-
2222 \overload-
2223-
2224 Replaces every occurrence of the string \a before with the string-
2225 \a after.-
2226*/-
2227-
2228/*! \fn QByteArray &QByteArray::replace(const char *before, const char *after)-
2229-
2230 \overload-
2231-
2232 Replaces every occurrence of the string \a before with the string-
2233 \a after.-
2234*/-
2235-
2236/*!-
2237 \overload-
2238-
2239 Replaces every occurrence of the character \a before with the-
2240 byte array \a after.-
2241*/-
2242-
2243QByteArray &QByteArray::replace(char before, const QByteArray &after)-
2244{-
2245 char b[2] = { before, '\0' };-
2246 QByteArray cb = fromRawData(b, 1);-
2247 return replace(cb, after);
executed 2 times by 1 test: return replace(cb, after);
Executed by:
  • tst_Collections
2
2248}-
2249-
2250/*! \fn QByteArray &QByteArray::replace(char before, const QString &after)-
2251-
2252 \overload-
2253-
2254 Replaces every occurrence of the character \a before with the-
2255 string \a after. The Unicode data is converted into 8-bit-
2256 characters using QString::toUtf8().-
2257-
2258 You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you-
2259 compile your applications. You then need to call QString::toUtf8() (or-
2260 QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to-
2261 convert the data to \c{const char *}.-
2262*/-
2263-
2264/*! \fn QByteArray &QByteArray::replace(char before, const char *after)-
2265-
2266 \overload-
2267-
2268 Replaces every occurrence of the character \a before with the-
2269 string \a after.-
2270*/-
2271-
2272/*!-
2273 \overload-
2274-
2275 Replaces every occurrence of the character \a before with the-
2276 character \a after.-
2277*/-
2278-
2279QByteArray &QByteArray::replace(char before, char after)-
2280{-
2281 if (d->size) {
d->sizeDescription
TRUEevaluated 158 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QLoggingRegistry
  • tst_QTextStream
FALSEevaluated 871 times by 24 tests
Evaluated by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
158-871
2282 char *i = data();-
2283 char *e = i + d->size;-
2284 for (; i != e; ++i)
i != eDescription
TRUEevaluated 2698 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QLoggingRegistry
  • tst_QTextStream
FALSEevaluated 158 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QLoggingRegistry
  • tst_QTextStream
158-2698
2285 if (*i == before)
*i == beforeDescription
TRUEevaluated 162 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QTextStream
FALSEevaluated 2536 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QLoggingRegistry
  • tst_QTextStream
162-2536
2286 * i = after;
executed 162 times by 2 tests: * i = after;
Executed by:
  • tst_QByteArray
  • tst_QTextStream
162
2287 }
executed 158 times by 3 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QLoggingRegistry
  • tst_QTextStream
158
2288 return *this;
executed 1029 times by 25 tests: return *this;
Executed by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLoggingRegistry
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_QTextStream
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qlogging - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_selftests - unknown status
1029
2289}-
2290-
2291/*!-
2292 Splits the byte array into subarrays wherever \a sep occurs, and-
2293 returns the list of those arrays. If \a sep does not match-
2294 anywhere in the byte array, split() returns a single-element list-
2295 containing this byte array.-
2296*/-
2297-
2298QList<QByteArray> QByteArray::split(char sep) const-
2299{-
2300 QList<QByteArray> list;-
2301 int start = 0;-
2302 int end;-
2303 while ((end = indexOf(sep, start)) != -1) {
(end = indexOf... start)) != -1Description
TRUEevaluated 563573 times by 64 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • ...
FALSEevaluated 182339 times by 72 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • ...
182339-563573
2304 list.append(mid(start, end - start));-
2305 start = end + 1;-
2306 }
executed 563573 times by 64 tests: end of block
Executed by:
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • ...
563573
2307 list.append(mid(start));-
2308 return list;
executed 182339 times by 72 tests: return list;
Executed by:
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • ...
182339
2309}-
2310-
2311/*!-
2312 \since 4.5-
2313-
2314 Returns a copy of this byte array repeated the specified number of \a times.-
2315-
2316 If \a times is less than 1, an empty byte array is returned.-
2317-
2318 Example:-
2319-
2320 \code-
2321 QByteArray ba("ab");-
2322 ba.repeated(4); // returns "abababab"-
2323 \endcode-
2324*/-
2325QByteArray QByteArray::repeated(int times) const-
2326{-
2327 if (d->size == 0)
d->size == 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QByteArray
5-11
2328 return *this;
executed 5 times by 1 test: return *this;
Executed by:
  • tst_QByteArray
5
2329-
2330 if (times <= 1) {
times <= 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QByteArray
4-7
2331 if (times == 1)
times == 1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
1-3
2332 return *this;
executed 1 time by 1 test: return *this;
Executed by:
  • tst_QByteArray
1
2333 return QByteArray();
executed 3 times by 1 test: return QByteArray();
Executed by:
  • tst_QByteArray
3
2334 }-
2335-
2336 const int resultSize = times * d->size;-
2337-
2338 QByteArray result;-
2339 result.reserve(resultSize);-
2340 if (result.d->alloc != uint(resultSize) + 1u)
result.d->allo...sultSize) + 1uDescription
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QByteArray
0-7
2341 return QByteArray(); // not enough memory
never executed: return QByteArray();
0
2342-
2343 memcpy(result.d->data(), d->data(), d->size);-
2344-
2345 int sizeSoFar = d->size;-
2346 char *end = result.d->data() + sizeSoFar;-
2347-
2348 const int halfResultSize = resultSize >> 1;-
2349 while (sizeSoFar <= halfResultSize) {
sizeSoFar <= halfResultSizeDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QByteArray
7-12
2350 memcpy(end, result.d->data(), sizeSoFar);-
2351 end += sizeSoFar;-
2352 sizeSoFar <<= 1;-
2353 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QByteArray
12
2354 memcpy(end, result.d->data(), resultSize - sizeSoFar);-
2355 result.d->data()[resultSize] = '\0';-
2356 result.d->size = resultSize;-
2357 return result;
executed 7 times by 1 test: return result;
Executed by:
  • tst_QByteArray
7
2358}-
2359-
2360#define REHASH(a) \-
2361 if (ol_minus_1 < sizeof(uint) * CHAR_BIT) \-
2362 hashHaystack -= (a) << ol_minus_1; \-
2363 hashHaystack <<= 1-
2364-
2365/*!-
2366 Returns the index position of the first occurrence of the byte-
2367 array \a ba in this byte array, searching forward from index-
2368 position \a from. Returns -1 if \a ba could not be found.-
2369-
2370 Example:-
2371 \snippet code/src_corelib_tools_qbytearray.cpp 21-
2372-
2373 \sa lastIndexOf(), contains(), count()-
2374*/-
2375-
2376int QByteArray::indexOf(const QByteArray &ba, int from) const-
2377{-
2378 const int ol = ba.d->size;-
2379 if (ol == 0)
ol == 0Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QString
FALSEevaluated 2152 times by 12 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QNetworkReply
  • tst_QOpenGlConfig
  • tst_QPrinter
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QString
  • tst_QXmlStream
  • tst_Selftests
  • tst_qmessagehandler
16-2152
2380 return from;
executed 16 times by 2 tests: return from;
Executed by:
  • tst_QByteArray
  • tst_QString
16
2381 if (ol == 1)
ol == 1Description
TRUEevaluated 72 times by 4 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QString
FALSEevaluated 2080 times by 12 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QNetworkReply
  • tst_QOpenGlConfig
  • tst_QPrinter
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QString
  • tst_QXmlStream
  • tst_Selftests
  • tst_qmessagehandler
72-2080
2382 return indexOf(*ba.d->data(), from);
executed 72 times by 4 tests: return indexOf(*ba.d->data(), from);
Executed by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QString
72
2383-
2384 const int l = d->size;-
2385 if (from > d->size || ol + from > l)
from > d->sizeDescription
TRUEnever evaluated
FALSEevaluated 2080 times by 12 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QNetworkReply
  • tst_QOpenGlConfig
  • tst_QPrinter
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QString
  • tst_QXmlStream
  • tst_Selftests
  • tst_qmessagehandler
ol + from > lDescription
TRUEevaluated 16 times by 4 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QOpenGlConfig
  • tst_QString
FALSEevaluated 2064 times by 12 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QNetworkReply
  • tst_QOpenGlConfig
  • tst_QPrinter
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QString
  • tst_QXmlStream
  • tst_Selftests
  • tst_qmessagehandler
0-2080
2386 return -1;
executed 16 times by 4 tests: return -1;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QOpenGlConfig
  • tst_QString
16
2387-
2388 return qFindByteArray(d->data(), d->size, from, ba.d->data(), ol);
executed 2064 times by 12 tests: return qFindByteArray(d->data(), d->size, from, ba.d->data(), ol);
Executed by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QNetworkReply
  • tst_QOpenGlConfig
  • tst_QPrinter
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QString
  • tst_QXmlStream
  • tst_Selftests
  • tst_qmessagehandler
2064
2389}-
2390-
2391/*! \fn int QByteArray::indexOf(const QString &str, int from) const-
2392-
2393 \overload-
2394-
2395 Returns the index position of the first occurrence of the string-
2396 \a str in the byte array, searching forward from index position-
2397 \a from. Returns -1 if \a str could not be found.-
2398-
2399 The Unicode data is converted into 8-bit characters using-
2400 QString::toUtf8().-
2401-
2402 You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you-
2403 compile your applications. You then need to call QString::toUtf8() (or-
2404 QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to-
2405 convert the data to \c{const char *}.-
2406*/-
2407-
2408/*! \fn int QByteArray::indexOf(const char *str, int from) const-
2409-
2410 \overload-
2411-
2412 Returns the index position of the first occurrence of the string-
2413 \a str in the byte array, searching forward from index position \a-
2414 from. Returns -1 if \a str could not be found.-
2415*/-
2416int QByteArray::indexOf(const char *c, int from) const-
2417{-
2418 const int ol = qstrlen(c);-
2419 if (ol == 1)
ol == 1Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 730686 times by 32 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QByteArray
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QXmlStream
  • tst_Selftests
  • ...
24-730686
2420 return indexOf(*c, from);
executed 24 times by 1 test: return indexOf(*c, from);
Executed by:
  • tst_QByteArray
24
2421-
2422 const int l = d->size;-
2423 if (from > d->size || ol + from > l)
from > d->sizeDescription
TRUEnever evaluated
FALSEevaluated 730686 times by 32 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QByteArray
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QXmlStream
  • tst_Selftests
  • ...
ol + from > lDescription
TRUEevaluated 18985 times by 17 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
  • tst_qnetworkreply - unknown status
FALSEevaluated 711701 times by 30 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QByteArray
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QXmlStream
  • tst_Selftests
  • tst_Spdy
  • ...
0-730686
2424 return -1;
executed 18985 times by 17 tests: return -1;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Spdy
  • tst_qnetworkreply - unknown status
18985
2425 if (ol == 0)
ol == 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 711693 times by 30 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QByteArray
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QXmlStream
  • tst_Selftests
  • tst_Spdy
  • ...
8-711693
2426 return from;
executed 8 times by 1 test: return from;
Executed by:
  • tst_QByteArray
8
2427-
2428 return qFindByteArray(d->data(), d->size, from, c, ol);
executed 711693 times by 30 tests: return qFindByteArray(d->data(), d->size, from, c, ol);
Executed by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QByteArray
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_QXmlStream
  • tst_Selftests
  • tst_Spdy
  • ...
711693
2429}-
2430-
2431/*!-
2432 \overload-
2433-
2434 Returns the index position of the first occurrence of the-
2435 character \a ch in the byte array, searching forward from index-
2436 position \a from. Returns -1 if \a ch could not be found.-
2437-
2438 Example:-
2439 \snippet code/src_corelib_tools_qbytearray.cpp 22-
2440-
2441 \sa lastIndexOf(), contains()-
2442*/-
2443-
2444int QByteArray::indexOf(char ch, int from) const-
2445{-
2446 if (from < 0)
from < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 899780 times by 124 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • ...
1-899780
2447 from = qMax(from + d->size, 0);
executed 1 time by 1 test: from = qMax(from + d->size, 0);
Executed by:
  • tst_Collections
1
2448 if (from < d->size) {
from < d->sizeDescription
TRUEevaluated 897521 times by 122 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • ...
FALSEevaluated 2260 times by 31 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QBuffer
  • tst_QByteArray
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHttpSocketEngine
  • tst_QMdiArea
  • tst_QMimeData
  • tst_QNetworkCookie
  • tst_QNetworkCookieJar
  • tst_QNetworkReply
  • tst_QOpenGLWidget
  • tst_QOpenGLWindow
  • tst_QOpenGlConfig
  • tst_QString
  • ...
2260-897521
2449 const char *n = d->data() + from - 1;-
2450 const char *e = d->data() + d->size;-
2451 while (++n != e)
++n != eDescription
TRUEevaluated 15661180 times by 122 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • ...
FALSEevaluated 181885 times by 73 tests
Evaluated by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QChar
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • ...
181885-15661180
2452 if (*n == ch)
*n == chDescription
TRUEevaluated 715636 times by 122 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • ...
FALSEevaluated 14945544 times by 122 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • ...
715636-14945544
2453 return n - d->data();
executed 715636 times by 122 tests: return n - d->data();
Executed by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractInterface
  • tst_QDBusInterface
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • ...
715636
2454 }
executed 181885 times by 73 tests: end of block
Executed by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QChar
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsView
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • ...
181885
2455 return -1;
executed 184145 times by 82 tests: return -1;
Executed by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBuffer
  • tst_QByteArray
  • tst_QByteDataBuffer
  • tst_QChar
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsItem
  • ...
184145
2456}-
2457-
2458-
2459static int lastIndexOfHelper(const char *haystack, int l, const char *needle, int ol, int from)-
2460{-
2461 int delta = l - ol;-
2462 if (from < 0)
from < 0Description
TRUEevaluated 40 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
15-40
2463 from = delta;
executed 40 times by 3 tests: from = delta;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
40
2464 if (from < 0 || from > l)
from < 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QString
FALSEevaluated 50 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
from > lDescription
TRUEnever evaluated
FALSEevaluated 50 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
0-50
2465 return -1;
executed 5 times by 1 test: return -1;
Executed by:
  • tst_QString
5
2466 if (from > delta)
from > deltaDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 48 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
2-48
2467 from = delta;
executed 2 times by 1 test: from = delta;
Executed by:
  • tst_QByteArray
2
2468-
2469 const char *end = haystack;-
2470 haystack += from;-
2471 const uint ol_minus_1 = ol - 1;-
2472 const char *n = needle + ol_minus_1;-
2473 const char *h = haystack + ol_minus_1;-
2474 uint hashNeedle = 0, hashHaystack = 0;-
2475 int idx;-
2476 for (idx = 0; idx < ol; ++idx) {
idx < olDescription
TRUEevaluated 285 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
FALSEevaluated 50 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
50-285
2477 hashNeedle = ((hashNeedle<<1) + *(n-idx));-
2478 hashHaystack = ((hashHaystack<<1) + *(h-idx));-
2479 }
executed 285 times by 3 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
285
2480 hashHaystack -= *haystack;-
2481 while (haystack >= end) {
haystack >= endDescription
TRUEevaluated 214 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
FALSEevaluated 14 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
14-214
2482 hashHaystack += *haystack;-
2483 if (hashHaystack == hashNeedle && memcmp(needle, haystack, ol) == 0)
hashHaystack == hashNeedleDescription
TRUEevaluated 38 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
FALSEevaluated 176 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
memcmp(needle,...tack, ol) == 0Description
TRUEevaluated 36 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QString
2-176
2484 return haystack - end;
executed 36 times by 3 tests: return haystack - end;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
36
2485 --haystack;-
2486 REHASH(*(haystack + ol));
executed 144 times by 3 tests: hashHaystack -= (*(haystack + ol)) << ol_minus_1;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
ol_minus_1 < sizeof(uint) * 8Description
TRUEevaluated 144 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QString
34-144
2487 }
executed 178 times by 3 tests: end of block
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
178
2488 return -1;
executed 14 times by 3 tests: return -1;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QString
14
2489-
2490}-
2491-
2492/*!-
2493 \fn int QByteArray::lastIndexOf(const QByteArray &ba, int from) const-
2494-
2495 Returns the index position of the last occurrence of the byte-
2496 array \a ba in this byte array, searching backward from index-
2497 position \a from. If \a from is -1 (the default), the search-
2498 starts at the last byte. Returns -1 if \a ba could not be found.-
2499-
2500 Example:-
2501 \snippet code/src_corelib_tools_qbytearray.cpp 23-
2502-
2503 \sa indexOf(), contains(), count()-
2504*/-
2505-
2506int QByteArray::lastIndexOf(const QByteArray &ba, int from) const-
2507{-
2508 const int ol = ba.d->size;-
2509 if (ol == 1)
ol == 1Description
TRUEevaluated 34 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QString
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QString
34-36
2510 return lastIndexOf(*ba.d->data(), from);
executed 34 times by 2 tests: return lastIndexOf(*ba.d->data(), from);
Executed by:
  • tst_QByteArray
  • tst_QString
34
2511-
2512 return lastIndexOfHelper(d->data(), d->size, ba.d->data(), ol, from);
executed 36 times by 2 tests: return lastIndexOfHelper(d->data(), d->size, ba.d->data(), ol, from);
Executed by:
  • tst_QByteArray
  • tst_QString
36
2513}-
2514-
2515/*! \fn int QByteArray::lastIndexOf(const QString &str, int from) const-
2516-
2517 \overload-
2518-
2519 Returns the index position of the last occurrence of the string \a-
2520 str in the byte array, searching backward from index position \a-
2521 from. If \a from is -1 (the default), the search starts at the-
2522 last (size() - 1) byte. Returns -1 if \a str could not be found.-
2523-
2524 The Unicode data is converted into 8-bit characters using-
2525 QString::toUtf8().-
2526-
2527 You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you-
2528 compile your applications. You then need to call QString::toUtf8() (or-
2529 QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to-
2530 convert the data to \c{const char *}.-
2531*/-
2532-
2533/*! \fn int QByteArray::lastIndexOf(const char *str, int from) const-
2534 \overload-
2535-
2536 Returns the index position of the last occurrence of the string \a-
2537 str in the byte array, searching backward from index position \a-
2538 from. If \a from is -1 (the default), the search starts at the-
2539 last (size() - 1) byte. Returns -1 if \a str could not be found.-
2540*/-
2541int QByteArray::lastIndexOf(const char *str, int from) const-
2542{-
2543 const int ol = qstrlen(str);-
2544 if (ol == 1)
ol == 1Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 19 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
19-24
2545 return lastIndexOf(*str, from);
executed 24 times by 1 test: return lastIndexOf(*str, from);
Executed by:
  • tst_QByteArray
24
2546-
2547 return lastIndexOfHelper(d->data(), d->size, str, ol, from);
executed 19 times by 2 tests: return lastIndexOfHelper(d->data(), d->size, str, ol, from);
Executed by:
  • tst_Collections
  • tst_QByteArray
19
2548}-
2549-
2550/*!-
2551 \overload-
2552-
2553 Returns the index position of the last occurrence of character \a-
2554 ch in the byte array, searching backward from index position \a-
2555 from. If \a from is -1 (the default), the search starts at the-
2556 last (size() - 1) byte. Returns -1 if \a ch could not be found.-
2557-
2558 Example:-
2559 \snippet code/src_corelib_tools_qbytearray.cpp 24-
2560-
2561 \sa indexOf(), contains()-
2562*/-
2563-
2564int QByteArray::lastIndexOf(char ch, int from) const-
2565{-
2566 if (from < 0)
from < 0Description
TRUEevaluated 543 times by 12 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDir
  • tst_QFileDialog2
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QSettings
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmakelib
  • tst_qmessagehandler
FALSEevaluated 50 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QMetaObject
  • tst_QObject
50-543
2567 from += d->size;
executed 543 times by 12 tests: from += d->size;
Executed by:
  • tst_QByteArray
  • tst_QDir
  • tst_QFileDialog2
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QSettings
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmakelib
  • tst_qmessagehandler
543
2568 else if (from > d->size)
from > d->sizeDescription
TRUEnever evaluated
FALSEevaluated 50 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QMetaObject
  • tst_QObject
0-50
2569 from = d->size-1;
never executed: from = d->size-1;
0
2570 if (from >= 0) {
from >= 0Description
TRUEevaluated 579 times by 13 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDir
  • tst_QFileDialog2
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QObject
  • tst_QSettings
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmakelib
  • tst_qmessagehandler
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QString
14-579
2571 const char *b = d->data();-
2572 const char *n = d->data() + from + 1;-
2573 while (n-- != b)
n-- != bDescription
TRUEevaluated 5582 times by 13 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDir
  • tst_QFileDialog2
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QObject
  • tst_QSettings
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmakelib
  • tst_qmessagehandler
FALSEevaluated 191 times by 6 tests
Evaluated by:
  • tst_QByteArray
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmessagehandler
191-5582
2574 if (*n == ch)
*n == chDescription
TRUEevaluated 388 times by 12 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDir
  • tst_QFileDialog2
  • tst_QMetaObject
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QObject
  • tst_QSettings
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmakelib
  • tst_qmessagehandler
FALSEevaluated 5194 times by 13 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDir
  • tst_QFileDialog2
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QObject
  • tst_QSettings
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmakelib
  • tst_qmessagehandler
388-5194
2575 return n - b;
executed 388 times by 12 tests: return n - b;
Executed by:
  • tst_QByteArray
  • tst_QDir
  • tst_QFileDialog2
  • tst_QMetaObject
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QObject
  • tst_QSettings
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmakelib
  • tst_qmessagehandler
388
2576 }
executed 191 times by 6 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmessagehandler
191
2577 return -1;
executed 205 times by 6 tests: return -1;
Executed by:
  • tst_QByteArray
  • tst_QMetaObject
  • tst_QMetaObjectBuilder
  • tst_QString
  • tst_qlogging - unknown status
  • tst_qmessagehandler
205
2578}-
2579-
2580/*!-
2581 Returns the number of (potentially overlapping) occurrences of-
2582 byte array \a ba in this byte array.-
2583-
2584 \sa contains(), indexOf()-
2585*/-
2586-
2587int QByteArray::count(const QByteArray &ba) const-
2588{-
2589 int num = 0;-
2590 int i = -1;-
2591 if (d->size > 500 && ba.d->size > 5) {
d->size > 500Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_Collections
ba.d->size > 5Description
TRUEnever evaluated
FALSEnever evaluated
0-4
2592 QByteArrayMatcher matcher(ba);-
2593 while ((i = matcher.indexIn(*this, i + 1)) != -1)
(i = matcher.i... i + 1)) != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
2594 ++num;
never executed: ++num;
0
2595 } else {
never executed: end of block
0
2596 while ((i = indexOf(ba, i + 1)) != -1)
(i = indexOf(ba, i + 1)) != -1Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_Collections
4-33
2597 ++num;
executed 33 times by 1 test: ++num;
Executed by:
  • tst_Collections
33
2598 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_Collections
4
2599 return num;
executed 4 times by 1 test: return num;
Executed by:
  • tst_Collections
4
2600}-
2601-
2602/*!-
2603 \overload-
2604-
2605 Returns the number of (potentially overlapping) occurrences of-
2606 string \a str in the byte array.-
2607*/-
2608-
2609int QByteArray::count(const char *str) const-
2610{-
2611 return count(fromRawData(str, qstrlen(str)));
executed 4 times by 1 test: return count(fromRawData(str, qstrlen(str)));
Executed by:
  • tst_Collections
4
2612}-
2613-
2614/*!-
2615 \overload-
2616-
2617 Returns the number of occurrences of character \a ch in the byte-
2618 array.-
2619-
2620 \sa contains(), indexOf()-
2621*/-
2622-
2623int QByteArray::count(char ch) const-
2624{-
2625 int num = 0;-
2626 const char *i = d->data() + d->size;-
2627 const char *b = d->data();-
2628 while (i != b)
i != bDescription
TRUEevaluated 65360 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QRingBuffer
  • tst_QXmlStream
FALSEevaluated 514 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QRingBuffer
  • tst_QXmlStream
514-65360
2629 if (*--i == ch)
*--i == chDescription
TRUEevaluated 65303 times by 3 tests
Evaluated by:
  • tst_Collections
  • tst_QRingBuffer
  • tst_QXmlStream
FALSEevaluated 57 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QXmlStream
57-65303
2630 ++num;
executed 65303 times by 3 tests: ++num;
Executed by:
  • tst_Collections
  • tst_QRingBuffer
  • tst_QXmlStream
65303
2631 return num;
executed 514 times by 3 tests: return num;
Executed by:
  • tst_Collections
  • tst_QRingBuffer
  • tst_QXmlStream
514
2632}-
2633-
2634/*! \fn int QByteArray::count() const-
2635-
2636 \overload-
2637-
2638 Same as size().-
2639*/-
2640-
2641/*!-
2642 Returns \c true if this byte array starts with byte array \a ba;-
2643 otherwise returns \c false.-
2644-
2645 Example:-
2646 \snippet code/src_corelib_tools_qbytearray.cpp 25-
2647-
2648 \sa endsWith(), left()-
2649*/-
2650bool QByteArray::startsWith(const QByteArray &ba) const-
2651{-
2652 if (d == ba.d || ba.d->size == 0)
d == ba.dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 3179 times by 30 tests
Evaluated by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusLocalCalls
  • tst_QFileSelector
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QMdiArea
  • tst_QNetworkProxyFactory
  • tst_QOpenGLWidget
  • tst_QOpenGLWindow
  • tst_QOpenGlConfig
  • tst_QRingBuffer
  • tst_QString
  • tst_QXmlStream
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • ...
ba.d->size == 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 3175 times by 30 tests
Evaluated by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusLocalCalls
  • tst_QFileSelector
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QMdiArea
  • tst_QNetworkProxyFactory
  • tst_QOpenGLWidget
  • tst_QOpenGLWindow
  • tst_QOpenGlConfig
  • tst_QRingBuffer
  • tst_QString
  • tst_QXmlStream
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • ...
2-3179
2653 return true;
executed 6 times by 1 test: return true;
Executed by:
  • tst_QByteArray
6
2654 if (d->size < ba.d->size)
d->size < ba.d->sizeDescription
TRUEevaluated 1045 times by 9 tests
Evaluated by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusLocalCalls
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 2130 times by 30 tests
Evaluated by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusLocalCalls
  • tst_QFileSelector
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QMdiArea
  • tst_QNetworkProxyFactory
  • tst_QOpenGLWidget
  • tst_QOpenGLWindow
  • tst_QOpenGlConfig
  • tst_QRingBuffer
  • tst_QString
  • tst_QXmlStream
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • ...
1045-2130
2655 return false;
executed 1045 times by 9 tests: return false;
Executed by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusLocalCalls
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
1045
2656 return memcmp(d->data(), ba.d->data(), ba.d->size) == 0;
executed 2130 times by 30 tests: return memcmp(d->data(), ba.d->data(), ba.d->size) == 0;
Executed by:
  • tst_QApplication
  • tst_QByteArray
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusLocalCalls
  • tst_QFileSelector
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QMdiArea
  • tst_QNetworkProxyFactory
  • tst_QOpenGLWidget
  • tst_QOpenGLWindow
  • tst_QOpenGlConfig
  • tst_QRingBuffer
  • tst_QString
  • tst_QXmlStream
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • ...
2130
2657}-
2658-
2659/*! \overload-
2660-
2661 Returns \c true if this byte array starts with string \a str;-
2662 otherwise returns \c false.-
2663*/-
2664bool QByteArray::startsWith(const char *str) const-
2665{-
2666 if (!str || !*str)
!strDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 1376174 times by 155 tests
Evaluated by:
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDataWidgetMapper
  • ...
!*strDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 1376171 times by 155 tests
Evaluated by:
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDataWidgetMapper
  • ...
3-1376174
2667 return true;
executed 6 times by 1 test: return true;
Executed by:
  • tst_QByteArray
6
2668 const int len = int(strlen(str));-
2669 if (d->size < len)
d->size < lenDescription
TRUEevaluated 263990 times by 14 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QChar
  • tst_QDataStream
  • tst_QFontDialog
  • tst_QGlyphRun
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QPrinter
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Utf8
  • tst_qmake
FALSEevaluated 1112181 times by 154 tests
Evaluated by:
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDataWidgetMapper
  • ...
263990-1112181
2670 return false;
executed 263990 times by 14 tests: return false;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QChar
  • tst_QDataStream
  • tst_QFontDialog
  • tst_QGlyphRun
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QPrinter
  • tst_QTcpSocket
  • tst_Selftests
  • tst_Utf8
  • tst_qmake
263990
2671 return qstrncmp(d->data(), str, len) == 0;
executed 1112181 times by 154 tests: return qstrncmp(d->data(), str, len) == 0;
Executed by:
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDataWidgetMapper
  • ...
1112181
2672}-
2673-
2674/*! \overload-
2675-
2676 Returns \c true if this byte array starts with character \a ch;-
2677 otherwise returns \c false.-
2678*/-
2679bool QByteArray::startsWith(char ch) const-
2680{-
2681 if (d->size == 0)
d->size == 0Description
TRUEevaluated 18 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QNetworkCookieJar
  • tst_Selftests
FALSEevaluated 113712 times by 65 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDateTimeEdit
  • tst_QDir
  • tst_QDirIterator
  • tst_QDirModel
  • tst_QDoubleValidator
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImageReader
  • ...
18-113712
2682 return false;
executed 18 times by 3 tests: return false;
Executed by:
  • tst_QByteArray
  • tst_QNetworkCookieJar
  • tst_Selftests
18
2683 return d->data()[0] == ch;
executed 113712 times by 65 tests: return d->data()[0] == ch;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDateTimeEdit
  • tst_QDir
  • tst_QDirIterator
  • tst_QDirModel
  • tst_QDoubleValidator
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImageReader
  • ...
113712
2684}-
2685-
2686/*!-
2687 Returns \c true if this byte array ends with byte array \a ba;-
2688 otherwise returns \c false.-
2689-
2690 Example:-
2691 \snippet code/src_corelib_tools_qbytearray.cpp 26-
2692-
2693 \sa startsWith(), right()-
2694*/-
2695bool QByteArray::endsWith(const QByteArray &ba) const-
2696{-
2697 if (d == ba.d || ba.d->size == 0)
d == ba.dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QByteArray
ba.d->size == 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QByteArray
2-9
2698 return true;
executed 6 times by 1 test: return true;
Executed by:
  • tst_QByteArray
6
2699 if (d->size < ba.d->size)
d->size < ba.d->sizeDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
2-3
2700 return false;
executed 3 times by 1 test: return false;
Executed by:
  • tst_QByteArray
3
2701 return memcmp(d->data() + d->size - ba.d->size, ba.d->data(), ba.d->size) == 0;
executed 2 times by 1 test: return memcmp(d->data() + d->size - ba.d->size, ba.d->data(), ba.d->size) == 0;
Executed by:
  • tst_QByteArray
2
2702}-
2703-
2704/*! \overload-
2705-
2706 Returns \c true if this byte array ends with string \a str; otherwise-
2707 returns \c false.-
2708*/-
2709bool QByteArray::endsWith(const char *str) const-
2710{-
2711 if (!str || !*str)
!strDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 222940 times by 538 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
!*strDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 222937 times by 538 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
3-222940
2712 return true;
executed 6 times by 1 test: return true;
Executed by:
  • tst_QByteArray
6
2713 const int len = int(strlen(str));-
2714 if (d->size < len)
d->size < lenDescription
TRUEevaluated 49833 times by 208 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_PlatformSocketEngine
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAtomicInt
  • tst_QAtomicInteger_Gcc_char
  • tst_QAtomicInteger_Gcc_char16_t
  • tst_QAtomicInteger_Gcc_char32_t
  • tst_QAtomicInteger_Gcc_int
  • tst_QAtomicInteger_Gcc_long
  • tst_QAtomicInteger_Gcc_qlonglong
  • tst_QAtomicInteger_Gcc_qptrdiff
  • tst_QAtomicInteger_Gcc_quintptr
  • tst_QAtomicInteger_Gcc_qulonglong
  • tst_QAtomicInteger_Gcc_schar
  • tst_QAtomicInteger_Gcc_short
  • tst_QAtomicInteger_Gcc_uchar
  • tst_QAtomicInteger_Gcc_uint
  • tst_QAtomicInteger_Gcc_ulong
  • ...
FALSEevaluated 173104 times by 538 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
49833-173104
2715 return false;
executed 49833 times by 208 tests: return false;
Executed by:
  • tst_Collections
  • tst_LargeFile
  • tst_PlatformSocketEngine
  • tst_QAbstractItemModel
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAtomicInt
  • tst_QAtomicInteger_Gcc_char
  • tst_QAtomicInteger_Gcc_char16_t
  • tst_QAtomicInteger_Gcc_char32_t
  • tst_QAtomicInteger_Gcc_int
  • tst_QAtomicInteger_Gcc_long
  • tst_QAtomicInteger_Gcc_qlonglong
  • tst_QAtomicInteger_Gcc_qptrdiff
  • tst_QAtomicInteger_Gcc_quintptr
  • tst_QAtomicInteger_Gcc_qulonglong
  • tst_QAtomicInteger_Gcc_schar
  • tst_QAtomicInteger_Gcc_short
  • tst_QAtomicInteger_Gcc_uchar
  • tst_QAtomicInteger_Gcc_uint
  • tst_QAtomicInteger_Gcc_ulong
  • ...
49833
2716 return qstrncmp(d->data() + d->size - len, str, len) == 0;
executed 173104 times by 538 tests: return qstrncmp(d->data() + d->size - len, str, len) == 0;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
173104
2717}-
2718-
2719/*! \overload-
2720-
2721 Returns \c true if this byte array ends with character \a ch;-
2722 otherwise returns \c false.-
2723*/-
2724bool QByteArray::endsWith(char ch) const-
2725{-
2726 if (d->size == 0)
d->size == 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 72387 times by 327 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
4-72387
2727 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_QByteArray
4
2728 return d->data()[d->size - 1] == ch;
executed 72387 times by 327 tests: return d->data()[d->size - 1] == ch;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
72387
2729}-
2730-
2731/*!-
2732 Returns a byte array that contains the leftmost \a len bytes of-
2733 this byte array.-
2734-
2735 The entire byte array is returned if \a len is greater than-
2736 size().-
2737-
2738 Example:-
2739 \snippet code/src_corelib_tools_qbytearray.cpp 27-
2740-
2741 \sa right(), mid(), startsWith(), truncate()-
2742*/-
2743-
2744QByteArray QByteArray::left(int len) const-
2745{-
2746 if (len >= d->size)
len >= d->sizeDescription
TRUEevaluated 212 times by 10 tests
Evaluated by:
  • tst_Collections
  • tst_QByteArray
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeData
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_Spdy
FALSEevaluated 80381 times by 52 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QChar
  • tst_QDataStream
  • tst_QDir
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • ...
212-80381
2747 return *this;
executed 212 times by 10 tests: return *this;
Executed by:
  • tst_Collections
  • tst_QByteArray
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeData
  • tst_QTextBrowser
  • tst_QTextCodec
  • tst_QTextDocument
  • tst_QTextEdit
  • tst_Spdy
212
2748 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEevaluated 80381 times by 52 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QChar
  • tst_QDataStream
  • tst_QDir
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • ...
0-80381
2749 len = 0;
never executed: len = 0;
0
2750 return QByteArray(d->data(), len);
executed 80381 times by 52 tests: return QByteArray(d->data(), len);
Executed by:
  • tst_Collections
  • tst_LargeFile
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QByteArray
  • tst_QChar
  • tst_QDataStream
  • tst_QDir
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QIODevice
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • ...
80381
2751}-
2752-
2753/*!-
2754 Returns a byte array that contains the rightmost \a len bytes of-
2755 this byte array.-
2756-
2757 The entire byte array is returned if \a len is greater than-
2758 size().-
2759-
2760 Example:-
2761 \snippet code/src_corelib_tools_qbytearray.cpp 28-
2762-
2763 \sa endsWith(), left(), mid()-
2764*/-
2765-
2766QByteArray QByteArray::right(int len) const-
2767{-
2768 if (len >= d->size)
len >= d->sizeDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
FALSEevaluated 17 times by 4 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_QAuthenticator
  • tst_QIODevice
4-17
2769 return *this;
executed 4 times by 2 tests: return *this;
Executed by:
  • tst_Collections
  • tst_LargeFile
4
2770 if (len < 0)
len < 0Description
TRUEnever evaluated
FALSEevaluated 17 times by 4 tests
Evaluated by:
  • tst_Collections
  • tst_LargeFile
  • tst_QAuthenticator
  • tst_QIODevice
0-17
2771 len = 0;
never executed: len = 0;
0
2772 return QByteArray(d->data() + d->size - len, len);
executed 17 times by 4 tests: return QByteArray(d->data() + d->size - len, len);
Executed by:
  • tst_Collections
  • tst_LargeFile
  • tst_QAuthenticator
  • tst_QIODevice
17
2773}-
2774-
2775/*!-
2776 Returns a byte array containing \a len bytes from this byte array,-
2777 starting at position \a pos.-
2778-
2779 If \a len is -1 (the default), or \a pos + \a len >= size(),-
2780 returns a byte array containing all bytes starting at position \a-
2781 pos until the end of the byte array.-
2782-
2783 Example:-
2784 \snippet code/src_corelib_tools_qbytearray.cpp 29-
2785-
2786 \sa left(), right()-
2787*/-
2788-
2789QByteArray QByteArray::mid(int pos, int len) const-
2790{-
2791 using namespace QtPrivate;-
2792 switch (QContainerImplHelper::mid(size(), &pos, &len)) {-
2793 case QContainerImplHelper::Null:
executed 113 times by 3 tests: case QContainerImplHelper::Null:
Executed by:
  • tst_QAuthenticator
  • tst_QHttpSocketEngine
  • tst_Spdy
113
2794 return QByteArray();
executed 113 times by 3 tests: return QByteArray();
Executed by:
  • tst_QAuthenticator
  • tst_QHttpSocketEngine
  • tst_Spdy
113
2795 case QContainerImplHelper::Empty:
executed 2432 times by 51 tests: case QContainerImplHelper::Empty:
Executed by:
  • tst_Collections
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHttpNetworkReply
  • tst_QIcon
  • tst_QLabel
  • ...
2432
2796 {-
2797 QByteArrayDataPtr empty = { Data::allocate(0) };-
2798 return QByteArray(empty);
executed 2432 times by 51 tests: return QByteArray(empty);
Executed by:
  • tst_Collections
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHttpNetworkReply
  • tst_QIcon
  • tst_QLabel
  • ...
2432
2799 }-
2800 case QContainerImplHelper::Full:
executed 65229 times by 32 tests: case QContainerImplHelper::Full:
Executed by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QByteArray
  • tst_QChar
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDateTime
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QMessageAuthenticationCode
  • tst_QMetaType
  • tst_QNetworkCookie
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QTimeZone
  • ...
65229
2801 return *this;
executed 65229 times by 32 tests: return *this;
Executed by:
  • tst_Collections
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QByteArray
  • tst_QChar
  • tst_QDBusAbstractInterface
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusPendingReply
  • tst_QDBusThreading
  • tst_QDateTime
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QMessageAuthenticationCode
  • tst_QMetaType
  • tst_QNetworkCookie
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QTimeZone
  • ...
65229
2802 case QContainerImplHelper::Subset:
executed 834417 times by 115 tests: case QContainerImplHelper::Subset:
Executed by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • ...
834417
2803 return QByteArray(d->data() + pos, len);
executed 834417 times by 115 tests: return QByteArray(d->data() + pos, len);
Executed by:
  • tst_Collections
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTime
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • ...
834417
2804 }-
2805 Q_UNREACHABLE();-
2806 return QByteArray();
never executed: return QByteArray();
0
2807}-
2808-
2809/*!-
2810 \fn QByteArray QByteArray::toLower() const-
2811-
2812 Returns a lowercase copy of the byte array. The bytearray is-
2813 interpreted as a Latin-1 encoded string.-
2814-
2815 Example:-
2816 \snippet code/src_corelib_tools_qbytearray.cpp 30-
2817-
2818 \sa toUpper(), {8-bit Character Comparisons}-
2819*/-
2820-
2821// prevent the compiler from inlining the function in each of-
2822// toLower and toUpper when the only difference is the table being used-
2823// (even with constant propagation, there's no gain in performance).-
2824template <typename T>-
2825Q_NEVER_INLINE-
2826static QByteArray toCase_template(T &input, const uchar * table)-
2827{-
2828 // find the first bad character in input-
2829 const char *orig_begin = input.constBegin();-
2830 const char *firstBad = orig_begin;-
2831 const char *e = input.constEnd();-
2832 for ( ; firstBad != e ; ++firstBad) {
firstBad != eDescription
TRUEevaluated 424013 times by 166 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
FALSEevaluated 49777 times by 112 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • ...
49777-424013
2833 uchar ch = uchar(*firstBad);-
2834 uchar converted = table[ch];-
2835 if (ch != converted)
ch != convertedDescription
TRUEevaluated 46227 times by 158 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • ...
FALSEevaluated 377786 times by 65 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QGuiVariant
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • ...
46227-377786
2836 break;
executed 46227 times by 158 tests: break;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • ...
46227
2837 }
executed 377786 times by 65 tests: end of block
Executed by:
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QGuiVariant
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • ...
377786
2838-
2839 if (firstBad == e)
firstBad == eDescription
TRUEevaluated 49777 times by 112 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • ...
FALSEevaluated 46227 times by 158 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • ...
46227-49777
2840 return qMove(input);
executed 49777 times by 112 tests: return std::move(input);
Executed by:
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDataUrl
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • ...
49777
2841-
2842 // transform the rest-
2843 QByteArray s = qMove(input); // will copy if T is const QByteArray-
2844 char *b = s.begin(); // will detach if necessary-
2845 char *p = b + (firstBad - orig_begin);-
2846 e = b + s.size();-
2847 for ( ; p != e; ++p) {
p != eDescription
TRUEevaluated 457049 times by 158 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • ...
FALSEevaluated 46227 times by 158 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • ...
46227-457049
2848 *p = char(uchar(table[uchar(*p)]));-
2849 }
executed 457049 times by 158 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • ...
457049
2850 return s;
executed 46227 times by 158 tests: return s;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCryptographicHash
  • ...
46227
2851}-
2852-
2853QByteArray QByteArray::toLower_helper(const QByteArray &a)-
2854{-
2855 return toCase_template(a, latin1_lowercased);
executed 33778 times by 165 tests: return toCase_template(a, latin1_lowercased);
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
33778
2856}-
2857-
2858QByteArray QByteArray::toLower_helper(QByteArray &a)-
2859{-
2860 return toCase_template(a, latin1_lowercased);
executed 61989 times by 55 tests: return toCase_template(a, latin1_lowercased);
Executed by:
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QByteArray
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • ...
61989
2861}-
2862-
2863/*!-
2864 \fn QByteArray QByteArray::toUpper() const-
2865-
2866 Returns an uppercase copy of the byte array. The bytearray is-
2867 interpreted as a Latin-1 encoded string.-
2868-
2869 Example:-
2870 \snippet code/src_corelib_tools_qbytearray.cpp 31-
2871-
2872 \sa toLower(), {8-bit Character Comparisons}-
2873*/-
2874-
2875QByteArray QByteArray::toUpper_helper(const QByteArray &a)-
2876{-
2877 return toCase_template(a, latin1_uppercased);
executed 214 times by 3 tests: return toCase_template(a, latin1_uppercased);
Executed by:
  • tst_QByteArray
  • tst_QImageReader
  • tst_QUrlInternal
214
2878}-
2879-
2880QByteArray QByteArray::toUpper_helper(QByteArray &a)-
2881{-
2882 return toCase_template(a, latin1_uppercased);
executed 23 times by 2 tests: return toCase_template(a, latin1_uppercased);
Executed by:
  • tst_QByteArray
  • tst_QCryptographicHash
23
2883}-
2884-
2885/*! \fn void QByteArray::clear()-
2886-
2887 Clears the contents of the byte array and makes it null.-
2888-
2889 \sa resize(), isNull()-
2890*/-
2891-
2892void QByteArray::clear()-
2893{-
2894 if (!d->ref.deref())
!d->ref.deref()Description
TRUEevaluated 16832 times by 98 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QBuffer
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • ...
FALSEevaluated 720262 times by 258 tests
Evaluated by:
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
16832-720262
2895 Data::deallocate(d);
executed 16832 times by 98 tests: Data::deallocate(d);
Executed by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QBuffer
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDir
  • tst_QEventLoop
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QGuiEventLoop
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • ...
16832
2896 d = Data::sharedNull();-
2897}
executed 737094 times by 263 tests: end of block
Executed by:
  • tst_Collections
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QBitArray
  • tst_QBrush
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QColumnView
  • ...
737094
2898-
2899#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE))-
2900-
2901/*! \relates QByteArray-
2902-
2903 Writes byte array \a ba to the stream \a out and returns a reference-
2904 to the stream.-
2905-
2906 \sa {Serializing Qt Data Types}-
2907*/-
2908-
2909QDataStream &operator<<(QDataStream &out, const QByteArray &ba)-
2910{-
2911 if (ba.isNull() && out.version() >= 6) {
ba.isNull()Description
TRUEevaluated 19 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QUrl
  • tst_QVariant
FALSEevaluated 799 times by 11 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFont
  • tst_QMetaObjectBuilder
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QUrl
  • tst_QVariant
out.version() >= 6Description
TRUEevaluated 19 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QUrl
  • tst_QVariant
FALSEnever evaluated
0-799
2912 out << (quint32)0xffffffff;-
2913 return out;
executed 19 times by 5 tests: return out;
Executed by:
  • tst_QDataStream
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QUrl
  • tst_QVariant
19
2914 }-
2915 return out.writeBytes(ba.constData(), ba.size());
executed 799 times by 11 tests: return out.writeBytes(ba.constData(), ba.size());
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFont
  • tst_QMetaObjectBuilder
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSettings
  • tst_QUrl
  • tst_QVariant
799
2916}-
2917-
2918/*! \relates QByteArray-
2919-
2920 Reads a byte array into \a ba from the stream \a in and returns a-
2921 reference to the stream.-
2922-
2923 \sa {Serializing Qt Data Types}-
2924*/-
2925-
2926QDataStream &operator>>(QDataStream &in, QByteArray &ba)-
2927{-
2928 ba.clear();-
2929 quint32 len;-
2930 in >> len;-
2931 if (len == 0xffffffff)
len == 0xffffffffDescription
TRUEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QDataStream
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QUrl
  • tst_QVariant
FALSEevaluated 946 times by 14 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QSettings
  • tst_QUrl
  • tst_QVariant
24-946
2932 return in;
executed 24 times by 5 tests: return in;
Executed by:
  • tst_QDataStream
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QUrl
  • tst_QVariant
24
2933-
2934 const quint32 Step = 1024 * 1024;-
2935 quint32 allocated = 0;-
2936-
2937 do {-
2938 int blockSize = qMin(Step, len - allocated);-
2939 ba.resize(allocated + blockSize);-
2940 if (in.readRawData(ba.data() + allocated, blockSize) != blockSize) {
in.readRawData...) != blockSizeDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 949 times by 14 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QSettings
  • tst_QUrl
  • tst_QVariant
11-949
2941 ba.clear();-
2942 in.setStatus(QDataStream::ReadPastEnd);-
2943 return in;
executed 11 times by 1 test: return in;
Executed by:
  • tst_QDataStream
11
2944 }-
2945 allocated += blockSize;-
2946 } while (allocated < len);
executed 949 times by 14 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QSettings
  • tst_QUrl
  • tst_QVariant
allocated < lenDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QDataStream
FALSEevaluated 935 times by 14 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QSettings
  • tst_QUrl
  • tst_QVariant
14-949
2947-
2948 return in;
executed 935 times by 14 tests: return in;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QFileDialog2
  • tst_QFont
  • tst_QGuiVariant
  • tst_QMetaObjectBuilder
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPrinter
  • tst_QSettings
  • tst_QUrl
  • tst_QVariant
935
2949}-
2950#endif // QT_NO_DATASTREAM-
2951-
2952/*! \fn bool QByteArray::operator==(const QString &str) const-
2953-
2954 Returns \c true if this byte array is equal to string \a str;-
2955 otherwise returns \c false.-
2956-
2957 The Unicode data is converted into 8-bit characters using-
2958 QString::toUtf8().-
2959-
2960 The comparison is case sensitive.-
2961-
2962 You can disable this operator by defining \c-
2963 QT_NO_CAST_FROM_ASCII when you compile your applications. You-
2964 then need to call QString::fromUtf8(), QString::fromLatin1(),-
2965 or QString::fromLocal8Bit() explicitly if you want to convert the byte-
2966 array to a QString before doing the comparison.-
2967*/-
2968-
2969/*! \fn bool QByteArray::operator!=(const QString &str) const-
2970-
2971 Returns \c true if this byte array is not equal to string \a str;-
2972 otherwise returns \c false.-
2973-
2974 The Unicode data is converted into 8-bit characters using-
2975 QString::toUtf8().-
2976-
2977 The comparison is case sensitive.-
2978-
2979 You can disable this operator by defining \c-
2980 QT_NO_CAST_FROM_ASCII when you compile your applications. You-
2981 then need to call QString::fromUtf8(), QString::fromLatin1(),-
2982 or QString::fromLocal8Bit() explicitly if you want to convert the byte-
2983 array to a QString before doing the comparison.-
2984*/-
2985-
2986/*! \fn bool QByteArray::operator<(const QString &str) const-
2987-
2988 Returns \c true if this byte array is lexically less than string \a-
2989 str; otherwise returns \c false.-
2990-
2991 The Unicode data is converted into 8-bit characters using-
2992 QString::toUtf8().-
2993-
2994 The comparison is case sensitive.-
2995-
2996 You can disable this operator by defining \c-
2997 QT_NO_CAST_FROM_ASCII when you compile your applications. You-
2998 then need to call QString::fromUtf8(), QString::fromLatin1(),-
2999 or QString::fromLocal8Bit() explicitly if you want to convert the byte-
3000 array to a QString before doing the comparison.-
3001*/-
3002-
3003/*! \fn bool QByteArray::operator>(const QString &str) const-
3004-
3005 Returns \c true if this byte array is lexically greater than string-
3006 \a str; otherwise returns \c false.-
3007-
3008 The Unicode data is converted into 8-bit characters using-
3009 QString::toUtf8().-
3010-
3011 The comparison is case sensitive.-
3012-
3013 You can disable this operator by defining \c-
3014 QT_NO_CAST_FROM_ASCII when you compile your applications. You-
3015 then need to call QString::fromUtf8(), QString::fromLatin1(),-
3016 or QString::fromLocal8Bit() explicitly if you want to convert the byte-
3017 array to a QString before doing the comparison.-
3018*/-
3019-
3020/*! \fn bool QByteArray::operator<=(const QString &str) const-
3021-
3022 Returns \c true if this byte array is lexically less than or equal-
3023 to string \a str; otherwise returns \c false.-
3024-
3025 The Unicode data is converted into 8-bit characters using-
3026 QString::toUtf8().-
3027-
3028 The comparison is case sensitive.-
3029-
3030 You can disable this operator by defining \c-
3031 QT_NO_CAST_FROM_ASCII when you compile your applications. You-
3032 then need to call QString::fromUtf8(), QString::fromLatin1(),-
3033 or QString::fromLocal8Bit() explicitly if you want to convert the byte-
3034 array to a QString before doing the comparison.-
3035*/-
3036-
3037/*! \fn bool QByteArray::operator>=(const QString &str) const-
3038-
3039 Returns \c true if this byte array is greater than or equal to string-
3040 \a str; otherwise returns \c false.-
3041-
3042 The Unicode data is converted into 8-bit characters using-
3043 QString::toUtf8().-
3044-
3045 The comparison is case sensitive.-
3046-
3047 You can disable this operator by defining \c-
3048 QT_NO_CAST_FROM_ASCII when you compile your applications. You-
3049 then need to call QString::fromUtf8(), QString::fromLatin1(),-
3050 or QString::fromLocal8Bit() explicitly if you want to convert the byte-
3051 array to a QString before doing the comparison.-
3052*/-
3053-
3054/*! \fn bool operator==(const QByteArray &a1, const QByteArray &a2)-
3055 \relates QByteArray-
3056-
3057 \overload-
3058-
3059 Returns \c true if byte array \a a1 is equal to byte array \a a2;-
3060 otherwise returns \c false.-
3061*/-
3062-
3063/*! \fn bool operator==(const QByteArray &a1, const char *a2)-
3064 \relates QByteArray-
3065-
3066 \overload-
3067-
3068 Returns \c true if byte array \a a1 is equal to string \a a2;-
3069 otherwise returns \c false.-
3070*/-
3071-
3072/*! \fn bool operator==(const char *a1, const QByteArray &a2)-
3073 \relates QByteArray-
3074-
3075 \overload-
3076-
3077 Returns \c true if string \a a1 is equal to byte array \a a2;-
3078 otherwise returns \c false.-
3079*/-
3080-
3081/*! \fn bool operator!=(const QByteArray &a1, const QByteArray &a2)-
3082 \relates QByteArray-
3083-
3084 \overload-
3085-
3086 Returns \c true if byte array \a a1 is not equal to byte array \a a2;-
3087 otherwise returns \c false.-
3088*/-
3089-
3090/*! \fn bool operator!=(const QByteArray &a1, const char *a2)-
3091 \relates QByteArray-
3092-
3093 \overload-
3094-
3095 Returns \c true if byte array \a a1 is not equal to string \a a2;-
3096 otherwise returns \c false.-
3097*/-
3098-
3099/*! \fn bool operator!=(const char *a1, const QByteArray &a2)-
3100 \relates QByteArray-
3101-
3102 \overload-
3103-
3104 Returns \c true if string \a a1 is not equal to byte array \a a2;-
3105 otherwise returns \c false.-
3106*/-
3107-
3108/*! \fn bool operator<(const QByteArray &a1, const QByteArray &a2)-
3109 \relates QByteArray-
3110-
3111 \overload-
3112-
3113 Returns \c true if byte array \a a1 is lexically less than byte array-
3114 \a a2; otherwise returns \c false.-
3115*/-
3116-
3117/*! \fn inline bool operator<(const QByteArray &a1, const char *a2)-
3118 \relates QByteArray-
3119-
3120 \overload-
3121-
3122 Returns \c true if byte array \a a1 is lexically less than string-
3123 \a a2; otherwise returns \c false.-
3124*/-
3125-
3126/*! \fn bool operator<(const char *a1, const QByteArray &a2)-
3127 \relates QByteArray-
3128-
3129 \overload-
3130-
3131 Returns \c true if string \a a1 is lexically less than byte array-
3132 \a a2; otherwise returns \c false.-
3133*/-
3134-
3135/*! \fn bool operator<=(const QByteArray &a1, const QByteArray &a2)-
3136 \relates QByteArray-
3137-
3138 \overload-
3139-
3140 Returns \c true if byte array \a a1 is lexically less than or equal-
3141 to byte array \a a2; otherwise returns \c false.-
3142*/-
3143-
3144/*! \fn bool operator<=(const QByteArray &a1, const char *a2)-
3145 \relates QByteArray-
3146-
3147 \overload-
3148-
3149 Returns \c true if byte array \a a1 is lexically less than or equal-
3150 to string \a a2; otherwise returns \c false.-
3151*/-
3152-
3153/*! \fn bool operator<=(const char *a1, const QByteArray &a2)-
3154 \relates QByteArray-
3155-
3156 \overload-
3157-
3158 Returns \c true if string \a a1 is lexically less than or equal-
3159 to byte array \a a2; otherwise returns \c false.-
3160*/-
3161-
3162/*! \fn bool operator>(const QByteArray &a1, const QByteArray &a2)-
3163 \relates QByteArray-
3164-
3165 \overload-
3166-
3167 Returns \c true if byte array \a a1 is lexically greater than byte-
3168 array \a a2; otherwise returns \c false.-
3169*/-
3170-
3171/*! \fn bool operator>(const QByteArray &a1, const char *a2)-
3172 \relates QByteArray-
3173-
3174 \overload-
3175-
3176 Returns \c true if byte array \a a1 is lexically greater than string-
3177 \a a2; otherwise returns \c false.-
3178*/-
3179-
3180/*! \fn bool operator>(const char *a1, const QByteArray &a2)-
3181 \relates QByteArray-
3182-
3183 \overload-
3184-
3185 Returns \c true if string \a a1 is lexically greater than byte array-
3186 \a a2; otherwise returns \c false.-
3187*/-
3188-
3189/*! \fn bool operator>=(const QByteArray &a1, const QByteArray &a2)-
3190 \relates QByteArray-
3191-
3192 \overload-
3193-
3194 Returns \c true if byte array \a a1 is lexically greater than or-
3195 equal to byte array \a a2; otherwise returns \c false.-
3196*/-
3197-
3198/*! \fn bool operator>=(const QByteArray &a1, const char *a2)-
3199 \relates QByteArray-
3200-
3201 \overload-
3202-
3203 Returns \c true if byte array \a a1 is lexically greater than or-
3204 equal to string \a a2; otherwise returns \c false.-
3205*/-
3206-
3207/*! \fn bool operator>=(const char *a1, const QByteArray &a2)-
3208 \relates QByteArray-
3209-
3210 \overload-
3211-
3212 Returns \c true if string \a a1 is lexically greater than or-
3213 equal to byte array \a a2; otherwise returns \c false.-
3214*/-
3215-
3216/*! \fn const QByteArray operator+(const QByteArray &a1, const QByteArray &a2)-
3217 \relates QByteArray-
3218-
3219 Returns a byte array that is the result of concatenating byte-
3220 array \a a1 and byte array \a a2.-
3221-
3222 \sa QByteArray::operator+=()-
3223*/-
3224-
3225/*! \fn const QByteArray operator+(const QByteArray &a1, const char *a2)-
3226 \relates QByteArray-
3227-
3228 \overload-
3229-
3230 Returns a byte array that is the result of concatenating byte-
3231 array \a a1 and string \a a2.-
3232*/-
3233-
3234/*! \fn const QByteArray operator+(const QByteArray &a1, char a2)-
3235 \relates QByteArray-
3236-
3237 \overload-
3238-
3239 Returns a byte array that is the result of concatenating byte-
3240 array \a a1 and character \a a2.-
3241*/-
3242-
3243/*! \fn const QByteArray operator+(const char *a1, const QByteArray &a2)-
3244 \relates QByteArray-
3245-
3246 \overload-
3247-
3248 Returns a byte array that is the result of concatenating string-
3249 \a a1 and byte array \a a2.-
3250*/-
3251-
3252/*! \fn const QByteArray operator+(char a1, const QByteArray &a2)-
3253 \relates QByteArray-
3254-
3255 \overload-
3256-
3257 Returns a byte array that is the result of concatenating character-
3258 \a a1 and byte array \a a2.-
3259*/-
3260-
3261/*!-
3262 \fn QByteArray QByteArray::simplified() const-
3263-
3264 Returns a byte array that has whitespace removed from the start-
3265 and the end, and which has each sequence of internal whitespace-
3266 replaced with a single space.-
3267-
3268 Whitespace means any character for which the standard C++-
3269 \c isspace() function returns \c true in the C locale. This includes the ASCII-
3270 isspace() function returns \c true in the C locale. This includes the ASCII-
3271 characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '.-
3272-
3273 Example:-
3274 \snippet code/src_corelib_tools_qbytearray.cpp 32-
3275-
3276 \sa trimmed()-
3277*/-
3278QByteArray QByteArray::simplified_helper(const QByteArray &a)-
3279{-
3280 return QStringAlgorithms<const QByteArray>::simplified_helper(a);
executed 12102 times by 2 tests: return QStringAlgorithms<const QByteArray>::simplified_helper(a);
Executed by:
  • tst_QLogging
  • tst_QTcpSocket
12102
3281}-
3282-
3283QByteArray QByteArray::simplified_helper(QByteArray &a)-
3284{-
3285 return QStringAlgorithms<QByteArray>::simplified_helper(a);
executed 55978 times by 32 tests: return QStringAlgorithms<QByteArray>::simplified_helper(a);
Executed by:
  • tst_QAbstractButton
  • tst_QAccessibility
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • tst_QPrinter
  • tst_QRegion
  • tst_QSizeGrip
  • tst_QStyle
  • tst_QSystemTrayIcon
  • tst_QToolBar
  • ...
55978
3286}-
3287-
3288/*!-
3289 \fn QByteArray QByteArray::trimmed() const-
3290-
3291 Returns a byte array that has whitespace removed from the start-
3292 and the end.-
3293-
3294 Whitespace means any character for which the standard C++-
3295 \c isspace() function returns \c true in the C locale. This includes the ASCII-
3296 characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '.-
3297-
3298 Example:-
3299 \snippet code/src_corelib_tools_qbytearray.cpp 33-
3300-
3301 Unlike simplified(), \l {QByteArray::trimmed()}{trimmed()} leaves internal whitespace alone.-
3302-
3303 \sa simplified()-
3304*/-
3305QByteArray QByteArray::trimmed_helper(const QByteArray &a)-
3306{-
3307 return QStringAlgorithms<const QByteArray>::trimmed_helper(a);
executed 29463 times by 47 tests: return QStringAlgorithms<const QByteArray>::trimmed_helper(a);
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAuthenticator
  • tst_QCalendarWidget
  • tst_QChar
  • tst_QColorDialog
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataUrl
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QMetaType
  • tst_QMimeData
  • ...
29463
3308}-
3309-
3310QByteArray QByteArray::trimmed_helper(QByteArray &a)-
3311{-
3312 return QStringAlgorithms<QByteArray>::trimmed_helper(a);
executed 88495 times by 52 tests: return QStringAlgorithms<QByteArray>::trimmed_helper(a);
Executed by:
  • tst_QAbstractButton
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QDBusConnection
  • tst_QDBusConnection_SpyHook
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileSystemModel
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QMessageBox
  • ...
88495
3313}-
3314-
3315-
3316/*!-
3317 Returns a byte array of size \a width that contains this byte-
3318 array padded by the \a fill character.-
3319-
3320 If \a truncate is false and the size() of the byte array is more-
3321 than \a width, then the returned byte array is a copy of this byte-
3322 array.-
3323-
3324 If \a truncate is true and the size() of the byte array is more-
3325 than \a width, then any bytes in a copy of the byte array-
3326 after position \a width are removed, and the copy is returned.-
3327-
3328 Example:-
3329 \snippet code/src_corelib_tools_qbytearray.cpp 34-
3330-
3331 \sa rightJustified()-
3332*/-
3333-
3334QByteArray QByteArray::leftJustified(int width, char fill, bool truncate) const-
3335{-
3336 QByteArray result;-
3337 int len = d->size;-
3338 int padlen = width - len;-
3339 if (padlen > 0) {
padlen > 0Description
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QByteArray
8-13
3340 result.resize(len+padlen);-
3341 if (len)
lenDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-12
3342 memcpy(result.d->data(), d->data(), len);
executed 12 times by 2 tests: memcpy(result.d->data(), d->data(), len);
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
12
3343 memset(result.d->data()+len, fill, padlen);-
3344 } else {
executed 13 times by 2 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
13
3345 if (truncate)
truncateDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArray
4
3346 result = left(width);
executed 4 times by 1 test: result = left(width);
Executed by:
  • tst_QByteArray
4
3347 else-
3348 result = *this;
executed 4 times by 1 test: result = *this;
Executed by:
  • tst_QByteArray
4
3349 }-
3350 return result;
executed 21 times by 2 tests: return result;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
21
3351}-
3352-
3353/*!-
3354 Returns a byte array of size \a width that contains the \a fill-
3355 character followed by this byte array.-
3356-
3357 If \a truncate is false and the size of the byte array is more-
3358 than \a width, then the returned byte array is a copy of this byte-
3359 array.-
3360-
3361 If \a truncate is true and the size of the byte array is more-
3362 than \a width, then the resulting byte array is truncated at-
3363 position \a width.-
3364-
3365 Example:-
3366 \snippet code/src_corelib_tools_qbytearray.cpp 35-
3367-
3368 \sa leftJustified()-
3369*/-
3370-
3371QByteArray QByteArray::rightJustified(int width, char fill, bool truncate) const-
3372{-
3373 QByteArray result;-
3374 int len = d->size;-
3375 int padlen = width - len;-
3376 if (padlen > 0) {
padlen > 0Description
TRUEevaluated 3107 times by 10 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 4789 times by 10 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
3107-4789
3377 result.resize(len+padlen);-
3378 if (len)
lenDescription
TRUEevaluated 3106 times by 10 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
1-3106
3379 memcpy(result.d->data()+padlen, data(), len);
executed 3106 times by 10 tests: memcpy(result.d->data()+padlen, data(), len);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
3106
3380 memset(result.d->data(), fill, padlen);-
3381 } else {
executed 3107 times by 10 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
3107
3382 if (truncate)
truncateDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 4785 times by 10 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
4-4785
3383 result = left(width);
executed 4 times by 1 test: result = left(width);
Executed by:
  • tst_QByteArray
4
3384 else-
3385 result = *this;
executed 4785 times by 10 tests: result = *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
4785
3386 }-
3387 return result;
executed 7896 times by 10 tests: return result;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
7896
3388}-
3389-
3390bool QByteArray::isNull() const { return d == QArrayData::sharedNull(); }
executed 687081 times by 428 tests: return d == QArrayData::sharedNull();
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • ...
687081
3391-
3392static qlonglong toIntegral_helper(const char *data, bool *ok, int base, qlonglong)-
3393{-
3394 return QLocaleData::bytearrayToLongLong(data, base, ok);
executed 197709 times by 65 tests: return QLocaleData::bytearrayToLongLong(data, base, ok);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFtp
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QLockFile
  • tst_QMdiArea
  • ...
197709
3395}-
3396-
3397static qulonglong toIntegral_helper(const char *data, bool *ok, int base, qulonglong)-
3398{-
3399 return QLocaleData::bytearrayToUnsLongLong(data, base, ok);
executed 8787 times by 23 tests: return QLocaleData::bytearrayToUnsLongLong(data, base, ok);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdbusabstractadaptor - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qprocess - unknown status
  • tst_qsystemsemaphore - unknown status
8787
3400}-
3401-
3402template <typename T> static inline-
3403T toIntegral_helper(const char *data, bool *ok, int base)-
3404{-
3405 // ### Qt6: use std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type-
3406 const bool isUnsigned = T(0) < T(-1);-
3407 typedef typename QtPrivate::QConditional<isUnsigned, qulonglong, qlonglong>::Type Int64;-
3408-
3409#if defined(QT_CHECK_RANGE)-
3410 if (base != 0 && (base < 2 || base > 36)) {-
3411 qWarning("QByteArray::toIntegral: Invalid base %d", base);-
3412 base = 10;-
3413 }-
3414#endif-
3415-
3416 // we select the right overload by the last, unused parameter-
3417 Int64 val = toIntegral_helper(data, ok, base, Int64());-
3418 if (T(val) != val) {
T(val) != valDescription
TRUEnever evaluated
FALSEevaluated 206496 times by 70 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFtp
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QLockFile
  • ...
0-206496
3419 if (ok)
okDescription
TRUEnever evaluated
FALSEnever evaluated
0
3420 *ok = false;
never executed: *ok = false;
0
3421 val = 0;-
3422 }
never executed: end of block
0
3423 return T(val);
executed 206496 times by 70 tests: return T(val);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFtp
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QLockFile
  • ...
206496
3424}-
3425-
3426/*!-
3427 Returns the byte array converted to a \c {long long} using base \a-
3428 base, which is 10 by default and must be between 2 and 36, or 0.-
3429-
3430 If \a base is 0, the base is determined automatically using the-
3431 following rules: If the byte array begins with "0x", it is assumed to-
3432 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3433 otherwise it is assumed to be decimal.-
3434-
3435 Returns 0 if the conversion fails.-
3436-
3437 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3438 false; otherwise *\a{ok} is set to true.-
3439-
3440 \note The conversion of the number is performed in the default C locale,-
3441 irrespective of the user's locale.-
3442-
3443 \sa number()-
3444*/-
3445-
3446qlonglong QByteArray::toLongLong(bool *ok, int base) const-
3447{-
3448 return toIntegral_helper<qlonglong>(nulTerminated().constData(), ok, base);
executed 669 times by 10 tests: return toIntegral_helper<qlonglong>(nulTerminated().constData(), ok, base);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QLockFile
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QProcess
  • tst_QVariant
  • tst_Spdy
669
3449}-
3450-
3451/*!-
3452 Returns the byte array converted to an \c {unsigned long long}-
3453 using base \a base, which is 10 by default and must be between 2-
3454 and 36, or 0.-
3455-
3456 If \a base is 0, the base is determined automatically using the-
3457 following rules: If the byte array begins with "0x", it is assumed to-
3458 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3459 otherwise it is assumed to be decimal.-
3460-
3461 Returns 0 if the conversion fails.-
3462-
3463 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3464 false; otherwise *\a{ok} is set to true.-
3465-
3466 \note The conversion of the number is performed in the default C locale,-
3467 irrespective of the user's locale.-
3468-
3469 \sa number()-
3470*/-
3471-
3472qulonglong QByteArray::toULongLong(bool *ok, int base) const-
3473{-
3474 return toIntegral_helper<qulonglong>(nulTerminated().constData(), ok, base);
executed 8066 times by 17 tests: return toIntegral_helper<qulonglong>(nulTerminated().constData(), ok, base);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpNetworkReply
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qnetworkreply - unknown status
8066
3475}-
3476-
3477/*!-
3478 Returns the byte array converted to an \c int using base \a-
3479 base, which is 10 by default and must be between 2 and 36, or 0.-
3480-
3481 If \a base is 0, the base is determined automatically using the-
3482 following rules: If the byte array begins with "0x", it is assumed to-
3483 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3484 otherwise it is assumed to be decimal.-
3485-
3486 Returns 0 if the conversion fails.-
3487-
3488 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3489 false; otherwise *\a{ok} is set to true.-
3490-
3491 \snippet code/src_corelib_tools_qbytearray.cpp 36-
3492-
3493 \note The conversion of the number is performed in the default C locale,-
3494 irrespective of the user's locale.-
3495-
3496 \sa number()-
3497*/-
3498-
3499int QByteArray::toInt(bool *ok, int base) const-
3500{-
3501 return toIntegral_helper<int>(nulTerminated().constData(), ok, base);
executed 196767 times by 61 tests: return toIntegral_helper<int>(nulTerminated().constData(), ok, base);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QChar
  • tst_QDateTime
  • tst_QDockWidget
  • tst_QFtp
  • tst_QGLBuffer
  • tst_QGLFunctions
  • tst_QGLThreads
  • tst_QGraphicsView
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLayout
  • tst_QMdiArea
  • tst_QNetworkAccessManager
  • ...
196767
3502}-
3503-
3504/*!-
3505 Returns the byte array converted to an \c {unsigned int} using base \a-
3506 base, which is 10 by default and must be between 2 and 36, or 0.-
3507-
3508 If \a base is 0, the base is determined automatically using the-
3509 following rules: If the byte array begins with "0x", it is assumed to-
3510 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3511 otherwise it is assumed to be decimal.-
3512-
3513 Returns 0 if the conversion fails.-
3514-
3515 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3516 false; otherwise *\a{ok} is set to true.-
3517-
3518 \note The conversion of the number is performed in the default C locale,-
3519 irrespective of the user's locale.-
3520-
3521 \sa number()-
3522*/-
3523-
3524uint QByteArray::toUInt(bool *ok, int base) const-
3525{-
3526 return toIntegral_helper<uint>(nulTerminated().constData(), ok, base);
executed 711 times by 6 tests: return toIntegral_helper<uint>(nulTerminated().constData(), ok, base);
Executed by:
  • tst_QAsn1Element
  • tst_QMimeDatabase
  • tst_qdbusabstractadaptor - unknown status
  • tst_qlogging - unknown status
  • tst_qprocess - unknown status
  • tst_qsystemsemaphore - unknown status
711
3527}-
3528-
3529/*!-
3530 \since 4.1-
3531-
3532 Returns the byte array converted to a \c long int using base \a-
3533 base, which is 10 by default and must be between 2 and 36, or 0.-
3534-
3535 If \a base is 0, the base is determined automatically using the-
3536 following rules: If the byte array begins with "0x", it is assumed to-
3537 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3538 otherwise it is assumed to be decimal.-
3539-
3540 Returns 0 if the conversion fails.-
3541-
3542 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3543 false; otherwise *\a{ok} is set to true.-
3544-
3545 \snippet code/src_corelib_tools_qbytearray.cpp 37-
3546-
3547 \note The conversion of the number is performed in the default C locale,-
3548 irrespective of the user's locale.-
3549-
3550 \sa number()-
3551*/-
3552long QByteArray::toLong(bool *ok, int base) const-
3553{-
3554 return toIntegral_helper<long>(nulTerminated().constData(), ok, base);
executed 273 times by 4 tests: return toIntegral_helper<long>(nulTerminated().constData(), ok, base);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
273
3555}-
3556-
3557/*!-
3558 \since 4.1-
3559-
3560 Returns the byte array converted to an \c {unsigned long int} using base \a-
3561 base, which is 10 by default and must be between 2 and 36, or 0.-
3562-
3563 If \a base is 0, the base is determined automatically using the-
3564 following rules: If the byte array begins with "0x", it is assumed to-
3565 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3566 otherwise it is assumed to be decimal.-
3567-
3568 Returns 0 if the conversion fails.-
3569-
3570 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3571 false; otherwise *\a{ok} is set to true.-
3572-
3573 \note The conversion of the number is performed in the default C locale,-
3574 irrespective of the user's locale.-
3575-
3576 \sa number()-
3577*/-
3578ulong QByteArray::toULong(bool *ok, int base) const-
3579{-
3580 return toIntegral_helper<ulong>(nulTerminated().constData(), ok, base);
executed 10 times by 1 test: return toIntegral_helper<ulong>(nulTerminated().constData(), ok, base);
Executed by:
  • tst_QByteArray
10
3581}-
3582-
3583/*!-
3584 Returns the byte array converted to a \c short using base \a-
3585 base, which is 10 by default and must be between 2 and 36, or 0.-
3586-
3587 If \a base is 0, the base is determined automatically using the-
3588 following rules: If the byte array begins with "0x", it is assumed to-
3589 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3590 otherwise it is assumed to be decimal.-
3591-
3592 Returns 0 if the conversion fails.-
3593-
3594 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3595 false; otherwise *\a{ok} is set to true.-
3596-
3597 \note The conversion of the number is performed in the default C locale,-
3598 irrespective of the user's locale.-
3599-
3600 \sa number()-
3601*/-
3602-
3603short QByteArray::toShort(bool *ok, int base) const-
3604{-
3605 return toIntegral_helper<short>(nulTerminated().constData(), ok, base);
never executed: return toIntegral_helper<short>(nulTerminated().constData(), ok, base);
0
3606}-
3607-
3608/*!-
3609 Returns the byte array converted to an \c {unsigned short} using base \a-
3610 base, which is 10 by default and must be between 2 and 36, or 0.-
3611-
3612 If \a base is 0, the base is determined automatically using the-
3613 following rules: If the byte array begins with "0x", it is assumed to-
3614 be hexadecimal; if it begins with "0", it is assumed to be octal;-
3615 otherwise it is assumed to be decimal.-
3616-
3617 Returns 0 if the conversion fails.-
3618-
3619 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3620 false; otherwise *\a{ok} is set to true.-
3621-
3622 \note The conversion of the number is performed in the default C locale,-
3623 irrespective of the user's locale.-
3624-
3625 \sa number()-
3626*/-
3627-
3628ushort QByteArray::toUShort(bool *ok, int base) const-
3629{-
3630 return toIntegral_helper<ushort>(nulTerminated().constData(), ok, base);
never executed: return toIntegral_helper<ushort>(nulTerminated().constData(), ok, base);
0
3631}-
3632-
3633-
3634/*!-
3635 Returns the byte array converted to a \c double value.-
3636-
3637 Returns 0.0 if the conversion fails.-
3638-
3639 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3640 false; otherwise *\a{ok} is set to true.-
3641-
3642 \snippet code/src_corelib_tools_qbytearray.cpp 38-
3643-
3644 \note The conversion of the number is performed in the default C locale,-
3645 irrespective of the user's locale.-
3646-
3647 \sa number()-
3648*/-
3649-
3650double QByteArray::toDouble(bool *ok) const-
3651{-
3652 return QLocaleData::bytearrayToDouble(nulTerminated().constData(), ok);
executed 6 times by 1 test: return QLocaleData::bytearrayToDouble(nulTerminated().constData(), ok);
Executed by:
  • tst_QVariant
6
3653}-
3654-
3655/*!-
3656 Returns the byte array converted to a \c float value.-
3657-
3658 Returns 0.0 if the conversion fails.-
3659-
3660 If \a ok is not 0: if a conversion error occurs, *\a{ok} is set to-
3661 false; otherwise *\a{ok} is set to true.-
3662-
3663 \note The conversion of the number is performed in the default C locale,-
3664 irrespective of the user's locale.-
3665-
3666 \sa number()-
3667*/-
3668-
3669float QByteArray::toFloat(bool *ok) const-
3670{-
3671 return QLocaleData::convertDoubleToFloat(toDouble(ok), ok);
executed 3 times by 1 test: return QLocaleData::convertDoubleToFloat(toDouble(ok), ok);
Executed by:
  • tst_QVariant
3
3672}-
3673-
3674/*!-
3675 Returns a copy of the byte array, encoded as Base64.-
3676-
3677 \snippet code/src_corelib_tools_qbytearray.cpp 39-
3678-
3679 The algorithm used to encode Base64-encoded data is defined in \l{RFC 4648}.-
3680-
3681 \sa fromBase64()-
3682*/-
3683QByteArray QByteArray::toBase64() const-
3684{-
3685 return toBase64(Base64Encoding);
executed 751 times by 13 tests: return toBase64(Base64Encoding);
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
751
3686}-
3687-
3688/*!-
3689 \since 5.2-
3690 \overload-
3691-
3692 Returns a copy of the byte array, encoded using the options \a options.-
3693-
3694 \snippet code/src_corelib_tools_qbytearray.cpp 39bis-
3695-
3696 The algorithm used to encode Base64-encoded data is defined in \l{RFC 4648}.-
3697-
3698 \sa fromBase64()-
3699*/-
3700QByteArray QByteArray::toBase64(Base64Options options) const-
3701{-
3702 const char alphabet_base64[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"-
3703 "ghijklmn" "opqrstuv" "wxyz0123" "456789+/";-
3704 const char alphabet_base64url[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"-
3705 "ghijklmn" "opqrstuv" "wxyz0123" "456789-_";-
3706 const char *const alphabet = options & Base64UrlEncoding ? alphabet_base64url : alphabet_base64;
options & Base64UrlEncodingDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 787 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
36-787
3707 const char padchar = '=';-
3708 int padlen = 0;-
3709-
3710 QByteArray tmp((d->size + 2) / 3 * 4, Qt::Uninitialized);-
3711-
3712 int i = 0;-
3713 char *out = tmp.data();-
3714 while (i < d->size) {
i < d->sizeDescription
TRUEevaluated 746920 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
FALSEevaluated 823 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
823-746920
3715 // encode 3 bytes at a time-
3716 int chunk = 0;-
3717 chunk |= int(uchar(d->data()[i++])) << 16;-
3718 if (i == d->size) {
i == d->sizeDescription
TRUEevaluated 420 times by 12 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
FALSEevaluated 746500 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
420-746500
3719 padlen = 2;-
3720 } else {
executed 420 times by 12 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
420
3721 chunk |= int(uchar(d->data()[i++])) << 8;-
3722 if (i == d->size)
i == d->sizeDescription
TRUEevaluated 250 times by 7 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
FALSEevaluated 746250 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
250-746250
3723 padlen = 1;
executed 250 times by 7 tests: padlen = 1;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
250
3724 else-
3725 chunk |= int(uchar(data()[i++]));
executed 746250 times by 13 tests: chunk |= int(uchar(data()[i++]));
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
746250
3726 }-
3727-
3728 int j = (chunk & 0x00fc0000) >> 18;-
3729 int k = (chunk & 0x0003f000) >> 12;-
3730 int l = (chunk & 0x00000fc0) >> 6;-
3731 int m = (chunk & 0x0000003f);-
3732 *out++ = alphabet[j];-
3733 *out++ = alphabet[k];-
3734-
3735 if (padlen > 1) {
padlen > 1Description
TRUEevaluated 420 times by 12 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
FALSEevaluated 746500 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
420-746500
3736 if ((options & OmitTrailingEquals) == 0)
(options & Omi...ngEquals) == 0Description
TRUEevaluated 406 times by 12 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QByteArray
14-406
3737 *out++ = padchar;
executed 406 times by 12 tests: *out++ = padchar;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
406
3738 } else {
executed 420 times by 12 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
420
3739 *out++ = alphabet[l];-
3740 }
executed 746500 times by 13 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
746500
3741 if (padlen > 0) {
padlen > 0Description
TRUEevaluated 670 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
FALSEevaluated 746250 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
670-746250
3742 if ((options & OmitTrailingEquals) == 0)
(options & Omi...ngEquals) == 0Description
TRUEevaluated 644 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QByteArray
26-644
3743 *out++ = padchar;
executed 644 times by 13 tests: *out++ = padchar;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
644
3744 } else {
executed 670 times by 13 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
670
3745 *out++ = alphabet[m];-
3746 }
executed 746250 times by 13 tests: end of block
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
746250
3747 }-
3748 Q_ASSERT((options & OmitTrailingEquals) || (out == tmp.size() + tmp.data()));-
3749 if (options & OmitTrailingEquals)
options & OmitTrailingEqualsDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 787 times by 13 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
36-787
3750 tmp.truncate(out - tmp.data());
executed 36 times by 1 test: tmp.truncate(out - tmp.data());
Executed by:
  • tst_QByteArray
36
3751 return tmp;
executed 823 times by 13 tests: return tmp;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_Spdy
823
3752}-
3753-
3754/*!-
3755 \fn QByteArray &QByteArray::setNum(int n, int base)-
3756-
3757 Sets the byte array to the printed value of \a n in base \a base (10-
3758 by default) and returns a reference to the byte array. The \a base can-
3759 be any value between 2 and 36. For bases other than 10, n is treated-
3760 as an unsigned integer.-
3761-
3762 Example:-
3763 \snippet code/src_corelib_tools_qbytearray.cpp 40-
3764-
3765 \note The format of the number is not localized; the default C locale-
3766 is used irrespective of the user's locale.-
3767-
3768 \sa number(), toInt()-
3769*/-
3770-
3771/*!-
3772 \fn QByteArray &QByteArray::setNum(uint n, int base)-
3773 \overload-
3774-
3775 \sa toUInt()-
3776*/-
3777-
3778/*!-
3779 \fn QByteArray &QByteArray::setNum(short n, int base)-
3780 \overload-
3781-
3782 \sa toShort()-
3783*/-
3784-
3785/*!-
3786 \fn QByteArray &QByteArray::setNum(ushort n, int base)-
3787 \overload-
3788-
3789 \sa toUShort()-
3790*/-
3791-
3792static char *qulltoa2(char *p, qulonglong n, int base)-
3793{-
3794#if defined(QT_CHECK_RANGE)-
3795 if (base < 2 || base > 36) {-
3796 qWarning("QByteArray::setNum: Invalid base %d", base);-
3797 base = 10;-
3798 }-
3799#endif-
3800 const char b = 'a' - 10;-
3801 do {-
3802 const int c = n % base;-
3803 n /= base;-
3804 *--p = c + (c < 10 ? '0' : b);
c < 10Description
TRUEevaluated 2324959 times by 97 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • ...
FALSEevaluated 34105 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSettings
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextEdit
  • tst_QUrlInternal
  • ...
34105-2324959
3805 } while (n);
executed 2359064 times by 97 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • ...
nDescription
TRUEevaluated 1913136 times by 72 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFtp
  • ...
FALSEevaluated 445928 times by 97 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • ...
445928-2359064
3806-
3807 return p;
executed 445928 times by 97 tests: return p;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • ...
445928
3808}-
3809-
3810/*!-
3811 \overload-
3812-
3813 \sa toLongLong()-
3814*/-
3815QByteArray &QByteArray::setNum(qlonglong n, int base)-
3816{-
3817 const int buffsize = 66; // big enough for MAX_ULLONG in base 2-
3818 char buff[buffsize];-
3819 char *p;-
3820-
3821 if (n < 0 && base == 10) {
n < 0Description
TRUEevaluated 186 times by 5 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QGetPutEnv
  • tst_QNetworkDiskCache
  • tst_QVariant
FALSEevaluated 424982 times by 90 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • tst_QFileDialog2
  • tst_QFileSystemWatcher
  • ...
base == 10Description
TRUEevaluated 18 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QGetPutEnv
  • tst_QVariant
FALSEevaluated 168 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QNetworkDiskCache
18-424982
3822 p = qulltoa2(buff + buffsize, qulonglong(-(1 + n)) + 1, base);-
3823 *--p = '-';-
3824 } else {
executed 18 times by 3 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QGetPutEnv
  • tst_QVariant
18
3825 p = qulltoa2(buff + buffsize, qulonglong(n), base);-
3826 }
executed 425150 times by 90 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • tst_QFileDialog2
  • tst_QFileSystemWatcher
  • ...
425150
3827-
3828 clear();-
3829 append(p, buffsize - (p - buff));-
3830 return *this;
executed 425168 times by 90 tests: return *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • tst_QFileDialog2
  • tst_QFileSystemWatcher
  • ...
425168
3831}-
3832-
3833/*!-
3834 \overload-
3835-
3836 \sa toULongLong()-
3837*/-
3838-
3839QByteArray &QByteArray::setNum(qulonglong n, int base)-
3840{-
3841 const int buffsize = 66; // big enough for MAX_ULLONG in base 2-
3842 char buff[buffsize];-
3843 char *p = qulltoa2(buff + buffsize, n, base);-
3844-
3845 clear();-
3846 append(p, buffsize - (p - buff));-
3847 return *this;
executed 20760 times by 33 tests: return *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSettings
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • ...
20760
3848}-
3849-
3850/*!-
3851 \overload-
3852-
3853 Sets the byte array to the printed value of \a n, formatted in format-
3854 \a f with precision \a prec, and returns a reference to the-
3855 byte array.-
3856-
3857 The format \a f can be any of the following:-
3858-
3859 \table-
3860 \header \li Format \li Meaning-
3861 \row \li \c e \li format as [-]9.9e[+|-]999-
3862 \row \li \c E \li format as [-]9.9E[+|-]999-
3863 \row \li \c f \li format as [-]9.9-
3864 \row \li \c g \li use \c e or \c f format, whichever is the most concise-
3865 \row \li \c G \li use \c E or \c f format, whichever is the most concise-
3866 \endtable-
3867-
3868 With 'e', 'E', and 'f', \a prec is the number of digits after the-
3869 decimal point. With 'g' and 'G', \a prec is the maximum number of-
3870 significant digits (trailing zeroes are omitted).-
3871-
3872 \note The format of the number is not localized; the default C locale-
3873 is used irrespective of the user's locale.-
3874-
3875 \sa toDouble()-
3876*/-
3877-
3878QByteArray &QByteArray::setNum(double n, char f, int prec)-
3879{-
3880 QLocaleData::DoubleForm form = QLocaleData::DFDecimal;-
3881 uint flags = 0;-
3882-
3883 if (qIsUpper(f))
qIsUpper(f)Description
TRUEnever evaluated
FALSEevaluated 217 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
0-217
3884 flags = QLocaleData::CapitalEorX;
never executed: flags = QLocaleData::CapitalEorX;
0
3885 f = qToLower(f);-
3886-
3887 switch (f) {-
3888 case 'f':
never executed: case 'f':
0
3889 form = QLocaleData::DFDecimal;-
3890 break;
never executed: break;
0
3891 case 'e':
never executed: case 'e':
0
3892 form = QLocaleData::DFExponent;-
3893 break;
never executed: break;
0
3894 case 'g':
executed 217 times by 3 tests: case 'g':
Executed by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
217
3895 form = QLocaleData::DFSignificantDigits;-
3896 break;
executed 217 times by 3 tests: break;
Executed by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
217
3897 default:
never executed: default:
0
3898#if defined(QT_CHECK_RANGE)-
3899 qWarning("QByteArray::setNum: Invalid format char '%c'", f);-
3900#endif-
3901 break;
never executed: break;
0
3902 }-
3903-
3904 *this = QLocaleData::c()->doubleToString(n, prec, form, -1, flags).toLatin1();-
3905 return *this;
executed 217 times by 3 tests: return *this;
Executed by:
  • tst_QByteArray
  • tst_QVariant
  • tst_selftests - unknown status
217
3906}-
3907-
3908/*!-
3909 \fn QByteArray &QByteArray::setNum(float n, char f, int prec)-
3910 \overload-
3911-
3912 Sets the byte array to the printed value of \a n, formatted in format-
3913 \a f with precision \a prec, and returns a reference to the-
3914 byte array.-
3915-
3916 \note The format of the number is not localized; the default C locale-
3917 is used irrespective of the user's locale.-
3918-
3919 \sa toFloat()-
3920*/-
3921-
3922/*!-
3923 Returns a byte array containing the string equivalent of the-
3924 number \a n to base \a base (10 by default). The \a base can be-
3925 any value between 2 and 36.-
3926-
3927 Example:-
3928 \snippet code/src_corelib_tools_qbytearray.cpp 41-
3929-
3930 \note The format of the number is not localized; the default C locale-
3931 is used irrespective of the user's locale.-
3932-
3933 \sa setNum(), toInt()-
3934*/-
3935QByteArray QByteArray::number(int n, int base)-
3936{-
3937 QByteArray s;-
3938 s.setNum(n, base);-
3939 return s;
executed 432570 times by 87 tests: return s;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QAlgorithms
  • tst_QApplication
  • tst_QAsn1Element
  • tst_QAuthenticator
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDBusXmlParser
  • tst_QDate
  • tst_QDialog
  • tst_QDir
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • ...
432570
3940}-
3941-
3942/*!-
3943 \overload-
3944-
3945 \sa toUInt()-
3946*/-
3947QByteArray QByteArray::number(uint n, int base)-
3948{-
3949 QByteArray s;-
3950 s.setNum(n, base);-
3951 return s;
executed 7587 times by 9 tests: return s;
Executed by:
  • tst_QAsn1Element
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QSettings
  • tst_languageChange
7587
3952}-
3953-
3954/*!-
3955 \overload-
3956-
3957 \sa toLongLong()-
3958*/-
3959QByteArray QByteArray::number(qlonglong n, int base)-
3960{-
3961 QByteArray s;-
3962 s.setNum(n, base);-
3963 return s;
executed 1419 times by 21 tests: return s;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QByteArray
  • tst_QColorDialog
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGetPutEnv
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QLockFile
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSettings
  • tst_QSslCertificate
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
  • tst_qlockfile - unknown status
  • tst_qmessagehandler
1419
3964}-
3965-
3966/*!-
3967 \overload-
3968-
3969 \sa toULongLong()-
3970*/-
3971QByteArray QByteArray::number(qulonglong n, int base)-
3972{-
3973 QByteArray s;-
3974 s.setNum(n, base);-
3975 return s;
executed 4329 times by 4 tests: return s;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAlgorithms
  • tst_QByteArray
  • tst_QVariant
4329
3976}-
3977-
3978/*!-
3979 \overload-
3980-
3981 Returns a byte array that contains the printed value of \a n,-
3982 formatted in format \a f with precision \a prec.-
3983-
3984 Argument \a n is formatted according to the \a f format specified,-
3985 which is \c g by default, and can be any of the following:-
3986-
3987 \table-
3988 \header \li Format \li Meaning-
3989 \row \li \c e \li format as [-]9.9e[+|-]999-
3990 \row \li \c E \li format as [-]9.9E[+|-]999-
3991 \row \li \c f \li format as [-]9.9-
3992 \row \li \c g \li use \c e or \c f format, whichever is the most concise-
3993 \row \li \c G \li use \c E or \c f format, whichever is the most concise-
3994 \endtable-
3995-
3996 With 'e', 'E', and 'f', \a prec is the number of digits after the-
3997 decimal point. With 'g' and 'G', \a prec is the maximum number of-
3998 significant digits (trailing zeroes are omitted).-
3999-
4000 \snippet code/src_corelib_tools_qbytearray.cpp 42-
4001-
4002 \note The format of the number is not localized; the default C locale-
4003 is used irrespective of the user's locale.-
4004-
4005 \sa toDouble()-
4006*/-
4007QByteArray QByteArray::number(double n, char f, int prec)-
4008{-
4009 QByteArray s;-
4010 s.setNum(n, f, prec);-
4011 return s;
executed 214 times by 2 tests: return s;
Executed by:
  • tst_QVariant
  • tst_selftests - unknown status
214
4012}-
4013-
4014/*!-
4015 Constructs a QByteArray that uses the first \a size bytes of the-
4016 \a data array. The bytes are \e not copied. The QByteArray will-
4017 contain the \a data pointer. The caller guarantees that \a data-
4018 will not be deleted or modified as long as this QByteArray and any-
4019 copies of it exist that have not been modified. In other words,-
4020 because QByteArray is an \l{implicitly shared} class and the-
4021 instance returned by this function contains the \a data pointer,-
4022 the caller must not delete \a data or modify it directly as long-
4023 as the returned QByteArray and any copies exist. However,-
4024 QByteArray does not take ownership of \a data, so the QByteArray-
4025 destructor will never delete the raw \a data, even when the-
4026 last QByteArray referring to \a data is destroyed.-
4027-
4028 A subsequent attempt to modify the contents of the returned-
4029 QByteArray or any copy made from it will cause it to create a deep-
4030 copy of the \a data array before doing the modification. This-
4031 ensures that the raw \a data array itself will never be modified-
4032 by QByteArray.-
4033-
4034 Here is an example of how to read data using a QDataStream on raw-
4035 data in memory without copying the raw data into a QByteArray:-
4036-
4037 \snippet code/src_corelib_tools_qbytearray.cpp 43-
4038-
4039 \warning A byte array created with fromRawData() is \e not-
4040 null-terminated, unless the raw data contains a 0 character at-
4041 position \a size. While that does not matter for QDataStream or-
4042 functions like indexOf(), passing the byte array to a function-
4043 accepting a \c{const char *} expected to be '\\0'-terminated will-
4044 fail.-
4045-
4046 \sa setRawData(), data(), constData()-
4047*/-
4048-
4049QByteArray QByteArray::fromRawData(const char *data, int size)-
4050{-
4051 Data *x;-
4052 if (!data) {
!dataDescription
TRUEnever evaluated
FALSEevaluated 1816242 times by 572 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-1816242
4053 x = Data::sharedNull();-
4054 } else if (!size) {
never executed: end of block
!sizeDescription
TRUEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QImage
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 1816223 times by 572 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-1816223
4055 x = Data::allocate(0);-
4056 } else {
executed 19 times by 4 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QImage
  • tst_QNetworkReply
  • tst_Spdy
19
4057 x = Data::fromRawData(data, size);-
4058 Q_CHECK_PTR(x);
never executed: qBadAlloc();
!(x)Description
TRUEnever evaluated
FALSEevaluated 1816223 times by 572 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-1816223
4059 }
executed 1816223 times by 572 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1816223
4060 QByteArrayDataPtr dataPtr = { x };-
4061 return QByteArray(dataPtr);
executed 1816242 times by 572 tests: return QByteArray(dataPtr);
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1816242
4062}-
4063-
4064/*!-
4065 \since 4.7-
4066-
4067 Resets the QByteArray to use the first \a size bytes of the-
4068 \a data array. The bytes are \e not copied. The QByteArray will-
4069 contain the \a data pointer. The caller guarantees that \a data-
4070 will not be deleted or modified as long as this QByteArray and any-
4071 copies of it exist that have not been modified.-
4072-
4073 This function can be used instead of fromRawData() to re-use-
4074 existing QByteArray objects to save memory re-allocations.-
4075-
4076 \sa fromRawData(), data(), constData()-
4077*/-
4078QByteArray &QByteArray::setRawData(const char *data, uint size)-
4079{-
4080 if (d->ref.isShared() || d->alloc) {
d->ref.isShared()Description
TRUEevaluated 9 times by 4 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QNetworkProxyFactory
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEevaluated 63 times by 4 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QNetworkProxyFactory
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
d->allocDescription
TRUEnever evaluated
FALSEevaluated 63 times by 4 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QNetworkProxyFactory
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
0-63
4081 *this = fromRawData(data, size);-
4082 } else {
executed 9 times by 4 tests: end of block
Executed by:
  • tst_QFileSelector
  • tst_QNetworkProxyFactory
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
4083 if (data) {
dataDescription
TRUEevaluated 63 times by 4 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QNetworkProxyFactory
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEnever evaluated
0-63
4084 d->size = size;-
4085 d->offset = data - reinterpret_cast<char *>(d);-
4086 } else {
executed 63 times by 4 tests: end of block
Executed by:
  • tst_QFileSelector
  • tst_QNetworkProxyFactory
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
63
4087 d->offset = sizeof(QByteArrayData);-
4088 d->size = 0;-
4089 *d->data() = 0;-
4090 }
never executed: end of block
0
4091 }-
4092 return *this;
executed 72 times by 4 tests: return *this;
Executed by:
  • tst_QFileSelector
  • tst_QNetworkProxyFactory
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
72
4093}-
4094-
4095/*!-
4096 Returns a decoded copy of the Base64 array \a base64. Input is not checked-
4097 for validity; invalid characters in the input are skipped, enabling the-
4098 decoding process to continue with subsequent characters.-
4099-
4100 For example:-
4101-
4102 \snippet code/src_corelib_tools_qbytearray.cpp 44-
4103-
4104 The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.-
4105-
4106 \sa toBase64()-
4107*/-
4108QByteArray QByteArray::fromBase64(const QByteArray &base64)-
4109{-
4110 return fromBase64(base64, Base64Encoding);
executed 20612 times by 12 tests: return fromBase64(base64, Base64Encoding);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
20612
4111}-
4112-
4113/*!-
4114 \since 5.2-
4115 \overload-
4116-
4117 Returns a decoded copy of the Base64 array \a base64, using the alphabet-
4118 defined by \a options. Input is not checked for validity; invalid-
4119 characters in the input are skipped, enabling the decoding process to-
4120 continue with subsequent characters.-
4121-
4122 For example:-
4123-
4124 \snippet code/src_corelib_tools_qbytearray.cpp 44bis-
4125-
4126 The algorithm used to decode Base64-encoded data is defined in \l{RFC 4648}.-
4127-
4128 \sa toBase64()-
4129*/-
4130QByteArray QByteArray::fromBase64(const QByteArray &base64, Base64Options options)-
4131{-
4132 unsigned int buf = 0;-
4133 int nbits = 0;-
4134 QByteArray tmp((base64.size() * 3) / 4, Qt::Uninitialized);-
4135-
4136 int offset = 0;-
4137 for (int i = 0; i < base64.size(); ++i) {
i < base64.size()Description
TRUEevaluated 32614095 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 20650 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
20650-32614095
4138 int ch = base64.at(i);-
4139 int d;-
4140-
4141 if (ch >= 'A' && ch <= 'Z')
ch >= 'A'Description
TRUEevaluated 27609756 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 5004339 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
ch <= 'Z'Description
TRUEevaluated 16156002 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 11453754 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
5004339-27609756
4142 d = ch - 'A';
executed 16156002 times by 12 tests: d = ch - 'A';
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
16156002
4143 else if (ch >= 'a' && ch <= 'z')
ch >= 'a'Description
TRUEevaluated 11453744 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 5004349 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
ch <= 'z'Description
TRUEevaluated 11453744 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEnever evaluated
0-11453744
4144 d = ch - 'a' + 26;
executed 11453744 times by 12 tests: d = ch - 'a' + 26;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
11453744
4145 else if (ch >= '0' && ch <= '9')
ch >= '0'Description
TRUEevaluated 3933050 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 1071299 times by 11 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
ch <= '9'Description
TRUEevaluated 3914334 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 18716 times by 8 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_static
18716-3933050
4146 d = ch - '0' + 52;
executed 3914334 times by 12 tests: d = ch - '0' + 52;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
3914334
4147 else if (ch == '+' && (options & Base64UrlEncoding) == 0)
ch == '+'Description
TRUEevaluated 282753 times by 11 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 807262 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
(options & Bas...Encoding) == 0Description
TRUEevaluated 282747 times by 11 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QByteArray
6-807262
4148 d = 62;
executed 282747 times by 11 tests: d = 62;
Executed by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
282747
4149 else if (ch == '-' && (options & Base64UrlEncoding) != 0)
ch == '-'Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 807256 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
(options & Bas...Encoding) != 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QByteArray
6-807256
4150 d = 62;
executed 6 times by 1 test: d = 62;
Executed by:
  • tst_QByteArray
6
4151 else if (ch == '/' && (options & Base64UrlEncoding) == 0)
ch == '/'Description
TRUEevaluated 322196 times by 11 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 485066 times by 8 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_static
(options & Bas...Encoding) == 0Description
TRUEevaluated 322191 times by 11 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QByteArray
5-485066
4152 d = 63;
executed 322191 times by 11 tests: d = 63;
Executed by:
  • tst_NetworkSelfTest
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
322191
4153 else if (ch == '_' && (options & Base64UrlEncoding) != 0)
ch == '_'Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 485061 times by 8 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_static
(options & Bas...Encoding) != 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QByteArray
5-485061
4154 d = 63;
executed 5 times by 1 test: d = 63;
Executed by:
  • tst_QByteArray
5
4155 else-
4156 d = -1;
executed 485066 times by 8 tests: d = -1;
Executed by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_static
485066
4157-
4158 if (d != -1) {
d != -1Description
TRUEevaluated 32129029 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 485066 times by 8 tests
Evaluated by:
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_static
485066-32129029
4159 buf = (buf << 6) | d;-
4160 nbits += 6;-
4161 if (nbits >= 8) {
nbits >= 8Description
TRUEevaluated 24092092 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
FALSEevaluated 8036937 times by 12 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
8036937-24092092
4162 nbits -= 8;-
4163 tmp[offset++] = buf >> nbits;-
4164 buf &= (1 << nbits) - 1;-
4165 }
executed 24092092 times by 12 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
24092092
4166 }
executed 32129029 times by 12 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
32129029
4167 }
executed 32614095 times by 12 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
32614095
4168-
4169 tmp.truncate(offset);-
4170 return tmp;
executed 20650 times by 12 tests: return tmp;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QHttpNetworkConnection
  • tst_QImageReader
  • tst_QNetworkReply
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_Spdy
20650
4171}-
4172-
4173/*!-
4174 Returns a decoded copy of the hex encoded array \a hexEncoded. Input is not checked-
4175 for validity; invalid characters in the input are skipped, enabling the-
4176 decoding process to continue with subsequent characters.-
4177-
4178 For example:-
4179-
4180 \snippet code/src_corelib_tools_qbytearray.cpp 45-
4181-
4182 \sa toHex()-
4183*/-
4184QByteArray QByteArray::fromHex(const QByteArray &hexEncoded)-
4185{-
4186 QByteArray res((hexEncoded.size() + 1)/ 2, Qt::Uninitialized);-
4187 uchar *result = (uchar *)res.data() + res.size();-
4188-
4189 bool odd_digit = true;-
4190 for (int i = hexEncoded.size() - 1; i >= 0; --i) {
i >= 0Description
TRUEevaluated 9924 times by 11 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 180 times by 11 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
180-9924
4191 uchar ch = uchar(hexEncoded.at(i));-
4192 int tmp = QtMiscUtils::fromHex(ch);-
4193 if (tmp == -1)
tmp == -1Description
TRUEevaluated 1031 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QSslCertificate
FALSEevaluated 8893 times by 11 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
1031-8893
4194 continue;
executed 1031 times by 2 tests: continue;
Executed by:
  • tst_QByteArray
  • tst_QSslCertificate
1031
4195 if (odd_digit) {
odd_digitDescription
TRUEevaluated 4449 times by 11 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
FALSEevaluated 4444 times by 11 tests
Evaluated by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
4444-4449
4196 --result;-
4197 *result = tmp;-
4198 odd_digit = false;-
4199 } else {
executed 4449 times by 11 tests: end of block
Executed by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
4449
4200 *result |= tmp << 4;-
4201 odd_digit = true;-
4202 }
executed 4444 times by 11 tests: end of block
Executed by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
4444
4203 }-
4204-
4205 res.remove(0, result - (const uchar *)res.constData());-
4206 return res;
executed 180 times by 11 tests: return res;
Executed by:
  • tst_QAsn1Element
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QHeaderView
  • tst_QMessageAuthenticationCode
  • tst_QMimeDatabase
  • tst_QSslCertificate
  • tst_QSslKey
  • tst_QTextCodec
  • tst_QUuid
  • tst_QVariant
180
4207}-
4208-
4209/*!-
4210 Returns a hex encoded copy of the byte array. The hex encoding uses the numbers 0-9 and-
4211 the letters a-f.-
4212-
4213 \sa fromHex()-
4214*/-
4215QByteArray QByteArray::toHex() const-
4216{-
4217 QByteArray hex(d->size * 2, Qt::Uninitialized);-
4218 char *hexData = hex.data();-
4219 const uchar *data = (const uchar *)d->data();-
4220 for (int i = 0; i < d->size; ++i) {
i < d->sizeDescription
TRUEevaluated 197241 times by 26 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QDBusInterface
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • ...
FALSEevaluated 10235 times by 26 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QDBusInterface
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • ...
10235-197241
4221 hexData[i*2] = QtMiscUtils::toHexLower(data[i] >> 4);-
4222 hexData[i*2+1] = QtMiscUtils::toHexLower(data[i] & 0xf);-
4223 }
executed 197241 times by 26 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QDBusInterface
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • ...
197241
4224 return hex;
executed 10235 times by 26 tests: return hex;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAuthenticator
  • tst_QByteArray
  • tst_QCryptographicHash
  • tst_QDBusInterface
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSharedMemory
  • tst_QSocks5SocketEngine
  • tst_QSslCertificate
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QStyleSheetStyle
  • tst_QSystemSemaphore
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • ...
10235
4225}-
4226-
4227static void q_fromPercentEncoding(QByteArray *ba, char percent)-
4228{-
4229 if (ba->isEmpty())
ba->isEmpty()Description
TRUEnever evaluated
FALSEevaluated 84 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
0-84
4230 return;
never executed: return;
0
4231-
4232 char *data = ba->data();-
4233 const char *inputPtr = data;-
4234-
4235 int i = 0;-
4236 int len = ba->count();-
4237 int outlen = 0;-
4238 int a, b;-
4239 char c;-
4240 while (i < len) {
i < lenDescription
TRUEevaluated 1998 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 84 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
84-1998
4241 c = inputPtr[i];-
4242 if (c == percent && i + 2 < len) {
c == percentDescription
TRUEevaluated 196 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 1802 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
i + 2 < lenDescription
TRUEevaluated 196 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEnever evaluated
0-1802
4243 a = inputPtr[++i];-
4244 b = inputPtr[++i];-
4245-
4246 if (a >= '0' && a <= '9') a -= '0';
executed 189 times by 5 tests: a -= '0';
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
a >= '0'Description
TRUEevaluated 196 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEnever evaluated
a <= '9'Description
TRUEevaluated 189 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
0-196
4247 else if (a >= 'a' && a <= 'f') a = a - 'a' + 10;
never executed: a = a - 'a' + 10;
a >= 'a'Description
TRUEnever evaluated
FALSEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
a <= 'f'Description
TRUEnever evaluated
FALSEnever evaluated
0-7
4248 else if (a >= 'A' && a <= 'F') a = a - 'A' + 10;
executed 7 times by 4 tests: a = a - 'A' + 10;
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
a >= 'A'Description
TRUEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
FALSEnever evaluated
a <= 'F'Description
TRUEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
FALSEnever evaluated
0-7
4249-
4250 if (b >= '0' && b <= '9') b -= '0';
executed 126 times by 5 tests: b -= '0';
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
b >= '0'Description
TRUEevaluated 196 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEnever evaluated
b <= '9'Description
TRUEevaluated 126 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 70 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
0-196
4251 else if (b >= 'a' && b <= 'f') b = b - 'a' + 10;
never executed: b = b - 'a' + 10;
b >= 'a'Description
TRUEnever evaluated
FALSEevaluated 70 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
b <= 'f'Description
TRUEnever evaluated
FALSEnever evaluated
0-70
4252 else if (b >= 'A' && b <= 'F') b = b - 'A' + 10;
executed 70 times by 4 tests: b = b - 'A' + 10;
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
b >= 'A'Description
TRUEevaluated 70 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
FALSEnever evaluated
b <= 'F'Description
TRUEevaluated 70 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
FALSEnever evaluated
0-70
4253-
4254 *data++ = (char)((a << 4) | b);-
4255 } else {
executed 196 times by 5 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
196
4256 *data++ = c;-
4257 }
executed 1802 times by 5 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
1802
4258-
4259 ++i;-
4260 ++outlen;-
4261 }
executed 1998 times by 5 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
1998
4262-
4263 if (outlen != len)
outlen != lenDescription
TRUEevaluated 58 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 26 times by 4 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
26-58
4264 ba->truncate(outlen);
executed 58 times by 5 tests: ba->truncate(outlen);
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
58
4265}
executed 84 times by 5 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
84
4266-
4267void q_fromPercentEncoding(QByteArray *ba)-
4268{-
4269 q_fromPercentEncoding(ba, '%');-
4270}
never executed: end of block
0
4271-
4272/*!-
4273 \since 4.4-
4274-
4275 Returns a decoded copy of the URI/URL-style percent-encoded \a input.-
4276 The \a percent parameter allows you to replace the '%' character for-
4277 another (for instance, '_' or '=').-
4278-
4279 For example:-
4280 \code-
4281 QByteArray text = QByteArray::fromPercentEncoding("Qt%20is%20great%33");-
4282 text.data(); // returns "Qt is great!"-
4283 \endcode-
4284-
4285 \sa toPercentEncoding(), QUrl::fromPercentEncoding()-
4286*/-
4287QByteArray QByteArray::fromPercentEncoding(const QByteArray &input, char percent)-
4288{-
4289 if (input.isNull())
input.isNull()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 89 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
2-89
4290 return QByteArray(); // preserve null
executed 2 times by 1 test: return QByteArray();
Executed by:
  • tst_QByteArray
2
4291 if (input.isEmpty())
input.isEmpty()Description
TRUEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 84 times by 5 tests
Evaluated by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
5-84
4292 return QByteArray(input.data(), 0);
executed 5 times by 3 tests: return QByteArray(input.data(), 0);
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
5
4293-
4294 QByteArray tmp = input;-
4295 q_fromPercentEncoding(&tmp, percent);-
4296 return tmp;
executed 84 times by 5 tests: return tmp;
Executed by:
  • tst_QByteArray
  • tst_QDataUrl
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QUrlInternal
84
4297}-
4298-
4299/*! \fn QByteArray QByteArray::fromStdString(const std::string &str)-
4300 \since 5.4-
4301-
4302 Returns a copy of the \a str string as a QByteArray.-
4303-
4304 \sa toStdString(), QString::fromStdString()-
4305*/-
4306-
4307/*!-
4308 \fn std::string QByteArray::toStdString() const-
4309 \since 5.4-
4310-
4311 Returns a std::string object with the data contained in this-
4312 QByteArray.-
4313-
4314 This operator is mostly useful to pass a QByteArray to a function-
4315 that accepts a std::string object.-
4316-
4317 \sa fromStdString(), QString::toStdString()-
4318*/-
4319-
4320/*! \fn QByteArray QByteArray::fromCFData(CFDataRef data)-
4321 \since 5.3-
4322-
4323 Constructs a new QByteArray containing a copy of the CFData \a data.-
4324-
4325 \sa fromRawCFData(), fromRawData(), toRawCFData(), toCFData()-
4326*/-
4327-
4328/*! \fn QByteArray QByteArray::fromRawCFData(CFDataRef data)-
4329 \since 5.3-
4330-
4331 Constructs a QByteArray that uses the bytes of the CFData \a data.-
4332-
4333 The \a data's bytes are not copied.-
4334-
4335 The caller guarantees that the CFData will not be deleted-
4336 or modified as long as this QByteArray object exists.-
4337-
4338 \sa fromCFData(), fromRawData(), toRawCFData(), toCFData()-
4339*/-
4340-
4341/*! \fn CFDataRef QByteArray::toCFData() const-
4342 \since 5.3-
4343-
4344 Creates a CFData from a QByteArray. The caller owns the CFData object-
4345 and is responsible for releasing it.-
4346-
4347 \sa toRawCFData(), fromCFData(), fromRawCFData(), fromRawData()-
4348*/-
4349-
4350/*! \fn CFDataRef QByteArray::toRawCFData() const-
4351 \since 5.3-
4352-
4353 Constructs a CFData that uses the bytes of the QByteArray.-
4354-
4355 The QByteArray's bytes are not copied.-
4356-
4357 The caller guarantees that the QByteArray will not be deleted-
4358 or modified as long as this CFData object exists.-
4359-
4360 \sa toCFData(), fromRawCFData(), fromCFData(), fromRawData()-
4361*/-
4362-
4363/*! \fn QByteArray QByteArray::fromNSData(const NSData *data)-
4364 \since 5.3-
4365-
4366 Constructs a new QByteArray containing a copy of the NSData \a data.-
4367-
4368 \sa fromRawNSData(), fromRawData(), toNSData(), toRawNSData()-
4369*/-
4370-
4371/*! \fn QByteArray QByteArray::fromRawNSData(const NSData *data)-
4372 \since 5.3-
4373-
4374 Constructs a QByteArray that uses the bytes of the NSData \a data.-
4375-
4376 The \a data's bytes are not copied.-
4377-
4378 The caller guarantees that the NSData will not be deleted-
4379 or modified as long as this QByteArray object exists.-
4380-
4381 \sa fromNSData(), fromRawData(), toRawNSData(), toNSData()-
4382*/-
4383-
4384/*! \fn NSData QByteArray::toNSData() const-
4385 \since 5.3-
4386-
4387 Creates a NSData from a QByteArray. The NSData object is autoreleased.-
4388-
4389 \sa fromNSData(), fromRawNSData(), fromRawData(), toRawNSData()-
4390*/-
4391-
4392/*! \fn NSData QByteArray::toRawNSData() const-
4393 \since 5.3-
4394-
4395 Constructs a NSData that uses the bytes of the QByteArray.-
4396-
4397 The QByteArray's bytes are not copied.-
4398-
4399 The caller guarantees that the QByteArray will not be deleted-
4400 or modified as long as this NSData object exists.-
4401-
4402 \sa fromRawNSData(), fromNSData(), fromRawData(), toNSData()-
4403*/-
4404-
4405static inline bool q_strchr(const char str[], char chr)-
4406{-
4407 if (!str) return false;
never executed: return false;
!strDescription
TRUEnever evaluated
FALSEevaluated 644 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
0-644
4408-
4409 const char *ptr = str;-
4410 char c;-
4411 while ((c = *ptr++))
(c = *ptr++)Description
TRUEevaluated 516 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
FALSEevaluated 595 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
516-595
4412 if (c == chr)
c == chrDescription
TRUEevaluated 49 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
FALSEevaluated 467 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
49-467
4413 return true;
executed 49 times by 2 tests: return true;
Executed by:
  • tst_QByteArray
  • tst_QUrl
49
4414 return false;
executed 595 times by 3 tests: return false;
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
595
4415}-
4416-
4417static void q_toPercentEncoding(QByteArray *ba, const char *dontEncode, const char *alsoEncode, char percent)-
4418{-
4419 if (ba->isEmpty())
ba->isEmpty()Description
TRUEnever evaluated
FALSEevaluated 74 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
0-74
4420 return;
never executed: return;
0
4421-
4422 QByteArray input = *ba;-
4423 int len = input.count();-
4424 const char *inputData = input.constData();-
4425 char *output = 0;-
4426 int length = 0;-
4427-
4428 for (int i = 0; i < len; ++i) {
i < lenDescription
TRUEevaluated 611 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 74 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
74-611
4429 unsigned char c = *inputData++;-
4430 if (((c >= 0x61 && c <= 0x7A) // ALPHA
c >= 0x61Description
TRUEevaluated 396 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 215 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
c <= 0x7ADescription
TRUEevaluated 203 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 193 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
193-396
4431 || (c >= 0x41 && c <= 0x5A) // ALPHA
c >= 0x41Description
TRUEevaluated 266 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 142 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
c <= 0x5ADescription
TRUEevaluated 61 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 205 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
61-266
4432 || (c >= 0x30 && c <= 0x39) // DIGIT
c >= 0x30Description
TRUEevaluated 251 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 96 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
c <= 0x39Description
TRUEevaluated 22 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 229 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
22-251
4433 || c == 0x2D // -
c == 0x2DDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
FALSEevaluated 319 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
6-319
4434 || c == 0x2E // .
c == 0x2EDescription
TRUEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 310 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
9-310
4435 || c == 0x5F // _
c == 0x5FDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
FALSEevaluated 308 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
2-308
4436 || c == 0x7E // ~
c == 0x7EDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
FALSEevaluated 306 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
2-306
4437 || q_strchr(dontEncode, c))
q_strchr(dontEncode, c)Description
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
FALSEevaluated 273 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
33-273
4438 && !q_strchr(alsoEncode, c)) {
!q_strchr(alsoEncode, c)Description
TRUEevaluated 322 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
16-322
4439 if (output)
outputDescription
TRUEevaluated 138 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 184 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
138-184
4440 output[length] = c;
executed 138 times by 3 tests: output[length] = c;
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
138
4441 ++length;-
4442 } else {
executed 322 times by 3 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
322
4443 if (!output) {
!outputDescription
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 219 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
70-219
4444 // detach now-
4445 ba->resize(len*3); // worst case-
4446 output = ba->data();-
4447 }
executed 70 times by 3 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
70
4448 output[length++] = percent;-
4449 output[length++] = QtMiscUtils::toHexUpper((c & 0xf0) >> 4);-
4450 output[length++] = QtMiscUtils::toHexUpper(c & 0xf);-
4451 }
executed 289 times by 3 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
289
4452 }-
4453 if (output)
outputDescription
TRUEevaluated 70 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
4-70
4454 ba->truncate(length);
executed 70 times by 3 tests: ba->truncate(length);
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
70
4455}
executed 74 times by 3 tests: end of block
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
74
4456-
4457void q_toPercentEncoding(QByteArray *ba, const char *exclude, const char *include)-
4458{-
4459 q_toPercentEncoding(ba, exclude, include, '%');-
4460}
never executed: end of block
0
4461-
4462void q_normalizePercentEncoding(QByteArray *ba, const char *exclude)-
4463{-
4464 q_fromPercentEncoding(ba, '%');-
4465 q_toPercentEncoding(ba, exclude, 0, '%');-
4466}
never executed: end of block
0
4467-
4468/*!-
4469 \since 4.4-
4470-
4471 Returns a URI/URL-style percent-encoded copy of this byte array. The-
4472 \a percent parameter allows you to override the default '%'-
4473 character for another.-
4474-
4475 By default, this function will encode all characters that are not-
4476 one of the following:-
4477-
4478 ALPHA ("a" to "z" and "A" to "Z") / DIGIT (0 to 9) / "-" / "." / "_" / "~"-
4479-
4480 To prevent characters from being encoded pass them to \a-
4481 exclude. To force characters to be encoded pass them to \a-
4482 include. The \a percent character is always encoded.-
4483-
4484 Example:-
4485-
4486 \code-
4487 QByteArray text = "{a fishy string?}";-
4488 QByteArray ba = text.toPercentEncoding("{}", "s");-
4489 qDebug(ba.constData());-
4490 // prints "{a fi%73hy %73tring%3F}"-
4491 \endcode-
4492-
4493 The hex encoding uses the numbers 0-9 and the uppercase letters A-F.-
4494-
4495 \sa fromPercentEncoding(), QUrl::toPercentEncoding()-
4496*/-
4497QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteArray &include,-
4498 char percent) const-
4499{-
4500 if (isNull())
isNull()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
2-78
4501 return QByteArray(); // preserve null
executed 2 times by 1 test: return QByteArray();
Executed by:
  • tst_QByteArray
2
4502 if (isEmpty())
isEmpty()Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
FALSEevaluated 74 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
4-74
4503 return QByteArray(data(), 0);
executed 4 times by 2 tests: return QByteArray(data(), 0);
Executed by:
  • tst_QByteArray
  • tst_QUrl
4
4504-
4505 QByteArray include2 = include;-
4506 if (percent != '%') // the default
percent != '%'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEevaluated 73 times by 3 tests
Evaluated by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
1-73
4507 if ((percent >= 0x61 && percent <= 0x7A) // ALPHA
percent >= 0x61Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
percent <= 0x7ADescription
TRUEnever evaluated
FALSEnever evaluated
0-1
4508 || (percent >= 0x41 && percent <= 0x5A) // ALPHA
percent >= 0x41Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEnever evaluated
percent <= 0x5ADescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QByteArray
FALSEnever evaluated
0-1
4509 || (percent >= 0x30 && percent <= 0x39) // DIGIT
percent >= 0x30Description
TRUEnever evaluated
FALSEnever evaluated
percent <= 0x39Description
TRUEnever evaluated
FALSEnever evaluated
0
4510 || percent == 0x2D // -
percent == 0x2DDescription
TRUEnever evaluated
FALSEnever evaluated
0
4511 || percent == 0x2E // .
percent == 0x2EDescription
TRUEnever evaluated
FALSEnever evaluated
0
4512 || percent == 0x5F // _
percent == 0x5FDescription
TRUEnever evaluated
FALSEnever evaluated
0
4513 || percent == 0x7E) // ~
percent == 0x7EDescription
TRUEnever evaluated
FALSEnever evaluated
0
4514 include2 += percent;
executed 1 time by 1 test: include2 += percent;
Executed by:
  • tst_QByteArray
1
4515-
4516 QByteArray result = *this;-
4517 q_toPercentEncoding(&result, exclude.nulTerminated().constData(), include2.nulTerminated().constData(), percent);-
4518-
4519 return result;
executed 74 times by 3 tests: return result;
Executed by:
  • tst_QByteArray
  • tst_QUrl
  • tst_QUrlInternal
74
4520}-
4521-
4522/*! \typedef QByteArray::ConstIterator-
4523 \internal-
4524*/-
4525-
4526/*! \typedef QByteArray::Iterator-
4527 \internal-
4528*/-
4529-
4530/*! \typedef QByteArray::const_iterator-
4531-
4532 This typedef provides an STL-style const iterator for QByteArray.-
4533-
4534 \sa QByteArray::const_reverse_iterator, QByteArray::iterator-
4535*/-
4536-
4537/*! \typedef QByteArray::iterator-
4538-
4539 This typedef provides an STL-style non-const iterator for QByteArray.-
4540-
4541 \sa QByteArray::reverse_iterator, QByteArray::const_iterator-
4542*/-
4543-
4544/*! \typedef QByteArray::const_reverse_iterator-
4545 \since 5.6-
4546-
4547 This typedef provides an STL-style const reverse iterator for QByteArray.-
4548-
4549 \sa QByteArray::reverse_iterator, QByteArray::const_iterator-
4550*/-
4551-
4552/*! \typedef QByteArray::reverse_iterator-
4553 \since 5.6-
4554-
4555 This typedef provides an STL-style non-const reverse iterator for QByteArray.-
4556-
4557 \sa QByteArray::const_reverse_iterator, QByteArray::iterator-
4558*/-
4559-
4560/*! \typedef QByteArray::size_type-
4561 \internal-
4562*/-
4563-
4564/*! \typedef QByteArray::difference_type-
4565 \internal-
4566*/-
4567-
4568/*! \typedef QByteArray::const_reference-
4569 \internal-
4570*/-
4571-
4572/*! \typedef QByteArray::reference-
4573 \internal-
4574*/-
4575-
4576/*! \typedef QByteArray::const_pointer-
4577 \internal-
4578*/-
4579-
4580/*! \typedef QByteArray::pointer-
4581 \internal-
4582*/-
4583-
4584/*! \typedef QByteArray::value_type-
4585 \internal-
4586 */-
4587-
4588/*!-
4589 \fn DataPtr &QByteArray::data_ptr()-
4590 \internal-
4591*/-
4592-
4593/*!-
4594 \typedef QByteArray::DataPtr-
4595 \internal-
4596*/-
4597-
4598QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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