OpenCoverage

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

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