MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / EnsureCapacity

Method EnsureCapacity

src/tier1/utlbuffer.cpp:319–338  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Makes sure we've got at least this much memory -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

317// Makes sure we've got at least this much memory
318//-----------------------------------------------------------------------------
319void CUtlBuffer::EnsureCapacity( int num )
320{
321 // Add one extra for the null termination
322 if ( IsText() )
323 num += 1;
324
325 if ( m_Memory.IsExternallyAllocated() )
326 {
327 if ( IsGrowable() && ( m_Memory.NumAllocated() < num ) )
328 {
329 m_Memory.ConvertToGrowableMemory( 0 );
330 }
331 else
332 {
333 num -= 1;
334 }
335 }
336
337 m_Memory.EnsureCapacity( num );
338}
339
340
341//-----------------------------------------------------------------------------

Callers 1

ConvertCRLFMethod · 0.45

Calls 3

IsExternallyAllocatedMethod · 0.45
NumAllocatedMethod · 0.45

Tested by

no test coverage detected