TrimSpace
0x0021ae10 · 165 bytes · __cdecl
_Z9TrimSpacePKcPc
Decompiled
undefined (2 params)
/* TrimSpace(char const*, char*) */
void TrimSpace(char *param_1,char *param_2)
{
char cVar1;
size_t sVar2;
char *pcVar3;
int iVar4;
int iVar5;
size_t __n;
sVar2 = strlen(param_1);
pcVar3 = param_1;
if ((*param_1 == '\0') || (g_WhiteSpace[*param_1] == '\0')) {
iVar5 = 0;
}
else {
iVar5 = 0;
do {
pcVar3 = pcVar3 + 1;
iVar5 = iVar5 + 1;
if (*pcVar3 == '\0') break;
} while (g_WhiteSpace[*pcVar3] != '\0');
}
iVar4 = sVar2 - 1;
if (0 < iVar4) {
cVar1 = g_WhiteSpace[param_1[sVar2 - 1]];
while ((cVar1 != '\0' && (iVar4 = iVar4 + -1, iVar4 != 0))) {
cVar1 = g_WhiteSpace[param_1[iVar4]];
}
}
__n = (iVar4 + 1) - iVar5;
sVar2 = 0;
if (0 < (int)__n) {
memcpy(param_2,pcVar3,__n);
sVar2 = __n;
}
param_2[sVar2] = '\0';
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.