MCPcopy Create free account
hub / github.com/avast/retdec / readString

Method readString

src/utils/dynamic_buffer.cpp:234–244  ·  view source on GitHub ↗

* Reads the null or length terminated string from the buffer. * * @param pos The poisition in the buffer where to start reading. * @param maxLength The maximal length of the string that is read. If this is 0, * the length limit is ignored and the string is read up to the next * 0 byte. * * @return String read from buffer. */

Source from the content-addressed store, hash-verified

232 * @return String read from buffer.
233 */
234std::string DynamicBuffer::readString(uint32_t pos, uint32_t maxLength) const
235{
236 std::string str;
237 char ch;
238
239 while (((ch = read<char>(pos++)) != 0)
240 && (!maxLength || str.length() < maxLength))
241 str += ch;
242
243 return str;
244}
245
246/**
247 * Writes the single byte into the buffer for repeating amount of times.

Callers 5

fixImportsAndEpMethod · 0.45
readMethod · 0.45
fixImportsMethod · 0.45
fixExportsMethod · 0.45
fixSectionHeadersMethod · 0.45

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected