MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / resize

Method resize

common/SmallString.cpp:732–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

730}
731
732void SmallStringBase::resize(u32 new_size, char fill, bool shrink_if_smaller)
733{
734 // if going larger, or we don't own the buffer, realloc
735 if (new_size >= m_buffer_size)
736 {
737 reserve(new_size);
738
739 if (m_length < new_size)
740 {
741 std::memset(m_buffer + m_length, fill, m_buffer_size - m_length - 1);
742 }
743
744 m_length = new_size;
745 }
746 else
747 {
748 // update length and terminator
749#if _DEBUG
750 std::memset(m_buffer + new_size, 0, m_buffer_size - new_size);
751#else
752 m_buffer[new_size] = 0;
753#endif
754 m_length = new_size;
755
756 // shrink if requested
757 if (shrink_if_smaller)
758 shrink_to_fit();
759 }
760}
761
762void SmallStringBase::update_size()
763{

Callers 15

ParseZipMethod · 0.45
ExtractUpdaterFunction · 0.45
HTTPStatusCallbackMethod · 0.45
StartRequestMethod · 0.45
ReadFileInZipToContainerFunction · 0.45
StdStringFromFormatVFunction · 0.45
UTF8StringToWideStringFunction · 0.45
WideStringToUTF8StringFunction · 0.45
SetSizeMethod · 0.45
SetPixelsMethod · 0.45
WriteCallbackMethod · 0.45

Calls 1

reserveFunction · 0.50

Tested by

no test coverage detected