Skip to content

Commit 90a5e55

Browse files
committed
LGTM
- Fix LGTM alerts - Remove HTML and JavaScript from LGTM analysis
1 parent c218a57 commit 90a5e55

File tree

7 files changed

+13
-26
lines changed

7 files changed

+13
-26
lines changed

.lgtm.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
path_classifiers:
2+
library:
3+
- "html/*"
4+
- "html_NG/*"
15
extraction:
26
cpp:
37
prepare:

src/packetq.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ int main(int argc, char* argv[])
304304

305305
delete g_app;
306306

307-
void destroy_packet_handlers();
307+
destroy_packet_handlers();
308308

309309
return 0;
310310
}

src/server.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,6 @@ namespace httpd {
121121
m_len = len;
122122
m_pos = 0;
123123
}
124-
Buffer(const Buffer& buf)
125-
{
126-
m_len = buf.m_len;
127-
m_buf = new unsigned char[buf.m_len];
128-
memcpy(m_buf, buf.m_buf, m_len);
129-
m_pos = 0;
130-
}
131124
~Buffer()
132125
{
133126
m_len = 0;
@@ -988,7 +981,6 @@ namespace httpd {
988981
m_file = 0;
989982
}
990983
set_delete();
991-
} else {
992984
}
993985
}
994986
}

src/sql.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ class Parser {
11561156
bool asc = true;
11571157
if (it->get_type() == Token::_label) {
11581158
if (cmpi(it->get_token(), "asc")) {
1159+
// default
11591160
} else if (cmpi(it->get_token(), "desc")) {
11601161
asc = false;
11611162
} else if (cmpi(it->get_token(), "collate")) {

src/sql.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ class DB {
166166
i.m_key = key;
167167
std::map<Item, std::string>::iterator it = m_lut.find(i);
168168
if (it != m_lut.end())
169-
// FIXME: we should store these strings in the first place
170169
return RefCountString::construct(it->second.c_str());
171170

172171
return 0;
@@ -530,7 +529,7 @@ class Token {
530529
{
531530
m_token = istr;
532531
}
533-
const Type get_type() const
532+
Type get_type() const
534533
{
535534
return m_type;
536535
}
@@ -561,7 +560,7 @@ class OP : public Token {
561560
return 0;
562561
}
563562

564-
OP(const OP& op)
563+
OP(const OP& op) // lgtm[cpp/rule-of-two]
565564
: Token(op.get_type(), op.get_token())
566565
{
567566
for (int i = 0; i < max_param(); i++) {
@@ -890,13 +889,13 @@ class Rsplit_func : public OP {
890889
}
891890
p--;
892891
}
893-
char buf[256]; // FIXME: arbitrary limitation, would probably be
894-
// better to allocate result buffer directly
895-
if (found < n || start >= l || end - start > sizeof(buf)) {
892+
if (found < n || start >= l) {
896893
RefCountStringHandle res(RefCountString::construct(""));
897894
v = *res;
898895
return;
899896
}
897+
size_t buflen = start < end ? end - start + 1 : 1;
898+
char buf[buflen];
900899
p = 0;
901900
while (start < end)
902901
buf[p++] = s[start++];

src/tcp.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ class Data_segment {
7878
m_data[i] = data[i];
7979
}
8080
}
81-
/// Copy constructor
82-
Data_segment(const Data_segment& other)
83-
{
84-
m_datasize = other.m_datasize;
85-
m_data = new unsigned char[m_datasize];
86-
for (unsigned int i = 0; i < m_datasize; i++) {
87-
m_data[i] = other.m_data[i];
88-
}
89-
}
9081
/// Destructor
9182
~Data_segment()
9283
{

src/variant.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ inline text_column convert_column_to_text(float_column v)
9191
{
9292
const int bufsize = 50;
9393
RefCountString* str = RefCountString::allocate(bufsize);
94-
snprintf(str->data, bufsize, "%g", v);
94+
snprintf(str->data, bufsize, "%g", v); // lgtm[cpp/badly-bounded-write]
9595
return str;
9696
}
9797
inline text_column convert_column_to_text(int_column v)
9898
{
9999
const int bufsize = (sizeof(int_column) * 8 + 1) / 3 + 1;
100100
RefCountString* str = RefCountString::allocate(bufsize);
101-
snprintf(str->data, bufsize, "%d", v);
101+
snprintf(str->data, bufsize, "%d", v); // lgtm[cpp/badly-bounded-write]
102102
return str;
103103
}
104104
inline text_column convert_column_to_text(bool_column v)

0 commit comments

Comments
 (0)