Source
static int item_preproc_csv_to_json_add_field(struct zbx_json *json, char ***names, char *field, unsigned int num,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: returns numeric type hint based on item value type *
* *
* Parameters: value_type - [IN] item value type *
* *
* Return value: variant numeric type or none *
* *
******************************************************************************/
static int item_preproc_numeric_type_hint(unsigned char value_type)
{
switch (value_type)
{
case ITEM_VALUE_TYPE_FLOAT:
return ZBX_VARIANT_DBL;
case ITEM_VALUE_TYPE_UINT64:
return ZBX_VARIANT_UI64;
default:
return ZBX_VARIANT_NONE;
}
}
/******************************************************************************
* *
* Purpose: convert variant value to the requested type *
* *
* Parameters: value - [IN/OUT] value to convert *
* type - [IN] new value type *
* errmsg - [OUT] *
* *
* Return value: SUCCEED - the value was converted successfully *
* FAIL - otherwise, errmsg contains the error message *