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

Function bytesToString

include/retdec/utils/conversion.h:242–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240 * (0 means all bytes from @a offset)
241 */
242template<typename N> void bytesToString(
243 const N *data,
244 std::size_t dataSize,
245 std::string &result,
246 std::size_t offset = 0,
247 std::size_t size = 0)
248{
249 if(!data)
250 {
251 dataSize = 0;
252 }
253
254 if(offset >= dataSize)
255 {
256 size = 0;
257 }
258 else
259 {
260 size = (size == 0 || offset + size > dataSize)
261 ? dataSize - offset
262 : size;
263 }
264
265 result.clear();
266 result.reserve(size);
267 result = std::string(reinterpret_cast<const char*>(data + offset), size);
268}
269
270/**
271 * Converts the given vector of numbers into a string

Callers 7

getStringMethod · 0.85
getStringMethod · 0.85
readPlainStringFunction · 0.85
getStringMethod · 0.85
loadRichHeaderMethod · 0.85
loadPdbInfoMethod · 0.85
SearchMethod · 0.85

Calls 3

clearMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected