| 223 | } |
| 224 | |
| 225 | static cell_t smn_WritePackFunction(IPluginContext *pContext, const cell_t *params) |
| 226 | { |
| 227 | Handle_t hndl = static_cast<Handle_t>(params[1]); |
| 228 | HandleError herr; |
| 229 | HandleSecurity sec; |
| 230 | CDataPack *pDataPack; |
| 231 | |
| 232 | sec.pOwner = pContext->GetIdentity(); |
| 233 | sec.pIdentity = g_pCoreIdent; |
| 234 | |
| 235 | if ((herr = handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack)) |
| 236 | != HandleError_None) |
| 237 | { |
| 238 | return pContext->ThrowNativeError("Invalid data pack handle %x (error %d).", hndl, herr); |
| 239 | } |
| 240 | |
| 241 | bool insert = (params[0] >= 3) ? params[3] : false; |
| 242 | if (!insert) |
| 243 | { |
| 244 | pDataPack->RemoveItem(); |
| 245 | } |
| 246 | |
| 247 | cell_t funcid = params[2]; |
| 248 | if (pContext->IsNullFunctionId(funcid)) |
| 249 | { |
| 250 | pDataPack->PackFunction(0); |
| 251 | } |
| 252 | else if (funcid <= 0) |
| 253 | { |
| 254 | return pContext->ThrowNativeError("Invalid function id (%X)", funcid); |
| 255 | } |
| 256 | else |
| 257 | { |
| 258 | pDataPack->PackFunction(funcid); |
| 259 | } |
| 260 | |
| 261 | return 1; |
| 262 | } |
| 263 | |
| 264 | static cell_t smn_ReadPackCell(IPluginContext *pContext, const cell_t *params) |
| 265 | { |
nothing calls this directly
no test coverage detected