Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | namespace { | - |
7 | static inline QString fromstrerror_helper(int, const QByteArray &buf) | - |
8 | { | - |
9 | return QString::fromLocal8Bit(buf); never executed: return QString::fromLocal8Bit(buf); | 0 |
10 | } | - |
11 | static inline QString fromstrerror_helper(const char *str, const QByteArray &) | - |
12 | { | - |
13 | return QString::fromLocal8Bit(str); executed: return QString::fromLocal8Bit(str); Execution Count:119 | 119 |
14 | } | - |
15 | } | - |
16 | static QString standardLibraryErrorString(int errorCode) | - |
17 | { | - |
18 | const char *s = 0; | - |
19 | QString ret; | - |
20 | switch (errorCode) { | - |
21 | case 0: | - |
22 | break; | 0 |
23 | case 13: | - |
24 | s = "Permission denied"; | - |
25 | break; executed: break; Execution Count:3 | 3 |
26 | case 24: | - |
27 | s = "Too many open files"; | - |
28 | break; | 0 |
29 | case 2: | - |
30 | s = "No such file or directory"; | - |
31 | break; executed: break; Execution Count:605 | 605 |
32 | case 28: | - |
33 | s = "No space left on device"; | - |
34 | break; | 0 |
35 | default: { | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | QByteArray buf(1024, '\0'); | - |
41 | ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf); | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | break; } executed: break; Execution Count:119 | 119 |
47 | } | - |
48 | if (s) { evaluated: s yes Evaluation Count:608 | yes Evaluation Count:119 |
| 119-608 |
49 | | - |
50 | | - |
51 | ret = QString::fromLatin1(s); | - |
52 | } executed: } Execution Count:608 | 608 |
53 | return ret.trimmed(); executed: return ret.trimmed(); Execution Count:727 | 727 |
54 | } | - |
55 | | - |
56 | QString QSystemError::toString() | - |
57 | { | - |
58 | switch(errorScope) { | - |
59 | case NativeError: | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | case StandardLibraryError: | - |
66 | return standardLibraryErrorString(errorCode); executed: return standardLibraryErrorString(errorCode); Execution Count:727 | 727 |
67 | default: | - |
68 | QMessageLogger("kernel/qsystemerror.cpp", 156, __PRETTY_FUNCTION__).warning("invalid error scope"); | - |
69 | | - |
70 | case NoError: | - |
71 | return QLatin1String("No error"); never executed: return QLatin1String("No error"); | 0 |
72 | } | - |
73 | } | 0 |
74 | | - |
75 | | - |
76 | | - |
| | |