L L4D2node

CUtlBinaryBlock::SetLength

0x002630d0 · 164 bytes · __thiscall

_ZN15CUtlBinaryBlock9SetLengthEi

Decompiled

undefined (2 params)

/* CUtlBinaryBlock::SetLength(int) */

void __thiscall CUtlBinaryBlock::SetLength(CUtlBinaryBlock *this,int param_1)

{
  int iVar1;
  void *pvVar2;
  size_t __size;
  
  __size = *(size_t *)(this + 4);
  *(int *)(this + 0xc) = param_1;
  if (param_1 <= (int)__size) {
    return;
  }
  iVar1 = *(int *)(this + 8);
  if (iVar1 < 0) goto LAB_00263134;
  if (iVar1 == 0) {
    if (__size == 0) {
      if (param_1 < 0x21) {
        __size = 0x20;
        goto LAB_00263116;
      }
      __size = 0x20;
    }
    do {
      __size = __size * 2;
    } while ((int)__size < param_1);
  }
  else {
    for (__size = iVar1 * ((param_1 + -1) / iVar1 + 1); (int)__size < param_1;
        __size = (int)(__size + param_1) / 2) {
    }
  }
LAB_00263116:
  *(size_t *)(this + 4) = __size;
  if (*(void **)this == (void *)0x0) {
    pvVar2 = malloc(__size);
    *(void **)this = pvVar2;
  }
  else {
    pvVar2 = realloc(*(void **)this,__size);
    __size = *(size_t *)(this + 4);
    *(void **)this = pvVar2;
  }
  if (param_1 <= (int)__size) {
    return;
  }
LAB_00263134:
  *(size_t *)(this + 0xc) = __size;
  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)