| 167 | } |
| 168 | |
| 169 | static 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 | |
| 197 | static cell_t smn_PbReadColor(IPluginContext *pCtx, const cell_t *params) |
| 198 | { |
nothing calls this directly
no test coverage detected