socket/qnativesocketengine.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() : -
9 socketDescriptor(-1), -
10 readNotifier(0), -
11 writeNotifier(0), -
12 exceptNotifier(0) -
13{ -
14}
executed: }
Execution Count:3376
3376
15 -
16 -
17 -
18 -
19QNativeSocketEnginePrivate::~QNativeSocketEnginePrivate() -
20{ -
21} -
22 -
23 -
24 -
25 -
26 -
27 -
28 -
29void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, ErrorString errorString) const -
30{ -
31 if (hasSetSocketError) {
evaluated: hasSetSocketError
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:2903
64-2903
32 -
33 -
34 -
35 -
36 -
37 -
38 -
39 return;
executed: return;
Execution Count:64
64
40 } -
41 if (error != QAbstractSocket::SocketError(11))
evaluated: error != QAbstractSocket::SocketError(11)
TRUEFALSE
yes
Evaluation Count:816
yes
Evaluation Count:2087
816-2087
42 hasSetSocketError = true;
executed: hasSetSocketError = true;
Execution Count:816
816
43 -
44 socketError = error; -
45 -
46 switch (errorString) { -
47 case NonBlockingInitFailedErrorString: -
48 socketErrorString = QNativeSocketEngine::tr("Unable to initialize non-blocking socket"); -
49 break;
never executed: break;
0
50 case BroadcastingInitFailedErrorString: -
51 socketErrorString = QNativeSocketEngine::tr("Unable to initialize broadcast socket"); -
52 break;
never executed: break;
0
53 -
54 case NoIpV6ErrorString: -
55 socketErrorString = QNativeSocketEngine::tr("Attempt to use IPv6 socket on a platform with no IPv6 support"); -
56 break;
never executed: break;
0
57 case RemoteHostClosedErrorString: -
58 socketErrorString = QNativeSocketEngine::tr("The remote host closed the connection"); -
59 break;
executed: break;
Execution Count:333
333
60 case TimeOutErrorString: -
61 socketErrorString = QNativeSocketEngine::tr("Network operation timed out"); -
62 break;
executed: break;
Execution Count:64
64
63 case ResourceErrorString: -
64 socketErrorString = QNativeSocketEngine::tr("Out of resources"); -
65 break;
never executed: break;
0
66 case OperationUnsupportedErrorString: -
67 socketErrorString = QNativeSocketEngine::tr("Unsupported socket operation"); -
68 break;
never executed: break;
0
69 case ProtocolUnsupportedErrorString: -
70 socketErrorString = QNativeSocketEngine::tr("Protocol type not supported"); -
71 break;
never executed: break;
0
72 case InvalidSocketErrorString: -
73 socketErrorString = QNativeSocketEngine::tr("Invalid socket descriptor"); -
74 break;
executed: break;
Execution Count:2089
2089
75 case HostUnreachableErrorString: -
76 socketErrorString = QNativeSocketEngine::tr("Host unreachable"); -
77 break;
never executed: break;
0
78 case NetworkUnreachableErrorString: -
79 socketErrorString = QNativeSocketEngine::tr("Network unreachable"); -
80 break;
executed: break;
Execution Count:2
2
81 case AccessErrorString: -
82 socketErrorString = QNativeSocketEngine::tr("Permission denied"); -
83 break;
never executed: break;
0
84 case ConnectionTimeOutErrorString: -
85 socketErrorString = QNativeSocketEngine::tr("Connection timed out"); -
86 break;
never executed: break;
0
87 case ConnectionRefusedErrorString: -
88 socketErrorString = QNativeSocketEngine::tr("Connection refused"); -
89 break;
executed: break;
Execution Count:8
8
90 case AddressInuseErrorString: -
91 socketErrorString = QNativeSocketEngine::tr("The bound address is already in use"); -
92 break;
executed: break;
Execution Count:9
9
93 case AddressNotAvailableErrorString: -
94 socketErrorString = QNativeSocketEngine::tr("The address is not available"); -
95 break;
executed: break;
Execution Count:1
1
96 case AddressProtectedErrorString: -
97 socketErrorString = QNativeSocketEngine::tr("The address is protected"); -
98 break;
never executed: break;
0
99 case DatagramTooLargeErrorString: -
100 socketErrorString = QNativeSocketEngine::tr("Datagram was too large to send"); -
101 break;
executed: break;
Execution Count:1
1
102 case SendDatagramErrorString: -
103 socketErrorString = QNativeSocketEngine::tr("Unable to send a message"); -
104 break;
never executed: break;
0
105 case ReceiveDatagramErrorString: -
106 socketErrorString = QNativeSocketEngine::tr("Unable to receive a message"); -
107 break;
never executed: break;
0
108 case WriteErrorString: -
109 socketErrorString = QNativeSocketEngine::tr("Unable to write"); -
110 break;
never executed: break;
0
111 case ReadErrorString: -
112 socketErrorString = QNativeSocketEngine::tr("Network error"); -
113 break;
never executed: break;
0
114 case PortInuseErrorString: -
115 socketErrorString = QNativeSocketEngine::tr("Another socket is already listening on the same port"); -
116 break;
never executed: break;
0
117 case NotSocketErrorString: -
118 socketErrorString = QNativeSocketEngine::tr("Operation on non-socket"); -
119 break;
never executed: break;
0
120 case InvalidProxyTypeString: -
121 socketErrorString = QNativeSocketEngine::tr("The proxy type is invalid for this operation"); -
122 break;
executed: break;
Execution Count:1
1
123 case TemporaryErrorString: -
124 socketErrorString = QNativeSocketEngine::tr("Temporary error"); -
125 break;
executed: break;
Execution Count:394
394
126 case UnknownSocketErrorString: -
127 socketErrorString = QNativeSocketEngine::tr("Unknown error"); -
128 break;
executed: break;
Execution Count:1
1
129 } -
130}
executed: }
Execution Count:2903
2903
131 -
132bool QNativeSocketEnginePrivate::checkProxy(const QHostAddress &address) -
133{ -
134 if (address.isLoopback())
evaluated: address.isLoopback()
TRUEFALSE
yes
Evaluation Count:1854
yes
Evaluation Count:2104
1854-2104
135 return true;
executed: return true;
Execution Count:1854
1854
136 -
137 -
138 QObject *parent = q_func()->parent(); -
139 QNetworkProxy proxy; -
140 if (QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(parent)) {
evaluated: QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(parent)
TRUEFALSE
yes
Evaluation Count:1688
yes
Evaluation Count:416
416-1688
141 proxy = socket->proxy(); -
142 } else if (QTcpServer *server = qobject_cast<QTcpServer *>(parent)) {
executed: }
Execution Count:1688
partially evaluated: QTcpServer *server = qobject_cast<QTcpServer *>(parent)
TRUEFALSE
yes
Evaluation Count:416
no
Evaluation Count:0
0-1688
143 proxy = server->proxy(); -
144 } else {
executed: }
Execution Count:416
416
145 -
146 return true;
never executed: return true;
0
147 } -
148 -
149 if (proxy.type() == QNetworkProxy::DefaultProxy)
evaluated: proxy.type() == QNetworkProxy::DefaultProxy
TRUEFALSE
yes
Evaluation Count:856
yes
Evaluation Count:1248
856-1248
150 proxy = QNetworkProxy::applicationProxy();
executed: proxy = QNetworkProxy::applicationProxy();
Execution Count:856
856
151 -
152 if (proxy.type() != QNetworkProxy::DefaultProxy &&
partially evaluated: proxy.type() != QNetworkProxy::DefaultProxy
TRUEFALSE
yes
Evaluation Count:2104
no
Evaluation Count:0
0-2104
153 proxy.type() != QNetworkProxy::NoProxy) {
evaluated: proxy.type() != QNetworkProxy::NoProxy
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2103
1-2103
154 -
155 setError(QAbstractSocket::UnsupportedSocketOperationError, -
156 QNativeSocketEnginePrivate::InvalidProxyTypeString); -
157 return false;
executed: return false;
Execution Count:1
1
158 } -
159 -
160 -
161 return true;
executed: return true;
Execution Count:2103
2103
162} -
163 -
164 -
165 -
166 -
167 -
168 -
169QNativeSocketEngine::QNativeSocketEngine(QObject *parent) -
170 : QAbstractSocketEngine(*new QNativeSocketEnginePrivate(), parent) -
171{ -
172}
executed: }
Execution Count:3376
3376
173 -
174 -
175 -
176 -
177QNativeSocketEngine::~QNativeSocketEngine() -
178{ -
179 close(); -
180}
executed: }
Execution Count:3374
3374
181bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol protocol) -
182{ -
183 QNativeSocketEnginePrivate * const d = d_func(); -
184 if (isValid())
partially evaluated: isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2761
0-2761
185 close();
never executed: close();
0
186 -
187 -
188 if (!d->createNewSocket(socketType, protocol)) {
partially evaluated: !d->createNewSocket(socketType, protocol)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2761
0-2761
189 return false;
never executed: return false;
0
190 } -
191 -
192 -
193 if (!setOption(NonBlockingSocketOption, 1)) {
partially evaluated: !setOption(NonBlockingSocketOption, 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2761
0-2761
194 d->setError(QAbstractSocket::UnsupportedSocketOperationError, -
195 QNativeSocketEnginePrivate::NonBlockingInitFailedErrorString); -
196 close(); -
197 return false;
never executed: return false;
0
198 } -
199 -
200 -
201 if (socketType == QAbstractSocket::UdpSocket
evaluated: socketType == QAbstractSocket::UdpSocket
TRUEFALSE
yes
Evaluation Count:235
yes
Evaluation Count:2526
235-2526
202 && !setOption(BroadcastSocketOption, 1)) {
partially evaluated: !setOption(BroadcastSocketOption, 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:235
0-235
203 d->setError(QAbstractSocket::UnsupportedSocketOperationError, -
204 QNativeSocketEnginePrivate::BroadcastingInitFailedErrorString); -
205 close(); -
206 return false;
never executed: return false;
0
207 } -
208 -
209 -
210 -
211 if (socketType == QAbstractSocket::TcpSocket
evaluated: socketType == QAbstractSocket::TcpSocket
TRUEFALSE
yes
Evaluation Count:2526
yes
Evaluation Count:235
235-2526
212 && !setOption(ReceiveOutOfBandData, 1)) {
partially evaluated: !setOption(ReceiveOutOfBandData, 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2526
0-2526
213 QMessageLogger("socket/qnativesocketengine.cpp", 389, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::initialize unable to inline out-of-band data"); -
214 }
never executed: }
0
215 d->socketType = socketType; -
216 d->socketProtocol = protocol; -
217 return true;
executed: return true;
Execution Count:2761
2761
218} -
219bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState) -
220{ -
221 QNativeSocketEnginePrivate * const d = d_func(); -
222 -
223 if (isValid())
partially evaluated: isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:615
0-615
224 close();
never executed: close();
0
225 -
226 d->socketDescriptor = socketDescriptor; -
227 -
228 -
229 if (!d->fetchConnectionParameters()) {
evaluated: !d->fetchConnectionParameters()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:612
3-612
230 -
231 -
232 -
233 -
234 d->socketDescriptor = -1; -
235 return false;
executed: return false;
Execution Count:3
3
236 } -
237 -
238 if (d->socketType != QAbstractSocket::UnknownSocketType) {
partially evaluated: d->socketType != QAbstractSocket::UnknownSocketType
TRUEFALSE
yes
Evaluation Count:612
no
Evaluation Count:0
0-612
239 -
240 if (!setOption(NonBlockingSocketOption, 1)) {
partially evaluated: !setOption(NonBlockingSocketOption, 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:612
0-612
241 d->setError(QAbstractSocket::UnsupportedSocketOperationError, -
242 QNativeSocketEnginePrivate::NonBlockingInitFailedErrorString); -
243 close(); -
244 return false;
never executed: return false;
0
245 } -
246 -
247 -
248 if (d->socketType == QAbstractSocket::UdpSocket
partially evaluated: d->socketType == QAbstractSocket::UdpSocket
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:612
0-612
249 && !setOption(BroadcastSocketOption, 1)) {
never evaluated: !setOption(BroadcastSocketOption, 1)
0
250 d->setError(QAbstractSocket::UnsupportedSocketOperationError, -
251 QNativeSocketEnginePrivate::BroadcastingInitFailedErrorString); -
252 close(); -
253 return false;
never executed: return false;
0
254 } -
255 }
executed: }
Execution Count:612
612
256 -
257 d->socketState = socketState; -
258 return true;
executed: return true;
Execution Count:612
612
259} -
260 -
261 -
262 -
263 -
264 -
265 -
266bool QNativeSocketEngine::isValid() const -
267{ -
268 const QNativeSocketEnginePrivate * const d = d_func(); -
269 return d->socketDescriptor != -1;
executed: return d->socketDescriptor != -1;
Execution Count:7595494
7595494
270} -
271 -
272 -
273 -
274 -
275 -
276qintptr QNativeSocketEngine::socketDescriptor() const -
277{ -
278 const QNativeSocketEnginePrivate * const d = d_func(); -
279 return d->socketDescriptor;
executed: return d->socketDescriptor;
Execution Count:328162
328162
280} -
281bool QNativeSocketEngine::connectToHost(const QHostAddress &address, quint16 port) -
282{ -
283 QNativeSocketEnginePrivate * const d = d_func(); -
284 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 509, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::connectToHost()"" was called on an uninitialized socket device"); return false; } } while (0);
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3288
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3288
never executed: return false;
executed: }
Execution Count:3288
0-3288
285 -
286 if (!d->checkProxy(address))
partially evaluated: !d->checkProxy(address)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3288
0-3288
287 return false;
never executed: return false;
0
288 -
289 do { if (d->socketState != (QAbstractSocket::UnconnectedState) && d->socketState != (QAbstractSocket::ConnectingState)) { QMessageLogger("socket/qnativesocketengine.cpp", 515, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::connectToHost()"" was called" " not in ""QAbstractSocket::UnconnectedState"" or ""QAbstractSocket::ConnectingState"); return (false); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3288
evaluated: d->socketState != (QAbstractSocket::UnconnectedState)
TRUEFALSE
yes
Evaluation Count:1195
yes
Evaluation Count:2093
partially evaluated: d->socketState != (QAbstractSocket::ConnectingState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1195
never executed: return (false);
executed: }
Execution Count:3288
0-3288
290 -
291 -
292 d->peerAddress = address; -
293 d->peerPort = port; -
294 bool connected = d->nativeConnect(address, port); -
295 if (connected)
evaluated: connected
TRUEFALSE
yes
Evaluation Count:1191
yes
Evaluation Count:2097
1191-2097
296 d->fetchConnectionParameters();
executed: d->fetchConnectionParameters();
Execution Count:1191
1191
297 -
298 return connected;
executed: return connected;
Execution Count:3288
3288
299} -
300 -
301 -
302 -
303 -
304 -
305void QNativeSocketEngine::connectionNotification() -
306{ -
307 QNativeSocketEnginePrivate * const d = d_func(); -
308 qt_noop(); -
309 -
310 connectToHost(d->peerAddress, d->peerPort); -
311 if (state() != QAbstractSocket::ConnectingState) {
partially evaluated: state() != QAbstractSocket::ConnectingState
TRUEFALSE
yes
Evaluation Count:774
no
Evaluation Count:0
0-774
312 -
313 QAbstractSocketEngine::connectionNotification(); -
314 }
executed: }
Execution Count:774
774
315}
executed: }
Execution Count:774
774
316bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port) -
317{ -
318 (void)name;; -
319 (void)port;; -
320 QNativeSocketEnginePrivate * const d = d_func(); -
321 d->setError(QAbstractSocket::UnsupportedSocketOperationError, -
322 QNativeSocketEnginePrivate::OperationUnsupportedErrorString); -
323 return false;
never executed: return false;
0
324} -
325bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port) -
326{ -
327 QNativeSocketEnginePrivate * const d = d_func(); -
328 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 572, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::bind()"" was called on an uninitialized socket device"); return false; } } while (0);
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:670
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:670
never executed: return false;
executed: }
Execution Count:670
0-670
329 -
330 if (!d->checkProxy(address))
evaluated: !d->checkProxy(address)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:669
1-669
331 return false;
executed: return false;
Execution Count:1
1
332 -
333 do { if (d->socketState != (QAbstractSocket::UnconnectedState)) { QMessageLogger("socket/qnativesocketengine.cpp", 577, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::bind()"" was not called in ""QAbstractSocket::UnconnectedState"); return (false); } } while (0);
partially evaluated: d->socketState != (QAbstractSocket::UnconnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:669
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:669
never executed: return (false);
executed: }
Execution Count:669
0-669
334 -
335 if (!d->nativeBind(address, port))
evaluated: !d->nativeBind(address, port)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:658
11-658
336 return false;
executed: return false;
Execution Count:11
11
337 -
338 d->fetchConnectionParameters(); -
339 return true;
executed: return true;
Execution Count:658
658
340} -
341bool QNativeSocketEngine::listen() -
342{ -
343 QNativeSocketEnginePrivate * const d = d_func(); -
344 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 604, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::listen()"" was called on an uninitialized socket device"); return false; } } while (0);
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:425
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:425
never executed: return false;
executed: }
Execution Count:425
0-425
345 do { if (d->socketState != (QAbstractSocket::BoundState)) { QMessageLogger("socket/qnativesocketengine.cpp", 605, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::listen()"" was not called in ""QAbstractSocket::BoundState"); return (false); } } while (0);
partially evaluated: d->socketState != (QAbstractSocket::BoundState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:425
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:425
never executed: return (false);
executed: }
Execution Count:425
0-425
346 do { if (d->socketType != (QAbstractSocket::TcpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 606, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::listen()"" was called by a" " socket other than ""QAbstractSocket::TcpSocket"""); return (false); } } while (0);
partially evaluated: d->socketType != (QAbstractSocket::TcpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:425
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:425
never executed: return (false);
executed: }
Execution Count:425
0-425
347 -
348 -
349 -
350 -
351 -
352 return d->nativeListen(50);
executed: return d->nativeListen(50);
Execution Count:425
425
353} -
354int QNativeSocketEngine::accept() -
355{ -
356 QNativeSocketEnginePrivate * const d = d_func(); -
357 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 625, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::accept()"" was called on an uninitialized socket device"); return -1; } } while (0);
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:920
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:920
never executed: return -1;
executed: }
Execution Count:920
0-920
358 do { if (d->socketState != (QAbstractSocket::ListeningState)) { QMessageLogger("socket/qnativesocketengine.cpp", 626, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::accept()"" was not called in ""QAbstractSocket::ListeningState"); return (false); } } while (0);
partially evaluated: d->socketState != (QAbstractSocket::ListeningState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:920
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:920
never executed: return (false);
executed: }
Execution Count:920
0-920
359 do { if (d->socketType != (QAbstractSocket::TcpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 627, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::accept()"" was called by a" " socket other than ""QAbstractSocket::TcpSocket"""); return (false); } } while (0);
partially evaluated: d->socketType != (QAbstractSocket::TcpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:920
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:920
never executed: return (false);
executed: }
Execution Count:920
0-920
360 -
361 return d->nativeAccept();
executed: return d->nativeAccept();
Execution Count:920
920
362} -
363 -
364 -
365 -
366 -
367 -
368 -
369bool QNativeSocketEngine::joinMulticastGroup(const QHostAddress &groupAddress, -
370 const QNetworkInterface &iface) -
371{ -
372 QNativeSocketEnginePrivate * const d = d_func(); -
373 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 641, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::joinMulticastGroup()"" was called on an uninitialized socket device"); return false; } } while (0);
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
never executed: return false;
executed: }
Execution Count:6
0-6
374 do { if (d->socketState != (QAbstractSocket::BoundState)) { QMessageLogger("socket/qnativesocketengine.cpp", 642, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::joinMulticastGroup()"" was not called in ""QAbstractSocket::BoundState"); return (false); } } while (0);
partially evaluated: d->socketState != (QAbstractSocket::BoundState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
never executed: return (false);
executed: }
Execution Count:6
0-6
375 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 643, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::joinMulticastGroup()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (false); } } while (0);
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
never executed: return (false);
executed: }
Execution Count:6
0-6
376 -
377 -
378 -
379 -
380 -
381 if (groupAddress.protocol() == QAbstractSocket::IPv4Protocol &&
evaluated: groupAddress.protocol() == QAbstractSocket::IPv4Protocol
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
382 (d->socketProtocol == QAbstractSocket::IPv6Protocol ||
partially evaluated: d->socketProtocol == QAbstractSocket::IPv6Protocol
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
383 d->socketProtocol == QAbstractSocket::AnyIPProtocol)) {
evaluated: d->socketProtocol == QAbstractSocket::AnyIPProtocol
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
384 QMessageLogger("socket/qnativesocketengine.cpp", 652, __PRETTY_FUNCTION__).warning("QAbstractSocket: cannot bind to QHostAddress::Any (or an IPv6 address) and join an IPv4 multicast group"); -
385 QMessageLogger("socket/qnativesocketengine.cpp", 653, __PRETTY_FUNCTION__).warning("QAbstractSocket: bind to QHostAddress::AnyIPv4 instead if you want to do this"); -
386 return false;
executed: return false;
Execution Count:1
1
387 } -
388 -
389 return d->nativeJoinMulticastGroup(groupAddress, iface);
executed: return d->nativeJoinMulticastGroup(groupAddress, iface);
Execution Count:5
5
390} -
391 -
392 -
393 -
394 -
395bool QNativeSocketEngine::leaveMulticastGroup(const QHostAddress &groupAddress, -
396 const QNetworkInterface &iface) -
397{ -
398 QNativeSocketEnginePrivate * const d = d_func(); -
399 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 667, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::leaveMulticastGroup()"" was called on an uninitialized socket device"); return false; } } while (0);
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never executed: return false;
executed: }
Execution Count:2
0-2
400 do { if (d->socketState != (QAbstractSocket::BoundState)) { QMessageLogger("socket/qnativesocketengine.cpp", 668, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::leaveMulticastGroup()"" was not called in ""QAbstractSocket::BoundState"); return (false); } } while (0);
partially evaluated: d->socketState != (QAbstractSocket::BoundState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never executed: return (false);
executed: }
Execution Count:2
0-2
401 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 669, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::leaveMulticastGroup()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (false); } } while (0);
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never executed: return (false);
executed: }
Execution Count:2
0-2
402 return d->nativeLeaveMulticastGroup(groupAddress, iface);
executed: return d->nativeLeaveMulticastGroup(groupAddress, iface);
Execution Count:2
2
403} -
404 -
405 -
406QNetworkInterface QNativeSocketEngine::multicastInterface() const -
407{ -
408 const QNativeSocketEnginePrivate * const d = d_func(); -
409 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 677, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::multicastInterface()"" was called on an uninitialized socket device"); return QNetworkInterface(); } } while (0);
never executed: return QNetworkInterface();
executed: }
Execution Count:8
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
410 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 678, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::multicastInterface()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (QNetworkInterface()); } } while (0);
never executed: return (QNetworkInterface());
executed: }
Execution Count:8
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
411 return d->nativeMulticastInterface();
executed: return d->nativeMulticastInterface();
Execution Count:8
8
412} -
413 -
414 -
415bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface) -
416{ -
417 QNativeSocketEnginePrivate * const d = d_func(); -
418 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 686, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::setMulticastInterface()"" was called on an uninitialized socket device"); return false; } } while (0);
never executed: return false;
executed: }
Execution Count:8
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
419 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 687, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::setMulticastInterface()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:8
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
420 return d->nativeSetMulticastInterface(iface);
executed: return d->nativeSetMulticastInterface(iface);
Execution Count:8
8
421} -
422qint64 QNativeSocketEngine::bytesAvailable() const -
423{ -
424 const QNativeSocketEnginePrivate * const d = d_func(); -
425 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 704, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::bytesAvailable()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
executed: }
Execution Count:33408
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33408
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33408
0-33408
426 do { if (d->socketState == (QAbstractSocket::UnconnectedState)) { QMessageLogger("socket/qnativesocketengine.cpp", 705, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::bytesAvailable()"" was called in ""QAbstractSocket::UnconnectedState"); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:33408
partially evaluated: d->socketState == (QAbstractSocket::UnconnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33408
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33408
0-33408
427 -
428 return d->nativeBytesAvailable();
executed: return d->nativeBytesAvailable();
Execution Count:33408
33408
429} -
430 -
431 -
432 -
433 -
434 -
435 -
436bool QNativeSocketEngine::hasPendingDatagrams() const -
437{ -
438 const QNativeSocketEnginePrivate * const d = d_func(); -
439 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 718, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::hasPendingDatagrams()"" was called on an uninitialized socket device"); return false; } } while (0);
never executed: return false;
executed: }
Execution Count:1662511
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1662511
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1662511
0-1662511
440 do { if (d->socketState == (QAbstractSocket::UnconnectedState)) { QMessageLogger("socket/qnativesocketengine.cpp", 719, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::hasPendingDatagrams()"" was called in ""QAbstractSocket::UnconnectedState"); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:1662511
partially evaluated: d->socketState == (QAbstractSocket::UnconnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1662511
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1662511
0-1662511
441 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 720, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::hasPendingDatagrams()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:1662511
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1662511
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1662511
0-1662511
442 -
443 return d->nativeHasPendingDatagrams();
executed: return d->nativeHasPendingDatagrams();
Execution Count:1662511
1662511
444} -
445 -
446 -
447 -
448 -
449 -
450 -
451 -
452qint64 QNativeSocketEngine::pendingDatagramSize() const -
453{ -
454 const QNativeSocketEnginePrivate * const d = d_func(); -
455 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 734, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::pendingDatagramSize()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
executed: }
Execution Count:31926
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31926
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31926
0-31926
456 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 735, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::pendingDatagramSize()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:31926
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31926
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31926
0-31926
457 -
458 return d->nativePendingDatagramSize();
executed: return d->nativePendingDatagramSize();
Execution Count:31926
31926
459} -
460qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxSize, QHostAddress *address, -
461 quint16 *port) -
462{ -
463 QNativeSocketEnginePrivate * const d = d_func(); -
464 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 759, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::readDatagram()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
executed: }
Execution Count:990809
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:990809
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:990809
0-990809
465 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 760, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::readDatagram()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:990809
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:990809
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:990809
0-990809
466 -
467 return d->nativeReceiveDatagram(data, maxSize, address, port);
executed: return d->nativeReceiveDatagram(data, maxSize, address, port);
Execution Count:990809
990809
468} -
469qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size, -
470 const QHostAddress &host, quint16 port) -
471{ -
472 QNativeSocketEnginePrivate * const d = d_func(); -
473 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 787, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::writeDatagram()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
executed: }
Execution Count:324646
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:324646
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:324646
0-324646
474 do { if (d->socketType != (QAbstractSocket::UdpSocket)) { QMessageLogger("socket/qnativesocketengine.cpp", 788, __PRETTY_FUNCTION__).warning("QNativeSocketEngine::writeDatagram()"" was called by a" " socket other than ""QAbstractSocket::UdpSocket"""); return (-1); } } while (0);
never executed: return (-1);
executed: }
Execution Count:324646
partially evaluated: d->socketType != (QAbstractSocket::UdpSocket)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:324646
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:324646
0-324646
475 return d->nativeSendDatagram(data, size, host, port);
executed: return d->nativeSendDatagram(data, size, host, port);
Execution Count:324646
324646
476} -
477 -
478 -
479 -
480 -
481 -
482qint64 QNativeSocketEngine::write(const char *data, qint64 size) -
483{ -
484 QNativeSocketEnginePrivate * const d = d_func(); -
485 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 799, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::write()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
executed: }
Execution Count:983483
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:983483
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:983483
0-983483
486 do { if (d->socketState != (QAbstractSocket::ConnectedState)) { QMessageLogger("socket/qnativesocketengine.cpp", 800, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::write()"" was not called in ""QAbstractSocket::ConnectedState"); return (-1); } } while (0);
never executed: return (-1);
executed: }
Execution Count:983483
partially evaluated: d->socketState != (QAbstractSocket::ConnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:983483
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:983483
0-983483
487 return d->nativeWrite(data, size);
executed: return d->nativeWrite(data, size);
Execution Count:983483
983483
488} -
489 -
490 -
491qint64 QNativeSocketEngine::bytesToWrite() const -
492{ -
493 return 0;
executed: return 0;
Execution Count:26827
26827
494} -
495 -
496 -
497 -
498 -
499 -
500qint64 QNativeSocketEngine::read(char *data, qint64 maxSize) -
501{ -
502 QNativeSocketEnginePrivate * const d = d_func(); -
503 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 817, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::read()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
executed: }
Execution Count:154611
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154611
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154611
0-154611
504 do { if (d->socketState != (QAbstractSocket::ConnectedState) && d->socketState != (QAbstractSocket::BoundState)) { QMessageLogger("socket/qnativesocketengine.cpp", 818, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::read()"" was called" " not in ""QAbstractSocket::ConnectedState"" or ""QAbstractSocket::BoundState"); return (-1); } } while (0);
never executed: return (-1);
executed: }
Execution Count:154611
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154611
partially evaluated: d->socketState != (QAbstractSocket::ConnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154611
never evaluated: d->socketState != (QAbstractSocket::BoundState)
0-154611
505 -
506 qint64 readBytes = d->nativeRead(data, maxSize); -
507 -
508 -
509 if (readBytes == 0 && d->socketType == QAbstractSocket::TcpSocket) {
evaluated: readBytes == 0
TRUEFALSE
yes
Evaluation Count:333
yes
Evaluation Count:154278
partially evaluated: d->socketType == QAbstractSocket::TcpSocket
TRUEFALSE
yes
Evaluation Count:333
no
Evaluation Count:0
0-154278
510 d->setError(QAbstractSocket::RemoteHostClosedError, -
511 QNativeSocketEnginePrivate::RemoteHostClosedErrorString); -
512 close(); -
513 return -1;
executed: return -1;
Execution Count:333
333
514 } else if (readBytes == -1) {
partially evaluated: readBytes == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154278
0-154278
515 if (!d->hasSetSocketError) {
never evaluated: !d->hasSetSocketError
0
516 d->hasSetSocketError = true; -
517 d->socketError = QAbstractSocket::NetworkError; -
518 d->socketErrorString = qt_error_string(); -
519 }
never executed: }
0
520 close(); -
521 return -1;
never executed: return -1;
0
522 } -
523 return readBytes;
executed: return readBytes;
Execution Count:154278
154278
524} -
525 -
526 -
527 -
528 -
529 -
530void QNativeSocketEngine::close() -
531{ -
532 QNativeSocketEnginePrivate * const d = d_func(); -
533 if (d->readNotifier)
evaluated: d->readNotifier
TRUEFALSE
yes
Evaluation Count:2459
yes
Evaluation Count:4613
2459-4613
534 d->readNotifier->setEnabled(false);
executed: d->readNotifier->setEnabled(false);
Execution Count:2459
2459
535 if (d->writeNotifier)
evaluated: d->writeNotifier
TRUEFALSE
yes
Evaluation Count:2326
yes
Evaluation Count:4746
2326-4746
536 d->writeNotifier->setEnabled(false);
executed: d->writeNotifier->setEnabled(false);
Execution Count:2326
2326
537 if (d->exceptNotifier)
partially evaluated: d->exceptNotifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7072
0-7072
538 d->exceptNotifier->setEnabled(false);
never executed: d->exceptNotifier->setEnabled(false);
0
539 -
540 if(d->socketDescriptor != -1) {
evaluated: d->socketDescriptor != -1
TRUEFALSE
yes
Evaluation Count:3371
yes
Evaluation Count:3701
3371-3701
541 d->nativeClose(); -
542 d->socketDescriptor = -1; -
543 }
executed: }
Execution Count:3371
3371
544 d->socketState = QAbstractSocket::UnconnectedState; -
545 d->hasSetSocketError = false; -
546 d->localPort = 0; -
547 d->localAddress.clear(); -
548 d->peerPort = 0; -
549 d->peerAddress.clear(); -
550 if (d->readNotifier) {
evaluated: d->readNotifier
TRUEFALSE
yes
Evaluation Count:2458
yes
Evaluation Count:4613
2458-4613
551 qDeleteInEventHandler(d->readNotifier); -
552 d->readNotifier = 0; -
553 }
executed: }
Execution Count:2459
2459
554 if (d->writeNotifier) {
evaluated: d->writeNotifier
TRUEFALSE
yes
Evaluation Count:2326
yes
Evaluation Count:4746
2326-4746
555 qDeleteInEventHandler(d->writeNotifier); -
556 d->writeNotifier = 0; -
557 }
executed: }
Execution Count:2326
2326
558 if (d->exceptNotifier) {
partially evaluated: d->exceptNotifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7072
0-7072
559 qDeleteInEventHandler(d->exceptNotifier); -
560 d->exceptNotifier = 0; -
561 }
never executed: }
0
562}
executed: }
Execution Count:7072
7072
563bool QNativeSocketEngine::waitForRead(int msecs, bool *timedOut) -
564{ -
565 const QNativeSocketEnginePrivate * const d = d_func(); -
566 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 896, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::waitForRead()"" was called on an uninitialized socket device"); return false; } } while (0);
never executed: return false;
executed: }
Execution Count:282
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
0-282
567 do { if (d->socketState == (QAbstractSocket::UnconnectedState)) { QMessageLogger("socket/qnativesocketengine.cpp", 898, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::waitForRead()"" was called in ""QAbstractSocket::UnconnectedState"); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:282
partially evaluated: d->socketState == (QAbstractSocket::UnconnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:282
0-282
568 -
569 -
570 if (timedOut)
evaluated: timedOut
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:280
2-280
571 *timedOut = false;
executed: *timedOut = false;
Execution Count:2
2
572 -
573 int ret = d->nativeSelect(msecs, true); -
574 if (ret == 0) {
evaluated: ret == 0
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:247
35-247
575 if (timedOut)
evaluated: timedOut
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:34
1-34
576 *timedOut = true;
executed: *timedOut = true;
Execution Count:1
1
577 d->setError(QAbstractSocket::SocketTimeoutError, -
578 QNativeSocketEnginePrivate::TimeOutErrorString); -
579 d->hasSetSocketError = false; -
580 return false;
executed: return false;
Execution Count:35
35
581 } else if (state() == QAbstractSocket::ConnectingState) {
partially evaluated: state() == QAbstractSocket::ConnectingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247
0-247
582 connectToHost(d->peerAddress, d->peerPort); -
583 }
never executed: }
0
584 -
585 return ret > 0;
executed: return ret > 0;
Execution Count:247
247
586} -
587bool QNativeSocketEngine::waitForWrite(int msecs, bool *timedOut) -
588{ -
589 QNativeSocketEnginePrivate * const d = d_func(); -
590 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 936, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::waitForWrite()"" was called on an uninitialized socket device"); return false; } } while (0);
never executed: return false;
executed: }
Execution Count:421
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:421
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:421
0-421
591 do { if (d->socketState == (QAbstractSocket::UnconnectedState)) { QMessageLogger("socket/qnativesocketengine.cpp", 938, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::waitForWrite()"" was called in ""QAbstractSocket::UnconnectedState"); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:421
partially evaluated: d->socketState == (QAbstractSocket::UnconnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:421
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:421
0-421
592 -
593 -
594 if (timedOut)
partially evaluated: timedOut
TRUEFALSE
yes
Evaluation Count:421
no
Evaluation Count:0
0-421
595 *timedOut = false;
executed: *timedOut = false;
Execution Count:421
421
596 -
597 int ret = d->nativeSelect(msecs, false); -
598 if (ret == 0) {
partially evaluated: ret == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:421
0-421
599 if (timedOut)
never evaluated: timedOut
0
600 *timedOut = true;
never executed: *timedOut = true;
0
601 d->setError(QAbstractSocket::SocketTimeoutError, -
602 QNativeSocketEnginePrivate::TimeOutErrorString); -
603 d->hasSetSocketError = false; -
604 return false;
never executed: return false;
0
605 } else if (state() == QAbstractSocket::ConnectingState) {
partially evaluated: state() == QAbstractSocket::ConnectingState
TRUEFALSE
yes
Evaluation Count:421
no
Evaluation Count:0
0-421
606 connectToHost(d->peerAddress, d->peerPort); -
607 }
executed: }
Execution Count:421
421
608 -
609 return ret > 0;
executed: return ret > 0;
Execution Count:421
421
610} -
611 -
612bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, -
613 bool checkRead, bool checkWrite, -
614 int msecs, bool *timedOut) -
615{ -
616 QNativeSocketEnginePrivate * const d = d_func(); -
617 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 992, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::waitForWrite()"" was called on an uninitialized socket device"); return false; } } while (0);
never executed: return false;
executed: }
Execution Count:18314
partially evaluated: !isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18314
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18314
0-18314
618 do { if (d->socketState == (QAbstractSocket::UnconnectedState)) { QMessageLogger("socket/qnativesocketengine.cpp", 994, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::waitForReadOrWrite()"" was called in ""QAbstractSocket::UnconnectedState"); return (false); } } while (0);
never executed: return (false);
executed: }
Execution Count:18315
partially evaluated: d->socketState == (QAbstractSocket::UnconnectedState)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18315
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18315
0-18315
619 -
620 -
621 int ret = d->nativeSelect(msecs, checkRead, checkWrite, readyToRead, readyToWrite); -
622 if (ret == 0) {
evaluated: ret == 0
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:18284
31-18284
623 if (timedOut)
partially evaluated: timedOut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
624 *timedOut = true;
never executed: *timedOut = true;
0
625 d->setError(QAbstractSocket::SocketTimeoutError, -
626 QNativeSocketEnginePrivate::TimeOutErrorString); -
627 d->hasSetSocketError = false; -
628 return false;
executed: return false;
Execution Count:31
31
629 } else if (state() == QAbstractSocket::ConnectingState) {
partially evaluated: state() == QAbstractSocket::ConnectingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18284
0-18284
630 connectToHost(d->peerAddress, d->peerPort); -
631 }
never executed: }
0
632 -
633 return ret > 0;
executed: return ret > 0;
Execution Count:18284
18284
634} -
635 -
636 -
637 -
638 -
639 -
640 -
641 -
642qint64 QNativeSocketEngine::receiveBufferSize() const -
643{ -
644 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 1047, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::receiveBufferSize()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
never executed: }
never evaluated: !isValid()
never evaluated: 0
0
645 return option(ReceiveBufferSocketOption);
never executed: return option(ReceiveBufferSocketOption);
0
646} -
647void QNativeSocketEngine::setReceiveBufferSize(qint64 size) -
648{ -
649 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 1068, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::setReceiveBufferSize()"" was called on an uninitialized socket device"); return ; } } while (0);
never executed: return ;
never executed: }
never evaluated: !isValid()
never evaluated: 0
0
650 setOption(ReceiveBufferSocketOption, size); -
651}
never executed: }
0
652 -
653 -
654 -
655 -
656 -
657 -
658qint64 QNativeSocketEngine::sendBufferSize() const -
659{ -
660 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 1079, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::setSendBufferSize()"" was called on an uninitialized socket device"); return -1; } } while (0);
never executed: return -1;
never executed: }
never evaluated: !isValid()
never evaluated: 0
0
661 return option(SendBufferSocketOption);
never executed: return option(SendBufferSocketOption);
0
662} -
663void QNativeSocketEngine::setSendBufferSize(qint64 size) -
664{ -
665 do { if (!isValid()) { QMessageLogger("socket/qnativesocketengine.cpp", 1094, __PRETTY_FUNCTION__).warning("""QNativeSocketEngine::setSendBufferSize()"" was called on an uninitialized socket device"); return ; } } while (0);
never executed: return ;
never executed: }
never evaluated: !isValid()
never evaluated: 0
0
666 setOption(SendBufferSocketOption, size); -
667}
never executed: }
0
668 -
669 -
670 -
671 -
672 -
673bool QNativeSocketEngine::setOption(SocketOption option, int value) -
674{ -
675 QNativeSocketEnginePrivate * const d = d_func(); -
676 return d->setOption(option, value);
executed: return d->setOption(option, value);
Execution Count:7277
7277
677} -
678 -
679 -
680 -
681 -
682int QNativeSocketEngine::option(SocketOption socketOption) const -
683{ -
684 const QNativeSocketEnginePrivate * const d = d_func(); -
685 return d->option(socketOption);
executed: return d->option(socketOption);
Execution Count:26
26
686} -
687 -
688bool QNativeSocketEngine::isReadNotificationEnabled() const -
689{ -
690 const QNativeSocketEnginePrivate * const d = d_func(); -
691 return d->readNotifier && d->readNotifier->isEnabled();
executed: return d->readNotifier && d->readNotifier->isEnabled();
Execution Count:442147
442147
692} -
693class QReadNotifier : public QSocketNotifier -
694{ -
695public: -
696 QReadNotifier(qintptr fd, QNativeSocketEngine *parent) -
697 : QSocketNotifier(fd, QSocketNotifier::Read, parent) -
698 { engine = parent; }
executed: }
Execution Count:2461
2461
699 -
700protected: -
701 bool event(QEvent *); -
702 -
703 QNativeSocketEngine *engine; -
704}; -
705 -
706bool QReadNotifier::event(QEvent *e) -
707{ -
708 if (e->type() == QEvent::SockAct) {
evaluated: e->type() == QEvent::SockAct
TRUEFALSE
yes
Evaluation Count:9576
yes
Evaluation Count:8
8-9576
709 engine->readNotification(); -
710 return true;
executed: return true;
Execution Count:9576
9576
711 } else if (e->type() == QEvent::SockClose) {
partially evaluated: e->type() == QEvent::SockClose
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
712 engine->closeNotification(); -
713 return true;
never executed: return true;
0
714 } -
715 return QSocketNotifier::event(e);
executed: return QSocketNotifier::event(e);
Execution Count:8
8
716} -
717class QWriteNotifier : public QSocketNotifier -
718{ -
719public: -
720 QWriteNotifier(int fd, QNativeSocketEngine *parent) -
721 : QSocketNotifier(fd, QSocketNotifier::Write, parent) { engine = parent; }
executed: }
Execution Count:2328
2328
722 -
723protected: -
724 bool event(QEvent *); -
725 -
726 QNativeSocketEngine *engine; -
727}; -
728 -
729bool QWriteNotifier::event(QEvent *e) -
730{ -
731 if (e->type() == QEvent::SockAct) {
evaluated: e->type() == QEvent::SockAct
TRUEFALSE
yes
Evaluation Count:8026
yes
Evaluation Count:2
2-8026
732 if (engine->state() == QAbstractSocket::ConnectingState)
evaluated: engine->state() == QAbstractSocket::ConnectingState
TRUEFALSE
yes
Evaluation Count:774
yes
Evaluation Count:7252
774-7252
733 engine->connectionNotification();
executed: engine->connectionNotification();
Execution Count:774
774
734 else -
735 engine->writeNotification();
executed: engine->writeNotification();
Execution Count:7252
7252
736 return true;
executed: return true;
Execution Count:8026
8026
737 } -
738 return QSocketNotifier::event(e);
executed: return QSocketNotifier::event(e);
Execution Count:2
2
739} -
740 -
741class QExceptionNotifier : public QSocketNotifier -
742{ -
743public: -
744 QExceptionNotifier(int fd, QNativeSocketEngine *parent) -
745 : QSocketNotifier(fd, QSocketNotifier::Exception, parent) { engine = parent; }
never executed: }
0
746 -
747protected: -
748 bool event(QEvent *); -
749 -
750 QNativeSocketEngine *engine; -
751}; -
752 -
753bool QExceptionNotifier::event(QEvent *e) -
754{ -
755 if (e->type() == QEvent::SockAct) {
never evaluated: e->type() == QEvent::SockAct
0
756 if (engine->state() == QAbstractSocket::ConnectingState)
never evaluated: engine->state() == QAbstractSocket::ConnectingState
0
757 engine->connectionNotification();
never executed: engine->connectionNotification();
0
758 else -
759 engine->exceptionNotification();
never executed: engine->exceptionNotification();
0
760 return true;
never executed: return true;
0
761 } -
762 return QSocketNotifier::event(e);
never executed: return QSocketNotifier::event(e);
0
763} -
764 -
765void QNativeSocketEngine::setReadNotificationEnabled(bool enable) -
766{ -
767 QNativeSocketEnginePrivate * const d = d_func(); -
768 if (d->readNotifier) {
evaluated: d->readNotifier
TRUEFALSE
yes
Evaluation Count:1005709
yes
Evaluation Count:3353
3353-1005709
769 d->readNotifier->setEnabled(enable); -
770 } else if (enable && d->threadData->eventDispatcher) {
executed: }
Execution Count:1005709
evaluated: enable
TRUEFALSE
yes
Evaluation Count:2461
yes
Evaluation Count:892
partially evaluated: d->threadData->eventDispatcher
TRUEFALSE
yes
Evaluation Count:2461
no
Evaluation Count:0
0-1005709
771 d->readNotifier = new QReadNotifier(d->socketDescriptor, this); -
772 d->readNotifier->setEnabled(true); -
773 }
executed: }
Execution Count:2461
2461
774} -
775 -
776bool QNativeSocketEngine::isWriteNotificationEnabled() const -
777{ -
778 const QNativeSocketEnginePrivate * const d = d_func(); -
779 return d->writeNotifier && d->writeNotifier->isEnabled();
executed: return d->writeNotifier && d->writeNotifier->isEnabled();
Execution Count:18490
18490
780} -
781 -
782void QNativeSocketEngine::setWriteNotificationEnabled(bool enable) -
783{ -
784 QNativeSocketEnginePrivate * const d = d_func(); -
785 if (d->writeNotifier) {
evaluated: d->writeNotifier
TRUEFALSE
yes
Evaluation Count:50556
yes
Evaluation Count:2328
2328-50556
786 d->writeNotifier->setEnabled(enable); -
787 } else if (enable && d->threadData->eventDispatcher) {
executed: }
Execution Count:50556
partially evaluated: enable
TRUEFALSE
yes
Evaluation Count:2328
no
Evaluation Count:0
partially evaluated: d->threadData->eventDispatcher
TRUEFALSE
yes
Evaluation Count:2328
no
Evaluation Count:0
0-50556
788 d->writeNotifier = new QWriteNotifier(d->socketDescriptor, this); -
789 d->writeNotifier->setEnabled(true); -
790 }
executed: }
Execution Count:2328
2328
791} -
792 -
793bool QNativeSocketEngine::isExceptionNotificationEnabled() const -
794{ -
795 const QNativeSocketEnginePrivate * const d = d_func(); -
796 return d->exceptNotifier && d->exceptNotifier->isEnabled();
executed: return d->exceptNotifier && d->exceptNotifier->isEnabled();
Execution Count:167
167
797} -
798 -
799void QNativeSocketEngine::setExceptionNotificationEnabled(bool enable) -
800{ -
801 QNativeSocketEnginePrivate * const d = d_func(); -
802 if (d->exceptNotifier) {
partially evaluated: d->exceptNotifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:334
0-334
803 d->exceptNotifier->setEnabled(enable); -
804 } else if (enable && d->threadData->eventDispatcher) {
never executed: }
partially evaluated: enable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:334
never evaluated: d->threadData->eventDispatcher
0-334
805 d->exceptNotifier = new QExceptionNotifier(d->socketDescriptor, this); -
806 d->exceptNotifier->setEnabled(true); -
807 }
never executed: }
0
808} -
809 -
810 -
811 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial