forked from deep5050/cppcheck-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCppCheckReport.txt
167 lines (166 loc) · 8.49 KB
/
CppCheckReport.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
__tests__/client/client.c:56:9: style: The scope of the variable 'rcvd_bytes' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level. [variableScope]
int rcvd_bytes;
^
__tests__/client/client.c:86:92: style: The scope of the variable 'n' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level. [variableScope]
int opt, port, debug_level, connect_status, sent_bytes, recv_bytes, temp_return_value, n;
^
__tests__/fibonacci.c:21:21: style: The scope of the variable 'first' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level. [variableScope]
static long int first = 0, second = 1, sum;
^
__tests__/fibonacci.c:21:32: style: The scope of the variable 'second' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level. [variableScope]
static long int first = 0, second = 1, sum;
^
__tests__/fibonacci.c:21:44: style: The scope of the variable 'sum' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level. [variableScope]
static long int first = 0, second = 1, sum;
^
__tests__/fibonacci.c:9:16: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
long int i = 0, j = 1;
^
__tests__/fibonacci.c:9:23: style: Variable 'j' is assigned a value that is never used. [unreadVariable]
long int i = 0, j = 1;
^
__tests__/fibonacci.c:8:9: style: Unused variable: k [unusedVariable]
int k, n;
^
__tests__/server/server.c:115:9: style: The scope of the variable 'client_fd' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level. [variableScope]
int client_fd, server_status, bind_status, listen_status, accept_status,
^
__tests__/server/server.c:115:35: style: The scope of the variable 'bind_status' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level. [variableScope]
int client_fd, server_status, bind_status, listen_status, accept_status,
^
__tests__/server/server.c:115:20: style: Unused variable: server_status [unusedVariable]
int client_fd, server_status, bind_status, listen_status, accept_status,
^
__tests__/server/server.c:115:63: style: Unused variable: accept_status [unusedVariable]
int client_fd, server_status, bind_status, listen_status, accept_status,
^
__tests__/server/server.c:116:22: style: Variable 'n' is assigned a value that is never used. [unreadVariable]
addr_status, n = 0, yes = 1, bytes_sent;
^
__tests__/server/server.c:116:38: style: Unused variable: bytes_sent [unusedVariable]
addr_status, n = 0, yes = 1, bytes_sent;
^
__tests__/server/server.c:130:10: style: Unused variable: buff [unusedVariable]
char buff[MAX_MSG_LEN], addr[INET_ADDRSTRLEN];
^
__tests__/test.c:26:9: style: Obsolete function 'asctime' called. It is recommended to use 'strftime' instead. [asctimeCalled]
str = asctime(local);
^
__tests__/test.c:243:6: style: Suspicious condition (assignment + comparison); Clarify expression with parentheses. [clarifyCondition]
if (listen_status = listen(server_fd, backlog) == -1) {
^
__tests__/test.c:148:15: warning: String literal compared with variable 'argv[1]'. Did you intend to use strcmp() instead? [literalWithCharPtrCompare]
if (argv[1] == "" || argv[1] == NULL) {
^
__tests__/test.c:153:15: warning: String literal compared with variable 'argv[2]'. Did you intend to use strcmp() instead? [literalWithCharPtrCompare]
if (argv[2] == "" || argv[2] == NULL) {
^
__tests__/test.c:243:21: style: Variable 'listen_status' is assigned a value that is never used. [unreadVariable]
if (listen_status = listen(server_fd, backlog) == -1) {
^
__tests__/test.c:262:20: style: Variable 'greetings' is assigned a value that is never used. [unreadVariable]
char greetings[] = "SERVER: Hi client, you are now connected\n";
^
__tests__/test.c:281:18: style: Variable 'sorry' is assigned a value that is never used. [unreadVariable]
char sorry[] = "SERVER: sorry could not give the service right now\n";
^
__tests__/test.c:164:18: style: Unused variable: server_status [unusedVariable]
int client_fd, server_status, bind_status, listen_status, accept_status,
^
__tests__/test.c:164:61: style: Unused variable: accept_status [unusedVariable]
int client_fd, server_status, bind_status, listen_status, accept_status,
^
__tests__/test.c:166:8: style: Unused variable: buff [unusedVariable]
char buff[max_mssg_len];
^
__tests__/test.c:167:7: style: Variable 'n' is assigned a value that is never used. [unreadVariable]
int n = 0, yes = 1;
^
__tests__/test.c:169:7: style: Unused variable: bytes_sent [unusedVariable]
int bytes_sent;
^
nofile:0:0: information: Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config. [missingInclude]