qdbusunixfiledescriptor.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6class QDBusUnixFileDescriptorPrivate : public QSharedData { -
7public: -
8 QDBusUnixFileDescriptorPrivate() : fd(-1) { }
never executed: }
0
9 QDBusUnixFileDescriptorPrivate(const QDBusUnixFileDescriptorPrivate &other) -
10 : QSharedData(other), fd(-1) -
11 { }
never executed: }
0
12 ~QDBusUnixFileDescriptorPrivate(); -
13 -
14 QAtomicInt fd; -
15}; -
16 -
17template<> inline -
18QExplicitlySharedDataPointer<QDBusUnixFileDescriptorPrivate>::~QExplicitlySharedDataPointer() -
19{ if (d && !d->ref.deref()) delete d; }
never executed: delete d;
never executed: }
never evaluated: d
never evaluated: !d->ref.deref()
0
20QDBusUnixFileDescriptor::QDBusUnixFileDescriptor() -
21 : d(0) -
22{ -
23}
never executed: }
0
24QDBusUnixFileDescriptor::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}
never executed: }
0
30 -
31 -
32 -
33 -
34QDBusUnixFileDescriptor::QDBusUnixFileDescriptor(const QDBusUnixFileDescriptor &other) -
35 : d(other.d) -
36{ -
37}
never executed: }
0
38 -
39 -
40 -
41 -
42 -
43 -
44QDBusUnixFileDescriptor &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 -
54QDBusUnixFileDescriptor::~QDBusUnixFileDescriptor() -
55{ -
56} -
57bool QDBusUnixFileDescriptor::isValid() const -
58{ -
59 return d ? d->fd.load() != -1 : false;
never executed: return d ? d->fd.load() != -1 : false;
0
60} -
61int QDBusUnixFileDescriptor::fileDescriptor() const -
62{ -
63 return d ? d->fd.load() : -1;
never executed: return d ? d->fd.load() : -1;
0
64} -
65bool QDBusUnixFileDescriptor::isSupported() -
66{ -
67 return true;
never executed: return true;
0
68} -
69void 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}
never executed: }
0
74 -
75 -
76 -
77 -
78 -
79 -
80 -
81void QDBusUnixFileDescriptor::giveFileDescriptor(int fileDescriptor) -
82{ -
83 -
84 -
85 if (d)
never evaluated: 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}
never executed: }
0
97int QDBusUnixFileDescriptor::takeFileDescriptor() -
98{ -
99 if (!d)
never evaluated: !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 -
105QDBusUnixFileDescriptorPrivate::~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}
never executed: }
0
111 -
112 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial