Skip to content

Commit

Permalink
Fix clang-tidy warnings in headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mkow committed Jul 31, 2017
1 parent e4c0617 commit 4f18a22
Show file tree
Hide file tree
Showing 54 changed files with 226 additions and 182 deletions.
4 changes: 2 additions & 2 deletions include/client/dbif.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NCWrapper;

class NCObjectHandle : public dbif::ObjectHandleBase {
public:
NCObjectHandle(NCWrapper* nc = nullptr,
explicit NCObjectHandle(NCWrapper* nc = nullptr,
const data::NodeID& id = *data::NodeID::getNilId(),
dbif::ObjectType type = dbif::ObjectType::CHUNK);
data::NodeID id();
Expand Down Expand Up @@ -94,7 +94,7 @@ class NCWrapper : public QObject {
typedef std::map<data::NodeID, NCObjectHandle> ChildrenMap;
typedef void (NCWrapper::*MessageHandler)(const msg_ptr&);

NCWrapper(NetworkClient* network_client, QObject* parent = nullptr);
explicit NCWrapper(NetworkClient* network_client, QObject* parent = nullptr);
static dbif::ObjectType typeFromTags(
const std::shared_ptr<std::unordered_set<std::shared_ptr<std::string>>>&
tags);
Expand Down
2 changes: 1 addition & 1 deletion include/client/networkclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class NetworkClient : public QObject {
enum class ConnectionStatus { NotConnected, Connecting, Connected };
static QString connStatusStr(ConnectionStatus status);

NetworkClient(QObject* parent = nullptr);
explicit NetworkClient(QObject* parent = nullptr);
virtual ~NetworkClient();
ConnectionStatus connectionStatus();
void connect(const QString& server_url, const QString& client_interface_name,
Expand Down
2 changes: 1 addition & 1 deletion include/client/nodetree.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef std::shared_ptr<proto::MsgpackMsg> msg_ptr;

class NodeTree {
public:
NodeTree(NetworkClient* network_client);
explicit NodeTree(NetworkClient* network_client);
void addRemoteNodeTreeRelatedMessage(const msg_ptr& msg);
};

Expand Down
7 changes: 4 additions & 3 deletions include/data/bindata.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ class BinData {
: width_(width), size_(size) {
assert(width != 0);
if (!isInline()) data_ = new uint8_t[octets()];
if (init_data)
if (init_data) {
memcpy(rawData(), init_data, octets());
else
} else {
memset(rawData(), 0, octets());
}
}

/** Constructs a BinData instance from given width and data given as
Expand Down Expand Up @@ -208,7 +209,7 @@ class BinData {
uint8_t octets[8] = {0};
uint64_t res = 0;
copyBits(octets, 0, rawData(el), start_bit, num_bits);
for (int i = 0; i < 8; i++) res |= (uint64_t)octets[i] << (8 * i);
for (int i = 0; i < 8; i++) res |= static_cast<uint64_t>(octets[i]) << (8 * i);
return res;
}

Expand Down
2 changes: 1 addition & 1 deletion include/data/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ struct ChunkDataItem {
// For COMPUTED, FIELD, BITFIELD, SUBCHUNK.
std::vector<ObjectHandle> ref;

operator bool() const { return type != NONE; }
explicit operator bool() const { return type != NONE; }

ChunkDataItem() : type(NONE) {}

Expand Down
2 changes: 1 addition & 1 deletion include/data/nodeid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class NodeID {
NodeID(const NodeID& other);

QString toHexString() const;
static std::shared_ptr<NodeID> fromHexString(QString& val);
static std::shared_ptr<NodeID> fromHexString(const QString& val);
std::vector<uint8_t> asStdVector() const;
// functions for more convenient getting of special values
static std::shared_ptr<NodeID> getRootNodeId();
Expand Down
2 changes: 1 addition & 1 deletion include/data/repack.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace data {
/** Represents data repacking format. */
class Repacker : public RepackerModel {
public:
Repacker(Endian endian = Endian::LITTLE, uint64_t from_width = 8,
explicit Repacker(Endian endian = Endian::LITTLE, uint64_t from_width = 8,
uint64_t to_width = 8, uint64_t high_pad = 0, uint64_t low_pad = 0)
: RepackerModel(endian, from_width, to_width, high_pad, low_pad) {}
using RepackerModel::RepackerModel;
Expand Down
6 changes: 3 additions & 3 deletions include/dbif/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ struct ParsersListReply : InfoReply {

struct BlobDataReply : InfoReply {
data::BinData data;
BlobDataReply(const data::BinData& data) : data(data) {}
BlobDataReply(data::BinData&& data) : data(data) {}
explicit BlobDataReply(const data::BinData& data) : data(data) {}
explicit BlobDataReply(data::BinData&& data) : data(data) {}
};

struct ChunkDataReply : InfoReply {
std::vector<data::ChunkDataItem> items;
ChunkDataReply(std::vector<data::ChunkDataItem>& items) : items(items) {}
explicit ChunkDataReply(const std::vector<data::ChunkDataItem>& items) : items(items) {}
};

} // namespace dbif
Expand Down
2 changes: 1 addition & 1 deletion include/dbif/method.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct BlobParseRequest : MethodRequest {
QString parser_id;
uint64_t start;
ObjectHandle parent_chunk;
BlobParseRequest(QString parser_id = "", uint64_t start = 0,
explicit BlobParseRequest(QString parser_id = "", uint64_t start = 0,
ObjectHandle parent_chunk = ObjectHandle())
: parser_id(parser_id), start(start), parent_chunk(parent_chunk) {}
typedef NullReply ReplyType;
Expand Down
6 changes: 4 additions & 2 deletions include/dbif/universe.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ class ObjectHandleBase {
[&err](PError error) { err = error; });
while (true) {
if (res) {
if (!promise.isNull())
if (!promise.isNull()) {
delete static_cast<MethodResultPromise*>(promise);
}
return res;
}
if (err) {
if (!promise.isNull())
if (!promise.isNull()) {
delete static_cast<MethodResultPromise*>(promise);
}
throw err;
}
QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
Expand Down
16 changes: 8 additions & 8 deletions include/kaitai/avi.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ class avi_t : public kaitai::kstruct {
HANDLER_TYPE_XVID = 1684633208
};

avi_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
explicit avi_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~avi_t();

class list_body_t : public kaitai::kstruct {
public:
list_body_t(kaitai::kstream* p_io, avi_t::block_t* p_parent = 0,
explicit list_body_t(kaitai::kstream* p_io, avi_t::block_t* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~list_body_t();
Expand All @@ -79,7 +79,7 @@ class avi_t : public kaitai::kstruct {

class rect_t : public kaitai::kstruct {
public:
rect_t(kaitai::kstream* p_io, avi_t::strh_body_t* p_parent = 0,
explicit rect_t(kaitai::kstream* p_io, avi_t::strh_body_t* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~rect_t();
Expand All @@ -103,7 +103,7 @@ class avi_t : public kaitai::kstruct {

class blocks_t : public kaitai::kstruct {
public:
blocks_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
explicit blocks_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~blocks_t();
Expand All @@ -125,7 +125,7 @@ class avi_t : public kaitai::kstruct {

class avih_body_t : public kaitai::kstruct {
public:
avih_body_t(kaitai::kstream* p_io, avi_t::block_t* p_parent = 0,
explicit avih_body_t(kaitai::kstream* p_io, avi_t::block_t* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~avih_body_t();
Expand Down Expand Up @@ -163,7 +163,7 @@ class avi_t : public kaitai::kstruct {

class block_t : public kaitai::kstruct {
public:
block_t(kaitai::kstream* p_io, avi_t::blocks_t* p_parent = 0,
explicit block_t(kaitai::kstream* p_io, avi_t::blocks_t* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~block_t();
Expand Down Expand Up @@ -193,7 +193,7 @@ class avi_t : public kaitai::kstruct {

class strh_body_t : public kaitai::kstruct {
public:
strh_body_t(kaitai::kstream* p_io, avi_t::block_t* p_parent = 0,
explicit strh_body_t(kaitai::kstream* p_io, avi_t::block_t* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~strh_body_t();
Expand Down Expand Up @@ -249,7 +249,7 @@ class avi_t : public kaitai::kstruct {

class strf_body_t : public kaitai::kstruct {
public:
strf_body_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
explicit strf_body_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
avi_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~strf_body_t();
Expand Down
4 changes: 2 additions & 2 deletions include/kaitai/avi_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class AviParser : public parser::Parser {
public:
AviParser() : parser::Parser("avi (ksy)") {}
void parse(
const dbif::ObjectHandle& blob, uint64_t start = 0,
const dbif::ObjectHandle& parent_chunk = dbif::ObjectHandle()) override {
const dbif::ObjectHandle& blob, uint64_t start,
const dbif::ObjectHandle& parent_chunk) override {
try {
auto stream = kaitai::kstream(blob, start, parent_chunk);
auto parser = kaitai::avi::avi_t(&stream);
Expand Down
10 changes: 5 additions & 5 deletions include/kaitai/bmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class bmp_t : public kaitai::kstruct {
class bitmap_core_header_t;
class bitmap_info_header_t;

bmp_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
explicit bmp_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
bmp_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~bmp_t();

class file_header_t : public kaitai::kstruct {
public:
file_header_t(kaitai::kstream* p_io, bmp_t* p_parent = 0,
explicit file_header_t(kaitai::kstream* p_io, bmp_t* p_parent = 0,
bmp_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~file_header_t();
Expand All @@ -53,7 +53,7 @@ class bmp_t : public kaitai::kstruct {

class dib_header_t : public kaitai::kstruct {
public:
dib_header_t(kaitai::kstream* p_io, bmp_t* p_parent = 0, bmp_t* p_root = 0);
explicit dib_header_t(kaitai::kstream* p_io, bmp_t* p_parent = 0, bmp_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~dib_header_t();

Expand Down Expand Up @@ -144,7 +144,7 @@ class bmp_t : public kaitai::kstruct {

class bitmap_core_header_t : public kaitai::kstruct {
public:
bitmap_core_header_t(kaitai::kstream* p_io,
explicit bitmap_core_header_t(kaitai::kstream* p_io,
bmp_t::dib_header_t* p_parent = 0, bmp_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~bitmap_core_header_t();
Expand All @@ -168,7 +168,7 @@ class bmp_t : public kaitai::kstruct {

class bitmap_info_header_t : public kaitai::kstruct {
public:
bitmap_info_header_t(kaitai::kstream* p_io,
explicit bitmap_info_header_t(kaitai::kstream* p_io,
bmp_t::dib_header_t* p_parent = 0, bmp_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~bitmap_info_header_t();
Expand Down
4 changes: 2 additions & 2 deletions include/kaitai/bmp_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class BmpParser : public parser::Parser {
public:
BmpParser() : parser::Parser("bmp (ksy)") {}
void parse(
const dbif::ObjectHandle& blob, uint64_t start = 0,
const dbif::ObjectHandle& parent_chunk = dbif::ObjectHandle()) override {
const dbif::ObjectHandle& blob, uint64_t start,
const dbif::ObjectHandle& parent_chunk) override {
try {
auto stream = kaitai::kstream(blob, start, parent_chunk);
auto parser = kaitai::bmp::bmp_t(&stream);
Expand Down
10 changes: 5 additions & 5 deletions include/kaitai/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ class elf_t : public kaitai::kstruct {
OBJ_TYPE_CORE = 4
};

elf_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
explicit elf_t(kaitai::kstream* p_io, kaitai::kstruct* p_parent = 0,
elf_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~elf_t();

class file_header_t : public kaitai::kstruct {
public:
file_header_t(kaitai::kstream* p_io, elf_t* p_parent = 0,
explicit file_header_t(kaitai::kstream* p_io, elf_t* p_parent = 0,
elf_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~file_header_t();
Expand Down Expand Up @@ -213,7 +213,7 @@ class elf_t : public kaitai::kstruct {

class program_header_t : public kaitai::kstruct {
public:
program_header_t(kaitai::kstream* p_io, elf_t* p_parent = 0,
explicit program_header_t(kaitai::kstream* p_io, elf_t* p_parent = 0,
elf_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~program_header_t();
Expand Down Expand Up @@ -265,7 +265,7 @@ class elf_t : public kaitai::kstruct {

class section_header_t : public kaitai::kstruct {
public:
section_header_t(kaitai::kstream* p_io, elf_t* p_parent = 0,
explicit section_header_t(kaitai::kstream* p_io, elf_t* p_parent = 0,
elf_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~section_header_t();
Expand Down Expand Up @@ -315,7 +315,7 @@ class elf_t : public kaitai::kstruct {

class strings_t : public kaitai::kstruct {
public:
strings_t(kaitai::kstream* p_io, elf_t* p_parent = 0, elf_t* p_root = 0);
explicit strings_t(kaitai::kstream* p_io, elf_t* p_parent = 0, elf_t* p_root = 0);
veles::dbif::ObjectHandle veles_obj;
~strings_t();

Expand Down
4 changes: 2 additions & 2 deletions include/kaitai/elf_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class ElfParser : public parser::Parser {
public:
ElfParser() : parser::Parser("elf (ksy)") {}
void parse(
const dbif::ObjectHandle& blob, uint64_t start = 0,
const dbif::ObjectHandle& parent_chunk = dbif::ObjectHandle()) override {
const dbif::ObjectHandle& blob, uint64_t start,
const dbif::ObjectHandle& parent_chunk) override {
try {
auto stream = kaitai::kstream(blob, start, parent_chunk);
auto parser = kaitai::elf::elf_t(&stream);
Expand Down
Loading

0 comments on commit 4f18a22

Please sign in to comment.