Commit 09807e73 authored by Robert Loehning's avatar Robert Loehning
Browse files

Reserving needed amount of memory before copying.

parent bec01778
......@@ -230,6 +230,7 @@ QByteArray BinEditor::dataMid(int from, int length) const
int block = from / m_blockSize;
QByteArray data;
data.reserve(length);
do {
data += blockData(block++);
} while (block * m_blockSize < end);
......@@ -1138,6 +1139,7 @@ void BinEditor::copy(bool raw)
}
QString hexString;
const char * const hex = "0123456789abcdef";
hexString.reserve(3 * data.size());
for (int i = 0; i < data.size(); ++i) {
const uchar val = static_cast<uchar>(data[i]);
hexString.append(hex[val >> 4]).append(hex[val & 0xf]).append(' ');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment