MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / smn_BfReadString

Function smn_BfReadString

core/smn_bitbuffer.cpp:490–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490static cell_t smn_BfReadString(IPluginContext *pCtx, const cell_t *params)
491{
492 Handle_t hndl = static_cast<Handle_t>(params[1]);
493 HandleError herr;
494 HandleSecurity sec;
495 bf_read *pBitBuf;
496 int numChars = 0;
497 char *buf;
498
499 sec.pOwner = NULL;
500 sec.pIdentity = g_pCoreIdent;
501
502 if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
503 != HandleError_None)
504 {
505 return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
506 }
507
508 pCtx->LocalToPhysAddr(params[2], (cell_t **)&buf);
509 pBitBuf->ReadString(buf, params[3], params[4] ? true : false, &numChars);
510
511 if (pBitBuf->IsOverflowed())
512 {
513 return -numChars - 1;
514 }
515
516 return numChars;
517}
518
519static cell_t smn_BfReadEntity(IPluginContext *pCtx, const cell_t *params)
520{

Callers

nothing calls this directly

Calls 2

ReadStringMethod · 0.80
ReadHandleMethod · 0.45

Tested by

no test coverage detected