Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | class QDBusUnixFileDescriptorPrivate : public QSharedData { | - |
7 | public: | - |
8 | QDBusUnixFileDescriptorPrivate() : fd(-1) { } | 0 |
9 | QDBusUnixFileDescriptorPrivate(const QDBusUnixFileDescriptorPrivate &other) | - |
10 | : QSharedData(other), fd(-1) | - |
11 | { } | 0 |
12 | ~QDBusUnixFileDescriptorPrivate(); | - |
13 | | - |
14 | QAtomicInt fd; | - |
15 | }; | - |
16 | | - |
17 | template<> inline | - |
18 | QExplicitlySharedDataPointer<QDBusUnixFileDescriptorPrivate>::~QExplicitlySharedDataPointer() | - |
19 | { if (d && !d->ref.deref()) delete d; } never executed: delete d; never evaluated: !d->ref.deref() | 0 |
20 | QDBusUnixFileDescriptor::QDBusUnixFileDescriptor() | - |
21 | : d(0) | - |
22 | { | - |
23 | } | 0 |
24 | QDBusUnixFileDescriptor::QDBusUnixFileDescriptor(int fileDescriptor) | - |
25 | : d(0) | - |
26 | { | - |
27 | if (fileDescriptor != -1) never evaluated: fileDescriptor != -1 | 0 |
28 | setFileDescriptor(fileDescriptor); never executed: setFileDescriptor(fileDescriptor); | 0 |
29 | } | 0 |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | QDBusUnixFileDescriptor::QDBusUnixFileDescriptor(const QDBusUnixFileDescriptor &other) | - |
35 | : d(other.d) | - |
36 | { | - |
37 | } | 0 |
38 | | - |
39 | | - |
40 | | - |
41 | | - |
42 | | - |
43 | | - |
44 | QDBusUnixFileDescriptor &QDBusUnixFileDescriptor::operator=(const QDBusUnixFileDescriptor &other) | - |
45 | { | - |
46 | if (this != &other) never evaluated: this != &other | 0 |
47 | d.operator=(other.d); never executed: d.operator=(other.d); | 0 |
48 | return *this; never executed: return *this; | 0 |
49 | } | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | QDBusUnixFileDescriptor::~QDBusUnixFileDescriptor() | - |
55 | { | - |
56 | } | - |
57 | bool QDBusUnixFileDescriptor::isValid() const | - |
58 | { | - |
59 | return d ? d->fd.load() != -1 : false; never executed: return d ? d->fd.load() != -1 : false; | 0 |
60 | } | - |
61 | int QDBusUnixFileDescriptor::fileDescriptor() const | - |
62 | { | - |
63 | return d ? d->fd.load() : -1; never executed: return d ? d->fd.load() : -1; | 0 |
64 | } | - |
65 | bool QDBusUnixFileDescriptor::isSupported() | - |
66 | { | - |
67 | return true; never executed: return true; | 0 |
68 | } | - |
69 | void QDBusUnixFileDescriptor::setFileDescriptor(int fileDescriptor) | - |
70 | { | - |
71 | if (fileDescriptor != -1) never evaluated: fileDescriptor != -1 | 0 |
72 | giveFileDescriptor(qt_safe_dup(fileDescriptor)); never executed: giveFileDescriptor(qt_safe_dup(fileDescriptor)); | 0 |
73 | } | 0 |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | | - |
80 | | - |
81 | void QDBusUnixFileDescriptor::giveFileDescriptor(int fileDescriptor) | - |
82 | { | - |
83 | | - |
84 | | - |
85 | if (d) | 0 |
86 | d.detach(); never executed: d.detach(); | 0 |
87 | else | - |
88 | d = new QDBusUnixFileDescriptorPrivate; never executed: d = new QDBusUnixFileDescriptorPrivate; | 0 |
89 | | - |
90 | const int fdl = d->fd.load(); | - |
91 | if (fdl != -1) never evaluated: fdl != -1 | 0 |
92 | qt_safe_close(fdl); never executed: qt_safe_close(fdl); | 0 |
93 | | - |
94 | if (fileDescriptor != -1) never evaluated: fileDescriptor != -1 | 0 |
95 | d->fd.store(fileDescriptor); never executed: d->fd.store(fileDescriptor); | 0 |
96 | } | 0 |
97 | int QDBusUnixFileDescriptor::takeFileDescriptor() | - |
98 | { | - |
99 | if (!d) | 0 |
100 | return -1; never executed: return -1; | 0 |
101 | | - |
102 | return d->fd.fetchAndStoreRelaxed(-1); never executed: return d->fd.fetchAndStoreRelaxed(-1); | 0 |
103 | } | - |
104 | | - |
105 | QDBusUnixFileDescriptorPrivate::~QDBusUnixFileDescriptorPrivate() | - |
106 | { | - |
107 | const int fdl = fd.load(); | - |
108 | if (fdl != -1) never evaluated: fdl != -1 | 0 |
109 | qt_safe_close(fdl); never executed: qt_safe_close(fdl); | 0 |
110 | } | 0 |
111 | | - |
112 | | - |
| | |