From 39c9e69d8ac88dc29d87dfeecacdf22f3953b718 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Tue, 23 Apr 2013 07:11:49 -0400 Subject: [PATCH] Remove deprecated PbReadRepeated natives. --- core/smn_protobuf.cpp | 150 ----------------------------------- plugins/include/protobuf.inc | 102 ------------------------ 2 files changed, 252 deletions(-) diff --git a/core/smn_protobuf.cpp b/core/smn_protobuf.cpp index 081414b2..07aa8271 100644 --- a/core/smn_protobuf.cpp +++ b/core/smn_protobuf.cpp @@ -308,148 +308,6 @@ static cell_t smn_PbGetRepeatedFieldCount(IPluginContext *pCtx, const cell_t *pa return cnt; } -static cell_t smn_PbReadRepeatedInt(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - int ret; - if (!msg->GetRepeatedInt32OrUnsignedOrEnum(strField, params[3], &ret)) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - return ret; -} - -static cell_t smn_PbReadRepeatedFloat(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - float ret; - if (!msg->GetRepeatedFloatOrDouble(strField, params[3], &ret)) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - return sp_ftoc(ret); -} - -static cell_t smn_PbReadRepeatedBool(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - bool ret; - if (!msg->GetRepeatedBool(strField, params[3], &ret)) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - return ret ? 1 : 0; -} - -static cell_t smn_PbReadRepeatedString(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - char *buf; - pCtx->LocalToPhysAddr(params[4], (cell_t **)&buf); - - if (!msg->GetRepeatedString(strField, params[3], buf, params[5])) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - return 1; -} - -static cell_t smn_PbReadRepeatedColor(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - cell_t *out; - pCtx->LocalToPhysAddr(params[4], &out); - - Color clr; - if (!msg->GetRepeatedColor(strField, params[3], &clr)) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - out[0] = clr.r(); - out[1] = clr.g(); - out[2] = clr.b(); - out[3] = clr.a(); - - return 1; -} - -static cell_t smn_PbReadRepeatedAngle(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - cell_t *out; - pCtx->LocalToPhysAddr(params[4], &out); - - QAngle ang; - if (!msg->GetRepeatedQAngle(strField, params[3], &ang)) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - out[0] = sp_ftoc(ang.x); - out[1] = sp_ftoc(ang.y); - out[2] = sp_ftoc(ang.z); - - return 1; -} - -static cell_t smn_PbReadRepeatedVector(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - cell_t *out; - pCtx->LocalToPhysAddr(params[4], &out); - - Vector vec; - if (!msg->GetRepeatedVector(strField, params[3], &vec)) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - out[0] = sp_ftoc(vec.x); - out[1] = sp_ftoc(vec.y); - out[2] = sp_ftoc(vec.z); - - return 1; -} - -static cell_t smn_PbReadRepeatedVector2D(IPluginContext *pCtx, const cell_t *params) -{ - GET_MSG_FROM_HANDLE_OR_ERR(); - GET_FIELD_NAME_OR_ERR(); - - cell_t *out; - pCtx->LocalToPhysAddr(params[4], &out); - - Vector2D vec; - if (!msg->GetRepeatedVector2D(strField, params[3], &vec)) - { - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str()); - } - - out[0] = sp_ftoc(vec.x); - out[1] = sp_ftoc(vec.y); - - return 1; -} - static cell_t smn_PbSetInt(IPluginContext *pCtx, const cell_t *params) { GET_MSG_FROM_HANDLE_OR_ERR(); @@ -920,14 +778,6 @@ REGISTER_NATIVES(protobufnatives) {"PbReadVector", smn_PbReadVector}, {"PbReadVector2D", smn_PbReadVector2D}, {"PbGetRepeatedFieldCount", smn_PbGetRepeatedFieldCount}, - {"PbReadRepeatedInt", smn_PbReadRepeatedInt}, - {"PbReadRepeatedFloat", smn_PbReadRepeatedFloat}, - {"PbReadRepeatedBool", smn_PbReadRepeatedBool}, - {"PbReadRepeatedString", smn_PbReadRepeatedString}, - {"PbReadRepeatedColor", smn_PbReadRepeatedColor}, - {"PbReadRepeatedAngle", smn_PbReadRepeatedAngle}, - {"PbReadRepeatedVector", smn_PbReadRepeatedVector}, - {"PbReadRepeatedVector2D", smn_PbReadRepeatedVector2D}, {"PbSetInt", smn_PbSetInt}, {"PbSetFloat", smn_PbSetFloat}, {"PbSetBool", smn_PbSetBool}, diff --git a/plugins/include/protobuf.inc b/plugins/include/protobuf.inc index 4cb06dbd..56ffb6ed 100644 --- a/plugins/include/protobuf.inc +++ b/plugins/include/protobuf.inc @@ -141,108 +141,6 @@ native PbReadVector2D(Handle:pb, const String:field[], Float:buffer[2], index=PB */ native PbGetRepeatedFieldCount(Handle:pb, const String:field[]); -/** - * Reads an int32, uint32, sint32, fixed32, or sfixed32 from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @return Integer value read. - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadInt with index param -native PbReadRepeatedInt(Handle:pb, const String:field[], index); - -/** - * Reads a float or downcasted double from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @return Float value read. - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadFloat with index param -native Float:PbReadRepeatedFloat(Handle:pb, const String:field[], index); - -/** - * Reads a bool from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @return Boolean value read. - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadBool with index param -native bool:PbReadRepeatedBool(Handle:pb, const String:field[], index); - -/** - * Reads a string from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @param buffer Destination string buffer. - * @param maxlength Maximum length of output string buffer. - * @noreturn - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadString with index param -native PbReadRepeatedString(Handle:pb, const String:field[], index, String:buffer[], size); - -/** - * Reads an RGBA color value from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @param buffer Destination color buffer. - * @noreturn - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadColor with index param -native PbReadRepeatedColor(Handle:pb, const String:field[], index, buffer[4]); - -/** - * Reads an XYZ angle value from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @param buffer Destination angle buffer. - * @noreturn - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadAngle with index param -native PbReadRepeatedAngle(Handle:pb, const String:field[], index, Float:buffer[3]); - -/** - * Reads an XYZ vector value from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @param buffer Destination vector buffer. - * @noreturn - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadVector with index param -native PbReadRepeatedVector(Handle:pb, const String:field[], index, Float:buffer[3]); - -/** - * Reads an XY vector value from a protobuf message repeated field. - * - * @param pb protobuf handle. - * @param field Field name. - * @param index Index in the repeated field. - * @param buffer Destination vector buffer. - * @noreturn - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type. - */ -#pragma deprecated use PbReadVector2D with index param -native PbReadRepeatedVector2D(Handle:pb, const String:field[], index, Float:buffer[2]); - /** * Sets an int32, uint32, sint32, fixed32, sfixed32, or enum value on a protobuf message. *