OpenCoverage

qftp.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qftp.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7class QFtpPI;-
8-
9-
10-
11-
12-
13class QFtpDTP : public QObject-
14{-
15 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
16#pragma GCC diagnostic push-
17 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
18#pragma GCC diagnostic pop-
19 struct QPrivateSignal {};-
20-
21public:-
22 enum ConnectState {-
23 CsHostFound,-
24 CsConnected,-
25 CsClosed,-
26 CsHostNotFound,-
27 CsConnectionRefused-
28 };-
29-
30 QFtpDTP(QFtpPI *p, QObject *parent = 0);-
31-
32 void setData(QByteArray *);-
33 void setDevice(QIODevice *);-
34 void writeData();-
35 void setBytesTotal(qint64 bytes);-
36-
37 bool hasError() const;-
38 QString errorMessage() const;-
39 void clearError();-
40-
41 void connectToHost(const QString & host, quint16 port);-
42 int setupListener(const QHostAddress &address);-
43 void waitForConnection();-
44-
45 QTcpSocket::SocketState state() const;-
46 qint64 bytesAvailable() const;-
47 qint64 read(char *data, qint64 maxlen);-
48 QByteArray readAll();-
49-
50 void abortConnection();-
51-
52 static bool parseDir(const QByteArray &buffer, const QString &userName, QUrlInfo *info);-
53-
54public :-
55 void listInfo(const QUrlInfo&);-
56 void readyRead();-
57 void dataTransferProgress(qint64, qint64);-
58-
59 void connectState(int);-
60-
61private :-
62 void socketConnected();-
63 void socketReadyRead();-
64 void socketError(QAbstractSocket::SocketError);-
65 void socketConnectionClosed();-
66 void socketBytesWritten(qint64);-
67 void setupSocket();-
68-
69 void dataReadyRead();-
70-
71private:-
72 void clearData();-
73-
74 QTcpSocket *socket;-
75 QTcpServer listener;-
76-
77 QFtpPI *pi;-
78 QString err;-
79 qint64 bytesDone;-
80 qint64 bytesTotal;-
81 bool callWriteData;-
82-
83-
84-
85 union {-
86 QByteArray *ba;-
87 QIODevice *dev;-
88 } data;-
89 bool is_ba;-
90-
91 QByteArray bytesFromSocket;-
92};-
93-
94-
95-
96-
97-
98-
99-
100class QFtpPI : public QObject-
101{-
102 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
103#pragma GCC diagnostic push-
104 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
105#pragma GCC diagnostic pop-
106 struct QPrivateSignal {};-
107-
108public:-
109 QFtpPI(QObject *parent = 0);-
110-
111 void connectToHost(const QString &host, quint16 port);-
112-
113 bool sendCommands(const QStringList &cmds);-
114 bool sendCommand(const QString &cmd)-
115 { return
never executed: return sendCommands(QStringList(cmd));
sendCommands(QStringList(cmd));
never executed: return sendCommands(QStringList(cmd));
}
0
116-
117 void clearPendingCommands();-
118 void abort();-
119-
120 QString currentCommand() const-
121 { return
executed 3234 times by 2 tests: return currentCmd;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
currentCmd;
executed 3234 times by 2 tests: return currentCmd;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
}
3234
122-
123 bool rawCommand;-
124 bool transferConnectionExtended;-
125-
126 QFtpDTP dtp;-
127-
128public :-
129 void connectState(int);-
130 void finished(const QString&);-
131 void error(int, const QString&);-
132 void rawFtpReply(int, const QString&);-
133-
134private :-
135 void hostFound();-
136 void connected();-
137 void connectionClosed();-
138 void delayedCloseFinished();-
139 void readyRead();-
140 void error(QAbstractSocket::SocketError);-
141-
142 void dtpConnectState(int);-
143-
144private:-
145-
146-
147 enum State {-
148 Begin,-
149 Idle,-
150 Waiting,-
151 Success,-
152 Failure-
153 };-
154-
155 enum AbortState {-
156 None,-
157 AbortStarted,-
158 WaitForAbortToFinish-
159 };-
160-
161 bool processReply();-
162 bool startNextCmd();-
163-
164 QTcpSocket commandSocket;-
165 QString replyText;-
166 char replyCode[3];-
167 State state;-
168 AbortState abortState;-
169 QStringList pendingCommands;-
170 QString currentCmd;-
171-
172 bool waitForDtpToConnect;-
173 bool waitForDtpToClose;-
174-
175 QByteArray bytesFromSocket;-
176-
177 friend class QFtpDTP;-
178};-
179-
180-
181-
182-
183-
184-
185class QFtpCommand-
186{-
187public:-
188 QFtpCommand(QFtp::Command cmd, const QStringList &raw, const QByteArray &ba);-
189 QFtpCommand(QFtp::Command cmd, const QStringList &raw, QIODevice *dev = 0);-
190 ~QFtpCommand();-
191-
192 int id;-
193 QFtp::Command command;-
194 QStringList rawCmds;-
195-
196-
197-
198 union {-
199 QByteArray *ba;-
200 QIODevice *dev;-
201 } data;-
202 bool is_ba;-
203-
204 static QBasicAtomicInt idCounter;-
205};-
206-
207QBasicAtomicInt QFtpCommand::idCounter = { 1 };-
208-
209QFtpCommand::QFtpCommand(QFtp::Command cmd, const QStringList &raw, const QByteArray &ba)-
210 : command(cmd), rawCmds(raw), is_ba(true)-
211{-
212 id = idCounter.fetchAndAddRelaxed(1);-
213 data.ba = new QByteArray(ba);-
214}
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFtp
28
215-
216QFtpCommand::QFtpCommand(QFtp::Command cmd, const QStringList &raw, QIODevice *dev)-
217 : command(cmd), rawCmds(raw), is_ba(false)-
218{-
219 id = idCounter.fetchAndAddRelaxed(1);-
220 data.dev = dev;-
221}
executed 3395 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3395
222-
223QFtpCommand::~QFtpCommand()-
224{-
225 if (is_ba
is_baDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 3391 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
28-3391
226 delete data.ba;
executed 28 times by 1 test: delete data.ba;
Executed by:
  • tst_QFtp
28
227}
executed 3419 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3419
228-
229-
230-
231-
232-
233-
234QFtpDTP::QFtpDTP(QFtpPI *p, QObject *parent) :-
235 QObject(parent),-
236 socket(0),-
237 listener(this),-
238 pi(p),-
239 callWriteData(false)-
240{-
241 clearData();-
242 listener.setObjectName(QLatin1String("QFtpDTP active state server"));-
243 connect(&listener, qFlagLocation("2""newConnection()" "\0" __FILE__ ":" "288"), qFlagLocation("1""setupSocket()" "\0" __FILE__ ":" "288"));-
244}
executed 661 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
661
245-
246void QFtpDTP::setData(QByteArray *ba)-
247{-
248 is_ba = true;-
249 data.ba = ba;-
250}
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFtp
28
251-
252void QFtpDTP::setDevice(QIODevice *dev)-
253{-
254 is_ba = false;-
255 data.dev = dev;-
256}
executed 55 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
55
257-
258void QFtpDTP::setBytesTotal(qint64 bytes)-
259{-
260 bytesTotal = bytes;-
261 bytesDone = 0;-
262 dataTransferProgress(bytesDone, bytesTotal);-
263}
executed 153 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
153
264-
265void QFtpDTP::connectToHost(const QString & host, quint16 port)-
266{-
267 bytesFromSocket.clear();-
268-
269 if (socket
socketDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 354 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
1-354
270 delete socket;-
271 socket = 0;-
272 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
273 socket = new QTcpSocket(this);-
274-
275-
276 socket->setProperty("_q_networksession", property("_q_networksession"));-
277-
278 socket->setObjectName(QLatin1String("QFtpDTP Passive state socket"));-
279 connect(socket, qFlagLocation("2""connected()" "\0" __FILE__ ":" "324"), qFlagLocation("1""socketConnected()" "\0" __FILE__ ":" "324"));-
280 connect(socket, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "325"), qFlagLocation("1""socketReadyRead()" "\0" __FILE__ ":" "325"));-
281 connect(socket, qFlagLocation("2""error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "326"), qFlagLocation("1""socketError(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "326"));-
282 connect(socket, qFlagLocation("2""disconnected()" "\0" __FILE__ ":" "327"), qFlagLocation("1""socketConnectionClosed()" "\0" __FILE__ ":" "327"));-
283 connect(socket, qFlagLocation("2""bytesWritten(qint64)" "\0" __FILE__ ":" "328"), qFlagLocation("1""socketBytesWritten(qint64)" "\0" __FILE__ ":" "328"));-
284-
285 socket->connectToHost(host, port);-
286}
executed 355 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
355
287-
288int QFtpDTP::setupListener(const QHostAddress &address)-
289{-
290-
291-
292 listener.setProperty("_q_networksession", property("_q_networksession"));-
293-
294 if (!listener.isListening()
!listener.isListening()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
&& !listener.listen(address, 0)
!listener.listen(address, 0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
)
0-8
295 return
never executed: return -1;
-1;
never executed: return -1;
0
296 return
executed 8 times by 1 test: return listener.serverPort();
Executed by:
  • tst_QFtp
listener.serverPort();
executed 8 times by 1 test: return listener.serverPort();
Executed by:
  • tst_QFtp
8
297}-
298-
299void QFtpDTP::waitForConnection()-
300{-
301-
302-
303-
304 if (listener.isListening()
listener.isListening()Description
TRUEnever evaluated
FALSEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-43
305 listener.waitForNewConnection();
never executed: listener.waitForNewConnection();
0
306}
executed 43 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
43
307-
308QTcpSocket::SocketState QFtpDTP::state() const-
309{-
310 return
executed 346 times by 2 tests: return socket ? socket->state() : QTcpSocket::UnconnectedState;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
socket ? socket->state() : QTcpSocket::UnconnectedState;
executed 346 times by 2 tests: return socket ? socket->state() : QTcpSocket::UnconnectedState;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
346
311}-
312-
313qint64 QFtpDTP::bytesAvailable() const-
314{-
315 if (!socket
!socketDescription
TRUEevaluated 4292 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1879 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
|| socket->state() != QTcpSocket::ConnectedState
socket->state(...ConnectedStateDescription
TRUEevaluated 1299 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 580 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
580-4292
316 return
executed 5591 times by 2 tests: return (qint64) bytesFromSocket.size();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
(qint64) bytesFromSocket.size();
executed 5591 times by 2 tests: return (qint64) bytesFromSocket.size();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
5591
317 return
executed 580 times by 2 tests: return socket->bytesAvailable();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
socket->bytesAvailable();
executed 580 times by 2 tests: return socket->bytesAvailable();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
580
318}-
319-
320qint64 QFtpDTP::read(char *data, qint64 maxlen)-
321{-
322 qint64 read;-
323 if (socket
socketDescription
TRUEnever evaluated
FALSEnever evaluated
&& socket->state() == QTcpSocket::ConnectedState
socket->state(...ConnectedStateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
324 read = socket->read(data, maxlen);-
325 }
never executed: end of block
else {
0
326 read = qMin(maxlen, qint64(bytesFromSocket.size()));-
327 memcpy(data, bytesFromSocket.data(), read);-
328 bytesFromSocket.remove(0, read);-
329 }
never executed: end of block
0
330-
331 bytesDone += read;-
332 return
never executed: return read;
read;
never executed: return read;
0
333}-
334-
335QByteArray QFtpDTP::readAll()-
336{-
337 QByteArray tmp;-
338 if (socket
socketDescription
TRUEevaluated 611 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
&& socket->state() == QTcpSocket::ConnectedState
socket->state(...ConnectedStateDescription
TRUEevaluated 587 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QFtp
) {
0-611
339 tmp = socket->readAll();-
340 bytesDone += tmp.size();-
341 }
executed 587 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else {
587
342 tmp = bytesFromSocket;-
343 bytesFromSocket.clear();-
344 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_QFtp
24
345 return
executed 611 times by 2 tests: return tmp;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
tmp;
executed 611 times by 2 tests: return tmp;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
611
346}-
347-
348void QFtpDTP::writeData()-
349{-
350 if (!socket
!socketDescription
TRUEnever evaluated
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-198
351 return;
never executed: return;
0
352-
353 if (is_ba
is_baDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 170 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
28-170
354-
355-
356-
357 if (data.ba->size() == 0
data.ba->size() == 0Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
)
8-20
358 dataTransferProgress(0, bytesTotal);
executed 20 times by 1 test: dataTransferProgress(0, bytesTotal);
Executed by:
  • tst_QFtp
20
359 else-
360 socket->write(data.ba->data(), data.ba->size());
executed 8 times by 1 test: socket->write(data.ba->data(), data.ba->size());
Executed by:
  • tst_QFtp
8
361-
362 socket->close();-
363-
364 clearData();-
365 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFtp
else if (data.dev
data.devDescription
TRUEevaluated 170 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-170
366 callWriteData = false;-
367 const qint64 blockSize = 16*1024;-
368 char buf[16*1024];-
369 qint64 read = data.dev->read(buf, blockSize);-
370-
371-
372-
373 if (read > 0
read > 0Description
TRUEevaluated 155 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
15-155
374 socket->write(buf, read);-
375 }
executed 155 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else if (read == -1
read == -1Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
|| (!data.dev->isSequential()
!data.dev->isSequential()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
&& data.dev->atEnd()
data.dev->atEnd()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
)) {
0-155
376-
377 if (bytesDone == 0
bytesDone == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& socket->bytesToWrite() == 0
socket->bytesToWrite() == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
)
0-13
378 dataTransferProgress(0, bytesTotal);
executed 2 times by 1 test: dataTransferProgress(0, bytesTotal);
Executed by:
  • tst_QNetworkReply
2
379 socket->close();-
380 clearData();-
381 }
executed 15 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
15
382-
383-
384 callWriteData = data.dev != 0;-
385 }
executed 170 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
170
386}
executed 198 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
198
387-
388void QFtpDTP::dataReadyRead()-
389{-
390 writeData();-
391}
never executed: end of block
0
392-
393inline bool QFtpDTP::hasError() const-
394{-
395 return
executed 3282 times by 2 tests: return !err.isNull();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
!err.isNull();
executed 3282 times by 2 tests: return !err.isNull();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3282
396}-
397-
398inline QString QFtpDTP::errorMessage() const-
399{-
400 return
never executed: return err;
err;
never executed: return err;
0
401}-
402-
403inline void QFtpDTP::clearError()-
404{-
405 err.clear();-
406}
never executed: end of block
0
407-
408void QFtpDTP::abortConnection()-
409{-
410-
411-
412-
413-
414 callWriteData = false;-
415 clearData();-
416-
417 if (socket
socketDescription
TRUEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 144 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
19-144
418 socket->abort();
executed 19 times by 2 tests: socket->abort();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
19
419}
executed 163 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
163
420-
421static void _q_fixupDateTime(QDateTime *dateTime)-
422{-
423-
424 const int futureTolerance = 86400;-
425 if (dateTime->secsTo(QDateTime::currentDateTime()) < -futureTolerance
dateTime->secs...utureToleranceDescription
TRUEnever evaluated
FALSEevaluated 116 times by 1 test
Evaluated by:
  • tst_QFtp
) {
0-116
426 QDate d = dateTime->date();-
427 d.setDate(d.year() - 1, d.month(), d.day());-
428 dateTime->setDate(d);-
429 }
never executed: end of block
0
430}
executed 116 times by 1 test: end of block
Executed by:
  • tst_QFtp
116
431-
432static void _q_parseUnixDir(const QStringList &tokens, const QString &userName, QUrlInfo *info)-
433{-
434-
435-
436-
437-
438 if (tokens.size() != 8
tokens.size() != 8Description
TRUEnever evaluated
FALSEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
)
0-372
439 return;
never executed: return;
0
440-
441 char first = tokens.at(1).at(0).toLatin1();-
442 if (first == 'd'
first == 'd'Description
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_QFtp
) {
156-216
443 info->setDir(true);-
444 info->setFile(false);-
445 info->setSymLink(false);-
446 }
executed 156 times by 1 test: end of block
Executed by:
  • tst_QFtp
else if (first == '-'
first == '-'Description
TRUEevaluated 216 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
) {
0-216
447 info->setDir(false);-
448 info->setFile(true);-
449 info->setSymLink(false);-
450 }
executed 216 times by 1 test: end of block
Executed by:
  • tst_QFtp
else if (first == 'l'
first == 'l'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-216
451 info->setDir(true);-
452 info->setFile(false);-
453 info->setSymLink(true);-
454 }
never executed: end of block
0
455-
456-
457 QString name = tokens.at(7);-
458 if (info->isSymLink()
info->isSymLink()Description
TRUEnever evaluated
FALSEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
) {
0-372
459 int linkPos = name.indexOf(QLatin1String(" ->"));-
460 if (linkPos != -1
linkPos != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
461 name.resize(linkPos);
never executed: name.resize(linkPos);
0
462 }
never executed: end of block
0
463 info->setName(name);-
464-
465-
466 info->setOwner(tokens.at(3));-
467 info->setGroup(tokens.at(4));-
468-
469-
470 info->setSize(tokens.at(5).toLongLong());-
471-
472 QStringList formats;-
473 formats << QLatin1String("MMM dd yyyy") << QLatin1String("MMM dd hh:mm") << QLatin1String("MMM d yyyy")-
474 << QLatin1String("MMM d hh:mm") << QLatin1String("MMM d yyyy") << QLatin1String("MMM dd yyyy");-
475-
476 QString dateString = tokens.at(6);-
477 dateString[0] = dateString[0].toUpper();-
478-
479-
480 QDateTime dateTime;-
481 int n = 0;-
482-
483 do {-
484 dateTime = QLocale::c().toDateTime(dateString, formats.at(n++));-
485 }
executed 496 times by 1 test: end of block
Executed by:
  • tst_QFtp
while (n < formats.size()
n < formats.size()Description
TRUEevaluated 496 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
&& (
(!dateTime.isValid())Description
TRUEevaluated 124 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
!dateTime.isValid())
(!dateTime.isValid())Description
TRUEevaluated 124 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
);
0-496
486-
487-
488 if (n == 2
n == 2Description
TRUEevaluated 116 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 256 times by 1 test
Evaluated by:
  • tst_QFtp
|| n == 4
n == 4Description
TRUEnever evaluated
FALSEevaluated 256 times by 1 test
Evaluated by:
  • tst_QFtp
) {
0-256
489-
490 dateTime.setDate(QDate(QDate::currentDate().year(),-
491 dateTime.date().month(),-
492 dateTime.date().day()));-
493 _q_fixupDateTime(&dateTime);-
494 }
executed 116 times by 1 test: end of block
Executed by:
  • tst_QFtp
116
495 if (dateTime.isValid()
dateTime.isValid()Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
)
0-372
496 info->setLastModified(dateTime);
executed 372 times by 1 test: info->setLastModified(dateTime);
Executed by:
  • tst_QFtp
372
497-
498-
499 int permissions = 0;-
500 const QString &p = tokens.at(2);-
501 permissions |= (p[0] == QLatin1Char('r')
p[0] == QLatin1Char('r')Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
? QUrlInfo::ReadOwner : 0);
0-372
502 permissions |= (p[1] == QLatin1Char('w')
p[1] == QLatin1Char('w')Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
? QUrlInfo::WriteOwner : 0);
0-372
503 permissions |= (p[2] == QLatin1Char('x')
p[2] == QLatin1Char('x')Description
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_QFtp
? QUrlInfo::ExeOwner : 0);
156-216
504 permissions |= (p[3] == QLatin1Char('r')
p[3] == QLatin1Char('r')Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
? QUrlInfo::ReadGroup : 0);
0-372
505 permissions |= (p[4] == QLatin1Char('w')
p[4] == QLatin1Char('w')Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 324 times by 1 test
Evaluated by:
  • tst_QFtp
? QUrlInfo::WriteGroup : 0);
48-324
506 permissions |= (p[5] == QLatin1Char('x')
p[5] == QLatin1Char('x')Description
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_QFtp
? QUrlInfo::ExeGroup : 0);
156-216
507 permissions |= (p[6] == QLatin1Char('r')
p[6] == QLatin1Char('r')Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
? QUrlInfo::ReadOther : 0);
0-372
508 permissions |= (p[7] == QLatin1Char('w')
p[7] == QLatin1Char('w')Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 324 times by 1 test
Evaluated by:
  • tst_QFtp
? QUrlInfo::WriteOther : 0);
48-324
509 permissions |= (p[8] == QLatin1Char('x')
p[8] == QLatin1Char('x')Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 264 times by 1 test
Evaluated by:
  • tst_QFtp
? QUrlInfo::ExeOther : 0);
108-264
510 info->setPermissions(permissions);-
511-
512 bool isOwner = info->owner() == userName;-
513 info->setReadable((permissions & QUrlInfo::ReadOther) || ((permissions & QUrlInfo::ReadOwner) && isOwner));-
514 info->setWritable((permissions & QUrlInfo::WriteOther) || ((permissions & QUrlInfo::WriteOwner) && isOwner));-
515}
executed 372 times by 1 test: end of block
Executed by:
  • tst_QFtp
372
516-
517static void _q_parseDosDir(const QStringList &tokens, const QString &userName, QUrlInfo *info)-
518{-
519-
520-
521-
522 if (tokens.size() != 4
tokens.size() != 4Description
TRUEnever evaluated
FALSEnever evaluated
)
0
523 return;
never executed: return;
0
524-
525 (void)userName;;-
526-
527 QString name = tokens.at(3);-
528 info->setName(name);-
529 info->setSymLink(name.toLower().endsWith(QLatin1String(".lnk")));-
530-
531 if (tokens.at(2) == QLatin1String("<DIR>")
tokens.at(2) =...tring("<DIR>")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
532 info->setFile(false);-
533 info->setDir(true);-
534 }
never executed: end of block
else {
0
535 info->setFile(true);-
536 info->setDir(false);-
537 info->setSize(tokens.at(2).toLongLong());-
538 }
never executed: end of block
0
539-
540-
541-
542 int permissions = QUrlInfo::ReadOwner | QUrlInfo::WriteOwner-
543 | QUrlInfo::ReadGroup | QUrlInfo::WriteGroup-
544 | QUrlInfo::ReadOther | QUrlInfo::WriteOther;-
545 QStringRef ext;-
546 int extIndex = name.lastIndexOf(QLatin1Char('.'));-
547 if (extIndex != -1
extIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
548 ext = name.midRef(extIndex + 1);
never executed: ext = name.midRef(extIndex + 1);
0
549 if (ext == QLatin1String("exe")
ext == QLatin1String("exe")Description
TRUEnever evaluated
FALSEnever evaluated
|| ext == QLatin1String("bat")
ext == QLatin1String("bat")Description
TRUEnever evaluated
FALSEnever evaluated
|| ext == QLatin1String("com")
ext == QLatin1String("com")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
550 permissions |= QUrlInfo::ExeOwner | QUrlInfo::ExeGroup | QUrlInfo::ExeOther;
never executed: permissions |= QUrlInfo::ExeOwner | QUrlInfo::ExeGroup | QUrlInfo::ExeOther;
0
551 info->setPermissions(permissions);-
552-
553 info->setReadable(true);-
554 info->setWritable(info->isFile());-
555-
556 QDateTime dateTime;-
557-
558 dateTime = QLocale::c().toDateTime(tokens.at(1), QLatin1String("MM-dd-yy hh:mmAP"));-
559 if (dateTime.date().year() < 1971
dateTime.date().year() < 1971Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
560 dateTime.setDate(QDate(dateTime.date().year() + 100,-
561 dateTime.date().month(),-
562 dateTime.date().day()));-
563 }
never executed: end of block
0
564-
565-
566 info->setLastModified(dateTime);-
567-
568}
never executed: end of block
0
569-
570bool QFtpDTP::parseDir(const QByteArray &buffer, const QString &userName, QUrlInfo *info)-
571{-
572 if (buffer.isEmpty()
buffer.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 374 times by 1 test
Evaluated by:
  • tst_QFtp
)
0-374
573 return
never executed: return false;
false;
never executed: return false;
0
574-
575 QString bufferStr = QString::fromUtf8(buffer).trimmed();-
576-
577-
578 QRegExp unixPattern(QLatin1String("^([\\-dl])([a-zA-Z\\-]{9,9})\\s+\\d+\\s+(\\S*)\\s+"-
579 "(\\S*)\\s+(\\d+)\\s+(\\S+\\s+\\S+\\s+\\S+)\\s+(\\S.*)"));-
580 if (unixPattern.indexIn(bufferStr) == 0
unixPattern.in...ufferStr) == 0Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
) {
2-372
581 _q_parseUnixDir(unixPattern.capturedTexts(), userName, info);-
582 return
executed 372 times by 1 test: return true;
Executed by:
  • tst_QFtp
true;
executed 372 times by 1 test: return true;
Executed by:
  • tst_QFtp
372
583 }-
584-
585-
586 QRegExp dosPattern(QLatin1String("^(\\d\\d-\\d\\d-\\d\\d\\ \\ \\d\\d:\\d\\d[AP]M)\\s+"-
587 "(<DIR>|\\d+)\\s+(\\S.*)$"));-
588 if (dosPattern.indexIn(bufferStr) == 0
dosPattern.ind...ufferStr) == 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
) {
0-2
589 _q_parseDosDir(dosPattern.capturedTexts(), userName, info);-
590 return
never executed: return true;
true;
never executed: return true;
0
591 }-
592-
593-
594 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_QFtp
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QFtp
2
595}-
596-
597void QFtpDTP::socketConnected()-
598{-
599 bytesDone = 0;-
600-
601-
602-
603 connectState(QFtpDTP::CsConnected);-
604}
executed 355 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
355
605-
606void QFtpDTP::socketReadyRead()-
607{-
608 if (!socket
!socketDescription
TRUEnever evaluated
FALSEevaluated 1579 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-1579
609 return;
never executed: return;
0
610-
611 if (pi->currentCommand().isEmpty()
pi->currentCommand().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1579 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-1579
612 socket->close();-
613-
614-
615-
616 connectState(QFtpDTP::CsClosed);-
617 return;
never executed: return;
0
618 }-
619-
620 if (pi->abortState != QFtpPI::None
pi->abortState != QFtpPI::NoneDescription
TRUEnever evaluated
FALSEevaluated 1579 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-1579
621-
622 socket->readAll();-
623 return;
never executed: return;
0
624 }-
625-
626 if (pi->currentCommand().startsWith(QLatin1String("LIST"))
pi->currentCom...tring("LIST"))Description
TRUEevaluated 142 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 1437 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
142-1437
627 while (socket->canReadLine()
socket->canReadLine()Description
TRUEevaluated 374 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 142 times by 1 test
Evaluated by:
  • tst_QFtp
) {
142-374
628 QUrlInfo i;-
629 QByteArray line = socket->readLine();-
630-
631-
632-
633 if (parseDir(line, QLatin1String(""), &i)
parseDir(line,...tring(""), &i)Description
TRUEevaluated 372 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
) {
2-372
634 listInfo(i);-
635 }
executed 372 times by 1 test: end of block
Executed by:
  • tst_QFtp
else {
372
636-
637-
638-
639 if (line.endsWith("No such file or directory\r\n")
line.endsWith(...irectory\r\n")Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
)
0-2
640 err = QString::fromUtf8(line);
never executed: err = QString::fromUtf8(line);
0
641 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QFtp
2
642 }-
643 }
executed 142 times by 1 test: end of block
Executed by:
  • tst_QFtp
else {
142
644 if (!is_ba
!is_baDescription
TRUEevaluated 1437 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
&& data.dev
data.devDescription
TRUEevaluated 236 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 1201 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-1437
645 do {-
646 QByteArray ba;-
647 ba.resize(socket->bytesAvailable());-
648 qint64 bytesRead = socket->read(ba.data(), ba.size());-
649 if (bytesRead < 0
bytesRead < 0Description
TRUEnever evaluated
FALSEevaluated 236 times by 1 test
Evaluated by:
  • tst_QFtp
) {
0-236
650-
651-
652 return;
never executed: return;
0
653 }-
654 ba.resize(bytesRead);-
655 bytesDone += bytesRead;-
656-
657-
658-
659 if (data.dev
data.devDescription
TRUEevaluated 236 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
)
0-236
660 data.dev->write(ba);
executed 236 times by 1 test: data.dev->write(ba);
Executed by:
  • tst_QFtp
236
661 dataTransferProgress(bytesDone, bytesTotal);-
662-
663-
664-
665-
666 }
executed 236 times by 1 test: end of block
Executed by:
  • tst_QFtp
while (socket->bytesAvailable()
socket->bytesAvailable()Description
TRUEnever evaluated
FALSEevaluated 236 times by 1 test
Evaluated by:
  • tst_QFtp
);
0-236
667 }
executed 236 times by 1 test: end of block
Executed by:
  • tst_QFtp
else {
236
668-
669-
670-
671-
672 dataTransferProgress(bytesDone+socket->bytesAvailable(), bytesTotal);-
673 readyRead();-
674 }
executed 1201 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
1201
675 }-
676}-
677-
678void QFtpDTP::socketError(QAbstractSocket::SocketError e)-
679{-
680 if (e == QTcpSocket::HostNotFoundError
e == QTcpSocke...tNotFoundErrorDescription
TRUEnever evaluated
FALSEevaluated 301 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-301
681-
682-
683-
684 connectState(QFtpDTP::CsHostNotFound);-
685 }
never executed: end of block
else if (e == QTcpSocket::ConnectionRefusedError
e == QTcpSocke...onRefusedErrorDescription
TRUEnever evaluated
FALSEevaluated 301 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-301
686-
687-
688-
689 connectState(QFtpDTP::CsConnectionRefused);-
690 }
never executed: end of block
0
691}
executed 301 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
301
692-
693void QFtpDTP::socketConnectionClosed()-
694{-
695 if (!is_ba
!is_baDescription
TRUEevaluated 343 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QFtp
&& data.dev
data.devDescription
TRUEevaluated 47 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 296 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
20-343
696 clearData();-
697 }
executed 47 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
47
698-
699 if (socket->isOpen()
socket->isOpen()Description
TRUEevaluated 301 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 62 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
62-301
700 bytesFromSocket = socket->readAll();
executed 301 times by 2 tests: bytesFromSocket = socket->readAll();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
301
701 else-
702 bytesFromSocket.clear();
executed 62 times by 2 tests: bytesFromSocket.clear();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
62
703-
704-
705-
706 connectState(QFtpDTP::CsClosed);-
707}
executed 363 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
363
708-
709void QFtpDTP::socketBytesWritten(qint64 bytes)-
710{-
711 bytesDone += bytes;-
712-
713-
714-
715 dataTransferProgress(bytesDone, bytesTotal);-
716 if (callWriteData
callWriteDataDescription
TRUEevaluated 155 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
)
8-155
717 writeData();
executed 155 times by 2 tests: writeData();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
155
718}
executed 163 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
163
719-
720void QFtpDTP::setupSocket()-
721{-
722 socket = listener.nextPendingConnection();-
723 socket->setObjectName(QLatin1String("QFtpDTP Active state socket"));-
724 connect(socket, qFlagLocation("2""connected()" "\0" __FILE__ ":" "769"), qFlagLocation("1""socketConnected()" "\0" __FILE__ ":" "769"));-
725 connect(socket, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "770"), qFlagLocation("1""socketReadyRead()" "\0" __FILE__ ":" "770"));-
726 connect(socket, qFlagLocation("2""error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "771"), qFlagLocation("1""socketError(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "771"));-
727 connect(socket, qFlagLocation("2""disconnected()" "\0" __FILE__ ":" "772"), qFlagLocation("1""socketConnectionClosed()" "\0" __FILE__ ":" "772"));-
728 connect(socket, qFlagLocation("2""bytesWritten(qint64)" "\0" __FILE__ ":" "773"), qFlagLocation("1""socketBytesWritten(qint64)" "\0" __FILE__ ":" "773"));-
729-
730 listener.close();-
731}
executed 8 times by 1 test: end of block
Executed by:
  • tst_QFtp
8
732-
733void QFtpDTP::clearData()-
734{-
735 is_ba = false;-
736 data.dev = 0;-
737}
executed 914 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
914
738-
739-
740-
741-
742-
743-
744QFtpPI::QFtpPI(QObject *parent) :-
745 QObject(parent),-
746 rawCommand(false),-
747 transferConnectionExtended(true),-
748 dtp(this),-
749 commandSocket(0),-
750 state(Begin), abortState(None),-
751 currentCmd(QString()),-
752 waitForDtpToConnect(false),-
753 waitForDtpToClose(false)-
754{-
755 commandSocket.setObjectName(QLatin1String("QFtpPI_socket"));-
756 connect(&commandSocket, qFlagLocation("2""hostFound()" "\0" __FILE__ ":" "801"),-
757 qFlagLocation("1""hostFound()" "\0" __FILE__ ":" "802"));-
758 connect(&commandSocket, qFlagLocation("2""connected()" "\0" __FILE__ ":" "803"),-
759 qFlagLocation("1""connected()" "\0" __FILE__ ":" "804"));-
760 connect(&commandSocket, qFlagLocation("2""disconnected()" "\0" __FILE__ ":" "805"),-
761 qFlagLocation("1""connectionClosed()" "\0" __FILE__ ":" "806"));-
762 connect(&commandSocket, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "807"),-
763 qFlagLocation("1""readyRead()" "\0" __FILE__ ":" "808"));-
764 connect(&commandSocket, qFlagLocation("2""error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "809"),-
765 qFlagLocation("1""error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "810"));-
766-
767 connect(&dtp, qFlagLocation("2""connectState(int)" "\0" __FILE__ ":" "812"),-
768 qFlagLocation("1""dtpConnectState(int)" "\0" __FILE__ ":" "813"));-
769}
executed 661 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
661
770-
771void QFtpPI::connectToHost(const QString &host, quint16 port)-
772{-
773 connectState(QFtp::HostLookup);-
774-
775-
776 commandSocket.setProperty("_q_networksession", property("_q_networksession"));-
777 dtp.setProperty("_q_networksession", property("_q_networksession"));-
778-
779 commandSocket.connectToHost(host, port);-
780}
executed 657 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
657
781bool QFtpPI::sendCommands(const QStringList &cmds)-
782{-
783 if (!pendingCommands.isEmpty()
!pendingCommands.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1956 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-1956
784 return
never executed: return false;
false;
never executed: return false;
0
785-
786 if (commandSocket.state() != QTcpSocket::ConnectedState
commandSocket....ConnectedStateDescription
TRUEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1935 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
|| state!=Idle
state!=IdleDescription
TRUEnever evaluated
FALSEevaluated 1935 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-1935
787 error(QFtp::NotConnected, QFtp::tr("Not connected"));-
788 return
executed 21 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
true;
executed 21 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
21
789 }-
790-
791 pendingCommands = cmds;-
792 startNextCmd();-
793 return
executed 1935 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
true;
executed 1935 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
1935
794}-
795-
796void QFtpPI::clearPendingCommands()-
797{-
798 pendingCommands.clear();-
799 dtp.abortConnection();-
800 currentCmd.clear();-
801 state = Idle;-
802}
executed 161 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
161
803-
804void QFtpPI::abort()-
805{-
806 pendingCommands.clear();-
807-
808 if (abortState != None
abortState != NoneDescription
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-4
809-
810 return;
never executed: return;
0
811-
812 if (currentCmd.isEmpty()
currentCmd.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
2
813 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QFtp
2
814-
815 if (currentCmd.startsWith(QLatin1String("STOR "))
currentCmd.sta...ring("STOR "))Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
0-2
816 abortState = AbortStarted;-
817-
818-
819-
820 commandSocket.write("ABOR\r\n", 6);-
821-
822 dtp.abortConnection();-
823 }
never executed: end of block
else {
0
824-
825-
826-
827-
828 abortState = WaitForAbortToFinish;-
829 dtp.abortConnection();-
830 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
2
831}-
832-
833void QFtpPI::hostFound()-
834{-
835 connectState(QFtp::Connecting);-
836}
executed 354 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
354
837-
838void QFtpPI::connected()-
839{-
840 state = Begin;-
841-
842-
843-
844-
845 commandSocket.setSocketOption(QAbstractSocket::LowDelayOption, 1);-
846-
847 connectState(QFtp::Connected);-
848}
executed 637 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
637
849-
850void QFtpPI::connectionClosed()-
851{-
852 commandSocket.close();-
853 connectState(QFtp::Unconnected);-
854}
executed 635 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
635
855-
856void QFtpPI::delayedCloseFinished()-
857{-
858 connectState(QFtp::Unconnected);-
859}
never executed: end of block
0
860-
861void QFtpPI::error(QAbstractSocket::SocketError e)-
862{-
863 if (e == QTcpSocket::HostNotFoundError
e == QTcpSocke...tNotFoundErrorDescription
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 482 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
7-482
864 connectState(QFtp::Unconnected);-
865 error(QFtp::HostNotFound,-
866 QFtp::tr("Host %1 not found").arg(commandSocket.peerName()));-
867 }
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else if (e == QTcpSocket::ConnectionRefusedError
e == QTcpSocke...onRefusedErrorDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 470 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
7-470
868 connectState(QFtp::Unconnected);-
869 error(QFtp::ConnectionRefused,-
870 QFtp::tr("Connection refused to host %1").arg(commandSocket.peerName()));-
871 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QFtp
else if (e == QTcpSocket::SocketTimeoutError
e == QTcpSocke...etTimeoutErrorDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 469 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
1-469
872 connectState(QFtp::Unconnected);-
873 error(QFtp::ConnectionRefused,-
874 QFtp::tr("Connection timed out to host %1").arg(commandSocket.peerName()));-
875 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QFtp
1
876}
executed 489 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
489
877-
878void QFtpPI::readyRead()-
879{-
880 if (waitForDtpToClose
waitForDtpToCloseDescription
TRUEnever evaluated
FALSEevaluated 4900 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-4900
881 return;
never executed: return;
0
882-
883 while (commandSocket.canReadLine()
commandSocket.canReadLine()Description
TRUEevaluated 4537 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 4801 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
4537-4801
884-
885 QString line = QString::fromUtf8(commandSocket.readLine());-
886 if (replyText.isEmpty()
replyText.isEmpty()Description
TRUEevaluated 4438 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 99 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
99-4438
887 if (line.length() < 3
line.length() < 3Description
TRUEnever evaluated
FALSEevaluated 4438 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-4438
888-
889 return;
never executed: return;
0
890 }-
891 const int lowerLimit[3] = {1,0,0};-
892 const int upperLimit[3] = {5,5,9};-
893 for (int i=0; i<3
i<3Description
TRUEevaluated 13314 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 4438 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
; i++) {
4438-13314
894 replyCode[i] = line.at(i).digitValue();-
895 if (replyCode[i]<lowerLimit[i]
replyCode[i]<lowerLimit[i]Description
TRUEnever evaluated
FALSEevaluated 13314 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
|| replyCode[i]>upperLimit[i]
replyCode[i]>upperLimit[i]Description
TRUEnever evaluated
FALSEevaluated 13314 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-13314
896-
897 return;
never executed: return;
0
898 }-
899 }
executed 13314 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
13314
900 }
executed 4438 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4438
901 QString endOfMultiLine;-
902 endOfMultiLine[0] = '0' + replyCode[0];-
903 endOfMultiLine[1] = '0' + replyCode[1];-
904 endOfMultiLine[2] = '0' + replyCode[2];-
905 endOfMultiLine[3] = QLatin1Char(' ');-
906 QString lineCont(endOfMultiLine);-
907 lineCont[3] = QLatin1Char('-');-
908 QStringRef lineLeft4 = line.leftRef(4);-
909-
910 while (lineLeft4 != endOfMultiLine
lineLeft4 != endOfMultiLineDescription
TRUEevaluated 242 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 4438 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
242-4438
911 if (lineLeft4 == lineCont
lineLeft4 == lineContDescription
TRUEevaluated 106 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 136 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
106-136
912 replyText += line.midRef(4);
executed 106 times by 2 tests: replyText += line.midRef(4);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
106
913 else-
914 replyText += line;
executed 136 times by 1 test: replyText += line;
Executed by:
  • tst_QNetworkReply
136
915 if (!commandSocket.canReadLine()
!commandSocket.canReadLine()Description
TRUEevaluated 99 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 143 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
99-143
916 return;
executed 99 times by 1 test: return;
Executed by:
  • tst_QNetworkReply
99
917 line = QString::fromUtf8(commandSocket.readLine());-
918 lineLeft4 = line.leftRef(4);-
919 }
executed 143 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
143
920 replyText += line.midRef(4);-
921 if (replyText.endsWith(QLatin1String("\r\n"))
replyText.ends...tring("\r\n"))Description
TRUEevaluated 4438 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
)
0-4438
922 replyText.chop(2);
executed 4438 times by 2 tests: replyText.chop(2);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4438
923-
924 if (processReply()
processReply()Description
TRUEevaluated 4436 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
)
2-4436
925 replyText = QLatin1String("");
executed 4436 times by 2 tests: replyText = QLatin1String("");
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4436
926 }
executed 4438 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4438
927}
executed 4801 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4801
928bool QFtpPI::processReply()-
929{-
930 int replyCodeInt = 100*replyCode[0] + 10*replyCode[1] + replyCode[2];-
931-
932-
933-
934 if (replyCodeInt == 226
replyCodeInt == 226Description
TRUEevaluated 346 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 4094 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
|| (replyCodeInt == 250
replyCodeInt == 250Description
TRUEevaluated 240 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 3854 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& currentCmd.startsWith(QLatin1String("RETR"))
currentCmd.sta...tring("RETR"))Description
TRUEnever evaluated
FALSEevaluated 240 times by 1 test
Evaluated by:
  • tst_QFtp
)) {
0-4094
935 if (dtp.state() != QTcpSocket::UnconnectedState
dtp.state() !=...connectedStateDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 344 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
2-344
936 waitForDtpToClose = true;-
937 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_QFtp
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QFtp
2
938 }-
939 }
executed 344 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
344
940-
941 switch (abortState) {-
942 case
never executed: case AbortStarted:
AbortStarted:
never executed: case AbortStarted:
0
943 abortState = WaitForAbortToFinish;-
944 break;
never executed: break;
0
945 case
executed 2 times by 1 test: case WaitForAbortToFinish:
Executed by:
  • tst_QNetworkReply
WaitForAbortToFinish:
executed 2 times by 1 test: case WaitForAbortToFinish:
Executed by:
  • tst_QNetworkReply
2
946 abortState = None;-
947 return
executed 2 times by 1 test: return true;
Executed by:
  • tst_QNetworkReply
true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_QNetworkReply
2
948 default
executed 4436 times by 2 tests: default:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
:
executed 4436 times by 2 tests: default:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4436
949 break;
executed 4436 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4436
950 }-
951-
952-
953 static const State table[5] = {-
954-
955 Waiting, Success, Idle, Failure, Failure-
956 };-
957 switch (state) {-
958 case
executed 637 times by 2 tests: case Begin:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
Begin:
executed 637 times by 2 tests: case Begin:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
637
959 if (replyCode[0] == 1
replyCode[0] == 1Description
TRUEnever evaluated
FALSEevaluated 637 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-637
960 return
never executed: return true;
true;
never executed: return true;
0
961 } else if (replyCode[0] == 2
replyCode[0] == 2Description
TRUEevaluated 637 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-637
962 state = Idle;-
963 finished(QFtp::tr("Connected to host %1").arg(commandSocket.peerName()));-
964 break;
executed 637 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
637
965 }-
966-
967 return
never executed: return true;
true;
never executed: return true;
0
968 case
executed 3799 times by 2 tests: case Waiting:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
Waiting:
executed 3799 times by 2 tests: case Waiting:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3799
969 if (static_cast<
static_cast<si...lyCode[0]) < 0Description
TRUEnever evaluated
FALSEevaluated 3799 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
signed char>(replyCode[0]) < 0
static_cast<si...lyCode[0]) < 0Description
TRUEnever evaluated
FALSEevaluated 3799 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
|| replyCode[0] > 5
replyCode[0] > 5Description
TRUEnever evaluated
FALSEevaluated 3799 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-3799
970 state = Failure;
never executed: state = Failure;
0
971 else-
972 if (replyCodeInt == 202
replyCodeInt == 202Description
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 3756 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
43-3756
973 state = Failure;
executed 43 times by 2 tests: state = Failure;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
43
974 else-
975 state = table[replyCode[0] - 1];
executed 3756 times by 2 tests: state = table[replyCode[0] - 1];
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3756
976 break;
executed 3799 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3799
977 default
never executed: default:
:
never executed: default:
0
978-
979 return
never executed: return true;
true;
never executed: return true;
0
980 }-
981-
982-
983-
984-
985-
986 rawFtpReply(replyCodeInt, replyText);-
987 if (rawCommand
rawCommandDescription
TRUEevaluated 132 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4304 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
132-4304
988 rawCommand = false;-
989 }
executed 132 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
else if (replyCodeInt == 227
replyCodeInt == 227Description
TRUEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 3949 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
132-3949
990-
991-
992-
993-
994-
995 QRegExp addrPortPattern(QLatin1String("(\\d+),(\\d+),(\\d+),(\\d+),(\\d+),(\\d+)"));-
996 if (addrPortPattern.indexIn(replyText) == -1
addrPortPatter...plyText) == -1Description
TRUEnever evaluated
FALSEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-355
997-
998-
999-
1000-
1001 }
never executed: end of block
else {
0
1002 const QStringList lst = addrPortPattern.capturedTexts();-
1003 QString host = lst[1] + QLatin1Char('.') + lst[2] + QLatin1Char('.') + lst[3] + QLatin1Char('.') + lst[4];-
1004 quint16 port = (lst[5].toUInt() << 8) + lst[6].toUInt();-
1005 waitForDtpToConnect = true;-
1006 dtp.connectToHost(host, port);-
1007 }
executed 355 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
355
1008 } else if (replyCodeInt == 229
replyCodeInt == 229Description
TRUEnever evaluated
FALSEevaluated 3949 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-3949
1009-
1010 int portPos = replyText.indexOf(QLatin1Char('('));-
1011 if (portPos == -1
portPos == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1012-
1013-
1014-
1015-
1016 }
never executed: end of block
else {
0
1017 ++portPos;-
1018 QChar delimiter = replyText.at(portPos);-
1019 const auto epsvParameters = replyText.midRef(portPos).split(delimiter);-
1020-
1021 waitForDtpToConnect = true;-
1022 dtp.connectToHost(commandSocket.peerAddress().toString(),-
1023 epsvParameters.at(3).toInt());-
1024 }
never executed: end of block
0
1025-
1026 } else if (replyCodeInt == 230
replyCodeInt == 230Description
TRUEevaluated 610 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 3339 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
610-3339
1027 if (currentCmd.startsWith(QLatin1String("USER "))
currentCmd.sta...ring("USER "))Description
TRUEnever evaluated
FALSEevaluated 610 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& pendingCommands.count()>0
pendingCommands.count()>0Description
TRUEnever evaluated
FALSEnever evaluated
&&
0-610
1028 pendingCommands.constFirst().startsWith(QLatin1String("PASS "))
pendingCommand...ring("PASS "))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1029-
1030 pendingCommands.pop_front();-
1031 }
never executed: end of block
0
1032-
1033 connectState(QFtp::LoggedIn);-
1034 }
executed 610 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else if (replyCodeInt == 213
replyCodeInt == 213Description
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 3245 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
94-3245
1035-
1036 if (currentCmd.startsWith(QLatin1String("SIZE "))
currentCmd.sta...ring("SIZE "))Description
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
)
0-94
1037 dtp.setBytesTotal(replyText.simplified().toLongLong());
executed 94 times by 2 tests: dtp.setBytesTotal(replyText.simplified().toLongLong());
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
94
1038 }
executed 94 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else if (replyCode[0]==1
replyCode[0]==1Description
TRUEevaluated 346 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2899 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& currentCmd.startsWith(QLatin1String("STOR "))
currentCmd.sta...ring("STOR "))Description
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 303 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
43-2899
1039 dtp.waitForConnection();-
1040 dtp.writeData();-
1041 }
executed 43 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
43
1042-
1043-
1044 switch (state) {-
1045 case
never executed: case Begin:
Begin:
never executed: case Begin:
0
1046-
1047 break;
never executed: break;
0
1048 case
executed 2633 times by 2 tests: case Success:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
Success:
executed 2633 times by 2 tests: case Success:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
2633
1049-
1050 state = Idle;-
1051-
1052 case
executed 649 times by 2 tests: case Idle:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
Idle:
executed 649 times by 2 tests: case Idle:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
code before this statement executed 2633 times by 2 tests: case Idle:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
649-2633
1053 if (dtp.hasError()
dtp.hasError()Description
TRUEnever evaluated
FALSEevaluated 3282 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-3282
1054 error(QFtp::UnknownError, dtp.errorMessage());-
1055 dtp.clearError();-
1056 }
never executed: end of block
0
1057 startNextCmd();-
1058 break;
executed 3282 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3282
1059 case
executed 975 times by 2 tests: case Waiting:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
Waiting:
executed 975 times by 2 tests: case Waiting:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
975
1060-
1061 break;
executed 975 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
975
1062 case
executed 179 times by 2 tests: case Failure:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
Failure:
executed 179 times by 2 tests: case Failure:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
179
1063-
1064-
1065 if (currentCmd.startsWith(QLatin1String("EPSV"))
currentCmd.sta...tring("EPSV"))Description
TRUEnever evaluated
FALSEevaluated 179 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-179
1066 transferConnectionExtended = false;-
1067 pendingCommands.prepend(QLatin1String("PASV\r\n"));-
1068 }
never executed: end of block
else if (currentCmd.startsWith(QLatin1String("EPRT"))
currentCmd.sta...tring("EPRT"))Description
TRUEnever evaluated
FALSEevaluated 179 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-179
1069 transferConnectionExtended = false;-
1070 pendingCommands.prepend(QLatin1String("PORT\r\n"));-
1071 }
never executed: end of block
else {
0
1072 error(QFtp::UnknownError, replyText);-
1073 }
executed 179 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
179
1074 if (state != Waiting
state != WaitingDescription
TRUEevaluated 175 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
) {
4-175
1075 state = Idle;-
1076 startNextCmd();-
1077 }
executed 175 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
175
1078 break;
executed 179 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
179
1079 }-
1080-
1081-
1082-
1083 return
executed 4436 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
true;
executed 4436 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4436
1084}-
1085-
1086-
1087-
1088-
1089-
1090-
1091-
1092bool QFtpPI::startNextCmd()-
1093{-
1094 if (waitForDtpToConnect
waitForDtpToConnectDescription
TRUEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 5392 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
355-5392
1095-
1096 return
executed 355 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
true;
executed 355 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
355
1097-
1098-
1099-
1100-
1101-
1102 if (pendingCommands.isEmpty()
pendingCommands.isEmpty()Description
TRUEevaluated 1937 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 3455 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
1937-3455
1103 currentCmd.clear();-
1104 finished(replyText);-
1105 return
executed 1937 times by 2 tests: return false;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
false;
executed 1937 times by 2 tests: return false;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
1937
1106 }-
1107 currentCmd = pendingCommands.constFirst();-
1108-
1109-
1110-
1111-
1112-
1113 QHostAddress address = commandSocket.localAddress();-
1114 if (currentCmd.startsWith(QLatin1String("PORT"))
currentCmd.sta...tring("PORT"))Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 3447 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
8-3447
1115 if ((
(address.proto...:IPv6Protocol)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
address.protocol() == QTcpSocket::IPv6Protocol)
(address.proto...:IPv6Protocol)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
&& transferConnectionExtended
transferConnectionExtendedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-8
1116 int port = dtp.setupListener(address);-
1117 currentCmd = QLatin1String("EPRT |");-
1118 currentCmd += (
(address.proto...:IPv4Protocol)Description
TRUEnever evaluated
FALSEnever evaluated
address.protocol() == QTcpSocket::IPv4Protocol)
(address.proto...:IPv4Protocol)Description
TRUEnever evaluated
FALSEnever evaluated
? QLatin1Char('1') : QLatin1Char('2');
0
1119 currentCmd += QLatin1Char('|') + address.toString() + QLatin1Char('|') + QString::number(port);-
1120 currentCmd += QLatin1Char('|');-
1121 }
never executed: end of block
else if (address.protocol() == QTcpSocket::IPv4Protocol
address.protoc...::IPv4ProtocolDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
) {
0-8
1122 int port = dtp.setupListener(address);-
1123 QString portArg;-
1124 quint32 ip = address.toIPv4Address();-
1125 portArg += QString::number((ip & 0xff000000) >> 24);-
1126 portArg += QLatin1Char(',') + QString::number((ip & 0xff0000) >> 16);-
1127 portArg += QLatin1Char(',') + QString::number((ip & 0xff00) >> 8);-
1128 portArg += QLatin1Char(',') + QString::number(ip & 0xff);-
1129 portArg += QLatin1Char(',') + QString::number((port & 0xff00) >> 8);-
1130 portArg += QLatin1Char(',') + QString::number(port & 0xff);-
1131-
1132 currentCmd = QLatin1String("PORT ");-
1133 currentCmd += portArg;-
1134 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QFtp
else {
8
1135-
1136-
1137 return
never executed: return false;
false;
never executed: return false;
0
1138 }-
1139-
1140 currentCmd += QLatin1String("\r\n");-
1141 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QFtp
else if (currentCmd.startsWith(QLatin1String("PASV"))
currentCmd.sta...tring("PASV"))Description
TRUEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 3092 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
8-3092
1142 if ((
(address.proto...:IPv6Protocol)Description
TRUEnever evaluated
FALSEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
address.protocol() == QTcpSocket::IPv6Protocol)
(address.proto...:IPv6Protocol)Description
TRUEnever evaluated
FALSEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& transferConnectionExtended
transferConnectionExtendedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0-355
1143 currentCmd = QLatin1String("EPSV\r\n");
never executed: currentCmd = QLatin1String("EPSV\r\n");
0
1144 }
executed 355 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
355
1145-
1146 pendingCommands.pop_front();-
1147-
1148-
1149-
1150 state = Waiting;-
1151 commandSocket.write(currentCmd.toUtf8());-
1152 return
executed 3455 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
true;
executed 3455 times by 2 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3455
1153}-
1154-
1155void QFtpPI::dtpConnectState(int s)-
1156{-
1157 switch (s) {-
1158 case
executed 363 times by 2 tests: case QFtpDTP::CsClosed:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
QFtpDTP::CsClosed:
executed 363 times by 2 tests: case QFtpDTP::CsClosed:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
363
1159 if (waitForDtpToClose
waitForDtpToCloseDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 361 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
2-361
1160-
1161 if (processReply()
processReply()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEnever evaluated
)
0-2
1162 replyText = QLatin1String("");
executed 2 times by 1 test: replyText = QLatin1String("");
Executed by:
  • tst_QFtp
2
1163 else-
1164 return;
never executed: return;
0
1165 }-
1166 waitForDtpToClose = false;-
1167 readyRead();-
1168 return;
executed 363 times by 2 tests: return;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
363
1169 case
executed 355 times by 2 tests: case QFtpDTP::CsConnected:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
QFtpDTP::CsConnected:
executed 355 times by 2 tests: case QFtpDTP::CsConnected:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
355
1170 waitForDtpToConnect = false;-
1171 startNextCmd();-
1172 return;
executed 355 times by 2 tests: return;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
355
1173 case
never executed: case QFtpDTP::CsHostNotFound:
QFtpDTP::CsHostNotFound:
never executed: case QFtpDTP::CsHostNotFound:
0
1174 case
never executed: case QFtpDTP::CsConnectionRefused:
QFtpDTP::CsConnectionRefused:
never executed: case QFtpDTP::CsConnectionRefused:
0
1175 error(QFtp::ConnectionRefused,-
1176 QFtp::tr("Data Connection refused"));-
1177 startNextCmd();-
1178 return;
never executed: return;
0
1179 default
never executed: default:
:
never executed: default:
0
1180 return;
never executed: return;
0
1181 }-
1182}-
1183-
1184-
1185-
1186-
1187-
1188-
1189-
1190-
1191-
1192-
1193class QFtpPrivate : public QObjectPrivate-
1194{-
1195 inline QFtp* q_func() { return static_cast<QFtp *>(q_ptr); } inline const QFtp* q_func() const { return static_cast<const QFtp *>(q_ptr); } friend class QFtp;-
1196public:-
1197-
1198 inline QFtpPrivate() : close_waitForStateChange(false), state(QFtp::Unconnected),-
1199 transferMode(QFtp::Passive), error(QFtp::NoError)-
1200 { }
executed 661 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
661
1201-
1202 ~QFtpPrivate() { while (!pending.isEmpty()
!pending.isEmpty()Description
TRUEevaluated 661 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 659 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) delete pending.takeFirst();
executed 661 times by 2 tests: delete pending.takeFirst();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
}
executed 659 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
659-661
1203-
1204-
1205 void _q_startNextCommand();-
1206 void _q_piFinished(const QString&);-
1207 void _q_piError(int, const QString&);-
1208 void _q_piConnectState(int);-
1209 void _q_piFtpReply(int, const QString&);-
1210-
1211 int addCommand(QFtpCommand *cmd);-
1212-
1213 QFtpPI pi;-
1214 QList<QFtpCommand *> pending;-
1215 bool close_waitForStateChange;-
1216 QFtp::State state;-
1217 QFtp::TransferMode transferMode;-
1218 QFtp::Error error;-
1219 QString errorString;-
1220-
1221 QString host;-
1222 quint16 port;-
1223 QString proxyHost;-
1224 quint16 proxyPort;-
1225};-
1226-
1227int QFtpPrivate::addCommand(QFtpCommand *cmd)-
1228{-
1229 pending.append(cmd);-
1230-
1231 if (pending.count() == 1
pending.count() == 1Description
TRUEevaluated 1481 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1942 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
1481-1942
1232-
1233 QTimer::singleShot(0, q_func(), qFlagLocation("1""_q_startNextCommand()" "\0" __FILE__ ":" "1307"));-
1234 }
executed 1481 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
1481
1235 return
executed 3423 times by 2 tests: return cmd->id;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
cmd->id;
executed 3423 times by 2 tests: return cmd->id;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
3423
1236}-
1237QFtp::QFtp(QObject *parent)-
1238 : QObject(*new QFtpPrivate, parent)-
1239{-
1240 QFtpPrivate * const d = d_func();-
1241 d->errorString = tr("Unknown error");-
1242-
1243 connect(&d->pi, qFlagLocation("2""connectState(int)" "\0" __FILE__ ":" "1431"),-
1244 qFlagLocation("1""_q_piConnectState(int)" "\0" __FILE__ ":" "1432"));-
1245 connect(&d->pi, qFlagLocation("2""finished(QString)" "\0" __FILE__ ":" "1433"),-
1246 qFlagLocation("1""_q_piFinished(QString)" "\0" __FILE__ ":" "1434"));-
1247 connect(&d->pi, qFlagLocation("2""error(int,QString)" "\0" __FILE__ ":" "1435"),-
1248 qFlagLocation("1""_q_piError(int,QString)" "\0" __FILE__ ":" "1436"));-
1249 connect(&d->pi, qFlagLocation("2""rawFtpReply(int,QString)" "\0" __FILE__ ":" "1437"),-
1250 qFlagLocation("1""_q_piFtpReply(int,QString)" "\0" __FILE__ ":" "1438"));-
1251-
1252 connect(&d->pi.dtp, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "1440"),-
1253 qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "1441"));-
1254 connect(&d->pi.dtp, qFlagLocation("2""dataTransferProgress(qint64,qint64)" "\0" __FILE__ ":" "1442"),-
1255 qFlagLocation("2""dataTransferProgress(qint64,qint64)" "\0" __FILE__ ":" "1443"));-
1256 connect(&d->pi.dtp, qFlagLocation("2""listInfo(QUrlInfo)" "\0" __FILE__ ":" "1444"),-
1257 qFlagLocation("2""listInfo(QUrlInfo)" "\0" __FILE__ ":" "1445"));-
1258}
executed 661 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
661
1259int QFtp::connectToHost(const QString &host, quint16 port)-
1260{-
1261 QStringList cmds;-
1262 cmds << host;-
1263 cmds << QString::number((uint)port);-
1264 int id = d_func()->addCommand(new QFtpCommand(ConnectToHost, cmds));-
1265 d_func()->pi.transferConnectionExtended = true;-
1266 return
executed 657 times by 2 tests: return id;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
id;
executed 657 times by 2 tests: return id;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
657
1267}-
1268int QFtp::login(const QString &user, const QString &password)-
1269{-
1270 QStringList cmds;-
1271 cmds << (QLatin1String("USER ") + (user.isNull() ? QLatin1String("anonymous") : user) + QLatin1String("\r\n"));-
1272 cmds << (QLatin1String("PASS ") + (password.isNull() ? QLatin1String("anonymous@") : password) + QLatin1String("\r\n"));-
1273 return
executed 636 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Login, cmds));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->addCommand(new QFtpCommand(Login, cmds));
executed 636 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Login, cmds));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
636
1274}-
1275int QFtp::close()-
1276{-
1277 return
executed 1235 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Close, QStringList(QLatin1String("QUIT\r\n"))));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->addCommand(new QFtpCommand(Close, QStringList(QLatin1String("QUIT\r\n"))));
executed 1235 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Close, QStringList(QLatin1String("QUIT\r\n"))));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
1235
1278}-
1279-
1280-
1281-
1282-
1283-
1284-
1285-
1286int QFtp::setTransferMode(TransferMode mode)-
1287{-
1288 int id = d_func()->addCommand(new QFtpCommand(SetTransferMode, QStringList()));-
1289 d_func()->pi.transferConnectionExtended = true;-
1290 d_func()->transferMode = mode;-
1291 return
executed 4 times by 1 test: return id;
Executed by:
  • tst_QFtp
id;
executed 4 times by 1 test: return id;
Executed by:
  • tst_QFtp
4
1292}-
1293int QFtp::setProxy(const QString &host, quint16 port)-
1294{-
1295 QStringList args;-
1296 args << host << QString::number(port);-
1297 return
executed 26 times by 2 tests: return d_func()->addCommand(new QFtpCommand(SetProxy, args));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->addCommand(new QFtpCommand(SetProxy, args));
executed 26 times by 2 tests: return d_func()->addCommand(new QFtpCommand(SetProxy, args));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
26
1298}-
1299int QFtp::list(const QString &dir)-
1300{-
1301 QStringList cmds;-
1302 cmds << QLatin1String("TYPE A\r\n");-
1303 cmds << QLatin1String(d_func()->transferMode == Passive ? "PASV\r\n" : "PORT\r\n");-
1304 if (dir.isEmpty()
dir.isEmpty()Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 156 times by 1 test
Evaluated by:
  • tst_QFtp
)
72-156
1305 cmds << QLatin1String("LIST\r\n");
executed 72 times by 1 test: cmds << QLatin1String("LIST\r\n");
Executed by:
  • tst_QFtp
72
1306 else-
1307 cmds << (QLatin1String("LIST ") + dir + QLatin1String("\r\n"));
executed 156 times by 1 test: cmds << (QLatin1String("LIST ") + dir + QLatin1String("\r\n"));
Executed by:
  • tst_QFtp
156
1308 return
executed 228 times by 1 test: return d_func()->addCommand(new QFtpCommand(List, cmds));
Executed by:
  • tst_QFtp
d_func()->addCommand(new QFtpCommand(List, cmds));
executed 228 times by 1 test: return d_func()->addCommand(new QFtpCommand(List, cmds));
Executed by:
  • tst_QFtp
228
1309}-
1310int QFtp::cd(const QString &dir)-
1311{-
1312 return
executed 216 times by 1 test: return d_func()->addCommand(new QFtpCommand(Cd, QStringList(QLatin1String("CWD ") + dir + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
d_func()->addCommand(new QFtpCommand(Cd, QStringList(QLatin1String("CWD ") + dir + QLatin1String("\r\n"))));
executed 216 times by 1 test: return d_func()->addCommand(new QFtpCommand(Cd, QStringList(QLatin1String("CWD ") + dir + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
216
1313}-
1314int QFtp::get(const QString &file, QIODevice *dev, TransferType type)-
1315{-
1316 QStringList cmds;-
1317 if (type == Binary
type == BinaryDescription
TRUEevaluated 110 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
)
0-110
1318 cmds << QLatin1String("TYPE I\r\n");
executed 110 times by 2 tests: cmds << QLatin1String("TYPE I\r\n");
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
110
1319 else-
1320 cmds << QLatin1String("TYPE A\r\n");
never executed: cmds << QLatin1String("TYPE A\r\n");
0
1321 cmds << QLatin1String("SIZE ") + file + QLatin1String("\r\n");-
1322 cmds << QLatin1String(d_func()->transferMode == Passive ? "PASV\r\n" : "PORT\r\n");-
1323 cmds << QLatin1String("RETR ") + file + QLatin1String("\r\n");-
1324 return
executed 110 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Get, cmds, dev));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->addCommand(new QFtpCommand(Get, cmds, dev));
executed 110 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Get, cmds, dev));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
110
1325}-
1326int QFtp::put(const QByteArray &data, const QString &file, TransferType type)-
1327{-
1328 QStringList cmds;-
1329 if (type == Binary
type == BinaryDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
)
4-24
1330 cmds << QLatin1String("TYPE I\r\n");
executed 24 times by 1 test: cmds << QLatin1String("TYPE I\r\n");
Executed by:
  • tst_QFtp
24
1331 else-
1332 cmds << QLatin1String("TYPE A\r\n");
executed 4 times by 1 test: cmds << QLatin1String("TYPE A\r\n");
Executed by:
  • tst_QFtp
4
1333 cmds << QLatin1String(d_func()->transferMode == Passive ? "PASV\r\n" : "PORT\r\n");-
1334 cmds << QLatin1String("ALLO ") + QString::number(data.size()) + QLatin1String("\r\n");-
1335 cmds << QLatin1String("STOR ") + file + QLatin1String("\r\n");-
1336 return
executed 28 times by 1 test: return d_func()->addCommand(new QFtpCommand(Put, cmds, data));
Executed by:
  • tst_QFtp
d_func()->addCommand(new QFtpCommand(Put, cmds, data));
executed 28 times by 1 test: return d_func()->addCommand(new QFtpCommand(Put, cmds, data));
Executed by:
  • tst_QFtp
28
1337}-
1338int QFtp::put(QIODevice *dev, const QString &file, TransferType type)-
1339{-
1340 QStringList cmds;-
1341 if (type == Binary
type == BinaryDescription
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
)
0-15
1342 cmds << QLatin1String("TYPE I\r\n");
executed 15 times by 2 tests: cmds << QLatin1String("TYPE I\r\n");
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
15
1343 else-
1344 cmds << QLatin1String("TYPE A\r\n");
never executed: cmds << QLatin1String("TYPE A\r\n");
0
1345 cmds << QLatin1String(d_func()->transferMode == Passive ? "PASV\r\n" : "PORT\r\n");-
1346 if (!dev->isSequential()
!dev->isSequential()Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
)
0-15
1347 cmds << QLatin1String("ALLO ") + QString::number(dev->size()) + QLatin1String("\r\n");
executed 15 times by 2 tests: cmds << QLatin1String("ALLO ") + QString::number(dev->size()) + QLatin1String("\r\n");
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
15
1348 cmds << QLatin1String("STOR ") + file + QLatin1String("\r\n");-
1349 return
executed 15 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Put, cmds, dev));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->addCommand(new QFtpCommand(Put, cmds, dev));
executed 15 times by 2 tests: return d_func()->addCommand(new QFtpCommand(Put, cmds, dev));
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
15
1350}-
1351int QFtp::remove(const QString &file)-
1352{-
1353 return
executed 32 times by 1 test: return d_func()->addCommand(new QFtpCommand(Remove, QStringList(QLatin1String("DELE ") + file + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
d_func()->addCommand(new QFtpCommand(Remove, QStringList(QLatin1String("DELE ") + file + QLatin1String("\r\n"))));
executed 32 times by 1 test: return d_func()->addCommand(new QFtpCommand(Remove, QStringList(QLatin1String("DELE ") + file + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
32
1354}-
1355int QFtp::mkdir(const QString &dir)-
1356{-
1357 return
executed 52 times by 1 test: return d_func()->addCommand(new QFtpCommand(Mkdir, QStringList(QLatin1String("MKD ") + dir + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
d_func()->addCommand(new QFtpCommand(Mkdir, QStringList(QLatin1String("MKD ") + dir + QLatin1String("\r\n"))));
executed 52 times by 1 test: return d_func()->addCommand(new QFtpCommand(Mkdir, QStringList(QLatin1String("MKD ") + dir + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
52
1358}-
1359int QFtp::rmdir(const QString &dir)-
1360{-
1361 return
executed 20 times by 1 test: return d_func()->addCommand(new QFtpCommand(Rmdir, QStringList(QLatin1String("RMD ") + dir + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
d_func()->addCommand(new QFtpCommand(Rmdir, QStringList(QLatin1String("RMD ") + dir + QLatin1String("\r\n"))));
executed 20 times by 1 test: return d_func()->addCommand(new QFtpCommand(Rmdir, QStringList(QLatin1String("RMD ") + dir + QLatin1String("\r\n"))));
Executed by:
  • tst_QFtp
20
1362}-
1363int QFtp::rename(const QString &oldname, const QString &newname)-
1364{-
1365 QStringList cmds;-
1366 cmds << QLatin1String("RNFR ") + oldname + QLatin1String("\r\n");-
1367 cmds << QLatin1String("RNTO ") + newname + QLatin1String("\r\n");-
1368 return
executed 28 times by 1 test: return d_func()->addCommand(new QFtpCommand(Rename, cmds));
Executed by:
  • tst_QFtp
d_func()->addCommand(new QFtpCommand(Rename, cmds));
executed 28 times by 1 test: return d_func()->addCommand(new QFtpCommand(Rename, cmds));
Executed by:
  • tst_QFtp
28
1369}-
1370int QFtp::rawCommand(const QString &command)-
1371{-
1372 const QString cmd = QStringRef(&command).trimmed() + QLatin1String("\r\n");-
1373 return
executed 136 times by 1 test: return d_func()->addCommand(new QFtpCommand(RawCommand, QStringList(cmd)));
Executed by:
  • tst_QNetworkReply
d_func()->addCommand(new QFtpCommand(RawCommand, QStringList(cmd)));
executed 136 times by 1 test: return d_func()->addCommand(new QFtpCommand(RawCommand, QStringList(cmd)));
Executed by:
  • tst_QNetworkReply
136
1374}-
1375qint64 QFtp::bytesAvailable() const-
1376{-
1377 return
executed 6171 times by 2 tests: return d_func()->pi.dtp.bytesAvailable();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->pi.dtp.bytesAvailable();
executed 6171 times by 2 tests: return d_func()->pi.dtp.bytesAvailable();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
6171
1378}-
1379qint64 QFtp::read(char *data, qint64 maxlen)-
1380{-
1381 return
never executed: return d_func()->pi.dtp.read(data, maxlen);
d_func()->pi.dtp.read(data, maxlen);
never executed: return d_func()->pi.dtp.read(data, maxlen);
0
1382}-
1383QByteArray QFtp::readAll()-
1384{-
1385 return
executed 611 times by 2 tests: return d_func()->pi.dtp.readAll();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->pi.dtp.readAll();
executed 611 times by 2 tests: return d_func()->pi.dtp.readAll();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
611
1386}-
1387void QFtp::abort()-
1388{-
1389 if (d_func()->pending.isEmpty()
d_func()->pending.isEmpty()Description
TRUEevaluated 657 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
4-657
1390 return;
executed 657 times by 2 tests: return;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
657
1391-
1392 clearPendingCommands();-
1393 d_func()->pi.abort();-
1394}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4
1395int QFtp::currentId() const-
1396{-
1397 if (d_func()->pending.isEmpty()
d_func()->pending.isEmpty()Description
TRUEevaluated 731 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 48388 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
731-48388
1398 return
executed 731 times by 1 test: return 0;
Executed by:
  • tst_QFtp
0;
executed 731 times by 1 test: return 0;
Executed by:
  • tst_QFtp
731
1399 return
executed 48388 times by 2 tests: return d_func()->pending.first()->id;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->pending.first()->id;
executed 48388 times by 2 tests: return d_func()->pending.first()->id;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
48388
1400}-
1401QFtp::Command QFtp::currentCommand() const-
1402{-
1403 if (d_func()->pending.isEmpty()
d_func()->pending.isEmpty()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 20744 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
24-20744
1404 return
executed 24 times by 1 test: return None;
Executed by:
  • tst_QFtp
None;
executed 24 times by 1 test: return None;
Executed by:
  • tst_QFtp
24
1405 return
executed 20744 times by 2 tests: return d_func()->pending.first()->command;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->pending.first()->command;
executed 20744 times by 2 tests: return d_func()->pending.first()->command;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
20744
1406}-
1407QIODevice* QFtp::currentDevice() const-
1408{-
1409 if (d_func()->pending.isEmpty()
d_func()->pending.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1410 return
never executed: return 0;
0;
never executed: return 0;
0
1411 QFtpCommand *c = d_func()->pending.first();-
1412 if (c->is_ba
c->is_baDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1413 return
never executed: return 0;
0;
never executed: return 0;
0
1414 return
never executed: return c->data.dev;
c->data.dev;
never executed: return c->data.dev;
0
1415}-
1416bool QFtp::hasPendingCommands() const-
1417{-
1418 return
executed 7303 times by 1 test: return d_func()->pending.count() > 1;
Executed by:
  • tst_QFtp
d_func()->pending.count() > 1;
executed 7303 times by 1 test: return d_func()->pending.count() > 1;
Executed by:
  • tst_QFtp
7303
1419}-
1420void QFtp::clearPendingCommands()-
1421{-
1422-
1423 while (d_func()->pending.count() > 1
d_func()->pending.count() > 1Description
TRUEevaluated 119 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 165 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
119-165
1424 delete d_func()->pending.takeLast();
executed 119 times by 2 tests: delete d_func()->pending.takeLast();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
119
1425}
executed 165 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
165
1426QFtp::State QFtp::state() const-
1427{-
1428 return
executed 10413 times by 2 tests: return d_func()->state;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->state;
executed 10413 times by 2 tests: return d_func()->state;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
10413
1429}-
1430QFtp::Error QFtp::error() const-
1431{-
1432 return
executed 5556 times by 2 tests: return d_func()->error;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
d_func()->error;
executed 5556 times by 2 tests: return d_func()->error;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
5556
1433}-
1434QString QFtp::errorString() const-
1435{-
1436 return
executed 6 times by 1 test: return d_func()->errorString;
Executed by:
  • tst_QNetworkReply
d_func()->errorString;
executed 6 times by 1 test: return d_func()->errorString;
Executed by:
  • tst_QNetworkReply
6
1437}-
1438-
1439-
1440-
1441void QFtpPrivate::_q_startNextCommand()-
1442{-
1443 QFtp * const q = q_func();-
1444 if (pending.isEmpty()
pending.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2643 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-2643
1445 return;
never executed: return;
0
1446 QFtpCommand *c = pending.constFirst();-
1447-
1448 error = QFtp::NoError;-
1449 errorString = QLatin1String("Unknown error");-
1450-
1451 if (q->bytesAvailable()
q->bytesAvailable()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 2635 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
8-2635
1452 q->readAll();
executed 8 times by 1 test: q->readAll();
Executed by:
  • tst_QFtp
8
1453 q->commandStarted(c->id);-
1454-
1455-
1456-
1457 if (c->command == QFtp::Login
c->command == QFtp::LoginDescription
TRUEevaluated 633 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2010 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& !proxyHost.isEmpty()
!proxyHost.isEmpty()Description
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 607 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
26-2010
1458 QString loginString;-
1459 loginString += QStringRef(&c->rawCmds.constFirst()).trimmed() + QLatin1Char('@') + host;-
1460 if (port
portDescription
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
&& port != 21
port != 21Description
TRUEnever evaluated
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
0-26
1461 loginString += QLatin1Char(':') + QString::number(port);
never executed: loginString += QLatin1Char(':') + QString::number(port);
0
1462 loginString += QLatin1String("\r\n");-
1463 c->rawCmds[0] = loginString;-
1464 }
executed 26 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
26
1465-
1466 if (c->command == QFtp::SetTransferMode
c->command == ...etTransferModeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 2639 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
4-2639
1467 _q_piFinished(QLatin1String("Transfer mode set"));-
1468 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QFtp
else if (c->command == QFtp::SetProxy
c->command == QFtp::SetProxyDescription
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2613 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
4-2613
1469 proxyHost = c->rawCmds.at(0);-
1470 proxyPort = c->rawCmds.at(1).toUInt();-
1471 c->rawCmds.clear();-
1472 _q_piFinished(QLatin1String("Proxy set to ") + proxyHost + QLatin1Char(':') + QString::number(proxyPort));-
1473 }
executed 26 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else if (c->command == QFtp::ConnectToHost
c->command == ...:ConnectToHostDescription
TRUEevaluated 657 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1956 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
26-1956
1474-
1475-
1476 pi.setProperty("_q_networksession", q->property("_q_networksession"));-
1477-
1478 if (!proxyHost.isEmpty()
!proxyHost.isEmpty()Description
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 631 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
26-631
1479 host = c->rawCmds.at(0);-
1480 port = c->rawCmds.at(1).toUInt();-
1481 pi.connectToHost(proxyHost, proxyPort);-
1482 }
executed 26 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else {
26
1483 pi.connectToHost(c->rawCmds.at(0), c->rawCmds.at(1).toUInt());-
1484 }
executed 631 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
631
1485 } else {-
1486 if (c->command == QFtp::Put
c->command == QFtp::PutDescription
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1913 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
43-1913
1487 if (c->is_ba
c->is_baDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
15-28
1488 pi.dtp.setData(c->data.ba);-
1489 pi.dtp.setBytesTotal(c->data.ba->size());-
1490 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFtp
else if (c->data.dev
c->data.devDescription
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
&& (c->data.dev->isOpen()
c->data.dev->isOpen()Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
|| c->data.dev->open(QIODevice::ReadOnly)
c->data.dev->o...ice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0-28
1491 pi.dtp.setDevice(c->data.dev);-
1492 if (c->data.dev->isSequential()
c->data.dev->isSequential()Description
TRUEnever evaluated
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-15
1493 pi.dtp.setBytesTotal(0);-
1494 pi.dtp.connect(c->data.dev, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "2292"), qFlagLocation("1""dataReadyRead()" "\0" __FILE__ ":" "2292"));-
1495 pi.dtp.connect(c->data.dev, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "2293"), qFlagLocation("1""dataReadyRead()" "\0" __FILE__ ":" "2293"));-
1496 }
never executed: end of block
else {
0
1497 pi.dtp.setBytesTotal(c->data.dev->size());-
1498 }
executed 15 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
15
1499 }-
1500 }
executed 43 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else if (c->command == QFtp::Get
c->command == QFtp::GetDescription
TRUEevaluated 110 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1803 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
43-1803
1501 if (!c->is_ba
!c->is_baDescription
TRUEevaluated 110 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
&& c->data.dev
c->data.devDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-110
1502 pi.dtp.setDevice(c->data.dev);-
1503 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_QFtp
40
1504 }
executed 110 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else if (c->command == QFtp::Close
c->command == QFtp::CloseDescription
TRUEevaluated 480 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1323 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
110-1323
1505 state = QFtp::Closing;-
1506 q->stateChanged(state);-
1507 }
executed 480 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
480
1508 pi.sendCommands(c->rawCmds);-
1509 }
executed 1956 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
1956
1510}-
1511-
1512-
1513-
1514void QFtpPrivate::_q_piFinished(const QString&)-
1515{-
1516 if (pending.isEmpty()
pending.isEmpty()Description
TRUEevaluated 116 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 2957 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
)
116-2957
1517 return;
executed 116 times by 1 test: return;
Executed by:
  • tst_QFtp
116
1518 QFtpCommand *c = pending.constFirst();-
1519-
1520 if (c->command == QFtp::Close
c->command == QFtp::CloseDescription
TRUEevaluated 948 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2009 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
948-2009
1521-
1522-
1523-
1524-
1525 if (state != QFtp::Unconnected
state != QFtp::UnconnectedDescription
TRUEevaluated 479 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 469 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
469-479
1526 close_waitForStateChange = true;-
1527 return;
executed 479 times by 2 tests: return;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
479
1528 }-
1529 }
executed 469 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
469
1530 q_func()->commandFinished(c->id, false);-
1531 pending.removeFirst();-
1532-
1533 delete c;-
1534-
1535 if (pending.isEmpty()
pending.isEmpty()Description
TRUEevaluated 663 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 1815 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
663-1815
1536 q_func()->done(false);-
1537 }
executed 663 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
else {
663
1538 _q_startNextCommand();-
1539 }
executed 1815 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
1815
1540}-
1541-
1542-
1543-
1544void QFtpPrivate::_q_piError(int errorCode, const QString &text)-
1545{-
1546 QFtp * const q = q_func();-
1547-
1548 if (pending.isEmpty()
pending.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 220 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
0-220
1549 QMessageLogger(__FILE__, 2347, __PRETTY_FUNCTION__).warning("QFtpPrivate::_q_piError was called without pending command!");-
1550 return;
never executed: return;
0
1551 }-
1552-
1553 QFtpCommand *c = pending.constFirst();-
1554-
1555-
1556 if (c->command == QFtp::Get
c->command == QFtp::GetDescription
TRUEevaluated 33 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 187 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& pi.currentCommand().startsWith(QLatin1String("SIZE "))
pi.currentComm...ring("SIZE "))Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QFtp
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
16-187
1557 pi.dtp.setBytesTotal(0);-
1558 return;
executed 16 times by 1 test: return;
Executed by:
  • tst_QFtp
16
1559 } else if (c->command==QFtp::Put
c->command==QFtp::PutDescription
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 161 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
&& pi.currentCommand().startsWith(QLatin1String("ALLO "))
pi.currentComm...ring("ALLO "))Description
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-161
1560 return;
executed 43 times by 2 tests: return;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
43
1561 }-
1562-
1563 error = QFtp::Error(errorCode);-
1564 switch (q->currentCommand()) {-
1565 case
executed 20 times by 2 tests: case QFtp::ConnectToHost:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
QFtp::ConnectToHost:
executed 20 times by 2 tests: case QFtp::ConnectToHost:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
20
1566 errorString = QString::fromLatin1("Connecting to host failed:\n%1")-
1567 .arg(text);-
1568 break;
executed 20 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
20
1569 case
executed 23 times by 2 tests: case QFtp::Login:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
QFtp::Login:
executed 23 times by 2 tests: case QFtp::Login:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
23
1570 errorString = QString::fromLatin1("Login failed:\n%1")-
1571 .arg(text);-
1572 break;
executed 23 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
23
1573 case
never executed: case QFtp::List:
QFtp::List:
never executed: case QFtp::List:
0
1574 errorString = QString::fromLatin1("Listing directory failed:\n%1")-
1575 .arg(text);-
1576 break;
never executed: break;
0
1577 case
executed 48 times by 1 test: case QFtp::Cd:
Executed by:
  • tst_QFtp
QFtp::Cd:
executed 48 times by 1 test: case QFtp::Cd:
Executed by:
  • tst_QFtp
48
1578 errorString = QString::fromLatin1("Changing directory failed:\n%1")-
1579 .arg(text);-
1580 break;
executed 48 times by 1 test: break;
Executed by:
  • tst_QFtp
48
1581 case
executed 17 times by 2 tests: case QFtp::Get:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
QFtp::Get:
executed 17 times by 2 tests: case QFtp::Get:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
17
1582 errorString = QString::fromLatin1("Downloading file failed:\n%1")-
1583 .arg(text);-
1584 break;
executed 17 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
17
1585 case
never executed: case QFtp::Put:
QFtp::Put:
never executed: case QFtp::Put:
0
1586 errorString = QString::fromLatin1("Uploading file failed:\n%1")-
1587 .arg(text);-
1588 break;
never executed: break;
0
1589 case
never executed: case QFtp::Remove:
QFtp::Remove:
never executed: case QFtp::Remove:
0
1590 errorString = QString::fromLatin1("Removing file failed:\n%1")-
1591 .arg(text);-
1592 break;
never executed: break;
0
1593 case
executed 32 times by 1 test: case QFtp::Mkdir:
Executed by:
  • tst_QFtp
QFtp::Mkdir:
executed 32 times by 1 test: case QFtp::Mkdir:
Executed by:
  • tst_QFtp
32
1594 errorString = QString::fromLatin1("Creating directory failed:\n%1")-
1595 .arg(text);-
1596 break;
executed 32 times by 1 test: break;
Executed by:
  • tst_QFtp
32
1597 case
never executed: case QFtp::Rmdir:
QFtp::Rmdir:
never executed: case QFtp::Rmdir:
0
1598 errorString = QString::fromLatin1("Removing directory failed:\n%1")-
1599 .arg(text);-
1600 break;
never executed: break;
0
1601 default
executed 21 times by 2 tests: default:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
:
executed 21 times by 2 tests: default:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
21
1602 errorString = text;-
1603 break;
executed 21 times by 2 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
21
1604 }-
1605-
1606 pi.clearPendingCommands();-
1607 q->clearPendingCommands();-
1608 q->commandFinished(c->id, true);-
1609-
1610 pending.removeFirst();-
1611 delete c;-
1612 if (pending.isEmpty()
pending.isEmpty()Description
TRUEevaluated 157 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFtp
)
4-157
1613 q->done(true);
executed 157 times by 2 tests: q->done(true);
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
157
1614 else-
1615 _q_startNextCommand();
executed 4 times by 1 test: _q_startNextCommand();
Executed by:
  • tst_QFtp
4
1616}-
1617-
1618-
1619-
1620void QFtpPrivate::_q_piConnectState(int connectState)-
1621{-
1622 state = QFtp::State(connectState);-
1623 q_func()->stateChanged(state);-
1624 if (close_waitForStateChange
close_waitForStateChangeDescription
TRUEevaluated 469 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
FALSEevaluated 2278 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
469-2278
1625 close_waitForStateChange = false;-
1626 _q_piFinished(QLatin1String("Connection closed"));-
1627 }
executed 469 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
469
1628}
executed 2747 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
2747
1629-
1630-
1631-
1632void QFtpPrivate::_q_piFtpReply(int code, const QString &text)-
1633{-
1634 if (q_func()->currentCommand() == QFtp::RawCommand
q_func()->curr...tp::RawCommandDescription
TRUEevaluated 132 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 4304 times by 2 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
) {
132-4304
1635 pi.rawCommand = true;-
1636 q_func()->rawCommandReply(code, text);-
1637 }
executed 132 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
132
1638}
executed 4436 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
4436
1639-
1640-
1641-
1642-
1643-
1644QFtp::~QFtp()-
1645{-
1646 abort();
executed 659 times by 2 tests: abort();
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
659
1647 close();-
1648}
executed 659 times by 2 tests: end of block
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
659
1649-
1650-
1651-
1652-
Switch to Source codePreprocessed file

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