summaryrefslogtreecommitdiff
path: root/src/instrumentparser.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-03-23 15:07:17 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-03-23 15:07:17 +0100
commit04e088e65942b7f6fdd80c4e54768dca987ff9d7 (patch)
treedd8157050b17e3ad20935500ad7a586eead2e0b3 /src/instrumentparser.cc
parent0728a11284f15100a8f8e0d9da0192019a056d6a (diff)
Fix horribly stupid bug.
Diffstat (limited to 'src/instrumentparser.cc')
-rw-r--r--src/instrumentparser.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc
index c04aee3..3b849e1 100644
--- a/src/instrumentparser.cc
+++ b/src/instrumentparser.cc
@@ -236,6 +236,13 @@ void InstrumentParser::endTag(const std::string& name)
int InstrumentParser::readData(std::string& data, std::size_t size)
{
- if(!fd) return -1;
- return fread((char*)data.c_str(), 1, size, fd);
+ if(!fd)
+ {
+ return -1;
+ }
+
+ data.resize(size);
+ auto nr_of_bytes_read = fread((void*)data.data(), 1, size, fd);
+ data.resize(nr_of_bytes_read);
+ return nr_of_bytes_read;
}