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