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

Function smn_PbReadString

core/smn_protobuf.cpp:169–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169static cell_t smn_PbReadString(IPluginContext *pCtx, const cell_t *params)
170{
171 GET_MSG_FROM_HANDLE_OR_ERR();
172 GET_FIELD_NAME_OR_ERR();
173
174 char *buf;
175 pCtx->LocalToPhysAddr(params[3], (cell_t **)&buf);
176
177 int index = params[0] >= 5 ? params[5] : -1;
178
179 if (index < 0)
180 {
181 if (!msg->GetString(strField, buf, params[4]))
182 {
183 return pCtx->ThrowNativeError("Invalid field \"%s\" for message \"%s\"", strField, msg->GetProtobufMessage()->GetTypeName().c_str());
184 }
185 }
186 else
187 {
188 if (!msg->GetRepeatedString(strField, index, buf, params[4]))
189 {
190 return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, index, msg->GetProtobufMessage()->GetTypeName().c_str());
191 }
192 }
193
194 return 1;
195}
196
197static cell_t smn_PbReadColor(IPluginContext *pCtx, const cell_t *params)
198{

Callers

nothing calls this directly

Calls 4

GetProtobufMessageMethod · 0.80
GetRepeatedStringMethod · 0.80
GetStringMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected