Compare commits

..

1 Commits

Author SHA1 Message Date
Lioncash
b16c89bf65 vi: Copy data directly into the std::vector within Parcel's ReadBlock function
Previously this would unnecessarily zero-initialize the vector before
copying the actual data into the vector instance.
2018-01-17 20:09:41 -05:00
2 changed files with 4 additions and 3 deletions

View File

@@ -47,8 +47,9 @@ public:
}
std::vector<u8> ReadBlock(size_t length) {
std::vector<u8> data(length);
std::memcpy(data.data(), buffer.data() + read_index, length);
const u8* const begin = buffer.data() + read_index;
const u8* const end = begin + length;
std::vector<u8> data(begin, end);
read_index += length;
read_index = Common::AlignUp(read_index, 4);
return data;

View File

@@ -49,7 +49,7 @@ public:
QString edit_filter_text_old;
protected:
bool eventFilter(QObject* obj, QEvent* event) override;
bool eventFilter(QObject* obj, QEvent* event);
};
QHBoxLayout* layout_filter = nullptr;
QTreeView* tree_view = nullptr;