L L4D2node

CUtlStreamBuffer::GrowAllocatedSize

0x0028d0f0 · 157 bytes · __thiscall

_ZN16CUtlStreamBuffer17GrowAllocatedSizeEi

Decompiled

undefined (2 params)

/* CUtlStreamBuffer::GrowAllocatedSize(int) */

void __thiscall CUtlStreamBuffer::GrowAllocatedSize(CUtlStreamBuffer *this,int param_1)

{
  int iVar1;
  int iVar2;
  size_t __size;
  void *pvVar3;
  
  __size = *(size_t *)(this + 4);
  if (param_1 < (int)__size) {
    return;
  }
  iVar2 = *(int *)(this + 8);
  iVar1 = (param_1 - __size & 0xffffc000) + 0x4000 + __size;
  if (iVar2 < 0) {
    return;
  }
  if (iVar2 == 0) {
    if (__size == 0) {
      __size = 0x20;
    }
    if ((int)__size < iVar1) {
      do {
        __size = __size * 2;
      } while ((int)__size < iVar1);
      pvVar3 = *(void **)this;
      *(size_t *)(this + 4) = __size;
      goto joined_r0x0028d17d;
    }
  }
  else {
    for (__size = ((iVar1 + -1) / iVar2 + 1) * iVar2; (int)__size < iVar1;
        __size = (int)(__size + iVar1) / 2) {
    }
  }
  pvVar3 = *(void **)this;
  *(size_t *)(this + 4) = __size;
joined_r0x0028d17d:
  if (pvVar3 != (void *)0x0) {
    pvVar3 = realloc(pvVar3,__size);
    *(void **)this = pvVar3;
    return;
  }
  pvVar3 = malloc(__size);
  *(void **)this = pvVar3;
  return;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)