MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / Resize

Method Resize

src/core/wchar16.cpp:290–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290void wc16_string_impl::Resize(int newlen)
291{
292 ASSERT(newlen >= 0);
293 if (newlen == length)
294 return;
295
296 WCHAR16* newString = new WCHAR16[newlen + 1];
297
298 if (newlen < length)
299 {
300 memcpy(newString, pString, newlen * sizeof(WCHAR16));
301 delete [] pString;
302 pString = newString;
303 length = newlen;
304 }
305 else
306 {
307 memcpy(newString, pString, length * sizeof(WCHAR16));
308 memset(newString + length, 0, (newlen - length) * sizeof(WCHAR16));
309 delete [] pString;
310 pString = newString;
311 length = newlen;
312 }
313}
314
315void wc16_string_impl::CopyString(const wc16_string_impl& rhs)
316{

Callers 2

wc16_stringMethod · 0.80
resizeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected