----------------------------------------------------------------------------- Makes sure we've got at least this much memory -----------------------------------------------------------------------------
| 317 | // Makes sure we've got at least this much memory |
| 318 | //----------------------------------------------------------------------------- |
| 319 | void 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 | //----------------------------------------------------------------------------- |
no test coverage detected