Skip to content

Commit

Permalink
LGTM
Browse files Browse the repository at this point in the history
- Fix LGTM alerts
- Remove HTML and JavaScript from LGTM analysis
  • Loading branch information
jelu committed Jun 4, 2020
1 parent c218a57 commit 90a5e55
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .lgtm.yml
@@ -1,3 +1,7 @@
path_classifiers:
library:
- "html/*"
- "html_NG/*"
extraction:
cpp:
prepare:
Expand Down
2 changes: 1 addition & 1 deletion src/packetq.cpp
Expand Up @@ -304,7 +304,7 @@ int main(int argc, char* argv[])

delete g_app;

void destroy_packet_handlers();
destroy_packet_handlers();

return 0;
}
8 changes: 0 additions & 8 deletions src/server.cpp
Expand Up @@ -121,13 +121,6 @@ namespace httpd {
m_len = len;
m_pos = 0;
}
Buffer(const Buffer& buf)
{
m_len = buf.m_len;
m_buf = new unsigned char[buf.m_len];
memcpy(m_buf, buf.m_buf, m_len);
m_pos = 0;
}
~Buffer()
{
m_len = 0;
Expand Down Expand Up @@ -988,7 +981,6 @@ namespace httpd {
m_file = 0;
}
set_delete();
} else {
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/sql.cpp
Expand Up @@ -1156,6 +1156,7 @@ class Parser {
bool asc = true;
if (it->get_type() == Token::_label) {
if (cmpi(it->get_token(), "asc")) {
// default
} else if (cmpi(it->get_token(), "desc")) {
asc = false;
} else if (cmpi(it->get_token(), "collate")) {
Expand Down
11 changes: 5 additions & 6 deletions src/sql.h
Expand Up @@ -166,7 +166,6 @@ class DB {
i.m_key = key;
std::map<Item, std::string>::iterator it = m_lut.find(i);
if (it != m_lut.end())
// FIXME: we should store these strings in the first place
return RefCountString::construct(it->second.c_str());

return 0;
Expand Down Expand Up @@ -530,7 +529,7 @@ class Token {
{
m_token = istr;
}
const Type get_type() const
Type get_type() const
{
return m_type;
}
Expand Down Expand Up @@ -561,7 +560,7 @@ class OP : public Token {
return 0;
}

OP(const OP& op)
OP(const OP& op) // lgtm[cpp/rule-of-two]
: Token(op.get_type(), op.get_token())
{
for (int i = 0; i < max_param(); i++) {
Expand Down Expand Up @@ -890,13 +889,13 @@ class Rsplit_func : public OP {
}
p--;
}
char buf[256]; // FIXME: arbitrary limitation, would probably be
// better to allocate result buffer directly
if (found < n || start >= l || end - start > sizeof(buf)) {
if (found < n || start >= l) {
RefCountStringHandle res(RefCountString::construct(""));
v = *res;
return;
}
size_t buflen = start < end ? end - start + 1 : 1;
char buf[buflen];
p = 0;
while (start < end)
buf[p++] = s[start++];
Expand Down
9 changes: 0 additions & 9 deletions src/tcp.cpp
Expand Up @@ -78,15 +78,6 @@ class Data_segment {
m_data[i] = data[i];
}
}
/// Copy constructor
Data_segment(const Data_segment& other)
{
m_datasize = other.m_datasize;
m_data = new unsigned char[m_datasize];
for (unsigned int i = 0; i < m_datasize; i++) {
m_data[i] = other.m_data[i];
}
}
/// Destructor
~Data_segment()
{
Expand Down
4 changes: 2 additions & 2 deletions src/variant.h
Expand Up @@ -91,14 +91,14 @@ inline text_column convert_column_to_text(float_column v)
{
const int bufsize = 50;
RefCountString* str = RefCountString::allocate(bufsize);
snprintf(str->data, bufsize, "%g", v);
snprintf(str->data, bufsize, "%g", v); // lgtm[cpp/badly-bounded-write]
return str;
}
inline text_column convert_column_to_text(int_column v)
{
const int bufsize = (sizeof(int_column) * 8 + 1) / 3 + 1;
RefCountString* str = RefCountString::allocate(bufsize);
snprintf(str->data, bufsize, "%d", v);
snprintf(str->data, bufsize, "%d", v); // lgtm[cpp/badly-bounded-write]
return str;
}
inline text_column convert_column_to_text(bool_column v)
Expand Down

0 comments on commit 90a5e55

Please sign in to comment.