Source
void zbx_preprocessor_unpack_top_sequences_result(zbx_vector_pp_sequence_stats_ptr_t *sequences, const unsigned char *data)
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
static zbx_ipc_message_t cached_message;
static int cached_values;
ZBX_PTR_VECTOR_IMPL(ipcmsg, zbx_ipc_message_t *)
static zbx_uint32_t fields_calc_size(zbx_packed_field_t *fields, int fields_num)
{
zbx_uint32_t data_size = 0, field_size;
int i;
for (i = 0; i < fields_num; i++)
{
if (PACKED_FIELD_STRING == fields[i].type)
{
field_size = (NULL != fields[i].value) ? (zbx_uint32_t)strlen((const char *)fields[i].value) + 1 : 0;
fields[i].size = (zbx_uint32_t)field_size;
field_size += (zbx_uint32_t)sizeof(zbx_uint32_t);
}
else
field_size = fields[i].size;
if (UINT32_MAX - field_size < data_size)
return 0;
data_size += field_size;
}
return data_size;