Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexei Vladishev <alexei.vladishev@zabbix.com>2017-12-18 19:22:46 +0300
committerAlexei Vladishev <alexei.vladishev@zabbix.com>2017-12-18 19:22:46 +0300
commit0250dc51af81650fa42983aee623c632e98d4a78 (patch)
tree696417f4082cb8b9063ece8657620ecc86e7edbd
parent7443e021fbc6f11ff612dc85bd4feef0b9ebdd87 (diff)
...G...PS. [DEV-764] added ability to compile Zabbix as C++ code for stronger type safety and new class of warnings
-rw-r--r--include/db.h2
-rw-r--r--include/module.h18
-rw-r--r--include/proxy.h2
-rw-r--r--include/zbxserialize.h2
-rw-r--r--include/zbxtypes.h2
-rw-r--r--m4/resolv.m42
-rw-r--r--src/libs/zbxalgo/binaryheap.c4
-rw-r--r--src/libs/zbxalgo/hashmap.c8
-rw-r--r--src/libs/zbxalgo/hashset.c6
-rw-r--r--src/libs/zbxalgo/queue.c4
-rw-r--r--src/libs/zbxalgo/vectorimpl.h6
-rw-r--r--src/libs/zbxcommon/misc.c18
-rw-r--r--src/libs/zbxcommon/setproctitle.c10
-rw-r--r--src/libs/zbxcommon/str.c46
-rw-r--r--src/libs/zbxcommon/xml.c6
-rw-r--r--src/libs/zbxcomms/comms.c6
-rw-r--r--src/libs/zbxcomms/telnet.c4
-rw-r--r--src/libs/zbxconf/cfg.c2
-rw-r--r--src/libs/zbxcrypto/base64.c2
-rw-r--r--src/libs/zbxdb/db.c8
-rw-r--r--src/libs/zbxdbcache/dbcache.c48
-rw-r--r--src/libs/zbxdbcache/dbconfig.c566
-rw-r--r--src/libs/zbxdbcache/dbconfig_dump.c6
-rw-r--r--src/libs/zbxdbcache/valuecache.c28
-rw-r--r--src/libs/zbxdbhigh/db.c38
-rw-r--r--src/libs/zbxdbhigh/event.c8
-rw-r--r--src/libs/zbxdbhigh/host.c72
-rw-r--r--src/libs/zbxdbhigh/itservices.c36
-rw-r--r--src/libs/zbxdbhigh/lld.c6
-rw-r--r--src/libs/zbxdbhigh/lld_graph.c18
-rw-r--r--src/libs/zbxdbhigh/lld_host.c20
-rw-r--r--src/libs/zbxdbhigh/lld_item.c56
-rw-r--r--src/libs/zbxdbhigh/lld_trigger.c71
-rw-r--r--src/libs/zbxdbhigh/proxy.c58
-rw-r--r--src/libs/zbxdbhigh/template_item.c54
-rw-r--r--src/libs/zbxdbhigh/trigger.c2
-rw-r--r--src/libs/zbxdbupgrade/dbupgrade_2010.c4
-rw-r--r--src/libs/zbxdbupgrade/dbupgrade_2050.c2
-rw-r--r--src/libs/zbxdbupgrade/dbupgrade_3010.c2
-rw-r--r--src/libs/zbxdbupgrade/dbupgrade_3050.c8
-rw-r--r--src/libs/zbxexec/execute.c2
-rw-r--r--src/libs/zbxhistory/history_elastic.c20
-rw-r--r--src/libs/zbxhistory/history_sql.c14
-rw-r--r--src/libs/zbxhttp/punycode.c2
-rw-r--r--src/libs/zbxhttp/urlencode.c4
-rw-r--r--src/libs/zbxicmpping/icmpping.c2
-rw-r--r--src/libs/zbxipcservice/ipcservice.c20
-rw-r--r--src/libs/zbxjson/json.c12
-rw-r--r--src/libs/zbxmedia/email.c9
-rw-r--r--src/libs/zbxmedia/eztexting.c8
-rw-r--r--src/libs/zbxmemory/memalloc.c12
-rw-r--r--src/libs/zbxmodules/modules.c22
-rw-r--r--src/libs/zbxregexp/zbxregexp.c8
-rw-r--r--src/libs/zbxself/selfmon.c2
-rw-r--r--src/libs/zbxserver/evalfunc.c8
-rw-r--r--src/libs/zbxserver/expression.c44
-rw-r--r--src/libs/zbxsysinfo/common/dir.c16
-rw-r--r--src/libs/zbxsysinfo/common/file.c2
-rw-r--r--src/libs/zbxsysinfo/common/http.c2
-rw-r--r--src/libs/zbxsysinfo/common/net.c4
-rw-r--r--src/libs/zbxsysinfo/linux/hardware.c4
-rw-r--r--src/libs/zbxsysinfo/linux/linux.c2
-rw-r--r--src/libs/zbxsysinfo/linux/net.c10
-rw-r--r--src/libs/zbxsysinfo/linux/proc.c10
-rw-r--r--src/libs/zbxsysinfo/linux/sensors.c7
-rw-r--r--src/libs/zbxsysinfo/linux/software.h2
-rw-r--r--src/libs/zbxsysinfo/simple/simple.c7
-rw-r--r--src/libs/zbxsysinfo/sysinfo.c22
-rw-r--r--src/libs/zbxtasks/task.c10
-rw-r--r--src/zabbix_agent/active.c12
-rw-r--r--src/zabbix_agent/cpustat.c2
-rw-r--r--src/zabbix_agent/listener.c2
-rw-r--r--src/zabbix_agent/logfiles.c94
-rw-r--r--src/zabbix_agent/stats.c8
-rw-r--r--src/zabbix_agent/zabbix_agentd.c6
-rw-r--r--src/zabbix_proxy/proxy.c2
-rw-r--r--src/zabbix_proxy/taskmanager/taskmanager.c2
-rw-r--r--src/zabbix_sender/zabbix_sender.c6
-rw-r--r--src/zabbix_server/actions.c90
-rw-r--r--src/zabbix_server/alerter/alert_manager.c10
-rw-r--r--src/zabbix_server/alerter/alerter_protocol.c12
-rw-r--r--src/zabbix_server/discoverer/discoverer.c2
-rw-r--r--src/zabbix_server/escalator/escalator.c25
-rw-r--r--src/zabbix_server/events.c35
-rw-r--r--src/zabbix_server/housekeeper/housekeeper.c30
-rw-r--r--src/zabbix_server/httppoller/httpmacro.c6
-rw-r--r--src/zabbix_server/httppoller/httptest.c10
-rw-r--r--src/zabbix_server/ipmi/checks_ipmi.c42
-rw-r--r--src/zabbix_server/ipmi/ipmi_manager.c4
-rw-r--r--src/zabbix_server/ipmi/ipmi_protocol.c4
-rw-r--r--src/zabbix_server/odbc/odbc.c8
-rw-r--r--src/zabbix_server/operations.c4
-rw-r--r--src/zabbix_server/pinger/pinger.c10
-rw-r--r--src/zabbix_server/poller/checks_aggregate.c10
-rw-r--r--src/zabbix_server/poller/checks_calculated.c16
-rw-r--r--src/zabbix_server/poller/checks_external.c2
-rw-r--r--src/zabbix_server/poller/checks_internal.c2
-rw-r--r--src/zabbix_server/poller/checks_simple_vmware.c34
-rw-r--r--src/zabbix_server/poller/checks_snmp.c26
-rw-r--r--src/zabbix_server/poller/poller.c2
-rw-r--r--src/zabbix_server/postinit.c4
-rw-r--r--src/zabbix_server/preprocessor/preproc_manager.c24
-rw-r--r--src/zabbix_server/preprocessor/preprocessing.c6
-rw-r--r--src/zabbix_server/server.c2
-rw-r--r--src/zabbix_server/snmptrapper/snmptrapper.c12
-rw-r--r--src/zabbix_server/timer/timer.c6
-rw-r--r--src/zabbix_server/trapper/active.c14
-rw-r--r--src/zabbix_server/trapper/trapper.c20
-rw-r--r--src/zabbix_server/vmware/vmware.c182
109 files changed, 1191 insertions, 1145 deletions
diff --git a/include/db.h b/include/db.h
index 2c2cf78fe96..00e8d4fcc3f 100644
--- a/include/db.h
+++ b/include/db.h
@@ -328,7 +328,7 @@ typedef struct
char *value2;
int condition_result;
unsigned char conditiontype;
- unsigned char operator;
+ unsigned char op;
}
DB_CONDITION;
diff --git a/include/module.h b/include/module.h
index 4419d6cb385..a7e7d872318 100644
--- a/include/module.h
+++ b/include/module.h
@@ -45,15 +45,6 @@
#define CF_MODULE 0x02 /* item is defined in a loadable module */
#define CF_USERPARAMETER 0x04 /* item is defined as user parameter */
-typedef struct
-{
- char *key;
- unsigned flags;
- int (*function)();
- char *test_param; /* item test parameters; user parameter items keep command here */
-}
-ZBX_METRIC;
-
/* agent request structure */
typedef struct
{
@@ -99,6 +90,15 @@ typedef struct
}
AGENT_RESULT;
+typedef struct
+{
+ char *key;
+ unsigned flags;
+ int (*function)(AGENT_REQUEST *request, AGENT_RESULT *result);
+ char *test_param; /* item test parameters; user parameter items keep command here */
+}
+ZBX_METRIC;
+
/* SET RESULT */
#define SET_UI64_RESULT(res, val) \
diff --git a/include/proxy.h b/include/proxy.h
index 42e969e935b..5679cdc1eef 100644
--- a/include/proxy.h
+++ b/include/proxy.h
@@ -58,7 +58,7 @@ int process_history_data(DC_ITEM *items, zbx_agent_value_t *values, int *errcode
int process_discovery_data(struct zbx_json_parse *jp, zbx_timespec_t *ts, char **error);
int process_auto_registration(struct zbx_json_parse *jp, zbx_uint64_t proxy_hostid, zbx_timespec_t *ts, char **error);
-void lld_process_discovery_rule(zbx_uint64_t lld_ruleid, char *value, const zbx_timespec_t *ts);
+void lld_process_discovery_rule(zbx_uint64_t lld_ruleid, const char *value, const zbx_timespec_t *ts);
int proxy_get_history_count(void);
diff --git a/include/zbxserialize.h b/include/zbxserialize.h
index 6ca5ca0890d..5af9212d6dc 100644
--- a/include/zbxserialize.h
+++ b/include/zbxserialize.h
@@ -78,7 +78,7 @@
( \
memcpy(&value_len, buffer, sizeof(zbx_uint32_t)), \
0 < value_len ? ( \
- *value = zbx_malloc(NULL, value_len + 1), \
+ *value = (char *)zbx_malloc(NULL, value_len + 1), \
memcpy(*(value), buffer + sizeof(zbx_uint32_t), value_len), \
(*value)[value_len] = '\0' \
) : (*value = NULL, 0), \
diff --git a/include/zbxtypes.h b/include/zbxtypes.h
index f869119cc84..523a0b957c8 100644
--- a/include/zbxtypes.h
+++ b/include/zbxtypes.h
@@ -159,7 +159,7 @@ typedef off_t zbx_offset_t;
#define ZBX_STR2UCHAR(var, string) var = (unsigned char)atoi(string)
-#define ZBX_CONST_STRING(str) ""str
+#define ZBX_CONST_STRING(str) "" str
#define ZBX_CONST_STRLEN(str) (sizeof(ZBX_CONST_STRING(str)) - 1)
typedef struct
diff --git a/m4/resolv.m4 b/m4/resolv.m4
index c0341552bc4..599b50cff3b 100644
--- a/m4/resolv.m4
+++ b/m4/resolv.m4
@@ -33,7 +33,7 @@ AC_TRY_LINK(
char *buf;
res_init();
- res_query("", C_IN, T_SOA, buf, 0);
+ res_query("", C_IN, T_SOA, (unsigned char *)buf, 0);
],
found_resolv="yes"
RESOLV_LIBS="$1")
diff --git a/src/libs/zbxalgo/binaryheap.c b/src/libs/zbxalgo/binaryheap.c
index e17975b4e5a..fff0d5cc9fd 100644
--- a/src/libs/zbxalgo/binaryheap.c
+++ b/src/libs/zbxalgo/binaryheap.c
@@ -70,7 +70,7 @@ static void __binary_heap_ensure_free_space(zbx_binary_heap_t *heap)
if (heap->elems_num != tmp_elems_alloc)
{
- heap->elems = heap->mem_realloc_func(heap->elems, tmp_elems_alloc * sizeof(zbx_binary_heap_elem_t));
+ heap->elems = (zbx_binary_heap_elem_t *)heap->mem_realloc_func(heap->elems, tmp_elems_alloc * sizeof(zbx_binary_heap_elem_t));
if (NULL == heap->elems)
{
@@ -165,7 +165,7 @@ void zbx_binary_heap_create_ext(zbx_binary_heap_t *heap, zbx_compare_func_t comp
if (HAS_DIRECT_OPTION(heap))
{
- heap->key_index = mem_malloc_func(NULL, sizeof(zbx_hashmap_t));
+ heap->key_index = (zbx_hashmap_t *)mem_malloc_func(NULL, sizeof(zbx_hashmap_t));
zbx_hashmap_create_ext(heap->key_index, 512,
ZBX_DEFAULT_UINT64_HASH_FUNC,
ZBX_DEFAULT_UINT64_COMPARE_FUNC,
diff --git a/src/libs/zbxalgo/hashmap.c b/src/libs/zbxalgo/hashmap.c
index d211d032688..b39a83d5ac3 100644
--- a/src/libs/zbxalgo/hashmap.c
+++ b/src/libs/zbxalgo/hashmap.c
@@ -39,12 +39,12 @@ static void __hashmap_ensure_free_entry(zbx_hashmap_t *hm, ZBX_HASHMAP_SLOT_T *s
{
slot->entries_num = 0;
slot->entries_alloc = 6;
- slot->entries = hm->mem_malloc_func(NULL, slot->entries_alloc * sizeof(ZBX_HASHMAP_ENTRY_T));
+ slot->entries = (ZBX_HASHMAP_ENTRY_T *)hm->mem_malloc_func(NULL, slot->entries_alloc * sizeof(ZBX_HASHMAP_ENTRY_T));
}
else if (slot->entries_num == slot->entries_alloc)
{
slot->entries_alloc = slot->entries_alloc * ARRAY_GROWTH_FACTOR;
- slot->entries = hm->mem_realloc_func(slot->entries, slot->entries_alloc * sizeof(ZBX_HASHMAP_ENTRY_T));
+ slot->entries = (ZBX_HASHMAP_ENTRY_T *)hm->mem_realloc_func(slot->entries, slot->entries_alloc * sizeof(ZBX_HASHMAP_ENTRY_T));
}
}
@@ -55,7 +55,7 @@ static void zbx_hashmap_init_slots(zbx_hashmap_t *hm, size_t init_size)
if (0 < init_size)
{
hm->num_slots = next_prime(init_size);
- hm->slots = hm->mem_malloc_func(NULL, hm->num_slots * sizeof(ZBX_HASHMAP_SLOT_T));
+ hm->slots = (ZBX_HASHMAP_SLOT_T *)hm->mem_malloc_func(NULL, hm->num_slots * sizeof(ZBX_HASHMAP_SLOT_T));
memset(hm->slots, 0, hm->num_slots * sizeof(ZBX_HASHMAP_SLOT_T));
}
else
@@ -179,7 +179,7 @@ void zbx_hashmap_set(zbx_hashmap_t *hm, zbx_uint64_t key, int value)
inc_slots = next_prime(hm->num_slots * SLOT_GROWTH_FACTOR);
- hm->slots = hm->mem_realloc_func(hm->slots, inc_slots * sizeof(ZBX_HASHMAP_SLOT_T));
+ hm->slots = (ZBX_HASHMAP_SLOT_T *)hm->mem_realloc_func(hm->slots, inc_slots * sizeof(ZBX_HASHMAP_SLOT_T));
memset(hm->slots + hm->num_slots, 0, (inc_slots - hm->num_slots) * sizeof(ZBX_HASHMAP_SLOT_T));
for (s = 0; s < hm->num_slots; s++)
diff --git a/src/libs/zbxalgo/hashset.c b/src/libs/zbxalgo/hashset.c
index 079ce0e792c..b718056144d 100644
--- a/src/libs/zbxalgo/hashset.c
+++ b/src/libs/zbxalgo/hashset.c
@@ -49,7 +49,7 @@ static int zbx_hashset_init_slots(zbx_hashset_t *hs, size_t init_size)
{
hs->num_slots = next_prime(init_size);
- if (NULL == (hs->slots = hs->mem_malloc_func(NULL, hs->num_slots * sizeof(ZBX_HASHSET_ENTRY_T *))))
+ if (NULL == (hs->slots = (ZBX_HASHSET_ENTRY_T **)hs->mem_malloc_func(NULL, hs->num_slots * sizeof(ZBX_HASHSET_ENTRY_T *))))
return FAIL;
memset(hs->slots, 0, hs->num_slots * sizeof(ZBX_HASHSET_ENTRY_T *));
@@ -166,7 +166,7 @@ void *zbx_hashset_insert_ext(zbx_hashset_t *hs, const void *data, size_t size, s
if (NULL == (slots = hs->mem_realloc_func(hs->slots, inc_slots * sizeof(ZBX_HASHSET_ENTRY_T *))))
return NULL;
- hs->slots = slots;
+ hs->slots = (ZBX_HASHSET_ENTRY_T **)slots;
memset(hs->slots + hs->num_slots, 0, (inc_slots - hs->num_slots) * sizeof(ZBX_HASHSET_ENTRY_T *));
@@ -200,7 +200,7 @@ void *zbx_hashset_insert_ext(zbx_hashset_t *hs, const void *data, size_t size, s
slot = hash % hs->num_slots;
}
- if (NULL == (entry = hs->mem_malloc_func(NULL, offsetof(ZBX_HASHSET_ENTRY_T, data) + size)))
+ if (NULL == (entry = (ZBX_HASHSET_ENTRY_T *)hs->mem_malloc_func(NULL, offsetof(ZBX_HASHSET_ENTRY_T, data) + size)))
return NULL;
memcpy((char *)entry->data + offset, (const char *)data + offset, size - offset);
diff --git a/src/libs/zbxalgo/queue.c b/src/libs/zbxalgo/queue.c
index 31c385122c3..6e6b81b0e7b 100644
--- a/src/libs/zbxalgo/queue.c
+++ b/src/libs/zbxalgo/queue.c
@@ -62,7 +62,7 @@ void zbx_queue_ptr_reserve(zbx_queue_ptr_t *queue, int num)
return;
alloc_num = MAX(queue->alloc_num + num + 1, queue->alloc_num * 1.5);
- queue->values = zbx_realloc(queue->values, alloc_num * sizeof(*queue->values));
+ queue->values = (void **)zbx_realloc(queue->values, alloc_num * sizeof(*queue->values));
if (queue->tail_pos > queue->head_pos)
{
@@ -110,7 +110,7 @@ void zbx_queue_ptr_compact(zbx_queue_ptr_t *queue)
}
}
- queue->values = zbx_realloc(queue->values, alloc_num * sizeof(*queue->values));
+ queue->values = (void **)zbx_realloc(queue->values, alloc_num * sizeof(*queue->values));
queue->alloc_num = alloc_num;
}
diff --git a/src/libs/zbxalgo/vectorimpl.h b/src/libs/zbxalgo/vectorimpl.h
index 20d1008ea92..73fe83c1fd4 100644
--- a/src/libs/zbxalgo/vectorimpl.h
+++ b/src/libs/zbxalgo/vectorimpl.h
@@ -30,12 +30,12 @@ static void __vector_ ## __id ## _ensure_free_space(zbx_vector_ ## __id ## _t *v
{ \
vector->values_num = 0; \
vector->values_alloc = 32; \
- vector->values = vector->mem_malloc_func(NULL, vector->values_alloc * sizeof(__type)); \
+ vector->values = (__type *)vector->mem_malloc_func(NULL, vector->values_alloc * sizeof(__type)); \
} \
else if (vector->values_num == vector->values_alloc) \
{ \
vector->values_alloc = MAX(vector->values_alloc + 1, vector->values_alloc * ZBX_VECTOR_ARRAY_GROWTH_FACTOR); \
- vector->values = vector->mem_realloc_func(vector->values, vector->values_alloc * sizeof(__type)); \
+ vector->values = (__type *)vector->mem_realloc_func(vector->values, vector->values_alloc * sizeof(__type)); \
} \
} \
\
@@ -259,7 +259,7 @@ void zbx_vector_ ## __id ## _reserve(zbx_vector_ ## __id ## _t *vector, size_t s
if ((int)size > vector->values_alloc) \
{ \
vector->values_alloc = (int)size; \
- vector->values = vector->mem_realloc_func(vector->values, vector->values_alloc * sizeof(__type)); \
+ vector->values = (__type *)vector->mem_realloc_func(vector->values, vector->values_alloc * sizeof(__type)); \
} \
} \
\
diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c
index 252f6588291..569a9db2f99 100644
--- a/src/libs/zbxcommon/misc.c
+++ b/src/libs/zbxcommon/misc.c
@@ -169,7 +169,7 @@ void zbx_timespec(zbx_timespec_t *ts)
#endif
if (NULL == last_ts)
- last_ts = zbx_calloc(last_ts, 1, sizeof(zbx_timespec_t));
+ last_ts = (zbx_timespec_t *)zbx_calloc(last_ts, 1, sizeof(zbx_timespec_t));
#ifdef _WINDOWS
if (TRUE == (rc = QueryPerformanceFrequency(&tickPerSecond)))
@@ -1106,7 +1106,7 @@ static int scheduler_parse_filter_r(zbx_scheduler_filter_t **filter, const char
return FAIL;
}
- filter_new = zbx_malloc(NULL, sizeof(zbx_scheduler_filter_t));
+ filter_new = (zbx_scheduler_filter_t *)zbx_malloc(NULL, sizeof(zbx_scheduler_filter_t));
filter_new->start = start;
filter_new->end = end;
filter_new->step = step;
@@ -1695,7 +1695,7 @@ int zbx_interval_preproc(const char *interval_str, int *simple_interval, zbx_cus
{
zbx_flexible_interval_t *new_interval;
- new_interval = zbx_malloc(NULL, sizeof(zbx_flexible_interval_t));
+ new_interval = (zbx_flexible_interval_t *)zbx_malloc(NULL, sizeof(zbx_flexible_interval_t));
if (SUCCEED != (ret = flexible_interval_parse(new_interval, interval_str,
(NULL == delim ? (int)strlen(interval_str) : (int)(delim - interval_str)))))
@@ -1712,7 +1712,7 @@ int zbx_interval_preproc(const char *interval_str, int *simple_interval, zbx_cus
{
zbx_scheduler_interval_t *new_interval;
- new_interval = zbx_malloc(NULL, sizeof(zbx_scheduler_interval_t));
+ new_interval = (zbx_scheduler_interval_t *)zbx_malloc(NULL, sizeof(zbx_scheduler_interval_t));
memset(new_interval, 0, sizeof(zbx_scheduler_interval_t));
if (SUCCEED != (ret = scheduler_interval_parse(new_interval, interval_str,
@@ -1742,7 +1742,7 @@ out:
}
else if (NULL != custom_intervals)
{
- *custom_intervals = zbx_malloc(NULL, sizeof(zbx_custom_interval_t));
+ *custom_intervals = (zbx_custom_interval_t *)zbx_malloc(NULL, sizeof(zbx_custom_interval_t));
(*custom_intervals)->flexible = flexible;
(*custom_intervals)->scheduling = scheduling;
}
@@ -1806,7 +1806,7 @@ int calculate_item_nextcheck(zbx_uint64_t seed, int item_type, int simple_interv
}
else
{
- int current_delay = 0, try = 0;
+ int current_delay = 0, attempt = 0;
time_t next_interval, t, tmax, scheduled_check = 0;
/* first try to parse out and calculate scheduled intervals */
@@ -1833,7 +1833,7 @@ int calculate_item_nextcheck(zbx_uint64_t seed, int item_type, int simple_interv
nextcheck = current_delay * (int)(t / (time_t)current_delay) +
(int)(seed % (zbx_uint64_t)current_delay);
- if (0 == try)
+ if (0 == attempt)
{
while (nextcheck <= t)
nextcheck += current_delay;
@@ -1857,7 +1857,7 @@ int calculate_item_nextcheck(zbx_uint64_t seed, int item_type, int simple_interv
{
/* 'nextcheck' is beyond the current interval */
t = next_interval;
- try++;
+ attempt++;
}
else
break; /* nextcheck is within the current interval */
@@ -2857,7 +2857,7 @@ int uint64_array_add(zbx_uint64_t **values, int *alloc, int *num, zbx_uint64_t v
}
*alloc += alloc_step;
- *values = zbx_realloc(*values, *alloc * sizeof(zbx_uint64_t));
+ *values = (uint64_t *)zbx_realloc(*values, *alloc * sizeof(zbx_uint64_t));
}
memmove(&(*values)[index + 1], &(*values)[index], sizeof(zbx_uint64_t) * (*num - index));
diff --git a/src/libs/zbxcommon/setproctitle.c b/src/libs/zbxcommon/setproctitle.c
index fd5ba369d39..fe757d14449 100644
--- a/src/libs/zbxcommon/setproctitle.c
+++ b/src/libs/zbxcommon/setproctitle.c
@@ -37,7 +37,7 @@ static char **environ_ext = NULL;
/* internal copy of argv[] and environment variables */
static char **argv_int = NULL, **environ_int = NULL;
-static char *empty_str = "";
+static const char *empty_str = "";
/* ps display buffer */
static char *ps_buf = NULL;
@@ -74,7 +74,7 @@ char **setproctitle_save_env(int argc, char **argv)
/* measure a size of continuous argv[] area and make a copy */
- argv_int = zbx_malloc(argv_int, ((unsigned int)argc + 1) * sizeof(char *));
+ argv_int = (char **)zbx_malloc(argv_int, ((unsigned int)argc + 1) * sizeof(char *));
#if defined(PS_APPEND_ARGV)
argc_ext_copied_first = argc - 1;
@@ -92,7 +92,7 @@ char **setproctitle_save_env(int argc, char **argv)
/* argv[argc_ext_copied_first] will be used to display status messages. The rest of arguments can be */
/* overwritten and their argv[] pointers will point to wrong strings. */
if (argc_ext_copied_first < i)
- argv[i] = empty_str;
+ argv[i] = (char *)empty_str;
}
argc_ext_copied_last = i - 1;
@@ -111,7 +111,7 @@ char **setproctitle_save_env(int argc, char **argv)
/* measure a size of continuous environment area and make a copy */
- environ_int = zbx_malloc(environ_int, ((unsigned int)envc + 1) * sizeof(char *));
+ environ_int = (char **)zbx_malloc(environ_int, ((unsigned int)envc + 1) * sizeof(char *));
for (i = 0; arg_next == environ[i]; i++)
{
@@ -120,7 +120,7 @@ char **setproctitle_save_env(int argc, char **argv)
/* environment variables can be overwritten by status messages in argv[0] */
/* and environ[] pointers will point to wrong strings */
- environ[i] = empty_str;
+ environ[i] = (char *)empty_str;
}
environ_ext_copied = i;
diff --git a/src/libs/zbxcommon/str.c b/src/libs/zbxcommon/str.c
index 42371208d29..ac96f9703be 100644
--- a/src/libs/zbxcommon/str.c
+++ b/src/libs/zbxcommon/str.c
@@ -227,7 +227,7 @@ retry:
*alloc_len = vsnprintf(NULL, 0, fmt, args) + 2; /* '\0' + one byte to prevent the operation retry */
va_end(args);
*offset = 0;
- *str = zbx_malloc(*str, *alloc_len);
+ *str = (char *)zbx_malloc(*str, *alloc_len);
}
avail_len = *alloc_len - *offset;
@@ -238,7 +238,7 @@ retry:
if (written_len == avail_len - 1)
{
*alloc_len *= 2;
- *str = zbx_realloc(*str, *alloc_len);
+ *str = (char *)zbx_realloc(*str, *alloc_len);
goto retry;
}
@@ -304,13 +304,13 @@ void zbx_strncpy_alloc(char **str, size_t *alloc_len, size_t *offset, const char
{
*alloc_len = n + 1;
*offset = 0;
- *str = zbx_malloc(*str, *alloc_len);
+ *str = (char *)zbx_malloc(*str, *alloc_len);
}
else if (*offset + n >= *alloc_len)
{
while (*offset + n >= *alloc_len)
*alloc_len *= 2;
- *str = zbx_realloc(*str, *alloc_len);
+ *str = (char *)zbx_realloc(*str, *alloc_len);
}
while (0 != n && '\0' != *src)
@@ -359,7 +359,7 @@ char *string_replace(const char *str, const char *sub_str1, const char *sub_str2
diff = (long)strlen(sub_str2) - len;
/* allocate new memory */
- new_str = zbx_malloc(new_str, (size_t)(strlen(str) + count*diff + 1)*sizeof(char));
+ new_str = (char *)zbx_malloc(new_str, (size_t)(strlen(str) + count*diff + 1)*sizeof(char));
for (q=str,t=new_str,p=str; (p = strstr(p, sub_str1)); )
{
@@ -621,7 +621,7 @@ char *zbx_dvsprintf(char *dest, const char *f, va_list args)
while (1)
{
- string = zbx_malloc(string, size);
+ string = (char *)zbx_malloc(string, size);
va_copy(curr, args);
n = vsnprintf(string, size, f, curr);
@@ -698,7 +698,7 @@ char *zbx_strdcat(char *dest, const char *src)
len_dest = strlen(dest);
len_src = strlen(src);
- dest = zbx_realloc(dest, len_dest + len_src + 1);
+ dest = (char *)zbx_realloc(dest, len_dest + len_src + 1);
zbx_strlcpy(dest + len_dest, src, len_src + 1);
@@ -1360,7 +1360,7 @@ char *get_param_dyn(const char *p, int num)
if (0 != get_param_len(p, num, &sz))
return buf;
- buf = zbx_malloc(buf, sz + 1);
+ buf = (char *)zbx_malloc(buf, sz + 1);
if (0 != get_param(p, num, buf, sz + 1))
zbx_free(buf);
@@ -1811,7 +1811,7 @@ char *zbx_dyn_escape_string(const char *src, const char *charlist)
sz = zbx_get_escape_string_len(src, charlist) + 1;
- dst = zbx_malloc(dst, sz);
+ dst = (char *)zbx_malloc(dst, sz);
for (d = dst; '\0' != *src; src++)
{
@@ -2510,7 +2510,7 @@ char *convert_to_utf8(char *in, size_t in_size, const char *encoding)
char *out = NULL, *p;
out_alloc = in_size + 1;
- p = out = zbx_malloc(out, out_alloc);
+ p = out = (char *)zbx_malloc(out, out_alloc);
if ('\0' == *encoding || (iconv_t)-1 == (cd = iconv_open(to_code, encoding)))
{
@@ -2530,7 +2530,7 @@ char *convert_to_utf8(char *in, size_t in_size, const char *encoding)
sz = (size_t)(p - out);
out_alloc += in_size;
out_size_left += in_size;
- p = out = zbx_realloc(out, out_alloc);
+ p = out = (char *)zbx_realloc(out, out_alloc);
p += sz;
}
@@ -2647,7 +2647,7 @@ char *zbx_replace_utf8(const char *text)
int n;
char *out, *p;
- out = p = zbx_malloc(NULL, strlen(text) + 1);
+ out = p = (char *)zbx_malloc(NULL, strlen(text) + 1);
while ('\0' != *text)
{
@@ -2956,7 +2956,7 @@ char *str_linefeed(const char *src, size_t maxline, const char *delim)
dst_size = src_size + feeds * delim_size + 1;
/* allocate memory for output */
- dst = zbx_malloc(dst, dst_size);
+ dst = (char *)zbx_malloc(dst, dst_size);
p_src = src;
p_dst = dst;
@@ -3001,7 +3001,7 @@ char *str_linefeed(const char *src, size_t maxline, const char *delim)
******************************************************************************/
void zbx_strarr_init(char ***arr)
{
- *arr = zbx_malloc(*arr, sizeof(char *));
+ *arr = (char **)zbx_malloc(*arr, sizeof(char *));
**arr = NULL;
}
@@ -3030,7 +3030,7 @@ void zbx_strarr_add(char ***arr, const char *entry)
for (i = 0; NULL != (*arr)[i]; i++)
;
- *arr = zbx_realloc(*arr, sizeof(char *) * (i + 2));
+ *arr = (char **)zbx_realloc(*arr, sizeof(char *) * (i + 2));
(*arr)[i] = zbx_strdup((*arr)[i], entry);
(*arr)[++i] = NULL;
@@ -3086,7 +3086,7 @@ void zbx_replace_string(char **data, size_t l, size_t *r, const char *value)
sz_data += sz_value - sz_block;
if (sz_value > sz_block)
- *data = zbx_realloc(*data, sz_data + 1);
+ *data = (char *)zbx_realloc(*data, sz_data + 1);
src = *data + l + sz_block;
dst = *data + l + sz_value;
@@ -3304,7 +3304,7 @@ int zbx_user_macro_parse_dyn(const char *macro, char **name, char **context, int
/* extract the macro name and close with '}' character */
len = ptr - macro + 1;
- *name = zbx_realloc(*name, len + 1);
+ *name = (char *)zbx_realloc(*name, len + 1);
memcpy(*name, macro, len - 1);
(*name)[len - 1] = '}';
(*name)[len] = '\0';
@@ -3313,7 +3313,7 @@ int zbx_user_macro_parse_dyn(const char *macro, char **name, char **context, int
}
else
{
- *name = zbx_realloc(*name, macro_r + 2);
+ *name = (char *)zbx_realloc(*name, macro_r + 2);
zbx_strlcpy(*name, macro, macro_r + 2);
}
@@ -3345,7 +3345,7 @@ char *zbx_user_macro_unquote_context_dyn(const char *context, int len)
int quoted = 0;
char *buffer, *ptr;
- ptr = buffer = zbx_malloc(NULL, len + 1);
+ ptr = buffer = (char *)zbx_malloc(NULL, len + 1);
if ('"' == *context)
{
@@ -3412,7 +3412,7 @@ char *zbx_user_macro_quote_context_dyn(const char *context, int force_quote)
return zbx_strdup(NULL, context);
len = (int)strlen(context) + 2 + quotes;
- ptr_buffer = buffer = zbx_malloc(NULL, len + 1);
+ ptr_buffer = buffer = (char *)zbx_malloc(NULL, len + 1);
*ptr_buffer++ = '"';
@@ -3454,7 +3454,7 @@ char *zbx_dyn_escape_shell_single_quote(const char *arg)
len++;
}
- pout = arg_esc = zbx_malloc(NULL, len);
+ pout = arg_esc = (char *)zbx_malloc(NULL, len);
for (pin = arg; '\0' != *pin; pin++)
{
@@ -3627,7 +3627,7 @@ int zbx_function_param_quote(char **param, int forced)
sz_dst = zbx_get_escape_string_len(*param, "\"") + 3;
- *param = zbx_realloc(*param, sz_dst);
+ *param = (char *)zbx_realloc(*param, sz_dst);
(*param)[--sz_dst] = '\0';
(*param)[--sz_dst] = '"';
@@ -4721,7 +4721,7 @@ int zbx_replace_mem_dyn(char **data, size_t *data_alloc, size_t *data_len, size_
while (*data_len > *data_alloc)
*data_alloc *= 2;
- *data = zbx_realloc(*data, *data_alloc);
+ *data = (char *)zbx_realloc(*data, *data_alloc);
}
to = *data + offset;
diff --git a/src/libs/zbxcommon/xml.c b/src/libs/zbxcommon/xml.c
index 8ddf21c860a..8b5be3dbccb 100644
--- a/src/libs/zbxcommon/xml.c
+++ b/src/libs/zbxcommon/xml.c
@@ -29,7 +29,7 @@ static char data_static[ZBX_MAX_B64_LEN];
int xml_get_data_dyn(const char *xml, const char *tag, char **data)
{
size_t len, sz;
- char *start, *end;
+ const char *start, *end;
sz = sizeof(data_static);
@@ -48,7 +48,7 @@ int xml_get_data_dyn(const char *xml, const char *tag, char **data)
len = end - start;
if (len > sz - 1)
- *data = zbx_malloc(*data, len + 1);
+ *data = (char *)zbx_malloc(*data, len + 1);
else
*data = data_static;
@@ -109,7 +109,7 @@ char *xml_escape_dyn(const char *data)
}
size++;
- out = zbx_malloc(NULL, size);
+ out = (char *)zbx_malloc(NULL, size);
for (ptr_out = out, ptr_in = data; '\0' != *ptr_in; ptr_in++)
{
diff --git a/src/libs/zbxcomms/comms.c b/src/libs/zbxcomms/comms.c
index 621668f5b67..c6f9bb4e293 100644
--- a/src/libs/zbxcomms/comms.c
+++ b/src/libs/zbxcomms/comms.c
@@ -1613,7 +1613,7 @@ ssize_t zbx_tcp_recv_ext(zbx_socket_t *s, unsigned char flags, int timeout)
else
{
s->buf_type = ZBX_BUF_TYPE_DYN;
- s->buffer = zbx_malloc(NULL, allocated);
+ s->buffer = (char *)zbx_malloc(NULL, allocated);
buf_dyn_bytes = buf_stat_bytes - ZBX_TCP_HEADER_LEN - sizeof(zbx_uint64_t);
buf_stat_bytes = 0;
memcpy(s->buffer, s->buf_stat + ZBX_TCP_HEADER_LEN + sizeof(zbx_uint64_t),
@@ -1632,7 +1632,7 @@ ssize_t zbx_tcp_recv_ext(zbx_socket_t *s, unsigned char flags, int timeout)
if (sizeof(s->buf_stat) == buf_stat_bytes)
{
s->buf_type = ZBX_BUF_TYPE_DYN;
- s->buffer = zbx_malloc(NULL, allocated);
+ s->buffer = (char *)zbx_malloc(NULL, allocated);
buf_dyn_bytes = sizeof(s->buf_stat);
buf_stat_bytes = 0;
memcpy(s->buffer, s->buf_stat, sizeof(s->buf_stat));
@@ -2060,7 +2060,7 @@ int zbx_udp_recv(zbx_socket_t *s, int timeout)
else
{
s->buf_type = ZBX_BUF_TYPE_DYN;
- s->buffer = zbx_malloc(s->buffer, read_bytes + 1);
+ s->buffer = (char *)zbx_malloc(s->buffer, read_bytes + 1);
}
buffer[read_bytes] = '\0';
diff --git a/src/libs/zbxcomms/telnet.c b/src/libs/zbxcomms/telnet.c
index 0df83430a56..143abc123c7 100644
--- a/src/libs/zbxcomms/telnet.c
+++ b/src/libs/zbxcomms/telnet.c
@@ -427,12 +427,12 @@ int telnet_execute(ZBX_SOCKET socket_fd, const char *command, AGENT_RESULT *resu
/* `command' with multiple lines may contain CR+LF from the browser; */
/* it should be converted to plain LF to remove echo later on properly */
offset_lf = strlen(command);
- command_lf = zbx_malloc(command_lf, offset_lf + 1);
+ command_lf = (char *)zbx_malloc(command_lf, offset_lf + 1);
zbx_strlcpy(command_lf, command, offset_lf + 1);
convert_telnet_to_unix_eol(command_lf, &offset_lf);
/* telnet protocol requires that end-of-line is transferred as CR+LF */
- command_crlf = zbx_malloc(command_crlf, offset_lf * 2 + 1);
+ command_crlf = (char *)zbx_malloc(command_crlf, offset_lf * 2 + 1);
convert_unix_to_telnet_eol(command_lf, offset_lf, command_crlf, &offset_crlf);
telnet_socket_write(socket_fd, command_crlf, offset_crlf);
diff --git a/src/libs/zbxconf/cfg.c b/src/libs/zbxconf/cfg.c
index b2a64ffef28..f30e4477e52 100644
--- a/src/libs/zbxconf/cfg.c
+++ b/src/libs/zbxconf/cfg.c
@@ -472,7 +472,7 @@ static int __parse_cfg_file(const char *cfg_file, struct cfg_line *cfg, int leve
zbx_strdup(*((char **)cfg[i].variable), value);
break;
case TYPE_MULTISTRING:
- zbx_strarr_add(cfg[i].variable, value);
+ zbx_strarr_add((char ***)cfg[i].variable, value);
break;
case TYPE_UINT64:
if (FAIL == str2uint64(value, "KMGT", &var))
diff --git a/src/libs/zbxcrypto/base64.c b/src/libs/zbxcrypto/base64.c
index 169b0f42a92..78d2254c7ab 100644
--- a/src/libs/zbxcrypto/base64.c
+++ b/src/libs/zbxcrypto/base64.c
@@ -196,7 +196,7 @@ void str_base64_encode_dyn(const char *p_str, char **p_b64str, int in_size)
assert(p_b64str);
assert(!*p_b64str); /* expect a pointer will NULL value, do not know whether allowed to free that memory */
- *p_b64str = zbx_malloc(*p_b64str, (in_size + 2) / 3 * 4 + 1);
+ *p_b64str = (char *)zbx_malloc(*p_b64str, (in_size + 2) / 3 * 4 + 1);
c_per_block = (ZBX_MAX_B64_LEN - 1) / 4 * 3;
b_per_block = c_per_block / 3 * 4;
full_block_num = in_size / c_per_block;
diff --git a/src/libs/zbxdb/db.c b/src/libs/zbxdb/db.c
index 2dc9d12bdda..b7c737605bd 100644
--- a/src/libs/zbxdb/db.c
+++ b/src/libs/zbxdb/db.c
@@ -1634,7 +1634,7 @@ error:
result = (SQL_CD_TRUE == IBM_DB2server_status() ? NULL : (DB_RESULT)ZBX_DB_DOWN);
}
#elif defined(HAVE_MYSQL)
- result = zbx_malloc(NULL, sizeof(struct zbx_db_result));
+ result = (DB_RESULT)zbx_malloc(NULL, sizeof(struct zbx_db_result));
result->result = NULL;
if (NULL == conn)
@@ -2413,7 +2413,7 @@ char *zbx_db_dyn_escape_string(const char *src, size_t max_bytes, size_t max_cha
len = zbx_db_get_escape_string_len(src, max_bytes, max_chars, flag);
- dst = zbx_malloc(dst, len);
+ dst = (char *)zbx_malloc(dst, len);
zbx_db_escape_string(src, dst, len, flag);
@@ -2480,7 +2480,7 @@ static void zbx_db_escape_like_pattern(const char *src, char *dst, int len)
assert(dst);
- tmp = zbx_malloc(tmp, len);
+ tmp = (char *)zbx_malloc(tmp, len);
zbx_db_escape_string(src, tmp, len, ESCAPE_SEQUENCE_ON);
@@ -2518,7 +2518,7 @@ char *zbx_db_dyn_escape_like_pattern(const char *src)
len = zbx_db_get_escape_like_pattern_len(src);
- dst = zbx_malloc(dst, len);
+ dst = (char *)zbx_malloc(dst, len);
zbx_db_escape_like_pattern(src, dst, len);
diff --git a/src/libs/zbxdbcache/dbcache.c b/src/libs/zbxdbcache/dbcache.c
index 09855b62368..806805c8f40 100644
--- a/src/libs/zbxdbcache/dbcache.c
+++ b/src/libs/zbxdbcache/dbcache.c
@@ -327,7 +327,7 @@ static void DCupdate_trends(zbx_vector_uint64_pair_t *trends_diff)
{
ZBX_DC_TREND *trend;
- if (NULL != (trend = zbx_hashset_search(&cache->trends, &trends_diff->values[i].first)))
+ if (NULL != (trend = (ZBX_DC_TREND *)zbx_hashset_search(&cache->trends, &trends_diff->values[i].first)))
trend->disable_from = trends_diff->values[i].second;
}
@@ -630,7 +630,7 @@ static void DBflush_trends(ZBX_DC_TREND *trends, int *trends_num, zbx_vector_uin
}
itemids_alloc = MIN(ZBX_HC_SYNC_MAX, *trends_num);
- itemids = zbx_malloc(itemids, itemids_alloc * sizeof(zbx_uint64_t));
+ itemids = (zbx_uint64_t *)zbx_malloc(itemids, itemids_alloc * sizeof(zbx_uint64_t));
for (i = 0; i < *trends_num; i++)
{
@@ -733,7 +733,7 @@ static void DCflush_trend(ZBX_DC_TREND *trend, ZBX_DC_TREND **trends, int *trend
if (*trends_num == *trends_alloc)
{
*trends_alloc += 256;
- *trends = zbx_realloc(*trends, *trends_alloc * sizeof(ZBX_DC_TREND));
+ *trends = (ZBX_DC_TREND *)zbx_realloc(*trends, *trends_alloc * sizeof(ZBX_DC_TREND));
}
memcpy(&(*trends)[*trends_num], trend, sizeof(ZBX_DC_TREND));
@@ -875,7 +875,7 @@ static void DBmass_update_trends(const ZBX_DC_TREND *trends, int trends_num,
if (0 != trends_num)
{
- trends_tmp = zbx_malloc(NULL, trends_num * sizeof(ZBX_DC_TREND));
+ trends_tmp = (ZBX_DC_TREND *)zbx_malloc(NULL, trends_num * sizeof(ZBX_DC_TREND));
memcpy(trends_tmp, trends, trends_num * sizeof(ZBX_DC_TREND));
while (0 < trends_num)
@@ -954,8 +954,8 @@ static void DBmass_update_triggers(const ZBX_DC_HISTORY *history, int history_nu
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- itemids = zbx_malloc(itemids, sizeof(zbx_uint64_t) * (size_t)history_num);
- timespecs = zbx_malloc(timespecs, sizeof(zbx_timespec_t) * (size_t)history_num);
+ itemids = (zbx_uint64_t *)zbx_malloc(itemids, sizeof(zbx_uint64_t) * (size_t)history_num);
+ timespecs = (zbx_timespec_t *)zbx_malloc(timespecs, sizeof(zbx_timespec_t) * (size_t)history_num);
for (i = 0; i < history_num; i++)
{
@@ -1036,7 +1036,7 @@ static void DCinventory_value_add(zbx_vector_ptr_t *inventory_values, const DC_I
zbx_format_value(value, sizeof(value), item->valuemapid, item->units, h->value_type);
- inventory_value = zbx_malloc(NULL, sizeof(zbx_inventory_value_t));
+ inventory_value = (zbx_inventory_value_t *)zbx_malloc(NULL, sizeof(zbx_inventory_value_t));
inventory_value->hostid = item->host.hostid;
inventory_value->idx = item->inventory_link - 1;
@@ -1053,7 +1053,7 @@ static void DCadd_update_inventory_sql(size_t *sql_offset, const zbx_vector_ptr_
for (i = 0; i < inventory_values->values_num; i++)
{
- const zbx_inventory_value_t *inventory_value = inventory_values->values[i];
+ const zbx_inventory_value_t *inventory_value = (zbx_inventory_value_t *)inventory_values->values[i];
value_esc = DBdyn_escape_field("host_inventory", inventory_value->field_name, inventory_value->value);
@@ -1228,7 +1228,7 @@ static int dc_history_set_value(ZBX_DC_HISTORY *hdata, unsigned char value_type,
if (ITEM_VALUE_TYPE_LOG != hdata->value_type)
{
dc_history_clean_value(hdata);
- hdata->value.log = zbx_malloc(NULL, sizeof(zbx_log_value_t));
+ hdata->value.log = (zbx_log_value_t *)zbx_malloc(NULL, sizeof(zbx_log_value_t));
memset(hdata->value.log, 0, sizeof(zbx_log_value_t));
}
hdata->value.log->value = value->data.str;
@@ -1496,7 +1496,7 @@ static void DBmass_update_items(const zbx_vector_ptr_t *item_diff, const zbx_vec
{
zbx_item_diff_t *diff;
- diff = item_diff->values[i];
+ diff = (zbx_item_diff_t *)item_diff->values[i];
if (0 != (ZBX_FLAGS_ITEM_DIFF_UPDATE_DB & diff->flags))
break;
}
@@ -1755,7 +1755,7 @@ static void dc_add_proxy_history_meta(ZBX_DC_HISTORY *history, int history_num)
else
{
flags |= PROXY_HISTORY_FLAG_NOVALUE;
- pvalue = "";
+ pvalue = (char *)"";
}
zbx_db_insert_add_values(&db_insert, h->itemid, h->ts.sec, h->ts.ns, pvalue, h->lastlogsize, h->mtime,
@@ -2275,22 +2275,22 @@ int DCsync_history(int sync_type, int *total_num)
sync_start = time(NULL);
if (NULL == history)
- history = zbx_malloc(history, ZBX_HC_SYNC_MAX * sizeof(ZBX_DC_HISTORY));
+ history = (ZBX_DC_HISTORY *)zbx_malloc(history, ZBX_HC_SYNC_MAX * sizeof(ZBX_DC_HISTORY));
if (NULL == history_float && NULL != history_float_cbs)
- history_float = zbx_malloc(history_float, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_FLOAT));
+ history_float = (ZBX_HISTORY_FLOAT *)zbx_malloc(history_float, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_FLOAT));
if (NULL == history_integer && NULL != history_integer_cbs)
- history_integer = zbx_malloc(history_integer, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_INTEGER));
+ history_integer = (ZBX_HISTORY_INTEGER *)zbx_malloc(history_integer, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_INTEGER));
if (NULL == history_string && NULL != history_string_cbs)
- history_string = zbx_malloc(history_string, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_STRING));
+ history_string = (ZBX_HISTORY_STRING *)zbx_malloc(history_string, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_STRING));
if (NULL == history_text && NULL != history_text_cbs)
- history_text = zbx_malloc(history_text, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_TEXT));
+ history_text = (ZBX_HISTORY_TEXT *)zbx_malloc(history_text, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_TEXT));
if (NULL == history_log && NULL != history_log_cbs)
- history_log = zbx_malloc(history_log, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_LOG));
+ history_log = (ZBX_HISTORY_LOG *)zbx_malloc(history_log, ZBX_HC_SYNC_MAX * sizeof(ZBX_HISTORY_LOG));
if (0 != (program_type & ZBX_PROGRAM_TYPE_SERVER))
{
@@ -2340,8 +2340,8 @@ int DCsync_history(int sync_type, int *total_num)
DC_ITEM *items;
zbx_vector_uint64_t itemids;
- items = zbx_malloc(NULL, sizeof(DC_ITEM) * (size_t)history_num);
- errcodes = zbx_malloc(NULL, sizeof(int) * (size_t)history_num);
+ items = (DC_ITEM *)zbx_malloc(NULL, sizeof(DC_ITEM) * (size_t)history_num);
+ errcodes = (int *)zbx_malloc(NULL, sizeof(int) * (size_t)history_num);
zbx_vector_uint64_create(&itemids);
zbx_vector_uint64_reserve(&itemids, history_num);
@@ -2516,7 +2516,7 @@ static void dc_string_buffer_realloc(size_t len)
}
while (string_values_alloc < string_values_offset + len);
- string_values = zbx_realloc(string_values, string_values_alloc);
+ string_values = (char *)zbx_realloc(string_values, string_values_alloc);
}
static dc_item_value_t *dc_local_get_history_slot(void)
@@ -2527,7 +2527,7 @@ static dc_item_value_t *dc_local_get_history_slot(void)
if (item_values_alloc == item_values_num)
{
item_values_alloc += ZBX_STRUCT_REALLOC_STEP;
- item_values = zbx_realloc(item_values, item_values_alloc * sizeof(dc_item_value_t));
+ item_values = (dc_item_value_t *)zbx_realloc(item_values, item_values_alloc * sizeof(dc_item_value_t));
}
return &item_values[item_values_num++];
@@ -3268,7 +3268,7 @@ static void hc_copy_history_data(ZBX_DC_HISTORY *history, zbx_uint64_t itemid, z
history->value.str = zbx_strdup(NULL, data->value.str);
break;
case ITEM_VALUE_TYPE_LOG:
- history->value.log = zbx_malloc(NULL, sizeof(zbx_log_value_t));
+ history->value.log = (zbx_log_value_t *)zbx_malloc(NULL, sizeof(zbx_log_value_t));
history->value.log->value = zbx_strdup(NULL, data->value.log->value);
if (NULL != data->value.log->source)
@@ -3534,7 +3534,7 @@ int init_database_cache(char **error)
}
if (NULL == sql)
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
out:
zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
@@ -3702,7 +3702,7 @@ void DCupdate_hosts_availability(void)
for (i = 0; i < hosts.values_num; i++)
{
if (SUCCEED == zbx_sql_add_host_availability(&sql_buf, &sql_buf_alloc, &sql_buf_offset,
- hosts.values[i]))
+ (zbx_host_availability_t *)hosts.values[i]))
{
zbx_strcpy_alloc(&sql_buf, &sql_buf_alloc, &sql_buf_offset, ";\n");
}
diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c
index 1299a80b7a8..7100aefaae2 100644
--- a/src/libs/zbxdbcache/dbconfig.c
+++ b/src/libs/zbxdbcache/dbconfig.c
@@ -262,7 +262,7 @@ static zbx_uint64_t get_item_nextcheck_seed(zbx_uint64_t itemid, zbx_uint64_t in
{
ZBX_DC_INTERFACE *interface;
- if (NULL == (interface = zbx_hashset_search(&config->interfaces, &interfaceid)) ||
+ if (NULL == (interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &interfaceid)) ||
SNMP_BULK_ENABLED != interface->bulk)
{
return itemid;
@@ -311,7 +311,7 @@ static void DCitem_nextcheck_update(ZBX_DC_ITEM *item, const ZBX_DC_HOST *host,
if (0 != (flags & ZBX_HOST_UNREACHABLE) && 0 != (item->nextcheck = DCget_disable_until(item, host)))
return;
- if (0 != host->proxy_hostid && NULL != (proxy = zbx_hashset_search(&config->proxies, &host->proxy_hostid)))
+ if (0 != host->proxy_hostid && NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &host->proxy_hostid)))
now -= proxy->timediff;
seed = get_item_nextcheck_seed(item->itemid, item->interfaceid, item->type, item->key);
@@ -507,7 +507,7 @@ static ZBX_DC_ITEM *DCfind_item(zbx_uint64_t hostid, const char *key)
item_hk_local.hostid = hostid;
item_hk_local.key = key;
- if (NULL == (item_hk = zbx_hashset_search(&config->items_hk, &item_hk_local)))
+ if (NULL == (item_hk = (ZBX_DC_ITEM_HK *)zbx_hashset_search(&config->items_hk, &item_hk_local)))
return NULL;
else
return item_hk->item_ptr;
@@ -519,7 +519,7 @@ static ZBX_DC_HOST *DCfind_host(const char *host)
host_h_local.host = host;
- if (NULL == (host_h = zbx_hashset_search(&config->hosts_h, &host_h_local)))
+ if (NULL == (host_h = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_h, &host_h_local)))
return NULL;
else
return host_h->host_ptr;
@@ -543,7 +543,7 @@ static ZBX_DC_HOST *DCfind_proxy(const char *host)
host_p_local.host = host;
- if (NULL == (host_p = zbx_hashset_search(&config->hosts_p, &host_p_local)))
+ if (NULL == (host_p = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_p, &host_p_local)))
return NULL;
else
return host_p->host_ptr;
@@ -602,17 +602,17 @@ static const char *zbx_strpool_acquire(const char *str)
return str;
}
-static int DCstrpool_replace(int found, const char **curr, const char *new)
+static int DCstrpool_replace(int found, const char **curr, const char *new_str)
{
if (1 == found)
{
- if (0 == strcmp(*curr, new))
+ if (0 == strcmp(*curr, new_str))
return FAIL;
zbx_strpool_release(*curr);
}
- *curr = zbx_strpool_intern(new);
+ *curr = zbx_strpool_intern(new_str);
return SUCCEED; /* indicate that the string has been replaced */
}
@@ -689,13 +689,13 @@ static void config_gmacro_add_index(zbx_hashset_t *gmacro_index, ZBX_DC_GMACRO *
gmacro_m_local.macro = gmacro->macro;
- if (NULL == (gmacro_m = zbx_hashset_search(gmacro_index, &gmacro_m_local)))
+ if (NULL == (gmacro_m = (ZBX_DC_GMACRO_M *)zbx_hashset_search(gmacro_index, &gmacro_m_local)))
{
gmacro_m_local.macro = zbx_strpool_acquire(gmacro->macro);
zbx_vector_ptr_create_ext(&gmacro_m_local.gmacros, __config_mem_malloc_func, __config_mem_realloc_func,
__config_mem_free_func);
- gmacro_m = zbx_hashset_insert(gmacro_index, &gmacro_m_local, sizeof(ZBX_DC_GMACRO_M));
+ gmacro_m = (ZBX_DC_GMACRO_M *)zbx_hashset_insert(gmacro_index, &gmacro_m_local, sizeof(ZBX_DC_GMACRO_M));
}
zbx_vector_ptr_append(&gmacro_m->gmacros, gmacro);
@@ -718,7 +718,7 @@ static void config_gmacro_remove_index(zbx_hashset_t *gmacro_index, ZBX_DC_GMACR
gmacro_m_local.macro = gmacro->macro;
- if (NULL != (gmacro_m = zbx_hashset_search(gmacro_index, &gmacro_m_local)))
+ if (NULL != (gmacro_m = (ZBX_DC_GMACRO_M *)zbx_hashset_search(gmacro_index, &gmacro_m_local)))
{
if (FAIL != (index = zbx_vector_ptr_search(&gmacro_m->gmacros, gmacro, ZBX_DEFAULT_PTR_COMPARE_FUNC)))
zbx_vector_ptr_remove(&gmacro_m->gmacros, index);
@@ -749,13 +749,13 @@ static void config_hmacro_add_index(zbx_hashset_t *hmacro_index, ZBX_DC_HMACRO *
hmacro_hm_local.hostid = hmacro->hostid;
hmacro_hm_local.macro = hmacro->macro;
- if (NULL == (hmacro_hm = zbx_hashset_search(hmacro_index, &hmacro_hm_local)))
+ if (NULL == (hmacro_hm = (ZBX_DC_HMACRO_HM *)zbx_hashset_search(hmacro_index, &hmacro_hm_local)))
{
hmacro_hm_local.macro = zbx_strpool_acquire(hmacro->macro);
zbx_vector_ptr_create_ext(&hmacro_hm_local.hmacros, __config_mem_malloc_func, __config_mem_realloc_func,
__config_mem_free_func);
- hmacro_hm = zbx_hashset_insert(hmacro_index, &hmacro_hm_local, sizeof(ZBX_DC_HMACRO_HM));
+ hmacro_hm = (ZBX_DC_HMACRO_HM *)zbx_hashset_insert(hmacro_index, &hmacro_hm_local, sizeof(ZBX_DC_HMACRO_HM));
}
zbx_vector_ptr_append(&hmacro_hm->hmacros, hmacro);
@@ -779,7 +779,7 @@ static void config_hmacro_remove_index(zbx_hashset_t *hmacro_index, ZBX_DC_HMACR
hmacro_hm_local.hostid = hmacro->hostid;
hmacro_hm_local.macro = hmacro->macro;
- if (NULL != (hmacro_hm = zbx_hashset_search(hmacro_index, &hmacro_hm_local)))
+ if (NULL != (hmacro_hm = (ZBX_DC_HMACRO_HM *)zbx_hashset_search(hmacro_index, &hmacro_hm_local)))
{
if (FAIL != (index = zbx_vector_ptr_search(&hmacro_hm->hmacros, hmacro, ZBX_DEFAULT_PTR_COMPARE_FUNC)))
zbx_vector_ptr_remove(&hmacro_hm->hmacros, index);
@@ -847,7 +847,7 @@ static int DCsync_config(zbx_dbsync_t *sync, int *flags)
if (NULL == config->config)
{
found = 0;
- config->config = __config_mem_malloc_func(NULL, sizeof(ZBX_DC_CONFIG_TABLE));
+ config->config = (ZBX_DC_CONFIG_TABLE *)__config_mem_malloc_func(NULL, sizeof(ZBX_DC_CONFIG_TABLE));
}
if (SUCCEED != (ret = zbx_dbsync_next(sync, &rowid, &db_row, &tag)))
@@ -1013,7 +1013,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
ZBX_DBROW2UINT64(proxy_hostid, row[1]);
ZBX_STR2UCHAR(status, row[22]);
- host = DCfind_id(&config->hosts, hostid, sizeof(ZBX_DC_HOST), &found);
+ host = (ZBX_DC_HOST *)DCfind_id(&config->hosts, hostid, sizeof(ZBX_DC_HOST), &found);
/* see whether we should and can update 'hosts_h' and 'hosts_p' indexes at this point */
@@ -1026,7 +1026,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
if (1 == found)
{
host_h_local.host = host->host;
- host_h = zbx_hashset_search(&config->hosts_h, &host_h_local);
+ host_h = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_h, &host_h_local);
if (NULL != host_h && host == host_h->host_ptr) /* see ZBX-4045 for NULL check */
{
@@ -1036,7 +1036,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
}
host_h_local.host = row[2];
- host_h = zbx_hashset_search(&config->hosts_h, &host_h_local);
+ host_h = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_h, &host_h_local);
if (NULL != host_h)
host_h->host_ptr = host;
@@ -1049,7 +1049,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
if (1 == found)
{
host_p_local.host = host->host;
- host_p = zbx_hashset_search(&config->hosts_p, &host_p_local);
+ host_p = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_p, &host_p_local);
if (NULL != host_p && host == host_p->host_ptr)
{
@@ -1059,7 +1059,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
}
host_p_local.host = row[2];
- host_p = zbx_hashset_search(&config->hosts_p, &host_p_local);
+ host_p = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_p, &host_p_local);
if (NULL != host_p)
host_p->host_ptr = host;
@@ -1159,7 +1159,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
psk_i_local.tls_psk_identity = host->tls_dc_psk->tls_psk_identity;
- if (NULL != (psk_i = zbx_hashset_search(&config->psks, &psk_i_local)) &&
+ if (NULL != (psk_i = (ZBX_DC_PSK *)zbx_hashset_search(&config->psks, &psk_i_local)) &&
0 == --(psk_i->refcount))
{
zbx_strpool_release(psk_i->tls_psk_identity);
@@ -1184,7 +1184,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
if (0 != strcmp(host->tls_dc_psk->tls_psk, row[34])) /* new PSK value */
/* differs from old */
{
- if (NULL == (psk_owner = zbx_hashset_search(&psk_owners,
+ if (NULL == (psk_owner = (zbx_ptr_pair_t *)zbx_hashset_search(&psk_owners,
&host->tls_dc_psk->tls_psk_identity)))
{
/* change underlying PSK value and 'config->psks' is updated, too */
@@ -1205,7 +1205,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
psk_i_local.tls_psk_identity = host->tls_dc_psk->tls_psk_identity;
- if (NULL != (psk_i = zbx_hashset_search(&config->psks, &psk_i_local)) &&
+ if (NULL != (psk_i = (ZBX_DC_PSK *)zbx_hashset_search(&config->psks, &psk_i_local)) &&
0 == --(psk_i->refcount))
{
zbx_strpool_release(psk_i->tls_psk_identity);
@@ -1220,13 +1220,13 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
psk_i_local.tls_psk_identity = row[33];
- if (NULL != (psk_i = zbx_hashset_search(&config->psks, &psk_i_local)))
+ if (NULL != (psk_i = (ZBX_DC_PSK *)zbx_hashset_search(&config->psks, &psk_i_local)))
{
/* new PSKid already in psks hashset */
if (0 != strcmp(psk_i->tls_psk, row[34])) /* PSKid stored but PSK value is different */
{
- if (NULL == (psk_owner = zbx_hashset_search(&psk_owners, &psk_i->tls_psk_identity)))
+ if (NULL == (psk_owner = (zbx_ptr_pair_t *)zbx_hashset_search(&psk_owners, &psk_i->tls_psk_identity)))
{
DCstrpool_replace(1, &psk_i->tls_psk, row[34]);
}
@@ -1252,7 +1252,7 @@ static void DCsync_hosts(zbx_dbsync_t *sync)
done:
if (NULL != host->tls_dc_psk && NULL == psk_owner)
{
- if (NULL == (psk_owner = zbx_hashset_search(&psk_owners, &host->tls_dc_psk->tls_psk_identity)))
+ if (NULL == (psk_owner = (zbx_ptr_pair_t *)zbx_hashset_search(&psk_owners, &host->tls_dc_psk->tls_psk_identity)))
{
/* register this host as the PSK identity owner, against which to report conflicts */
@@ -1341,14 +1341,14 @@ done:
if (ZBX_IPMI_DEFAULT_AUTHTYPE != ipmi_authtype || ZBX_IPMI_DEFAULT_PRIVILEGE != ipmi_privilege ||
'\0' != *row[5] || '\0' != *row[6]) /* useipmi */
{
- ipmihost = DCfind_id(&config->ipmihosts, hostid, sizeof(ZBX_DC_IPMIHOST), &found);
+ ipmihost = (ZBX_DC_IPMIHOST *)DCfind_id(&config->ipmihosts, hostid, sizeof(ZBX_DC_IPMIHOST), &found);
ipmihost->ipmi_authtype = ipmi_authtype;
ipmihost->ipmi_privilege = ipmi_privilege;
DCstrpool_replace(found, &ipmihost->ipmi_username, row[5]);
DCstrpool_replace(found, &ipmihost->ipmi_password, row[6]);
}
- else if (NULL != (ipmihost = zbx_hashset_search(&config->ipmihosts, &hostid)))
+ else if (NULL != (ipmihost = (ZBX_DC_IPMIHOST *)zbx_hashset_search(&config->ipmihosts, &hostid)))
{
/* remove IPMI connection parameters for hosts without IPMI */
@@ -1362,7 +1362,7 @@ done:
if (HOST_STATUS_PROXY_ACTIVE == status || HOST_STATUS_PROXY_PASSIVE == status)
{
- proxy = DCfind_id(&config->proxies, hostid, sizeof(ZBX_DC_PROXY), &found);
+ proxy = (ZBX_DC_PROXY *)DCfind_id(&config->proxies, hostid, sizeof(ZBX_DC_PROXY), &found);
if (0 == found)
{
@@ -1389,7 +1389,7 @@ done:
proxy->location = ZBX_LOC_NOWHERE;
}
}
- else if (NULL != (proxy = zbx_hashset_search(&config->proxies, &hostid)))
+ else if (NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &hostid)))
{
if (ZBX_LOC_QUEUE == proxy->location)
{
@@ -1406,14 +1406,14 @@ done:
/* remove deleted hosts from buffer */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (host = zbx_hashset_search(&config->hosts, &rowid)))
+ if (NULL == (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &rowid)))
continue;
hostid = host->hostid;
/* IPMI hosts */
- if (NULL != (ipmihost = zbx_hashset_search(&config->ipmihosts, &hostid)))
+ if (NULL != (ipmihost = (ZBX_DC_IPMIHOST *)zbx_hashset_search(&config->ipmihosts, &hostid)))
{
zbx_strpool_release(ipmihost->ipmi_username);
zbx_strpool_release(ipmihost->ipmi_password);
@@ -1423,7 +1423,7 @@ done:
/* proxies */
- if (NULL != (proxy = zbx_hashset_search(&config->proxies, &hostid)))
+ if (NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &hostid)))
{
if (ZBX_LOC_QUEUE == proxy->location)
{
@@ -1439,7 +1439,7 @@ done:
if (HOST_STATUS_MONITORED == host->status || HOST_STATUS_NOT_MONITORED == host->status)
{
host_h_local.host = host->host;
- host_h = zbx_hashset_search(&config->hosts_h, &host_h_local);
+ host_h = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_h, &host_h_local);
if (NULL != host_h && host == host_h->host_ptr) /* see ZBX-4045 for NULL check */
{
@@ -1450,7 +1450,7 @@ done:
else if (HOST_STATUS_PROXY_ACTIVE == host->status || HOST_STATUS_PROXY_PASSIVE == host->status)
{
host_p_local.host = host->host;
- host_p = zbx_hashset_search(&config->hosts_p, &host_p_local);
+ host_p = (ZBX_DC_HOST_H *)zbx_hashset_search(&config->hosts_p, &host_p_local);
if (NULL != host_p && host == host_p->host_ptr)
{
@@ -1476,7 +1476,7 @@ done:
{
psk_i_local.tls_psk_identity = host->tls_dc_psk->tls_psk_identity;
- if (NULL != (psk_i = zbx_hashset_search(&config->psks, &psk_i_local)) &&
+ if (NULL != (psk_i = (ZBX_DC_PSK *)zbx_hashset_search(&config->psks, &psk_i_local)) &&
0 == --(psk_i->refcount))
{
zbx_strpool_release(psk_i->tls_psk_identity);
@@ -1516,7 +1516,7 @@ static void DCsync_host_inventory(zbx_dbsync_t *sync)
ZBX_STR2UINT64(hostid, row[0]);
- host_inventory = DCfind_id(&config->host_inventories, hostid, sizeof(ZBX_DC_HOST_INVENTORY), &found);
+ host_inventory = (ZBX_DC_HOST_INVENTORY *)DCfind_id(&config->host_inventories, hostid, sizeof(ZBX_DC_HOST_INVENTORY), &found);
ZBX_STR2UCHAR(host_inventory->inventory_mode, row[1]);
@@ -1524,7 +1524,7 @@ static void DCsync_host_inventory(zbx_dbsync_t *sync)
for (i = 0; i < HOST_INVENTORY_FIELD_COUNT; i++)
DCstrpool_replace(found, &(host_inventory->values[i]), row[i + 2]);
- host_inventory_auto = DCfind_id(&config->host_inventories_auto, hostid, sizeof(ZBX_DC_HOST_INVENTORY),
+ host_inventory_auto = (ZBX_DC_HOST_INVENTORY *)DCfind_id(&config->host_inventories_auto, hostid, sizeof(ZBX_DC_HOST_INVENTORY),
&found);
host_inventory_auto->inventory_mode = host_inventory->inventory_mode;
@@ -1550,7 +1550,7 @@ static void DCsync_host_inventory(zbx_dbsync_t *sync)
/* remove deleted host inventory from cache */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (host_inventory = zbx_hashset_search(&config->host_inventories, &rowid)))
+ if (NULL == (host_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories, &rowid)))
continue;
for (i = 0; i < HOST_INVENTORY_FIELD_COUNT; i++)
@@ -1558,7 +1558,7 @@ static void DCsync_host_inventory(zbx_dbsync_t *sync)
zbx_hashset_remove_direct(&config->host_inventories, host_inventory);
- if (NULL == (host_inventory_auto = zbx_hashset_search(&config->host_inventories_auto, &rowid)))
+ if (NULL == (host_inventory_auto = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories_auto, &rowid)))
{
THIS_SHOULD_NEVER_HAPPEN;
continue;
@@ -1607,7 +1607,7 @@ static void DCsync_htmpls(zbx_dbsync_t *sync)
{
_hostid = hostid;
- htmpl = DCfind_id(&config->htmpls, hostid, sizeof(ZBX_DC_HTMPL), &found);
+ htmpl = (ZBX_DC_HTMPL *)DCfind_id(&config->htmpls, hostid, sizeof(ZBX_DC_HTMPL), &found);
if (0 == found)
{
@@ -1698,7 +1698,7 @@ static void DCsync_gmacros(zbx_dbsync_t *sync)
continue;
}
- gmacro = DCfind_id(&config->gmacros, globalmacroid, sizeof(ZBX_DC_GMACRO), &found);
+ gmacro = (ZBX_DC_GMACRO *)DCfind_id(&config->gmacros, globalmacroid, sizeof(ZBX_DC_GMACRO), &found);
/* see whether we should and can update gmacros_m index at this point */
update_index = 0;
@@ -1739,7 +1739,7 @@ static void DCsync_gmacros(zbx_dbsync_t *sync)
/* remove deleted globalmacros from buffer */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (gmacro = zbx_hashset_search(&config->gmacros, &rowid)))
+ if (NULL == (gmacro = (ZBX_DC_GMACRO *)zbx_hashset_search(&config->gmacros, &rowid)))
continue;
config_gmacro_remove_index(&config->gmacros_m, gmacro);
@@ -1790,7 +1790,7 @@ static void DCsync_hmacros(zbx_dbsync_t *sync)
continue;
}
- hmacro = DCfind_id(&config->hmacros, hostmacroid, sizeof(ZBX_DC_HMACRO), &found);
+ hmacro = (ZBX_DC_HMACRO *)DCfind_id(&config->hmacros, hostmacroid, sizeof(ZBX_DC_HMACRO), &found);
/* see whether we should and can update hmacros_hm index at this point */
update_index = 0;
@@ -1833,7 +1833,7 @@ static void DCsync_hmacros(zbx_dbsync_t *sync)
/* remove deleted host macros from buffer */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (hmacro = zbx_hashset_search(&config->hmacros, &rowid)))
+ if (NULL == (hmacro = (ZBX_DC_HMACRO *)zbx_hashset_search(&config->hmacros, &rowid)))
continue;
config_hmacro_remove_index(&config->hmacros_hm, hmacro);
@@ -1966,7 +1966,7 @@ static void DCsync_interfaces(zbx_dbsync_t *sync)
ZBX_STR2UCHAR(useip, row[4]);
ZBX_STR2UCHAR(bulk, row[8]);
- interface = DCfind_id(&config->interfaces, interfaceid, sizeof(ZBX_DC_INTERFACE), &found);
+ interface = (ZBX_DC_INTERFACE *)DCfind_id(&config->interfaces, interfaceid, sizeof(ZBX_DC_INTERFACE), &found);
zbx_vector_ptr_append(&interfaces, interface);
/* remove old address->interfaceid index */
@@ -1983,7 +1983,7 @@ static void DCsync_interfaces(zbx_dbsync_t *sync)
{
interface_ht_local.hostid = interface->hostid;
interface_ht_local.type = interface->type;
- interface_ht = zbx_hashset_search(&config->interfaces_ht, &interface_ht_local);
+ interface_ht = (ZBX_DC_INTERFACE_HT *)zbx_hashset_search(&config->interfaces_ht, &interface_ht_local);
if (NULL != interface_ht && interface == interface_ht->interface_ptr)
{
@@ -1996,7 +1996,7 @@ static void DCsync_interfaces(zbx_dbsync_t *sync)
{
interface_ht_local.hostid = hostid;
interface_ht_local.type = type;
- interface_ht = zbx_hashset_search(&config->interfaces_ht, &interface_ht_local);
+ interface_ht = (ZBX_DC_INTERFACE_HT *)zbx_hashset_search(&config->interfaces_ht, &interface_ht_local);
if (NULL != interface_ht)
interface_ht->interface_ptr = interface;
@@ -2037,12 +2037,12 @@ static void DCsync_interfaces(zbx_dbsync_t *sync)
if ('\0' != *interface_snmpaddr_local.addr)
{
- if (NULL == (interface_snmpaddr = zbx_hashset_search(&config->interface_snmpaddrs,
+ if (NULL == (interface_snmpaddr = (ZBX_DC_INTERFACE_ADDR *)zbx_hashset_search(&config->interface_snmpaddrs,
&interface_snmpaddr_local)))
{
zbx_strpool_acquire(interface_snmpaddr_local.addr);
- interface_snmpaddr = zbx_hashset_insert(&config->interface_snmpaddrs,
+ interface_snmpaddr = (ZBX_DC_INTERFACE_ADDR *)zbx_hashset_insert(&config->interface_snmpaddrs,
&interface_snmpaddr_local, sizeof(ZBX_DC_INTERFACE_ADDR));
zbx_vector_uint64_create_ext(&interface_snmpaddr->interfaceids,
__config_mem_malloc_func,
@@ -2072,7 +2072,7 @@ static void DCsync_interfaces(zbx_dbsync_t *sync)
ZBX_DC_HOST *host;
- if (NULL != (host = zbx_hashset_search(&config->hosts, &interface->hostid)))
+ if (NULL != (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &interface->hostid)))
{
int exists = 0;
@@ -2112,12 +2112,12 @@ static void DCsync_interfaces(zbx_dbsync_t *sync)
{
ZBX_DC_HOST *host;
- if (NULL == (interface = zbx_hashset_search(&config->interfaces, &rowid)))
+ if (NULL == (interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &rowid)))
continue;
/* remove interface from the list of host interfaces in 'config->hosts' hashset */
- if (NULL != (host = zbx_hashset_search(&config->hosts, &interface->hostid)))
+ if (NULL != (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &interface->hostid)))
{
for (i = 0; i < host->interfaces_v.values_num; i++)
{
@@ -2136,7 +2136,7 @@ static void DCsync_interfaces(zbx_dbsync_t *sync)
{
interface_ht_local.hostid = interface->hostid;
interface_ht_local.type = interface->type;
- interface_ht = zbx_hashset_search(&config->interfaces_ht, &interface_ht_local);
+ interface_ht = (ZBX_DC_INTERFACE_HT *)zbx_hashset_search(&config->interfaces_ht, &interface_ht_local);
if (NULL != interface_ht && interface == interface_ht->interface_ptr)
{
@@ -2307,10 +2307,10 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
ZBX_STR2UCHAR(status, row[2]);
ZBX_STR2UCHAR(type, row[3]);
- if (NULL == (host = zbx_hashset_search(&config->hosts, &hostid)))
+ if (NULL == (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)))
continue;
- item = DCfind_id(&config->items, itemid, sizeof(ZBX_DC_ITEM), &found);
+ item = (ZBX_DC_ITEM *)DCfind_id(&config->items, itemid, sizeof(ZBX_DC_ITEM), &found);
if (0 != found && ITEM_TYPE_SNMPTRAP == item->type)
dc_interface_snmpitems_remove(item);
@@ -2325,7 +2325,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
{
item_hk_local.hostid = item->hostid;
item_hk_local.key = item->key;
- item_hk = zbx_hashset_search(&config->items_hk, &item_hk_local);
+ item_hk = (ZBX_DC_ITEM_HK *)zbx_hashset_search(&config->items_hk, &item_hk_local);
if (item == item_hk->item_ptr)
{
@@ -2336,7 +2336,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
item_hk_local.hostid = hostid;
item_hk_local.key = row[5];
- item_hk = zbx_hashset_search(&config->items_hk, &item_hk_local);
+ item_hk = (ZBX_DC_ITEM_HK *)zbx_hashset_search(&config->items_hk, &item_hk_local);
if (NULL != item_hk)
item_hk->item_ptr = item;
@@ -2427,7 +2427,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_VALUE_TYPE_FLOAT == item->value_type || ITEM_VALUE_TYPE_UINT64 == item->value_type)
{
- numitem = DCfind_id(&config->numitems, itemid, sizeof(ZBX_DC_NUMITEM), &found);
+ numitem = (ZBX_DC_NUMITEM *)DCfind_id(&config->numitems, itemid, sizeof(ZBX_DC_NUMITEM), &found);
if (ZBX_HK_OPTION_ENABLED == config->config->hk.trends_global)
numitem->trends = (0 != config->config->hk.trends);
@@ -2436,7 +2436,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
DCstrpool_replace(found, &numitem->units, row[35]);
}
- else if (NULL != (numitem = zbx_hashset_search(&config->numitems, &itemid)))
+ else if (NULL != (numitem = (ZBX_DC_NUMITEM *)zbx_hashset_search(&config->numitems, &itemid)))
{
/* remove parameters for non-numeric item */
@@ -2449,7 +2449,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (SUCCEED == is_snmp_type(item->type))
{
- snmpitem = DCfind_id(&config->snmpitems, itemid, sizeof(ZBX_DC_SNMPITEM), &found);
+ snmpitem = (ZBX_DC_SNMPITEM *)DCfind_id(&config->snmpitems, itemid, sizeof(ZBX_DC_SNMPITEM), &found);
DCstrpool_replace(found, &snmpitem->snmp_community, row[6]);
DCstrpool_replace(found, &snmpitem->snmpv3_securityname, row[9]);
@@ -2470,7 +2470,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
snmpitem->snmp_oid_type = ZBX_SNMP_OID_TYPE_NORMAL;
}
}
- else if (NULL != (snmpitem = zbx_hashset_search(&config->snmpitems, &itemid)))
+ else if (NULL != (snmpitem = (ZBX_DC_SNMPITEM *)zbx_hashset_search(&config->snmpitems, &itemid)))
{
/* remove SNMP parameters for non-SNMP item */
@@ -2488,11 +2488,11 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_IPMI == item->type)
{
- ipmiitem = DCfind_id(&config->ipmiitems, itemid, sizeof(ZBX_DC_IPMIITEM), &found);
+ ipmiitem = (ZBX_DC_IPMIITEM *)DCfind_id(&config->ipmiitems, itemid, sizeof(ZBX_DC_IPMIITEM), &found);
DCstrpool_replace(found, &ipmiitem->ipmi_sensor, row[13]);
}
- else if (NULL != (ipmiitem = zbx_hashset_search(&config->ipmiitems, &itemid)))
+ else if (NULL != (ipmiitem = (ZBX_DC_IPMIITEM *)zbx_hashset_search(&config->ipmiitems, &itemid)))
{
/* remove IPMI parameters for non-IPMI item */
zbx_strpool_release(ipmiitem->ipmi_sensor);
@@ -2503,11 +2503,11 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_TRAPPER == item->type && '\0' != *row[15])
{
- trapitem = DCfind_id(&config->trapitems, itemid, sizeof(ZBX_DC_TRAPITEM), &found);
+ trapitem = (ZBX_DC_TRAPITEM *)DCfind_id(&config->trapitems, itemid, sizeof(ZBX_DC_TRAPITEM), &found);
zbx_trim_str_list(row[15], ',');
DCstrpool_replace(found, &trapitem->trapper_hosts, row[15]);
}
- else if (NULL != (trapitem = zbx_hashset_search(&config->trapitems, &itemid)))
+ else if (NULL != (trapitem = (ZBX_DC_TRAPITEM *)zbx_hashset_search(&config->trapitems, &itemid)))
{
/* remove trapper_hosts parameter */
zbx_strpool_release(trapitem->trapper_hosts);
@@ -2518,7 +2518,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_DEPENDENT == item->type && SUCCEED != DBis_null(row[38]))
{
- depitem = DCfind_id(&config->dependentitems, itemid, sizeof(ZBX_DC_DEPENDENTITEM), &found);
+ depitem = (ZBX_DC_DEPENDENTITEM *)DCfind_id(&config->dependentitems, itemid, sizeof(ZBX_DC_DEPENDENTITEM), &found);
if (1 == found)
depitem->last_master_itemid = depitem->master_itemid;
@@ -2530,7 +2530,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (depitem->last_master_itemid != depitem->master_itemid)
zbx_vector_ptr_append(&dep_items, depitem);
}
- else if (NULL != (depitem = zbx_hashset_search(&config->dependentitems, &itemid)))
+ else if (NULL != (depitem = (ZBX_DC_DEPENDENTITEM *)zbx_hashset_search(&config->dependentitems, &itemid)))
{
dc_masteritem_remove_depitem(depitem->master_itemid, itemid);
zbx_hashset_remove_direct(&config->dependentitems, depitem);
@@ -2540,11 +2540,11 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_VALUE_TYPE_LOG == item->value_type && '\0' != *row[16])
{
- logitem = DCfind_id(&config->logitems, itemid, sizeof(ZBX_DC_LOGITEM), &found);
+ logitem = (ZBX_DC_LOGITEM *)DCfind_id(&config->logitems, itemid, sizeof(ZBX_DC_LOGITEM), &found);
DCstrpool_replace(found, &logitem->logtimefmt, row[16]);
}
- else if (NULL != (logitem = zbx_hashset_search(&config->logitems, &itemid)))
+ else if (NULL != (logitem = (ZBX_DC_LOGITEM *)zbx_hashset_search(&config->logitems, &itemid)))
{
/* remove logtimefmt parameter */
zbx_strpool_release(logitem->logtimefmt);
@@ -2555,13 +2555,13 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_DB_MONITOR == item->type && '\0' != *row[17])
{
- dbitem = DCfind_id(&config->dbitems, itemid, sizeof(ZBX_DC_DBITEM), &found);
+ dbitem = (ZBX_DC_DBITEM *)DCfind_id(&config->dbitems, itemid, sizeof(ZBX_DC_DBITEM), &found);
DCstrpool_replace(found, &dbitem->params, row[17]);
DCstrpool_replace(found, &dbitem->username, row[20]);
DCstrpool_replace(found, &dbitem->password, row[21]);
}
- else if (NULL != (dbitem = zbx_hashset_search(&config->dbitems, &itemid)))
+ else if (NULL != (dbitem = (ZBX_DC_DBITEM *)zbx_hashset_search(&config->dbitems, &itemid)))
{
/* remove db item parameters */
zbx_strpool_release(dbitem->params);
@@ -2575,7 +2575,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_SSH == item->type)
{
- sshitem = DCfind_id(&config->sshitems, itemid, sizeof(ZBX_DC_SSHITEM), &found);
+ sshitem = (ZBX_DC_SSHITEM *)DCfind_id(&config->sshitems, itemid, sizeof(ZBX_DC_SSHITEM), &found);
sshitem->authtype = (unsigned short)atoi(row[19]);
DCstrpool_replace(found, &sshitem->username, row[20]);
@@ -2584,7 +2584,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
DCstrpool_replace(found, &sshitem->privatekey, row[23]);
DCstrpool_replace(found, &sshitem->params, row[17]);
}
- else if (NULL != (sshitem = zbx_hashset_search(&config->sshitems, &itemid)))
+ else if (NULL != (sshitem = (ZBX_DC_SSHITEM *)zbx_hashset_search(&config->sshitems, &itemid)))
{
/* remove SSH item parameters */
@@ -2601,13 +2601,13 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_TELNET == item->type)
{
- telnetitem = DCfind_id(&config->telnetitems, itemid, sizeof(ZBX_DC_TELNETITEM), &found);
+ telnetitem = (ZBX_DC_TELNETITEM *)DCfind_id(&config->telnetitems, itemid, sizeof(ZBX_DC_TELNETITEM), &found);
DCstrpool_replace(found, &telnetitem->username, row[20]);
DCstrpool_replace(found, &telnetitem->password, row[21]);
DCstrpool_replace(found, &telnetitem->params, row[17]);
}
- else if (NULL != (telnetitem = zbx_hashset_search(&config->telnetitems, &itemid)))
+ else if (NULL != (telnetitem = (ZBX_DC_TELNETITEM *)zbx_hashset_search(&config->telnetitems, &itemid)))
{
/* remove TELNET item parameters */
@@ -2622,12 +2622,12 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_SIMPLE == item->type)
{
- simpleitem = DCfind_id(&config->simpleitems, itemid, sizeof(ZBX_DC_SIMPLEITEM), &found);
+ simpleitem = (ZBX_DC_SIMPLEITEM *)DCfind_id(&config->simpleitems, itemid, sizeof(ZBX_DC_SIMPLEITEM), &found);
DCstrpool_replace(found, &simpleitem->username, row[20]);
DCstrpool_replace(found, &simpleitem->password, row[21]);
}
- else if (NULL != (simpleitem = zbx_hashset_search(&config->simpleitems, &itemid)))
+ else if (NULL != (simpleitem = (ZBX_DC_SIMPLEITEM *)zbx_hashset_search(&config->simpleitems, &itemid)))
{
/* remove simple item parameters */
@@ -2641,13 +2641,13 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_JMX == item->type)
{
- jmxitem = DCfind_id(&config->jmxitems, itemid, sizeof(ZBX_DC_JMXITEM), &found);
+ jmxitem = (ZBX_DC_JMXITEM *)DCfind_id(&config->jmxitems, itemid, sizeof(ZBX_DC_JMXITEM), &found);
DCstrpool_replace(found, &jmxitem->username, row[20]);
DCstrpool_replace(found, &jmxitem->password, row[21]);
DCstrpool_replace(found, &jmxitem->jmx_endpoint, row[37]);
}
- else if (NULL != (jmxitem = zbx_hashset_search(&config->jmxitems, &itemid)))
+ else if (NULL != (jmxitem = (ZBX_DC_JMXITEM *)zbx_hashset_search(&config->jmxitems, &itemid)))
{
/* remove JMX item parameters */
@@ -2662,7 +2662,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_SNMPTRAP == item->type && 0 == host->proxy_hostid)
{
- interface_snmpitem = DCfind_id(&config->interface_snmpitems,
+ interface_snmpitem = (ZBX_DC_INTERFACE_ITEM *)DCfind_id(&config->interface_snmpitems,
item->interfaceid, sizeof(ZBX_DC_INTERFACE_ITEM), &found);
if (0 == found)
@@ -2680,11 +2680,11 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_CALCULATED == item->type)
{
- calcitem = DCfind_id(&config->calcitems, itemid, sizeof(ZBX_DC_CALCITEM), &found);
+ calcitem = (ZBX_DC_CALCITEM *)DCfind_id(&config->calcitems, itemid, sizeof(ZBX_DC_CALCITEM), &found);
DCstrpool_replace(found, &calcitem->params, row[17]);
}
- else if (NULL != (calcitem = zbx_hashset_search(&config->calcitems, &itemid)))
+ else if (NULL != (calcitem = (ZBX_DC_CALCITEM *)zbx_hashset_search(&config->calcitems, &itemid)))
{
/* remove calculated item parameters */
@@ -2719,17 +2719,17 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
for (i = 0; i < dep_items.values_num; i++)
{
- depitem = dep_items.values[i];
+ depitem = (ZBX_DC_DEPENDENTITEM *)dep_items.values[i];
itemid = depitem->itemid;
dc_masteritem_remove_depitem(depitem->last_master_itemid, itemid);
/* append item to dependent item vector of master item */
- if (NULL == (master = zbx_hashset_search(&config->masteritems, &depitem->master_itemid)))
+ if (NULL == (master = (ZBX_DC_MASTERITEM *)zbx_hashset_search(&config->masteritems, &depitem->master_itemid)))
{
ZBX_DC_MASTERITEM master_local;
master_local.itemid = depitem->master_itemid;
- master = zbx_hashset_insert(&config->masteritems, &master_local, sizeof(master_local));
+ master = (ZBX_DC_MASTERITEM *)zbx_hashset_insert(&config->masteritems, &master_local, sizeof(master_local));
zbx_vector_uint64_create_ext(&master->dep_itemids, __config_mem_malloc_func,
__config_mem_realloc_func, __config_mem_free_func);
@@ -2743,11 +2743,11 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
/* remove deleted items from buffer */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (item = zbx_hashset_search(&config->items, &rowid)))
+ if (NULL == (item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &rowid)))
continue;
if (ITEM_STATUS_ACTIVE == item->status &&
- NULL != (host = zbx_hashset_search(&config->hosts, &item->hostid)))
+ NULL != (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &item->hostid)))
{
dc_host_update_agent_stats(host, item->type, -1);
}
@@ -2761,7 +2761,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_VALUE_TYPE_FLOAT == item->value_type || ITEM_VALUE_TYPE_UINT64 == item->value_type)
{
- numitem = zbx_hashset_search(&config->numitems, &itemid);
+ numitem = (ZBX_DC_NUMITEM *)zbx_hashset_search(&config->numitems, &itemid);
zbx_strpool_release(numitem->units);
@@ -2772,7 +2772,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (SUCCEED == is_snmp_type(item->type))
{
- snmpitem = zbx_hashset_search(&config->snmpitems, &itemid);
+ snmpitem = (ZBX_DC_SNMPITEM *)zbx_hashset_search(&config->snmpitems, &itemid);
zbx_strpool_release(snmpitem->snmp_community);
zbx_strpool_release(snmpitem->snmp_oid);
@@ -2788,7 +2788,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_IPMI == item->type)
{
- ipmiitem = zbx_hashset_search(&config->ipmiitems, &itemid);
+ ipmiitem = (ZBX_DC_IPMIITEM *)zbx_hashset_search(&config->ipmiitems, &itemid);
zbx_strpool_release(ipmiitem->ipmi_sensor);
zbx_hashset_remove_direct(&config->ipmiitems, ipmiitem);
}
@@ -2796,7 +2796,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
/* trapper items */
if (ITEM_TYPE_TRAPPER == item->type &&
- NULL != (trapitem = zbx_hashset_search(&config->trapitems, &itemid)))
+ NULL != (trapitem = (ZBX_DC_TRAPITEM *)zbx_hashset_search(&config->trapitems, &itemid)))
{
zbx_strpool_release(trapitem->trapper_hosts);
zbx_hashset_remove_direct(&config->trapitems, trapitem);
@@ -2804,7 +2804,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
/* dependent items */
- if (NULL != (depitem = zbx_hashset_search(&config->dependentitems, &itemid)))
+ if (NULL != (depitem = (ZBX_DC_DEPENDENTITEM *)zbx_hashset_search(&config->dependentitems, &itemid)))
{
dc_masteritem_remove_depitem(depitem->master_itemid, itemid);
zbx_hashset_remove_direct(&config->dependentitems, depitem);
@@ -2813,7 +2813,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
/* log items */
if (ITEM_VALUE_TYPE_LOG == item->value_type &&
- NULL != (logitem = zbx_hashset_search(&config->logitems, &itemid)))
+ NULL != (logitem = (ZBX_DC_LOGITEM *)zbx_hashset_search(&config->logitems, &itemid)))
{
zbx_strpool_release(logitem->logtimefmt);
zbx_hashset_remove_direct(&config->logitems, logitem);
@@ -2822,7 +2822,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
/* db items */
if (ITEM_TYPE_DB_MONITOR == item->type &&
- NULL != (dbitem = zbx_hashset_search(&config->dbitems, &itemid)))
+ NULL != (dbitem = (ZBX_DC_DBITEM *)zbx_hashset_search(&config->dbitems, &itemid)))
{
zbx_strpool_release(dbitem->params);
zbx_strpool_release(dbitem->username);
@@ -2835,7 +2835,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_SSH == item->type)
{
- sshitem = zbx_hashset_search(&config->sshitems, &itemid);
+ sshitem = (ZBX_DC_SSHITEM *)zbx_hashset_search(&config->sshitems, &itemid);
zbx_strpool_release(sshitem->username);
zbx_strpool_release(sshitem->password);
@@ -2850,7 +2850,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_TELNET == item->type)
{
- telnetitem = zbx_hashset_search(&config->telnetitems, &itemid);
+ telnetitem = (ZBX_DC_TELNETITEM *)zbx_hashset_search(&config->telnetitems, &itemid);
zbx_strpool_release(telnetitem->username);
zbx_strpool_release(telnetitem->password);
@@ -2863,7 +2863,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_SIMPLE == item->type)
{
- simpleitem = zbx_hashset_search(&config->simpleitems, &itemid);
+ simpleitem = (ZBX_DC_SIMPLEITEM *)zbx_hashset_search(&config->simpleitems, &itemid);
zbx_strpool_release(simpleitem->username);
zbx_strpool_release(simpleitem->password);
@@ -2875,7 +2875,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_JMX == item->type)
{
- jmxitem = zbx_hashset_search(&config->jmxitems, &itemid);
+ jmxitem = (ZBX_DC_JMXITEM *)zbx_hashset_search(&config->jmxitems, &itemid);
zbx_strpool_release(jmxitem->username);
zbx_strpool_release(jmxitem->password);
@@ -2888,7 +2888,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (ITEM_TYPE_CALCULATED == item->type)
{
- calcitem = zbx_hashset_search(&config->calcitems, &itemid);
+ calcitem = (ZBX_DC_CALCITEM *)zbx_hashset_search(&config->calcitems, &itemid);
zbx_strpool_release(calcitem->params);
zbx_hashset_remove_direct(&config->calcitems, calcitem);
}
@@ -2897,7 +2897,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
item_hk_local.hostid = item->hostid;
item_hk_local.key = item->key;
- item_hk = zbx_hashset_search(&config->items_hk, &item_hk_local);
+ item_hk = (ZBX_DC_ITEM_HK *)zbx_hashset_search(&config->items_hk, &item_hk_local);
if (item == item_hk->item_ptr)
{
@@ -2915,7 +2915,7 @@ static void DCsync_items(zbx_dbsync_t *sync, int flags)
if (NULL != item->triggers)
config->items.mem_free_func(item->triggers);
- if (NULL != (preprocitem = zbx_hashset_search(&config->preprocitems, &item->itemid)))
+ if (NULL != (preprocitem = (ZBX_DC_PREPROCITEM *)zbx_hashset_search(&config->preprocitems, &item->itemid)))
{
zbx_vector_ptr_destroy(&preprocitem->preproc_ops);
zbx_hashset_remove_direct(&config->preprocitems, preprocitem);
@@ -2950,7 +2950,7 @@ static void DCsync_triggers(zbx_dbsync_t *sync)
ZBX_STR2UINT64(triggerid, row[0]);
- trigger = DCfind_id(&config->triggers, triggerid, sizeof(ZBX_DC_TRIGGER), &found);
+ trigger = (ZBX_DC_TRIGGER *)DCfind_id(&config->triggers, triggerid, sizeof(ZBX_DC_TRIGGER), &found);
/* store new information in trigger structure */
@@ -2990,7 +2990,7 @@ static void DCsync_triggers(zbx_dbsync_t *sync)
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (trigger = zbx_hashset_search(&config->triggers, &rowid)))
+ if (NULL == (trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &rowid)))
continue;
/* force trigger list update for items used in removed trigger */
@@ -3002,10 +3002,10 @@ static void DCsync_triggers(zbx_dbsync_t *sync)
for (i = 0; i < functionids.values_num; i++)
{
- if (NULL == (function = zbx_hashset_search(&config->functions, &functionids.values[i])))
+ if (NULL == (function = (ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions, &functionids.values[i])))
continue;
- if (NULL == (item = zbx_hashset_search(&config->items, &function->itemid)))
+ if (NULL == (item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &function->itemid)))
continue;
item->update_triggers = 1;
@@ -3108,20 +3108,20 @@ static void DCsync_trigdeps(zbx_dbsync_t *sync)
/* find trigdep_down pointer */
ZBX_STR2UINT64(triggerid_down, row[0]);
- if (NULL == (trigger_down = zbx_hashset_search(&config->triggers, &triggerid_down)))
+ if (NULL == (trigger_down = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &triggerid_down)))
continue;
ZBX_STR2UINT64(triggerid_up, row[1]);
- if (NULL == (trigger_up = zbx_hashset_search(&config->triggers, &triggerid_up)))
+ if (NULL == (trigger_up = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &triggerid_up)))
continue;
- trigdep_down = DCfind_id(&config->trigdeps, triggerid_down, sizeof(ZBX_DC_TRIGGER_DEPLIST), &found);
+ trigdep_down = (ZBX_DC_TRIGGER_DEPLIST *)DCfind_id(&config->trigdeps, triggerid_down, sizeof(ZBX_DC_TRIGGER_DEPLIST), &found);
if (0 == found)
dc_trigger_deplist_init(trigdep_down, trigger_down);
else
trigdep_down->refcount++;
- trigdep_up = DCfind_id(&config->trigdeps, triggerid_up, sizeof(ZBX_DC_TRIGGER_DEPLIST), &found);
+ trigdep_up = (ZBX_DC_TRIGGER_DEPLIST *)DCfind_id(&config->trigdeps, triggerid_up, sizeof(ZBX_DC_TRIGGER_DEPLIST), &found);
if (0 == found)
dc_trigger_deplist_init(trigdep_up, trigger_up);
else
@@ -3191,7 +3191,7 @@ static void DCsync_functions(zbx_dbsync_t *sync)
ZBX_STR2UINT64(functionid, row[1]);
ZBX_STR2UINT64(triggerid, row[4]);
- if (NULL == (item = zbx_hashset_search(&config->items, &itemid)))
+ if (NULL == (item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemid)))
{
/* Item could have been created after we have selected them in the */
/* previous queries. However, we shall avoid the check for functions being the */
@@ -3204,7 +3204,7 @@ static void DCsync_functions(zbx_dbsync_t *sync)
/* process function information */
- function = DCfind_id(&config->functions, functionid, sizeof(ZBX_DC_FUNCTION), &found);
+ function = (ZBX_DC_FUNCTION *)DCfind_id(&config->functions, functionid, sizeof(ZBX_DC_FUNCTION), &found);
function->triggerid = triggerid;
function->itemid = itemid;
@@ -3220,10 +3220,10 @@ static void DCsync_functions(zbx_dbsync_t *sync)
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (function = zbx_hashset_search(&config->functions, &rowid)))
+ if (NULL == (function = (ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions, &rowid)))
continue;
- if (NULL != (item = zbx_hashset_search(&config->items, &function->itemid)))
+ if (NULL != (item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &function->itemid)))
{
item->update_triggers = 1;
if (NULL != item->triggers)
@@ -3256,7 +3256,7 @@ static ZBX_DC_REGEXP *dc_regexp_remove_expression(const char *regexp_name, zbx_u
regexp_local.name = regexp_name;
- if (NULL == (regexp = zbx_hashset_search(&config->regexps, &regexp_local)))
+ if (NULL == (regexp = (ZBX_DC_REGEXP *)zbx_hashset_search(&config->regexps, &regexp_local)))
return NULL;
if (FAIL == (index = zbx_vector_uint64_search(&regexp->expressionids, expressionid,
@@ -3300,7 +3300,7 @@ static void DCsync_expressions(zbx_dbsync_t *sync)
break;
ZBX_STR2UINT64(expressionid, row[1]);
- expression = DCfind_id(&config->expressions, expressionid, sizeof(ZBX_DC_EXPRESSION), &found);
+ expression = (ZBX_DC_EXPRESSION *)DCfind_id(&config->expressions, expressionid, sizeof(ZBX_DC_EXPRESSION), &found);
if (0 != found)
dc_regexp_remove_expression(expression->regexp, expressionid);
@@ -3313,7 +3313,7 @@ static void DCsync_expressions(zbx_dbsync_t *sync)
regexp_local.name = row[0];
- if (NULL == (regexp = zbx_hashset_search(&config->regexps, &regexp_local)))
+ if (NULL == (regexp = (ZBX_DC_REGEXP *)zbx_hashset_search(&config->regexps, &regexp_local)))
{
DCstrpool_replace(0, &regexp_local.name, row[0]);
zbx_vector_uint64_create_ext(&regexp_local.expressionids,
@@ -3321,7 +3321,7 @@ static void DCsync_expressions(zbx_dbsync_t *sync)
__config_mem_realloc_func,
__config_mem_free_func);
- regexp = zbx_hashset_insert(&config->regexps, &regexp_local, sizeof(ZBX_DC_REGEXP));
+ regexp = (ZBX_DC_REGEXP *)zbx_hashset_insert(&config->regexps, &regexp_local, sizeof(ZBX_DC_REGEXP));
}
zbx_vector_uint64_append(&regexp->expressionids, expressionid);
@@ -3330,7 +3330,7 @@ static void DCsync_expressions(zbx_dbsync_t *sync)
/* remove regexps with no expressions related to it */
zbx_hashset_iter_reset(&config->regexps, &iter);
- while (NULL != (regexp = zbx_hashset_iter_next(&iter)))
+ while (NULL != (regexp = (ZBX_DC_REGEXP *)zbx_hashset_iter_next(&iter)))
{
if (0 < regexp->expressionids.values_num)
continue;
@@ -3343,7 +3343,7 @@ static void DCsync_expressions(zbx_dbsync_t *sync)
/* remove unused expressions */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (expression = zbx_hashset_search(&config->expressions, &rowid)))
+ if (NULL == (expression = (ZBX_DC_EXPRESSION *)zbx_hashset_search(&config->expressions, &rowid)))
continue;
if (NULL != (regexp = dc_regexp_remove_expression(expression->regexp, expression->expressionid)))
@@ -3399,7 +3399,7 @@ static void DCsync_actions(zbx_dbsync_t *sync)
break;
ZBX_STR2UINT64(actionid, row[0]);
- action = DCfind_id(&config->actions, actionid, sizeof(zbx_dc_action_t), &found);
+ action = (zbx_dc_action_t *)DCfind_id(&config->actions, actionid, sizeof(zbx_dc_action_t), &found);
if (0 == found)
{
@@ -3420,7 +3420,7 @@ static void DCsync_actions(zbx_dbsync_t *sync)
/* remove deleted actions */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (action = zbx_hashset_search(&config->actions, &rowid)))
+ if (NULL == (action = (zbx_dc_action_t *)zbx_hashset_search(&config->actions, &rowid)))
continue;
zbx_strpool_release(action->formula);
@@ -3530,12 +3530,12 @@ static void DCsync_action_conditions(zbx_dbsync_t *sync)
ZBX_STR2UINT64(actionid, row[1]);
- if (NULL == (action = zbx_hashset_search(&config->actions, &actionid)))
+ if (NULL == (action = (zbx_dc_action_t *)zbx_hashset_search(&config->actions, &actionid)))
continue;
ZBX_STR2UINT64(conditionid, row[0]);
- condition = DCfind_id(&config->action_conditions, conditionid, sizeof(zbx_dc_action_condition_t),
+ condition = (zbx_dc_action_condition_t *)DCfind_id(&config->action_conditions, conditionid, sizeof(zbx_dc_action_condition_t),
&found);
ZBX_STR2UCHAR(condition->conditiontype, row[2]);
@@ -3557,10 +3557,10 @@ static void DCsync_action_conditions(zbx_dbsync_t *sync)
/* remove deleted conditions */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (condition = zbx_hashset_search(&config->action_conditions, &rowid)))
+ if (NULL == (condition = (zbx_dc_action_condition_t *)zbx_hashset_search(&config->action_conditions, &rowid)))
continue;
- if (NULL != (action = zbx_hashset_search(&config->actions, &condition->actionid)))
+ if (NULL != (action = (zbx_dc_action_t *)zbx_hashset_search(&config->actions, &condition->actionid)))
{
if (FAIL != (index = zbx_vector_ptr_search(&action->conditions, condition,
ZBX_DEFAULT_PTR_COMPARE_FUNC)))
@@ -3632,7 +3632,7 @@ static void DCsync_correlations(zbx_dbsync_t *sync)
ZBX_STR2UINT64(correlationid, row[0]);
- correlation = DCfind_id(&config->correlations, correlationid, sizeof(zbx_dc_correlation_t), &found);
+ correlation = (zbx_dc_correlation_t *)DCfind_id(&config->correlations, correlationid, sizeof(zbx_dc_correlation_t), &found);
if (0 == found)
{
@@ -3653,7 +3653,7 @@ static void DCsync_correlations(zbx_dbsync_t *sync)
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (correlation = zbx_hashset_search(&config->correlations, &rowid)))
+ if (NULL == (correlation = (zbx_dc_correlation_t *)zbx_hashset_search(&config->correlations, &rowid)))
continue;
zbx_strpool_release(correlation->name);
@@ -3850,14 +3850,14 @@ static void DCsync_corr_conditions(zbx_dbsync_t *sync)
ZBX_STR2UINT64(correlationid, row[1]);
- if (NULL == (correlation = zbx_hashset_search(&config->correlations, &correlationid)))
+ if (NULL == (correlation = (zbx_dc_correlation_t *)zbx_hashset_search(&config->correlations, &correlationid)))
continue;
ZBX_STR2UINT64(conditionid, row[0]);
ZBX_STR2UCHAR(type, row[2]);
condition_size = dc_corr_condition_get_size(type);
- condition = DCfind_id(&config->corr_conditions, conditionid, condition_size, &found);
+ condition = (zbx_dc_corr_condition_t *)DCfind_id(&config->corr_conditions, conditionid, condition_size, &found);
condition->correlationid = correlationid;
condition->type = type;
@@ -3875,11 +3875,11 @@ static void DCsync_corr_conditions(zbx_dbsync_t *sync)
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (condition = zbx_hashset_search(&config->corr_conditions, &rowid)))
+ if (NULL == (condition = (zbx_dc_corr_condition_t *)zbx_hashset_search(&config->corr_conditions, &rowid)))
continue;
/* remove condition from correlation->conditions vector */
- if (NULL != (correlation = zbx_hashset_search(&config->correlations, &condition->correlationid)))
+ if (NULL != (correlation = (zbx_dc_correlation_t *)zbx_hashset_search(&config->correlations, &condition->correlationid)))
{
if (FAIL != (index = zbx_vector_ptr_search(&correlation->conditions, condition,
ZBX_DEFAULT_PTR_COMPARE_FUNC)))
@@ -3950,13 +3950,13 @@ static void DCsync_corr_operations(zbx_dbsync_t *sync)
ZBX_STR2UINT64(correlationid, row[1]);
- if (NULL == (correlation = zbx_hashset_search(&config->correlations, &correlationid)))
+ if (NULL == (correlation = (zbx_dc_correlation_t *)zbx_hashset_search(&config->correlations, &correlationid)))
continue;
ZBX_STR2UINT64(operationid, row[0]);
ZBX_STR2UCHAR(type, row[2]);
- operation = DCfind_id(&config->corr_operations, operationid, sizeof(zbx_dc_corr_operation_t), &found);
+ operation = (zbx_dc_corr_operation_t *)DCfind_id(&config->corr_operations, operationid, sizeof(zbx_dc_corr_operation_t), &found);
operation->type = type;
@@ -3972,11 +3972,11 @@ static void DCsync_corr_operations(zbx_dbsync_t *sync)
/* remove deleted actions */
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (operation = zbx_hashset_search(&config->corr_operations, &rowid)))
+ if (NULL == (operation = (zbx_dc_corr_operation_t *)zbx_hashset_search(&config->corr_operations, &rowid)))
continue;
/* remove operation from correlation->conditions vector */
- if (NULL != (correlation = zbx_hashset_search(&config->correlations, &operation->correlationid)))
+ if (NULL != (correlation = (zbx_dc_correlation_t *)zbx_hashset_search(&config->correlations, &operation->correlationid)))
{
if (FAIL != (index = zbx_vector_ptr_search(&correlation->operations, operation,
ZBX_DEFAULT_PTR_COMPARE_FUNC)))
@@ -4032,7 +4032,7 @@ static void DCsync_hostgroups(zbx_dbsync_t *sync)
ZBX_STR2UINT64(groupid, row[0]);
- group = DCfind_id(&config->hostgroups, groupid, sizeof(zbx_dc_hostgroup_t), &found);
+ group = (zbx_dc_hostgroup_t *)DCfind_id(&config->hostgroups, groupid, sizeof(zbx_dc_hostgroup_t), &found);
if (0 == found)
{
@@ -4047,7 +4047,7 @@ static void DCsync_hostgroups(zbx_dbsync_t *sync)
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (group = zbx_hashset_search(&config->hostgroups, &rowid)))
+ if (NULL == (group = (zbx_dc_hostgroup_t *)zbx_hashset_search(&config->hostgroups, &rowid)))
continue;
if (FAIL != (index = zbx_vector_ptr_search(&config->hostgroups_name, group, dc_compare_hgroups)))
@@ -4100,12 +4100,12 @@ static void DCsync_trigger_tags(zbx_dbsync_t *sync)
ZBX_STR2UINT64(triggerid, row[1]);
- if (NULL == (trigger = zbx_hashset_search(&config->triggers, &triggerid)))
+ if (NULL == (trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &triggerid)))
continue;
ZBX_STR2UINT64(triggertagid, row[0]);
- trigger_tag = DCfind_id(&config->trigger_tags, triggertagid, sizeof(zbx_dc_trigger_tag_t), &found);
+ trigger_tag = (zbx_dc_trigger_tag_t *)DCfind_id(&config->trigger_tags, triggertagid, sizeof(zbx_dc_trigger_tag_t), &found);
DCstrpool_replace(found, &trigger_tag->tag, row[2]);
DCstrpool_replace(found, &trigger_tag->value, row[3]);
@@ -4120,10 +4120,10 @@ static void DCsync_trigger_tags(zbx_dbsync_t *sync)
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (trigger_tag = zbx_hashset_search(&config->trigger_tags, &rowid)))
+ if (NULL == (trigger_tag = (zbx_dc_trigger_tag_t *)zbx_hashset_search(&config->trigger_tags, &rowid)))
continue;
- if (NULL != (trigger = zbx_hashset_search(&config->triggers, &trigger_tag->triggerid)))
+ if (NULL != (trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &trigger_tag->triggerid)))
{
if (FAIL != (index = zbx_vector_ptr_search(&trigger->tags, trigger_tag,
ZBX_DEFAULT_PTR_COMPARE_FUNC)))
@@ -4210,13 +4210,13 @@ static void DCsync_item_preproc(zbx_dbsync_t *sync)
if (NULL == preprocitem || itemid != preprocitem->itemid)
{
- if (NULL == (preprocitem = zbx_hashset_search(&config->preprocitems, &itemid)))
+ if (NULL == (preprocitem = (ZBX_DC_PREPROCITEM *)zbx_hashset_search(&config->preprocitems, &itemid)))
{
ZBX_DC_PREPROCITEM preprocitem_local;
preprocitem_local.itemid = itemid;
- preprocitem = zbx_hashset_insert(&config->preprocitems, &preprocitem_local,
+ preprocitem = (ZBX_DC_PREPROCITEM *)zbx_hashset_insert(&config->preprocitems, &preprocitem_local,
sizeof(preprocitem_local));
zbx_vector_ptr_create_ext(&preprocitem->preproc_ops, __config_mem_malloc_func,
@@ -4226,7 +4226,7 @@ static void DCsync_item_preproc(zbx_dbsync_t *sync)
ZBX_STR2UINT64(item_preprocid, row[0]);
- op = DCfind_id(&config->preprocops, item_preprocid, sizeof(zbx_dc_preproc_op_t), &found);
+ op = (zbx_dc_preproc_op_t *)DCfind_id(&config->preprocops, item_preprocid, sizeof(zbx_dc_preproc_op_t), &found);
ZBX_STR2UCHAR(op->type, row[2]);
DCstrpool_replace(found, &op->params, row[3]);
@@ -4245,10 +4245,10 @@ static void DCsync_item_preproc(zbx_dbsync_t *sync)
for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
{
- if (NULL == (op = zbx_hashset_search(&config->preprocops, &rowid)))
+ if (NULL == (op = (zbx_dc_preproc_op_t *)zbx_hashset_search(&config->preprocops, &rowid)))
continue;
- if (NULL != (preprocitem = zbx_hashset_search(&config->preprocitems, &op->itemid)))
+ if (NULL != (preprocitem = (ZBX_DC_PREPROCITEM *)zbx_hashset_search(&config->preprocitems, &op->itemid)))
{
if (FAIL != (index = zbx_vector_ptr_search(&preprocitem->preproc_ops, op,
ZBX_DEFAULT_PTR_COMPARE_FUNC)))
@@ -4348,8 +4348,8 @@ static void dc_trigger_update_cache()
while (NULL != (function = (ZBX_DC_FUNCTION *)zbx_hashset_iter_next(&iter)))
{
- if (NULL == (item = zbx_hashset_search(&config->items, &function->itemid)) ||
- NULL == (trigger = zbx_hashset_search(&config->triggers, &function->triggerid)))
+ if (NULL == (item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &function->itemid)) ||
+ NULL == (trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &function->triggerid)))
{
continue;
}
@@ -4376,7 +4376,7 @@ static void dc_trigger_update_cache()
continue;
if (ITEM_STATUS_DISABLED == item->status ||
- (NULL == (host = zbx_hashset_search(&config->hosts, &item->hostid)) ||
+ (NULL == (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &item->hostid)) ||
HOST_STATUS_NOT_MONITORED == host->status))
{
trigger->functional = TRIGGER_FUNCTIONAL_FALSE;
@@ -4403,7 +4403,7 @@ static void dc_trigger_update_cache()
item = (ZBX_DC_ITEM *)itemtrigs.values[i].first;
item->update_triggers = 0;
- item->triggers = config->items.mem_realloc_func(item->triggers, (j - i + 1) * sizeof(ZBX_DC_TRIGGER *));
+ item->triggers = (ZBX_DC_TRIGGER **)config->items.mem_realloc_func(item->triggers, (j - i + 1) * sizeof(ZBX_DC_TRIGGER *));
for (k = i; k < j; k++)
item->triggers[k - i] = (ZBX_DC_TRIGGER *)itemtrigs.values[k].second;
@@ -5136,8 +5136,8 @@ static int __config_snmp_item_compare(const ZBX_DC_ITEM *i1, const ZBX_DC_ITEM *
ZBX_RETURN_IF_NOT_EQUAL(f1, f2);
- s1 = zbx_hashset_search(&config->snmpitems, &i1->itemid);
- s2 = zbx_hashset_search(&config->snmpitems, &i2->itemid);
+ s1 = (ZBX_DC_SNMPITEM *)zbx_hashset_search(&config->snmpitems, &i1->itemid);
+ s2 = (ZBX_DC_SNMPITEM *)zbx_hashset_search(&config->snmpitems, &i2->itemid);
ZBX_RETURN_IF_NOT_EQUAL(s1->snmp_community, s2->snmp_community);
ZBX_RETURN_IF_NOT_EQUAL(s1->snmpv3_securityname, s2->snmpv3_securityname);
@@ -5201,8 +5201,8 @@ static int __config_java_item_compare(const ZBX_DC_ITEM *i1, const ZBX_DC_ITEM *
ZBX_RETURN_IF_NOT_EQUAL(i1->interfaceid, i2->interfaceid);
- j1 = zbx_hashset_search(&config->jmxitems, &i1->itemid);
- j2 = zbx_hashset_search(&config->jmxitems, &i2->itemid);
+ j1 = (ZBX_DC_JMXITEM *)zbx_hashset_search(&config->jmxitems, &i1->itemid);
+ j2 = (ZBX_DC_JMXITEM *)zbx_hashset_search(&config->jmxitems, &i2->itemid);
ZBX_RETURN_IF_NOT_EQUAL(j1->username, j2->username);
ZBX_RETURN_IF_NOT_EQUAL(j1->password, j2->password);
@@ -5300,7 +5300,7 @@ int init_configuration_cache(char **error)
goto out;
}
- config = __config_mem_malloc_func(NULL, sizeof(ZBX_DC_CONFIG) +
+ config = (ZBX_DC_CONFIG *)__config_mem_malloc_func(NULL, sizeof(ZBX_DC_CONFIG) +
CONFIG_TIMER_FORKS * sizeof(zbx_vector_ptr_t));
config->time_triggers = (zbx_vector_ptr_t *)(config + 1);
@@ -5421,7 +5421,7 @@ int init_configuration_cache(char **error)
config->config = NULL;
- config->status = __config_mem_malloc_func(NULL, sizeof(ZBX_DC_STATUS));
+ config->status = (ZBX_DC_STATUS *)__config_mem_malloc_func(NULL, sizeof(ZBX_DC_STATUS));
config->status->last_update = 0;
config->availability_diff_ts = 0;
@@ -5538,7 +5538,7 @@ static void DCget_host(DC_HOST *dst_host, const ZBX_DC_HOST *src_host)
strscpy(dst_host->tls_psk, src_host->tls_dc_psk->tls_psk);
}
#endif
- if (NULL != (ipmihost = zbx_hashset_search(&config->ipmihosts, &src_host->hostid)))
+ if (NULL != (ipmihost = (ZBX_DC_IPMIHOST *)zbx_hashset_search(&config->ipmihosts, &src_host->hostid)))
{
dst_host->ipmi_authtype = ipmihost->ipmi_authtype;
dst_host->ipmi_privilege = ipmihost->ipmi_privilege;
@@ -5553,7 +5553,7 @@ static void DCget_host(DC_HOST *dst_host, const ZBX_DC_HOST *src_host)
*dst_host->ipmi_password = '\0';
}
- if (NULL != (host_inventory = zbx_hashset_search(&config->host_inventories, &src_host->hostid)))
+ if (NULL != (host_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories, &src_host->hostid)))
dst_host->inventory_mode = (char)host_inventory->inventory_mode;
else
dst_host->inventory_mode = HOST_INVENTORY_DISABLED;
@@ -5580,7 +5580,7 @@ int DCget_host_by_hostid(DC_HOST *host, zbx_uint64_t hostid)
LOCK_CACHE;
- if (NULL != (dc_host = zbx_hashset_search(&config->hosts, &hostid)))
+ if (NULL != (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)))
{
DCget_host(host, dc_host);
ret = SUCCEED;
@@ -5749,7 +5749,7 @@ size_t DCget_psk_by_identity(const unsigned char *psk_identity, unsigned char *p
psk_i_local.tls_psk_identity = (const char *)psk_identity;
- if (NULL != (psk_i = zbx_hashset_search(&config->psks, &psk_i_local)))
+ if (NULL != (psk_i = (ZBX_DC_PSK *)zbx_hashset_search(&config->psks, &psk_i_local)))
psk_len = zbx_strlcpy((char *)psk_buf, psk_i->tls_psk, psk_buf_len);
UNLOCK_CACHE;
@@ -5824,13 +5824,13 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
{
case ITEM_VALUE_TYPE_FLOAT:
case ITEM_VALUE_TYPE_UINT64:
- numitem = zbx_hashset_search(&config->numitems, &src_item->itemid);
+ numitem = (ZBX_DC_NUMITEM *)zbx_hashset_search(&config->numitems, &src_item->itemid);
dst_item->trends = numitem->trends;
dst_item->units = zbx_strdup(NULL, numitem->units);
break;
case ITEM_VALUE_TYPE_LOG:
- if (NULL != (logitem = zbx_hashset_search(&config->logitems, &src_item->itemid)))
+ if (NULL != (logitem = (ZBX_DC_LOGITEM *)zbx_hashset_search(&config->logitems, &src_item->itemid)))
strscpy(dst_item->logtimefmt, logitem->logtimefmt);
else
*dst_item->logtimefmt = '\0';
@@ -5842,7 +5842,7 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
case ITEM_TYPE_SNMPv1:
case ITEM_TYPE_SNMPv2c:
case ITEM_TYPE_SNMPv3:
- snmpitem = zbx_hashset_search(&config->snmpitems, &src_item->itemid);
+ snmpitem = (ZBX_DC_SNMPITEM *)zbx_hashset_search(&config->snmpitems, &src_item->itemid);
strscpy(dst_item->snmp_community_orig, snmpitem->snmp_community);
strscpy(dst_item->snmp_oid_orig, snmpitem->snmp_oid);
@@ -5862,19 +5862,19 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
dst_item->snmpv3_contextname = NULL;
break;
case ITEM_TYPE_TRAPPER:
- if (NULL != (trapitem = zbx_hashset_search(&config->trapitems, &src_item->itemid)))
+ if (NULL != (trapitem = (ZBX_DC_TRAPITEM *)zbx_hashset_search(&config->trapitems, &src_item->itemid)))
strscpy(dst_item->trapper_hosts, trapitem->trapper_hosts);
else
*dst_item->trapper_hosts = '\0';
break;
case ITEM_TYPE_IPMI:
- if (NULL != (ipmiitem = zbx_hashset_search(&config->ipmiitems, &src_item->itemid)))
+ if (NULL != (ipmiitem = (ZBX_DC_IPMIITEM *)zbx_hashset_search(&config->ipmiitems, &src_item->itemid)))
strscpy(dst_item->ipmi_sensor, ipmiitem->ipmi_sensor);
else
*dst_item->ipmi_sensor = '\0';
break;
case ITEM_TYPE_DB_MONITOR:
- if (NULL != (dbitem = zbx_hashset_search(&config->dbitems, &src_item->itemid)))
+ if (NULL != (dbitem = (ZBX_DC_DBITEM *)zbx_hashset_search(&config->dbitems, &src_item->itemid)))
{
dst_item->params = zbx_strdup(NULL, dbitem->params);
strscpy(dst_item->username_orig, dbitem->username);
@@ -5891,7 +5891,7 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
break;
case ITEM_TYPE_SSH:
- if (NULL != (sshitem = zbx_hashset_search(&config->sshitems, &src_item->itemid)))
+ if (NULL != (sshitem = (ZBX_DC_SSHITEM *)zbx_hashset_search(&config->sshitems, &src_item->itemid)))
{
dst_item->authtype = sshitem->authtype;
strscpy(dst_item->username_orig, sshitem->username);
@@ -5915,7 +5915,7 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
dst_item->password = NULL;
break;
case ITEM_TYPE_TELNET:
- if (NULL != (telnetitem = zbx_hashset_search(&config->telnetitems, &src_item->itemid)))
+ if (NULL != (telnetitem = (ZBX_DC_TELNETITEM *)zbx_hashset_search(&config->telnetitems, &src_item->itemid)))
{
strscpy(dst_item->username_orig, telnetitem->username);
strscpy(dst_item->password_orig, telnetitem->password);
@@ -5931,7 +5931,7 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
dst_item->password = NULL;
break;
case ITEM_TYPE_SIMPLE:
- if (NULL != (simpleitem = zbx_hashset_search(&config->simpleitems, &src_item->itemid)))
+ if (NULL != (simpleitem = (ZBX_DC_SIMPLEITEM *)zbx_hashset_search(&config->simpleitems, &src_item->itemid)))
{
strscpy(dst_item->username_orig, simpleitem->username);
strscpy(dst_item->password_orig, simpleitem->password);
@@ -5945,7 +5945,7 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
dst_item->password = NULL;
break;
case ITEM_TYPE_JMX:
- if (NULL != (jmxitem = zbx_hashset_search(&config->jmxitems, &src_item->itemid)))
+ if (NULL != (jmxitem = (ZBX_DC_JMXITEM *)zbx_hashset_search(&config->jmxitems, &src_item->itemid)))
{
strscpy(dst_item->username_orig, jmxitem->username);
strscpy(dst_item->password_orig, jmxitem->password);
@@ -5962,14 +5962,14 @@ static void DCget_item(DC_ITEM *dst_item, const ZBX_DC_ITEM *src_item)
dst_item->jmx_endpoint = NULL;
break;
case ITEM_TYPE_CALCULATED:
- calcitem = zbx_hashset_search(&config->calcitems, &src_item->itemid);
+ calcitem = (ZBX_DC_CALCITEM *)zbx_hashset_search(&config->calcitems, &src_item->itemid);
dst_item->params = zbx_strdup(NULL, NULL != calcitem ? calcitem->params : "");
break;
default:
/* nothing to do */;
}
- dc_interface = zbx_hashset_search(&config->interfaces, &src_item->interfaceid);
+ dc_interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &src_item->interfaceid);
DCget_interface(&dst_item->interface, dc_interface);
@@ -6027,7 +6027,7 @@ static void DCget_function(DC_FUNCTION *dst_function, const ZBX_DC_FUNCTION *src
sz_function = strlen(src_function->function) + 1;
sz_parameter = strlen(src_function->parameter) + 1;
- dst_function->function = zbx_malloc(NULL, sz_function + sz_parameter);
+ dst_function->function = (char *)zbx_malloc(NULL, sz_function + sz_parameter);
dst_function->parameter = dst_function->function + sz_function;
memcpy(dst_function->function, src_function->function, sz_function);
memcpy(dst_function->parameter, src_function->parameter, sz_parameter);
@@ -6075,7 +6075,7 @@ static void DCget_trigger(DC_TRIGGER *dst_trigger, ZBX_DC_TRIGGER *src_trigger)
zbx_dc_trigger_tag_t *dc_trigger_tag = (zbx_dc_trigger_tag_t *)src_trigger->tags.values[i];
zbx_tag_t *tag;
- tag = zbx_malloc(NULL, sizeof(zbx_tag_t));
+ tag = (zbx_tag_t *)zbx_malloc(NULL, sizeof(zbx_tag_t));
tag->tag = zbx_strdup(NULL, dc_trigger_tag->tag);
tag->value = zbx_strdup(NULL, dc_trigger_tag->value);
@@ -6169,8 +6169,8 @@ void DCconfig_get_items_by_itemids(DC_ITEM *items, const zbx_uint64_t *itemids,
for (i = 0; i < num; i++)
{
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemids[i])) ||
- NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemids[i])) ||
+ NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
{
errcodes[i] = FAIL;
continue;
@@ -6274,7 +6274,7 @@ void DCconfig_get_preprocessable_items(zbx_hashset_t *items, int *timestamp)
item = (zbx_preproc_item_t *)zbx_hashset_insert(items, &item_local, sizeof(item_local));
item->preproc_ops_num = dc_preprocitem->preproc_ops.values_num;
- item->preproc_ops = zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * item->preproc_ops_num);
+ item->preproc_ops = (zbx_preproc_op_t *)zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * item->preproc_ops_num);
for (i = 0; i < dc_preprocitem->preproc_ops.values_num; i++)
{
@@ -6297,7 +6297,7 @@ void DCconfig_get_preprocessable_items(zbx_hashset_t *items, int *timestamp)
}
item->dep_itemids_num = dc_masteritem->dep_itemids.values_num;
- item->dep_itemids = zbx_malloc(NULL, sizeof(zbx_uint64_t) * item->dep_itemids_num);
+ item->dep_itemids = (zbx_uint64_t *)zbx_malloc(NULL, sizeof(zbx_uint64_t) * item->dep_itemids_num);
memcpy(item->dep_itemids, dc_masteritem->dep_itemids.values,
sizeof(zbx_uint64_t) * item->dep_itemids_num);
}
@@ -6332,8 +6332,8 @@ void DCconfig_get_hosts_by_itemids(DC_HOST *hosts, const zbx_uint64_t *itemids,
for (i = 0; i < num; i++)
{
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemids[i])) ||
- NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemids[i])) ||
+ NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
{
errcodes[i] = FAIL;
continue;
@@ -6356,7 +6356,7 @@ void DCconfig_get_triggers_by_triggerids(DC_TRIGGER *triggers, const zbx_uint64_
for (i = 0; i < num; i++)
{
- if (NULL == (dc_trigger = zbx_hashset_search(&config->triggers, &triggerids[i])))
+ if (NULL == (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &triggerids[i])))
{
errcode[i] = FAIL;
continue;
@@ -6393,7 +6393,7 @@ void DCconfig_get_functions_by_functionids(DC_FUNCTION *functions, zbx_uint64_t
for (i = 0; i < num; i++)
{
- if (NULL == (dc_function = zbx_hashset_search(&config->functions, &functionids[i])))
+ if (NULL == (dc_function = (ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions, &functionids[i])))
{
errcodes[i] = FAIL;
continue;
@@ -6491,7 +6491,7 @@ int DCconfig_lock_triggers_by_history_items(zbx_vector_ptr_t *history_items, zbx
{
history_item = (zbx_hc_item_t *)history_items->values[i];
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &history_item->itemid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &history_item->itemid)))
continue;
if (NULL == dc_item->triggers)
@@ -6549,7 +6549,7 @@ void DCconfig_lock_triggers_by_triggerids(zbx_vector_uint64_t *triggerids_in, zb
for (i = 0; i < triggerids_in->values_num; i++)
{
- if (NULL == (dc_trigger = zbx_hashset_search(&config->triggers, &triggerids_in->values[i])))
+ if (NULL == (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &triggerids_in->values[i])))
continue;
if (1 == dc_trigger->locked)
@@ -6578,7 +6578,7 @@ void DCconfig_unlock_triggers(const zbx_vector_uint64_t *triggerids)
for (i = 0; i < triggerids->values_num; i++)
{
- if (NULL == (dc_trigger = zbx_hashset_search(&config->triggers, &triggerids->values[i])))
+ if (NULL == (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &triggerids->values[i])))
continue;
dc_trigger->locked = 0;
@@ -6604,7 +6604,7 @@ void DCconfig_unlock_all_triggers(void)
zbx_hashset_iter_reset(&config->triggers, &iter);
- while (NULL != (dc_trigger = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_iter_next(&iter)))
dc_trigger->locked = 0;
UNLOCK_CACHE;
@@ -6688,7 +6688,7 @@ void DCconfig_get_triggers_by_itemids(zbx_hashset_t *trigger_info, zbx_vector_pt
{
/* skip items which are not in configuration cache and items without triggers */
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemids[i])) || NULL == dc_item->triggers)
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemids[i])) || NULL == dc_item->triggers)
continue;
/* process all triggers for the specified item */
@@ -6699,7 +6699,7 @@ void DCconfig_get_triggers_by_itemids(zbx_hashset_t *trigger_info, zbx_vector_pt
continue;
/* find trigger by id or create a new record in hashset if not found */
- trigger = DCfind_id(trigger_info, dc_trigger->triggerid, sizeof(DC_TRIGGER), &found);
+ trigger = (DC_TRIGGER *)DCfind_id(trigger_info, dc_trigger->triggerid, sizeof(DC_TRIGGER), &found);
if (0 == found)
{
@@ -6737,19 +6737,19 @@ static int DCconfig_find_active_time_function(const char *expression)
while (SUCCEED == get_N_functionid(expression, 1, &functionid, &expression))
{
- if (NULL == (dc_function = zbx_hashset_search(&config->functions, &functionid)))
+ if (NULL == (dc_function = (ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions, &functionid)))
continue;
if (SUCCEED != is_time_function(dc_function->function))
continue;
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &dc_function->itemid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &dc_function->itemid)))
continue;
if (ITEM_STATUS_ACTIVE != dc_item->status)
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -6861,7 +6861,7 @@ void DCconfig_update_interface_snmp_stats(zbx_uint64_t interfaceid, int max_snmp
LOCK_CACHE;
- if (NULL != (dc_interface = zbx_hashset_search(&config->interfaces, &interfaceid)) &&
+ if (NULL != (dc_interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &interfaceid)) &&
SNMP_BULK_ENABLED == dc_interface->bulk)
{
if (dc_interface->max_snmp_succeed < max_snmp_succeed)
@@ -6879,7 +6879,7 @@ static int DCconfig_get_suggested_snmp_vars_nolock(zbx_uint64_t interfaceid, int
int num;
ZBX_DC_INTERFACE *dc_interface;
- dc_interface = zbx_hashset_search(&config->interfaces, &interfaceid);
+ dc_interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &interfaceid);
if (NULL != bulk)
*bulk = (NULL == dc_interface ? SNMP_BULK_DISABLED : dc_interface->bulk);
@@ -6930,7 +6930,7 @@ static int dc_get_interface_by_type(DC_INTERFACE *interface, zbx_uint64_t hostid
interface_ht_local.hostid = hostid;
interface_ht_local.type = type;
- if (NULL != (interface_ht = zbx_hashset_search(&config->interfaces_ht, &interface_ht_local)))
+ if (NULL != (interface_ht = (ZBX_DC_INTERFACE_HT *)zbx_hashset_search(&config->interfaces_ht, &interface_ht_local)))
{
dc_interface = interface_ht->interface_ptr;
DCget_interface(interface, dc_interface);
@@ -6990,12 +6990,12 @@ int DCconfig_get_interface(DC_INTERFACE *interface, zbx_uint64_t hostid, zbx_uin
if (0 != itemid)
{
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemid)))
goto unlock;
if (0 != dc_item->interfaceid)
{
- if (NULL == (dc_interface = zbx_hashset_search(&config->interfaces, &dc_item->interfaceid)))
+ if (NULL == (dc_interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &dc_item->interfaceid)))
goto unlock;
DCget_interface(interface, dc_interface);
@@ -7187,7 +7187,7 @@ int DCconfig_get_poller_items(unsigned char poller_type, DC_ITEM *items)
if (0 == config->config->refresh_unsupported && ITEM_STATE_NOTSUPPORTED == dc_item->state)
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -7234,7 +7234,7 @@ int DCconfig_get_poller_items(unsigned char poller_type, DC_ITEM *items)
{
ZBX_DC_SNMPITEM *snmpitem;
- snmpitem = zbx_hashset_search(&config->snmpitems, &dc_item->itemid);
+ snmpitem = (ZBX_DC_SNMPITEM *)zbx_hashset_search(&config->snmpitems, &dc_item->itemid);
if (ZBX_SNMP_OID_TYPE_NORMAL == snmpitem->snmp_oid_type ||
ZBX_SNMP_OID_TYPE_DYNAMIC == snmpitem->snmp_oid_type)
@@ -7301,7 +7301,7 @@ int DCconfig_get_ipmi_poller_items(int now, DC_ITEM *items, int items_num, int *
if (0 == config->config->refresh_unsupported && ITEM_STATE_NOTSUPPORTED == dc_item->state)
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -7365,10 +7365,10 @@ int DCconfig_get_snmp_interfaceids_by_addr(const char *addr, zbx_uint64_t **inte
LOCK_CACHE;
- if (NULL == (dc_interface_snmpaddr = zbx_hashset_search(&config->interface_snmpaddrs, &dc_interface_snmpaddr_local)))
+ if (NULL == (dc_interface_snmpaddr = (ZBX_DC_INTERFACE_ADDR *)zbx_hashset_search(&config->interface_snmpaddrs, &dc_interface_snmpaddr_local)))
goto unlock;
- *interfaceids = zbx_malloc(*interfaceids, dc_interface_snmpaddr->interfaceids.values_num * sizeof(zbx_uint64_t));
+ *interfaceids = (zbx_uint64_t *)zbx_malloc(*interfaceids, dc_interface_snmpaddr->interfaceids.values_num * sizeof(zbx_uint64_t));
for (i = 0; i < dc_interface_snmpaddr->interfaceids.values_num; i++)
(*interfaceids)[i] = dc_interface_snmpaddr->interfaceids.values[i];
@@ -7408,23 +7408,23 @@ size_t DCconfig_get_snmp_items_by_interfaceid(zbx_uint64_t interfaceid, DC_ITEM
LOCK_CACHE;
- if (NULL == (dc_interface = zbx_hashset_search(&config->interfaces, &interfaceid)))
+ if (NULL == (dc_interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces, &interfaceid)))
goto unlock;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_interface->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_interface->hostid)))
goto unlock;
if (HOST_STATUS_MONITORED != dc_host->status)
goto unlock;
- if (NULL == (dc_interface_snmpitem = zbx_hashset_search(&config->interface_snmpitems, &interfaceid)))
+ if (NULL == (dc_interface_snmpitem = (ZBX_DC_INTERFACE_ITEM *)zbx_hashset_search(&config->interface_snmpitems, &interfaceid)))
goto unlock;
- *items = zbx_malloc(*items, items_alloc * sizeof(DC_ITEM));
+ *items = (DC_ITEM *)zbx_malloc(*items, items_alloc * sizeof(DC_ITEM));
for (i = 0; i < dc_interface_snmpitem->itemids.values_num; i++)
{
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &dc_interface_snmpitem->itemids.values[i])))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &dc_interface_snmpitem->itemids.values[i])))
continue;
if (ITEM_STATUS_ACTIVE != dc_item->status)
@@ -7439,7 +7439,7 @@ size_t DCconfig_get_snmp_items_by_interfaceid(zbx_uint64_t interfaceid, DC_ITEM
if (items_num == items_alloc)
{
items_alloc += 8;
- *items = zbx_realloc(*items, items_alloc * sizeof(DC_ITEM));
+ *items = (DC_ITEM *)zbx_realloc(*items, items_alloc * sizeof(DC_ITEM));
}
DCget_host(&(*items)[items_num].host, dc_host);
@@ -7466,7 +7466,7 @@ static void dc_requeue_items(const zbx_uint64_t *itemids, const unsigned char *s
if (FAIL == errcodes[i])
continue;
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemids[i])))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemids[i])))
continue;
if (ZBX_LOC_POLLER == dc_item->location)
@@ -7475,7 +7475,7 @@ static void dc_requeue_items(const zbx_uint64_t *itemids, const unsigned char *s
if (ITEM_STATUS_ACTIVE != dc_item->status)
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -7553,7 +7553,7 @@ void zbx_dc_requeue_unreachable_items(zbx_uint64_t *itemids, size_t itemids_num)
for (i = 0; i < itemids_num; i++)
{
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemids[i])))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemids[i])))
continue;
if (ZBX_LOC_POLLER == dc_item->location)
@@ -7562,7 +7562,7 @@ void zbx_dc_requeue_unreachable_items(zbx_uint64_t *itemids, size_t itemids_num)
if (ITEM_STATUS_ACTIVE != dc_item->status)
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -7919,7 +7919,7 @@ int DChost_activate(zbx_uint64_t hostid, unsigned char agent_type, const zbx_tim
LOCK_CACHE;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)))
goto unlock;
/* Don't try activating host if: */
@@ -7981,7 +7981,7 @@ int DChost_deactivate(zbx_uint64_t hostid, unsigned char agent_type, const zbx_t
LOCK_CACHE;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)))
goto unlock;
/* Don't try deactivating host if: */
@@ -8069,7 +8069,7 @@ int DCset_hosts_availability(zbx_vector_ptr_t *availabilities)
{
ha = (zbx_host_availability_t *)availabilities->values[i];
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &ha->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &ha->hostid)))
{
int j;
@@ -8179,7 +8179,7 @@ int DCconfig_check_trigger_dependencies(zbx_uint64_t triggerid)
LOCK_CACHE;
- if (NULL != (trigdep = zbx_hashset_search(&config->trigdeps, &triggerid)))
+ if (NULL != (trigdep = (ZBX_DC_TRIGGER_DEPLIST *)zbx_hashset_search(&config->trigdeps, &triggerid)))
ret = DCconfig_check_trigger_dependencies_rec(trigdep, 0, NULL, NULL);
UNLOCK_CACHE;
@@ -8252,7 +8252,7 @@ static void DCconfig_sort_triggers_topologically(void)
zbx_hashset_iter_reset(&config->trigdeps, &iter);
- while (NULL != (trigdep = zbx_hashset_iter_next(&iter)))
+ while (NULL != (trigdep = (ZBX_DC_TRIGGER_DEPLIST *)zbx_hashset_iter_next(&iter)))
{
trigger = trigdep->trigger;
@@ -8286,7 +8286,7 @@ void DCconfig_triggers_apply_changes(zbx_vector_ptr_t *trigger_diff)
{
diff = (zbx_trigger_diff_t *)trigger_diff->values[i];
- if (NULL == (dc_trigger = zbx_hashset_search(&config->triggers, &diff->triggerid)))
+ if (NULL == (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_search(&config->triggers, &diff->triggerid)))
continue;
if (0 != (diff->flags & ZBX_FLAGS_TRIGGER_DIFF_UPDATE_LASTCHANGE))
@@ -8326,7 +8326,7 @@ void DCconfig_set_maintenance(const zbx_uint64_t *hostids, int hostids_num, int
for (i = 0; i < hostids_num; i++)
{
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &hostids[i])))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostids[i])))
continue;
if (HOST_STATUS_MONITORED != dc_host->status && HOST_STATUS_NOT_MONITORED != dc_host->status)
@@ -8394,7 +8394,7 @@ static void DCget_proxy(DC_PROXY *dst_proxy, ZBX_DC_PROXY *src_proxy)
dst_proxy->proxy_tasks_nextcheck = src_proxy->proxy_tasks_nextcheck;
dst_proxy->version = src_proxy->version;
- if (NULL != (host = zbx_hashset_search(&config->hosts, &src_proxy->hostid)))
+ if (NULL != (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &src_proxy->hostid)))
{
strscpy(dst_proxy->host, host->host);
strscpy(dst_proxy->proxy_address, host->proxy_address);
@@ -8434,7 +8434,7 @@ static void DCget_proxy(DC_PROXY *dst_proxy, ZBX_DC_PROXY *src_proxy)
interface_ht_local.hostid = src_proxy->hostid;
interface_ht_local.type = INTERFACE_TYPE_UNKNOWN;
- if (NULL != (interface_ht = zbx_hashset_search(&config->interfaces_ht, &interface_ht_local)))
+ if (NULL != (interface_ht = (ZBX_DC_INTERFACE_HT *)zbx_hashset_search(&config->interfaces_ht, &interface_ht_local)))
{
const ZBX_DC_INTERFACE *interface = interface_ht->interface_ptr;
@@ -8565,8 +8565,8 @@ void DCrequeue_proxy(zbx_uint64_t hostid, unsigned char update_nextcheck)
LOCK_CACHE;
- if (NULL != (dc_host = zbx_hashset_search(&config->hosts, &hostid)) &&
- NULL != (dc_proxy = zbx_hashset_search(&config->proxies, &hostid)))
+ if (NULL != (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)) &&
+ NULL != (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &hostid)))
{
if (ZBX_LOC_POLLER == dc_proxy->location)
dc_proxy->location = ZBX_LOC_NOWHERE;
@@ -8664,7 +8664,7 @@ void DCconfig_set_proxy_timediff(zbx_uint64_t hostid, const zbx_timespec_t *time
LOCK_CACHE;
- if (NULL != (dc_proxy = zbx_hashset_search(&config->proxies, &hostid)))
+ if (NULL != (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &hostid)))
dc_proxy->timediff = timediff->sec;
UNLOCK_CACHE;
@@ -8687,7 +8687,7 @@ static void dc_get_host_macro(const zbx_uint64_t *hostids, int host_num, const c
{
hmacro_hm_local.hostid = hostids[i];
- if (NULL != (hmacro_hm = zbx_hashset_search(&config->hmacros_hm, &hmacro_hm_local)))
+ if (NULL != (hmacro_hm = (ZBX_DC_HMACRO_HM *)zbx_hashset_search(&config->hmacros_hm, &hmacro_hm_local)))
{
for (j = 0; j < hmacro_hm->hmacros.values_num; j++)
{
@@ -8714,7 +8714,7 @@ static void dc_get_host_macro(const zbx_uint64_t *hostids, int host_num, const c
for (i = 0; i < host_num; i++)
{
- if (NULL != (htmpl = zbx_hashset_search(&config->htmpls, &hostids[i])))
+ if (NULL != (htmpl = (ZBX_DC_HTMPL *)zbx_hashset_search(&config->htmpls, &hostids[i])))
{
for (j = 0; j < htmpl->templateids.values_num; j++)
zbx_vector_uint64_append(&templateids, htmpl->templateids.values[j]);
@@ -8737,7 +8737,7 @@ static void dc_get_global_macro(const char *macro, const char *context, char **v
gmacro_m_local.macro = macro;
- if (NULL != (gmacro_m = zbx_hashset_search(&config->gmacros_m, &gmacro_m_local)))
+ if (NULL != (gmacro_m = (ZBX_DC_GMACRO_M *)zbx_hashset_search(&config->gmacros_m, &gmacro_m_local)))
{
for (i = 0; i < gmacro_m->gmacros.values_num; i++)
{
@@ -9018,7 +9018,7 @@ int DCget_item_queue(zbx_vector_ptr_t *queue, int from, int to)
zbx_hashset_iter_reset(&config->items, &iter);
- while (NULL != (dc_item = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_item = (ZBX_DC_ITEM *)zbx_hashset_iter_next(&iter)))
{
const ZBX_DC_HOST *dc_host;
@@ -9028,7 +9028,7 @@ int DCget_item_queue(zbx_vector_ptr_t *queue, int from, int to)
if (SUCCEED != is_counted_in_item_queue(dc_item->type, dc_item->key))
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -9072,7 +9072,7 @@ int DCget_item_queue(zbx_vector_ptr_t *queue, int from, int to)
if (NULL != queue)
{
- queue_item = zbx_malloc(NULL, sizeof(zbx_queue_item_t));
+ queue_item = (zbx_queue_item_t *)zbx_malloc(NULL, sizeof(zbx_queue_item_t));
queue_item->itemid = dc_item->itemid;
queue_item->type = dc_item->type;
queue_item->nextcheck = dc_item->nextcheck;
@@ -9133,10 +9133,10 @@ static int dc_trigger_items_hosts_enabled(const char *expression)
if (SUCCEED != is_uint64_n(p + 1, q - p - 1, &functionid))
continue;
- if (NULL == (dc_function = zbx_hashset_search(&config->functions, &functionid)) ||
- NULL == (dc_item = zbx_hashset_search(&config->items, &dc_function->itemid)) ||
+ if (NULL == (dc_function = (ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions, &functionid)) ||
+ NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &dc_function->itemid)) ||
ITEM_STATUS_ACTIVE != dc_item->status ||
- NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)) ||
+ NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)) ||
HOST_STATUS_MONITORED != dc_host->status)
{
return FAIL;
@@ -9205,7 +9205,7 @@ static void dc_status_update(void)
zbx_hashset_iter_reset(&config->proxies, &iter);
- while (NULL != (dc_proxy = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_iter_next(&iter)))
{
dc_proxy->hosts_monitored = 0;
dc_proxy->hosts_not_monitored = 0;
@@ -9216,7 +9216,7 @@ static void dc_status_update(void)
zbx_hashset_iter_reset(&config->hosts, &iter);
- while (NULL != (dc_host = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_host = (ZBX_DC_HOST *)zbx_hashset_iter_next(&iter)))
{
/* reset per-host/per-proxy item counters */
@@ -9231,7 +9231,7 @@ static void dc_status_update(void)
config->status->hosts_monitored++;
if (0 == dc_host->proxy_hostid)
break;
- if (NULL == (dc_proxy = zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid)))
+ if (NULL == (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid)))
break;
dc_proxy->hosts_monitored++;
break;
@@ -9239,7 +9239,7 @@ static void dc_status_update(void)
config->status->hosts_not_monitored++;
if (0 == dc_host->proxy_hostid)
break;
- if (NULL == (dc_proxy = zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid)))
+ if (NULL == (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid)))
break;
dc_proxy->hosts_not_monitored++;
break;
@@ -9250,7 +9250,7 @@ static void dc_status_update(void)
zbx_hashset_iter_reset(&config->items, &iter);
- while (NULL != (dc_item = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_item = (ZBX_DC_ITEM *)zbx_hashset_iter_next(&iter)))
{
dc_proxy = NULL;
dc_proxy_host = NULL;
@@ -9258,13 +9258,13 @@ static void dc_status_update(void)
if (ZBX_FLAG_DISCOVERY_NORMAL != dc_item->flags && ZBX_FLAG_DISCOVERY_CREATED != dc_item->flags)
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (0 != dc_host->proxy_hostid)
{
- dc_proxy = zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid);
- dc_proxy_host = zbx_hashset_search(&config->hosts, &dc_host->proxy_hostid);
+ dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &dc_host->proxy_hostid);
+ dc_proxy_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_host->proxy_hostid);
}
switch (dc_item->status)
@@ -9318,7 +9318,7 @@ static void dc_status_update(void)
zbx_hashset_iter_reset(&config->triggers, &iter);
- while (NULL != (dc_trigger = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_trigger = (ZBX_DC_TRIGGER *)zbx_hashset_iter_next(&iter)))
{
switch (dc_trigger->status)
{
@@ -9377,7 +9377,7 @@ zbx_uint64_t DCget_item_count(zbx_uint64_t hostid)
if (0 == hostid)
count = config->status->items_active_normal + config->status->items_active_notsupported;
- else if (NULL != (dc_host = zbx_hashset_search(&config->hosts, &hostid)))
+ else if (NULL != (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)))
count = dc_host->items_active_normal + dc_host->items_active_notsupported;
else
count = 0;
@@ -9409,7 +9409,7 @@ zbx_uint64_t DCget_item_unsupported_count(zbx_uint64_t hostid)
if (0 == hostid)
count = config->status->items_active_notsupported;
- else if (NULL != (dc_host = zbx_hashset_search(&config->hosts, &hostid)))
+ else if (NULL != (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)))
count = dc_host->items_active_notsupported;
else
count = 0;
@@ -9489,7 +9489,7 @@ static void proxy_counter_ui64_push(zbx_vector_ptr_t *vector, zbx_uint64_t proxy
{
zbx_proxy_counter_t *proxy_counter;
- proxy_counter = zbx_malloc(NULL, sizeof(zbx_proxy_counter_t));
+ proxy_counter = (zbx_proxy_counter_t *)zbx_malloc(NULL, sizeof(zbx_proxy_counter_t));
proxy_counter->proxyid = proxyid;
proxy_counter->counter_value.ui64 = counter;
zbx_vector_ptr_append(vector, proxy_counter);
@@ -9499,7 +9499,7 @@ static void proxy_counter_dbl_push(zbx_vector_ptr_t *vector, zbx_uint64_t proxyi
{
zbx_proxy_counter_t *proxy_counter;
- proxy_counter = zbx_malloc(NULL, sizeof(zbx_proxy_counter_t));
+ proxy_counter = (zbx_proxy_counter_t *)zbx_malloc(NULL, sizeof(zbx_proxy_counter_t));
proxy_counter->proxyid = proxyid;
proxy_counter->counter_value.dbl = counter;
zbx_vector_ptr_append(vector, proxy_counter);
@@ -9531,12 +9531,12 @@ void DCget_status(zbx_vector_ptr_t *hosts_monitored, zbx_vector_ptr_t *hosts_not
zbx_hashset_iter_reset(&config->proxies, &iter);
- while (NULL != (dc_proxy = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_iter_next(&iter)))
{
proxy_counter_ui64_push(hosts_monitored, dc_proxy->hostid, dc_proxy->hosts_monitored);
proxy_counter_ui64_push(hosts_not_monitored, dc_proxy->hostid, dc_proxy->hosts_not_monitored);
- if (NULL != (dc_proxy_host = zbx_hashset_search(&config->hosts, &dc_proxy->hostid)))
+ if (NULL != (dc_proxy_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_proxy->hostid)))
{
proxy_counter_ui64_push(items_active_normal, dc_proxy->hostid,
dc_proxy_host->items_active_normal);
@@ -9577,17 +9577,17 @@ void DCget_expressions_by_names(zbx_vector_ptr_t *expressions, const char * cons
{
search_regexp.name = names[iname];
- if (NULL != (regexp = zbx_hashset_search(&config->regexps, &search_regexp)))
+ if (NULL != (regexp = (ZBX_DC_REGEXP *)zbx_hashset_search(&config->regexps, &search_regexp)))
{
for (i = 0; i < regexp->expressionids.values_num; i++)
{
zbx_uint64_t expressionid = regexp->expressionids.values[i];
zbx_expression_t *rxp;
- if (NULL == (expression = zbx_hashset_search(&config->expressions, &expressionid)))
+ if (NULL == (expression = (ZBX_DC_EXPRESSION *)zbx_hashset_search(&config->expressions, &expressionid)))
continue;
- rxp = zbx_malloc(NULL, sizeof(zbx_expression_t));
+ rxp = (zbx_expression_t *)zbx_malloc(NULL, sizeof(zbx_expression_t));
rxp->name = zbx_strdup(NULL, regexp->name);
rxp->expression = zbx_strdup(NULL, expression->expression);
rxp->exp_delimiter = expression->delimiter;
@@ -9640,13 +9640,13 @@ int DCget_data_expected_from(zbx_uint64_t itemid, int *seconds)
LOCK_CACHE;
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemid)))
goto unlock;
if (ITEM_STATUS_ACTIVE != dc_item->status)
goto unlock;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
goto unlock;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -9683,10 +9683,10 @@ void zbx_dc_get_hostids_by_functionids(const zbx_uint64_t *functionids, int func
for (i = 0; i < functionids_num; i++)
{
- if (NULL == (function = zbx_hashset_search(&config->functions, &functionids[i])))
+ if (NULL == (function = (ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions, &functionids[i])))
continue;
- if (NULL != (item = zbx_hashset_search(&config->items, &function->itemid)))
+ if (NULL != (item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &function->itemid)))
zbx_vector_uint64_append(hostids, item->hostid);
}
@@ -9741,7 +9741,7 @@ void zbx_config_get(zbx_config_t *cfg, zbx_uint64_t flags)
{
int i;
- cfg->severity_name = zbx_malloc(NULL, TRIGGER_SEVERITY_COUNT * sizeof(char *));
+ cfg->severity_name = (char **)zbx_malloc(NULL, TRIGGER_SEVERITY_COUNT * sizeof(char *));
for (i = 0; i < TRIGGER_SEVERITY_COUNT; i++)
cfg->severity_name[i] = zbx_strdup(NULL, config->config->severity_name[i]);
@@ -9838,7 +9838,7 @@ int DCreset_hosts_availability(zbx_vector_ptr_t *hosts)
{
ZBX_DC_PROXY *proxy;
- if (NULL != (proxy = zbx_hashset_search(&config->proxies, &host->proxy_hostid)))
+ if (NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &host->proxy_hostid)))
{
/* SEC_PER_MIN is a tolerance interval, it was chosen arbitrarily */
if (ZBX_PROXY_HEARTBEAT_FREQUENCY_MAX + SEC_PER_MIN >= now - proxy->lastaccess)
@@ -10037,7 +10037,7 @@ static void dc_action_copy_conditions(const zbx_dc_action_t *dc_action, zbx_vect
condition->conditionid = dc_condition->conditionid;
condition->actionid = dc_action->actionid;
condition->conditiontype = dc_condition->conditiontype;
- condition->operator = dc_condition->op;
+ condition->op = dc_condition->op;
condition->value = zbx_strdup(NULL, dc_condition->value);
condition->value2 = zbx_strdup(NULL, dc_condition->value2);
@@ -10103,20 +10103,20 @@ static void prepare_actions_eval(zbx_vector_ptr_t *actions, zbx_hashset_t *uniq_
for (i = 0; i < actions->values_num; i++)
{
- zbx_action_eval_t *action = actions->values[i];
+ zbx_action_eval_t *action = (zbx_action_eval_t *)actions->values[i];
for (j = 0; j < action->conditions.values_num; j++)
{
- DB_CONDITION *uniq_condition = NULL, *condition = action->conditions.values[j];
+ DB_CONDITION *uniq_condition = NULL, *condition = (DB_CONDITION *)action->conditions.values[j];
if (EVENT_SOURCE_COUNT <= action->eventsource)
{
zbx_db_condition_clean(condition);
}
- else if (NULL == (uniq_condition = zbx_hashset_search(&uniq_conditions[action->eventsource],
+ else if (NULL == (uniq_condition = (DB_CONDITION *)zbx_hashset_search(&uniq_conditions[action->eventsource],
condition)))
{
- uniq_condition = zbx_hashset_insert(&uniq_conditions[action->eventsource],
+ uniq_condition = (DB_CONDITION *)zbx_hashset_insert(&uniq_conditions[action->eventsource],
condition, sizeof(DB_CONDITION));
}
else
@@ -10352,10 +10352,10 @@ static char *dc_correlation_formula_dup(const zbx_dc_correlation_t *dc_correlati
switch (dc_correlation->evaltype)
{
case CONDITION_EVAL_TYPE_OR:
- op = " or";
+ op = (char *)" or";
break;
case CONDITION_EVAL_TYPE_AND:
- op = " and";
+ op = (char *)" and";
break;
}
@@ -10474,7 +10474,7 @@ void zbx_dc_correlation_rules_get(zbx_correlation_rules_t *rules)
zbx_dc_correlation_rules_clean(rules);
zbx_hashset_iter_reset(&config->correlations, &iter);
- while (NULL != (dc_correlation = zbx_hashset_iter_next(&iter)))
+ while (NULL != (dc_correlation = (zbx_dc_correlation_t *)zbx_hashset_iter_next(&iter)))
{
correlation = (zbx_correlation_t *)zbx_malloc(NULL, sizeof(zbx_correlation_t));
correlation->correlationid = dc_correlation->correlationid;
@@ -10488,7 +10488,7 @@ void zbx_dc_correlation_rules_get(zbx_correlation_rules_t *rules)
{
dc_condition = (zbx_dc_corr_condition_t *)dc_correlation->conditions.values[i];
condition_local.corr_conditionid = dc_condition->corr_conditionid;
- condition = zbx_hashset_insert(&rules->conditions, &condition_local, sizeof(condition_local));
+ condition = (zbx_corr_condition_t *)zbx_hashset_insert(&rules->conditions, &condition_local, sizeof(condition_local));
dc_corr_condition_copy(dc_condition, condition);
zbx_vector_ptr_append(&correlation->conditions, condition);
}
@@ -10496,7 +10496,7 @@ void zbx_dc_correlation_rules_get(zbx_correlation_rules_t *rules)
for (i = 0; i < dc_correlation->operations.values_num; i++)
{
zbx_vector_ptr_append(&correlation->operations,
- zbx_dc_corr_operation_dup(dc_correlation->operations.values[i]));
+ zbx_dc_corr_operation_dup((zbx_dc_corr_operation_t *)dc_correlation->operations.values[i]));
}
zbx_vector_ptr_append(&rules->correlations, correlation);
@@ -10531,7 +10531,7 @@ static void dc_get_nested_hostgroupids(zbx_uint64_t groupid, zbx_vector_uint64_t
/* is nevertheless returned so that the SELECT statements of the callers work even if no group */
/* was found. */
- if (NULL != (parent_group = zbx_hashset_search(&config->hostgroups, &groupid)))
+ if (NULL != (parent_group = (zbx_dc_hostgroup_t *)zbx_hashset_search(&config->hostgroups, &groupid)))
{
if (0 == (parent_group->flags & ZBX_DC_HOSTGROUP_FLAGS_NESTED_GROUPIDS))
{
@@ -10607,7 +10607,9 @@ void zbx_dc_get_nested_hostgroupids_by_names(char **names, int names_num, zbx_ve
for (i = 0; i < names_num; i++)
{
- zbx_dc_hostgroup_t group_local = {.name = names[i]}, *group;
+ zbx_dc_hostgroup_t group_local, *group;
+
+ group_local.name = names[i];
if (FAIL != (index = zbx_vector_ptr_bsearch(&config->hostgroups_name, &group_local,
dc_compare_hgroups)))
@@ -10659,7 +10661,7 @@ int zbx_dc_get_active_proxy_by_name(const char *name, DC_PROXY *proxy, char **er
goto out;
}
- if (NULL == (dc_proxy = zbx_hashset_search(&config->proxies, &dc_host->hostid)))
+ if (NULL == (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &dc_host->hostid)))
{
*error = zbx_dsprintf(*error, "proxy \"%s\" not found in configuration cache", name);
goto out;
@@ -10690,7 +10692,7 @@ void zbx_dc_update_proxy_version(zbx_uint64_t hostid, int version)
LOCK_CACHE;
- if (NULL != (dc_proxy = zbx_hashset_search(&config->proxies, &hostid)))
+ if (NULL != (dc_proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &hostid)))
dc_proxy->version = version;
UNLOCK_CACHE;
@@ -10723,13 +10725,13 @@ void zbx_dc_items_update_nextcheck(DC_ITEM *items, zbx_agent_value_t *values, in
if (FAIL == errcodes[i])
continue;
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &items[i].itemid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &items[i].itemid)))
continue;
if (ITEM_STATUS_ACTIVE != dc_item->status)
continue;
- if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
+ if (NULL == (dc_host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &dc_item->hostid)))
continue;
if (HOST_STATUS_MONITORED != dc_host->status)
@@ -10826,19 +10828,19 @@ int zbx_dc_get_host_interfaces(zbx_uint64_t hostid, DC_INTERFACE2 **interfaces,
/* find host entry in 'config->hosts' hashset */
- if (NULL == (host = zbx_hashset_search(&config->hosts, &hostid)))
+ if (NULL == (host = (ZBX_DC_HOST *)zbx_hashset_search(&config->hosts, &hostid)))
goto unlock;
/* allocate memory for results */
if (0 < (*n = host->interfaces_v.values_num))
- *interfaces = zbx_malloc(NULL, sizeof(DC_INTERFACE2) * (size_t)*n);
+ *interfaces = (DC_INTERFACE2 *)zbx_malloc(NULL, sizeof(DC_INTERFACE2) * (size_t)*n);
/* copy data about all host interfaces */
for (i = 0; i < *n; i++)
{
- const ZBX_DC_INTERFACE *src = host->interfaces_v.values[i];
+ const ZBX_DC_INTERFACE *src = (ZBX_DC_INTERFACE *)host->interfaces_v.values[i];
DC_INTERFACE2 *dst = *interfaces + i;
dst->interfaceid = src->interfaceid;
@@ -10882,7 +10884,7 @@ void DCconfig_items_apply_changes(const zbx_vector_ptr_t *item_diff)
{
diff = (const zbx_item_diff_t *)item_diff->values[i];
- if (NULL == (dc_item = zbx_hashset_search(&config->items, &diff->itemid)))
+ if (NULL == (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &diff->itemid)))
continue;
if (0 != (ZBX_FLAGS_ITEM_DIFF_UPDATE_LASTLOGSIZE & diff->flags))
@@ -10925,7 +10927,7 @@ void DCconfig_update_inventory_values(const zbx_vector_ptr_t *inventory_values)
if (NULL == host_inventory || inventory_value->hostid != host_inventory->hostid)
{
- host_inventory = zbx_hashset_search(&config->host_inventories_auto, &inventory_value->hostid);
+ host_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories_auto, &inventory_value->hostid);
if (NULL == host_inventory)
continue;
@@ -10955,15 +10957,15 @@ int DCget_host_inventory_value_by_itemid(zbx_uint64_t itemid, char **replace_to,
LOCK_CACHE;
- if (NULL != (dc_item = zbx_hashset_search(&config->items, &itemid)))
+ if (NULL != (dc_item = (ZBX_DC_ITEM *)zbx_hashset_search(&config->items, &itemid)))
{
- if (NULL != (dc_inventory = zbx_hashset_search(&config->host_inventories_auto, &dc_item->hostid)) &&
+ if (NULL != (dc_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories_auto, &dc_item->hostid)) &&
NULL != dc_inventory->values[value_idx])
{
*replace_to = zbx_strdup(*replace_to, dc_inventory->values[value_idx]);
ret = SUCCEED;
}
- else if (NULL != (dc_inventory = zbx_hashset_search(&config->host_inventories, &dc_item->hostid)))
+ else if (NULL != (dc_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories, &dc_item->hostid)))
{
*replace_to = zbx_strdup(*replace_to, dc_inventory->values[value_idx]);
ret = SUCCEED;
@@ -11011,7 +11013,7 @@ void zbx_dc_get_trigger_dependencies(const zbx_vector_uint64_t *triggerids, zbx_
for (i = 0; i < triggerids->values_num; i++)
{
- if (NULL == (trigdep = zbx_hashset_search(&config->trigdeps, &triggerids->values[i])))
+ if (NULL == (trigdep = (ZBX_DC_TRIGGER_DEPLIST *)zbx_hashset_search(&config->trigdeps, &triggerids->values[i])))
continue;
if (FAIL == (ret = DCconfig_check_trigger_dependencies_rec(trigdep, 0, triggerids, &masterids)) ||
diff --git a/src/libs/zbxdbcache/dbconfig_dump.c b/src/libs/zbxdbcache/dbconfig_dump.c
index 57baeddb85c..9a3598a4a89 100644
--- a/src/libs/zbxdbcache/dbconfig_dump.c
+++ b/src/libs/zbxdbcache/dbconfig_dump.c
@@ -135,7 +135,7 @@ static void DCdump_hosts(ZBX_DC_CONFIG *config)
for (j = 0; j < host->interfaces_v.values_num; j++)
{
- ZBX_DC_INTERFACE *interface = host->interfaces_v.values[j];
+ ZBX_DC_INTERFACE *interface = (ZBX_DC_INTERFACE *)host->interfaces_v.values[j];
zabbix_log(LOG_LEVEL_TRACE, " interfaceid:" ZBX_FS_UI64, interface->interfaceid);
}
@@ -719,7 +719,7 @@ static void DCdump_trigdeps(ZBX_DC_CONFIG *config)
for (j = 0; j < trigdep->dependencies.values_num; j++)
{
- const ZBX_DC_TRIGGER_DEPLIST *trigdep_up = trigdep->dependencies.values[j];
+ const ZBX_DC_TRIGGER_DEPLIST *trigdep_up = (ZBX_DC_TRIGGER_DEPLIST *)trigdep->dependencies.values[j];
zabbix_log(LOG_LEVEL_TRACE, " triggerid:" ZBX_FS_UI64, trigdep_up->triggerid);
}
@@ -791,7 +791,7 @@ static void DCdump_actions(ZBX_DC_CONFIG *config)
for (j = 0; j < action->conditions.values_num; j++)
{
- zbx_dc_action_condition_t *condition = action->conditions.values[j];
+ zbx_dc_action_condition_t *condition = (zbx_dc_action_condition_t *)action->conditions.values[j];
zabbix_log(LOG_LEVEL_TRACE, " conditionid:" ZBX_FS_UI64 " conditiontype:%u operator:%u"
" value:'%s' value2:'%s'", condition->conditionid, condition->conditiontype,
diff --git a/src/libs/zbxdbcache/valuecache.c b/src/libs/zbxdbcache/valuecache.c
index e92b40a72c1..c214ad677a7 100644
--- a/src/libs/zbxdbcache/valuecache.c
+++ b/src/libs/zbxdbcache/valuecache.c
@@ -583,7 +583,7 @@ static zbx_log_value_t *vc_history_logdup(const zbx_log_value_t *log)
{
zbx_log_value_t *plog;
- plog = zbx_malloc(NULL, sizeof(zbx_log_value_t));
+ plog = (zbx_log_value_t *)zbx_malloc(NULL, sizeof(zbx_log_value_t));
plog->timestamp = log->timestamp;
plog->logeventid = log->logeventid;
@@ -719,7 +719,7 @@ static void vc_release_space(zbx_vc_item_t *source_item, size_t space)
/* first remove items with the last accessed time older than a day */
zbx_hashset_iter_reset(&vc_cache->items, &iter);
- while (NULL != (item = zbx_hashset_iter_next(&iter)))
+ while (NULL != (item = (zbx_vc_item_t *)zbx_hashset_iter_next(&iter)))
{
if (0 == item->refcount && source_item != item && item->last_accessed < timestamp)
{
@@ -742,7 +742,7 @@ static void vc_release_space(zbx_vc_item_t *source_item, size_t space)
zbx_hashset_iter_reset(&vc_cache->items, &iter);
- while (NULL != (item = zbx_hashset_iter_next(&iter)))
+ while (NULL != (item = (zbx_vc_item_t *)zbx_hashset_iter_next(&iter)))
{
/* don't remove the item that requested the space and also keep */
/* items currently being accessed */
@@ -845,13 +845,13 @@ static void *vc_item_malloc(zbx_vc_item_t *item, size_t size)
{
char *ptr;
- if (NULL == (ptr = __vc_mem_malloc_func(NULL, size)))
+ if (NULL == (ptr = (char *)__vc_mem_malloc_func(NULL, size)))
{
/* If failed to allocate required memory, try to free space in */
/* cache and allocate again. If there still is not enough space - */
/* return NULL as failure. */
vc_release_space(item, size);
- ptr = __vc_mem_malloc_func(NULL, size);
+ ptr = (char *)__vc_mem_malloc_func(NULL, size);
}
return ptr;
@@ -967,7 +967,7 @@ static zbx_log_value_t *vc_item_logdup(zbx_vc_item_t *item, const zbx_log_value_
{
zbx_log_value_t *plog = NULL;
- if (NULL == (plog = vc_item_malloc(item, sizeof(zbx_log_value_t))))
+ if (NULL == (plog = (zbx_log_value_t *)vc_item_malloc(item, sizeof(zbx_log_value_t))))
return NULL;
plog->timestamp = log->timestamp;
@@ -1272,7 +1272,7 @@ static int vch_item_add_chunk(zbx_vc_item_t *item, int nslots, zbx_vc_chunk_t *i
chunk_size = sizeof(zbx_vc_chunk_t) + sizeof(zbx_history_record_t) * (nslots - 1);
- if (NULL == (chunk = vc_item_malloc(item, chunk_size)))
+ if (NULL == (chunk = (zbx_vc_chunk_t *)vc_item_malloc(item, chunk_size)))
return FAIL;
memset(chunk, 0, sizeof(zbx_vc_chunk_t));
@@ -2572,7 +2572,7 @@ int zbx_vc_init(char **error)
CONFIG_VALUE_CACHE_SIZE -= size_reserved;
- vc_cache = __vc_mem_malloc_func(vc_cache, sizeof(zbx_vc_cache_t));
+ vc_cache = (zbx_vc_cache_t *)__vc_mem_malloc_func(vc_cache, sizeof(zbx_vc_cache_t));
if (NULL == vc_cache)
{
@@ -2658,7 +2658,7 @@ void zbx_vc_reset(void)
vc_try_lock();
zbx_hashset_iter_reset(&vc_cache->items, &iter);
- while (NULL != (item = zbx_hashset_iter_next(&iter)))
+ while (NULL != (item = (zbx_vc_item_t *)zbx_hashset_iter_next(&iter)))
{
vch_item_free_cache(item);
zbx_hashset_iter_remove(&iter);
@@ -2708,7 +2708,7 @@ int zbx_vc_add_values(zbx_vector_ptr_t *history)
{
h = (ZBX_DC_HISTORY *)history->values[i];
- if (NULL != (item = zbx_hashset_search(&vc_cache->items, &h->itemid)))
+ if (NULL != (item = (zbx_vc_item_t *)zbx_hashset_search(&vc_cache->items, &h->itemid)))
{
zbx_history_record_t record = {h->ts, h->value};
@@ -2782,13 +2782,13 @@ int zbx_vc_get_value_range(zbx_uint64_t itemid, int value_type, zbx_vector_histo
if (ZBX_VC_MODE_LOWMEM == vc_cache->mode)
vc_warn_low_memory();
- if (NULL == (item = zbx_hashset_search(&vc_cache->items, &itemid)))
+ if (NULL == (item = (zbx_vc_item_t *)zbx_hashset_search(&vc_cache->items, &itemid)))
{
if (ZBX_VC_MODE_NORMAL == vc_cache->mode)
{
zbx_vc_item_t new_item = {.itemid = itemid, .value_type = value_type};
- if (NULL == (item = zbx_hashset_insert(&vc_cache->items, &new_item, sizeof(zbx_vc_item_t))))
+ if (NULL == (item = (zbx_vc_item_t *)zbx_hashset_insert(&vc_cache->items, &new_item, sizeof(zbx_vc_item_t))))
goto out;
}
else
@@ -2905,13 +2905,13 @@ int zbx_vc_get_value(zbx_uint64_t itemid, int value_type, const zbx_timespec_t *
if (ZBX_VC_MODE_LOWMEM == vc_cache->mode)
vc_warn_low_memory();
- if (NULL == (item = zbx_hashset_search(&vc_cache->items, &itemid)))
+ if (NULL == (item = (zbx_vc_item_t *)zbx_hashset_search(&vc_cache->items, &itemid)))
{
if (ZBX_VC_MODE_NORMAL == vc_cache->mode)
{
zbx_vc_item_t new_item = {.itemid = itemid, .value_type = value_type};
- if (NULL == (item = zbx_hashset_insert(&vc_cache->items, &new_item, sizeof(zbx_vc_item_t))))
+ if (NULL == (item = (zbx_vc_item_t *)zbx_hashset_insert(&vc_cache->items, &new_item, sizeof(zbx_vc_item_t))))
goto out;
}
else
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index c1ccba561e1..cca8378a260 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -766,7 +766,7 @@ void DBadd_condition_alloc(char **sql, size_t *sql_alloc, size_t *sql_offset, co
/* Store lengths of consecutive sequences of values in a temporary array 'seq_len'. */
/* An isolated value is represented as a sequence with length 1. */
- seq_len = zbx_malloc(seq_len, num * sizeof(int));
+ seq_len = (int *)zbx_malloc(seq_len, num * sizeof(int));
for (i = 1, seq_num = 0, value = values[0], len = 1; i < num; i++)
{
@@ -1314,7 +1314,7 @@ static void process_autoreg_hosts(zbx_vector_ptr_t *autoreg_hosts, zbx_uint64_t
zbx_autoreg_host_t *autoreg_host;
int i;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_str_create(&hosts);
if (0 != proxy_hostid)
@@ -1400,7 +1400,7 @@ void DBregister_host_flush(zbx_vector_ptr_t *autoreg_hosts, zbx_uint64_t proxy_h
zbx_autoreg_host_t *autoreg_host;
zbx_uint64_t autoreg_hostid;
zbx_db_insert_t db_insert;
- int i, new = 0, upd = 0;
+ int i, create = 0, update = 0;
char *sql = NULL, *ip_esc, *dns_esc, *host_metadata_esc;
size_t sql_alloc = 256, sql_offset = 0;
zbx_timespec_t ts = {0, 0};
@@ -1417,20 +1417,20 @@ void DBregister_host_flush(zbx_vector_ptr_t *autoreg_hosts, zbx_uint64_t proxy_h
autoreg_host = (zbx_autoreg_host_t *)autoreg_hosts->values[i];
if (0 == autoreg_host->autoreg_hostid)
- new++;
+ create++;
}
- if (0 != new)
+ if (0 != create)
{
- autoreg_hostid = DBget_maxid_num("autoreg_host", new);
+ autoreg_hostid = DBget_maxid_num("autoreg_host", create);
zbx_db_insert_prepare(&db_insert, "autoreg_host", "autoreg_hostid", "proxy_hostid", "host", "listen_ip",
"listen_dns", "listen_port", "host_metadata", NULL);
}
- if (0 != (upd = autoreg_hosts->values_num - new))
+ if (0 != (update = autoreg_hosts->values_num - create))
{
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
}
@@ -1474,13 +1474,13 @@ void DBregister_host_flush(zbx_vector_ptr_t *autoreg_hosts, zbx_uint64_t proxy_h
&ts, TRIGGER_VALUE_PROBLEM, NULL, NULL, NULL, 0, 0, NULL, 0, NULL, 0, NULL);
}
- if (0 != new)
+ if (0 != create)
{
zbx_db_insert_execute(&db_insert);
zbx_db_insert_clean(&db_insert);
}
- if (0 != upd)
+ if (0 != update)
{
DBend_multiple_update(&sql, &sql_alloc, &sql_offset);
DBexecute("%s", sql);
@@ -1943,7 +1943,7 @@ int DBexecute_multiple_query(const char *query, const char *field_name, zbx_vect
size_t sql_alloc = ZBX_KIBIBYTE, sql_offset = 0;
int i, ret = SUCCEED;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
@@ -2193,11 +2193,11 @@ void zbx_db_insert_add_values_dyn(zbx_db_insert_t *self, const zbx_db_value_t **
exit(EXIT_FAILURE);
}
- row = zbx_malloc(NULL, self->fields.values_num * sizeof(zbx_db_value_t));
+ row = (zbx_db_value_t *)zbx_malloc(NULL, self->fields.values_num * sizeof(zbx_db_value_t));
for (i = 0; i < self->fields.values_num; i++)
{
- ZBX_FIELD *field = self->fields.values[i];
+ ZBX_FIELD *field = (ZBX_FIELD *)self->fields.values[i];
const zbx_db_value_t *value = values[i];
switch (field->type)
@@ -2250,9 +2250,9 @@ void zbx_db_insert_add_values(zbx_db_insert_t *self, ...)
for (i = 0; i < self->fields.values_num; i++)
{
- field = self->fields.values[i];
+ field = (ZBX_FIELD *)self->fields.values[i];
- value = zbx_malloc(NULL, sizeof(zbx_db_value_t));
+ value = (zbx_db_value_t *)zbx_malloc(NULL, sizeof(zbx_db_value_t));
switch (field->type)
{
@@ -2339,9 +2339,9 @@ int zbx_db_insert_execute(zbx_db_insert_t *self)
}
#ifndef HAVE_ORACLE
- sql = zbx_malloc(NULL, sql_alloc);
+ sql = (char *)zbx_malloc(NULL, sql_alloc);
#endif
- sql_command = zbx_malloc(NULL, sql_command_alloc);
+ sql_command = (char *)zbx_malloc(NULL, sql_command_alloc);
/* create sql insert statement command */
@@ -2463,7 +2463,7 @@ retry_oracle:
{
const zbx_db_value_t *value = &values[j];
- field = self->fields.values[j];
+ field = (const ZBX_FIELD *)self->fields.values[j];
zbx_chrcpy_alloc(&sql, &sql_alloc, &sql_offset, delim[0 == j]);
@@ -2554,7 +2554,7 @@ void zbx_db_insert_autoincrement(zbx_db_insert_t *self, const char *field_name)
for (i = 0; i < self->fields.values_num; i++)
{
- ZBX_FIELD *field = self->fields.values[i];
+ ZBX_FIELD *field = (ZBX_FIELD *)self->fields.values[i];
if (ZBX_TYPE_ID == field->type && 0 == strcmp(field_name, field->name))
{
diff --git a/src/libs/zbxdbhigh/event.c b/src/libs/zbxdbhigh/event.c
index 6abec0f3726..6a9ad2a3af9 100644
--- a/src/libs/zbxdbhigh/event.c
+++ b/src/libs/zbxdbhigh/event.c
@@ -62,7 +62,7 @@ void zbx_db_get_events_by_eventids(zbx_vector_uint64_t *eventids, zbx_vector_ptr
{
DB_EVENT *event = NULL;
- event = zbx_malloc(event, sizeof(DB_EVENT));
+ event = (DB_EVENT *)zbx_malloc(event, sizeof(DB_EVENT));
ZBX_STR2UINT64(event->eventid, row[0]);
event->source = atoi(row[1]);
event->object = atoi(row[2]);
@@ -114,10 +114,10 @@ void zbx_db_get_events_by_eventids(zbx_vector_uint64_t *eventids, zbx_vector_ptr
continue;
}
- event = events->values[index];
+ event = (DB_EVENT *)events->values[index];
}
- tag = zbx_malloc(NULL, sizeof(zbx_tag_t));
+ tag = (zbx_tag_t *)zbx_malloc(NULL, sizeof(zbx_tag_t));
tag->tag = zbx_strdup(NULL, row[1]);
tag->value = zbx_strdup(NULL, row[2]);
zbx_vector_ptr_append(&event->tags, tag);
@@ -149,7 +149,7 @@ void zbx_db_get_events_by_eventids(zbx_vector_uint64_t *eventids, zbx_vector_ptr
for (i = 0; i < events->values_num; i++)
{
- DB_EVENT *event = events->values[i];
+ DB_EVENT *event = (DB_EVENT *)events->values[i];
if (EVENT_OBJECT_TRIGGER != event->object)
continue;
diff --git a/src/libs/zbxdbhigh/host.c b/src/libs/zbxdbhigh/host.c
index b921d1e3d7b..0d9831aaef3 100644
--- a/src/libs/zbxdbhigh/host.c
+++ b/src/libs/zbxdbhigh/host.c
@@ -32,8 +32,8 @@ static char *get_template_names(const zbx_vector_uint64_t *templateids)
char *sql = NULL, *template_names = NULL;
size_t sql_alloc = 256, sql_offset=0, tmp_alloc = 64, tmp_offset = 0;
- sql = zbx_malloc(sql, sql_alloc);
- template_names = zbx_malloc(template_names, tmp_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
+ template_names = (char *)zbx_malloc(template_names, tmp_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select host"
@@ -191,7 +191,7 @@ static int validate_linked_templates(const zbx_vector_uint64_t *templateids, cha
if (0 == templateids->values_num)
goto out;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
/* items */
if (SUCCEED == ret && 1 < templateids->values_num)
@@ -454,7 +454,7 @@ static int validate_inventory_links(zbx_uint64_t hostid, const zbx_vector_uint64
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
sql_offset = 0;
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
@@ -549,7 +549,7 @@ static int validate_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *te
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
/* selects web scenarios from templates and host with identical names */
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
@@ -631,7 +631,7 @@ static void DBget_graphitems(const char *sql, ZBX_GRAPH_ITEMS **gitems, size_t *
if (*gitems_alloc == *gitems_num)
{
*gitems_alloc += 16;
- *gitems = zbx_realloc(*gitems, *gitems_alloc * sizeof(ZBX_GRAPH_ITEMS));
+ *gitems = (ZBX_GRAPH_ITEMS *)zbx_realloc(*gitems, *gitems_alloc * sizeof(ZBX_GRAPH_ITEMS));
}
gitem = &(*gitems)[*gitems_num];
@@ -738,7 +738,7 @@ static int validate_host(zbx_uint64_t hostid, zbx_vector_uint64_t *templateids,
if (SUCCEED != (ret = validate_httptests(hostid, templateids, error, max_error_len)))
goto out;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
sql_offset = 0;
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
@@ -1054,7 +1054,7 @@ static void DBdelete_triggers(zbx_vector_uint64_t *triggerids)
if (0 == triggerids->values_num)
return;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&selementids);
@@ -1111,7 +1111,7 @@ static void DBdelete_trigger_hierarchy(zbx_vector_uint64_t *triggerids)
if (0 == triggerids->values_num)
return;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&children_triggerids);
@@ -1194,7 +1194,7 @@ void DBdelete_graphs(zbx_vector_uint64_t *graphids)
if (0 == graphids->values_num)
goto out;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&profileids);
zbx_vector_uint64_create(&screen_itemids);
@@ -1256,7 +1256,7 @@ static void DBdelete_graph_hierarchy(zbx_vector_uint64_t *graphids)
if (0 == graphids->values_num)
return;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&children_graphids);
@@ -1300,7 +1300,7 @@ static void DBdelete_graphs_by_itemids(zbx_vector_uint64_t *itemids)
if (0 == itemids->values_num)
goto out;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&graphids);
/* select all graphs with items */
@@ -1368,7 +1368,7 @@ void DBdelete_items(zbx_vector_uint64_t *itemids)
if (0 == itemids->values_num)
goto out;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&screen_itemids);
zbx_vector_uint64_create(&profileids);
@@ -1460,7 +1460,7 @@ static void DBdelete_httptests(zbx_vector_uint64_t *httptestids)
if (0 == httptestids->values_num)
goto out;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&itemids);
/* httpstepitem, httptestitem */
@@ -2139,7 +2139,7 @@ static int DBcopy_trigger_to_host(zbx_uint64_t *new_triggerid, zbx_uint64_t *cur
*correlation_tag_esc;
int res = FAIL;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
@@ -2337,9 +2337,9 @@ static int DBadd_template_dependencies_for_new_triggers(zbx_uint64_t *trids, int
zbx_vector_uint64_pair_create(&links);
- sql = zbx_malloc(sql, sql_alloc);
- tpl_triggerids = zbx_malloc(tpl_triggerids, alloc * sizeof(zbx_uint64_t));
- hst_triggerids = zbx_malloc(hst_triggerids, alloc * sizeof(zbx_uint64_t));
+ sql = (char *)zbx_malloc(sql, sql_alloc);
+ tpl_triggerids = (uint64_t *)zbx_malloc(tpl_triggerids, alloc * sizeof(zbx_uint64_t));
+ hst_triggerids = (uint64_t *)zbx_malloc(hst_triggerids, alloc * sizeof(zbx_uint64_t));
sql_offset = 0;
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
@@ -2358,8 +2358,8 @@ static int DBadd_template_dependencies_for_new_triggers(zbx_uint64_t *trids, int
if (alloc == count)
{
alloc += 16;
- hst_triggerids = zbx_realloc(hst_triggerids, alloc * sizeof(zbx_uint64_t));
- tpl_triggerids = zbx_realloc(tpl_triggerids, alloc * sizeof(zbx_uint64_t));
+ hst_triggerids = (uint64_t *)zbx_realloc(hst_triggerids, alloc * sizeof(zbx_uint64_t));
+ tpl_triggerids = (uint64_t *)zbx_realloc(tpl_triggerids, alloc * sizeof(zbx_uint64_t));
}
hst_triggerids[count] = triggerid;
@@ -2610,7 +2610,7 @@ int DBdelete_template_elements(zbx_uint64_t hostid, zbx_vector_uint64_t *del_tem
/* unlinked applications */
DBdelete_template_applications(hostid, del_templateids);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"delete from hosts_templates"
@@ -2807,7 +2807,7 @@ static void DBcopy_template_applications(zbx_uint64_t hostid, const zbx_vector_u
zbx_vector_ptr_create(&applications);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select applicationid,hostid,name"
@@ -3423,7 +3423,7 @@ static void DBhost_prototypes_save(zbx_vector_ptr_t *host_prototypes, zbx_vector
if (new_hosts != host_prototypes->values_num || 0 != upd_group_prototypes)
{
- sql1 = zbx_malloc(sql1, sql1_alloc);
+ sql1 = (char *)zbx_malloc(sql1, sql1_alloc);
DBbegin_multiple_update(&sql1, &sql1_alloc, &sql1_offset);
}
@@ -3437,7 +3437,7 @@ static void DBhost_prototypes_save(zbx_vector_ptr_t *host_prototypes, zbx_vector
if (0 != del_hosttemplateids->values_num)
{
- sql2 = zbx_malloc(sql2, sql2_alloc);
+ sql2 = (char *)zbx_malloc(sql2, sql2_alloc);
zbx_strcpy_alloc(&sql2, &sql2_alloc, &sql2_offset, "delete from hosts_templates where");
DBadd_condition_alloc(&sql2, &sql2_alloc, &sql2_offset, "hosttemplateid",
del_hosttemplateids->values, del_hosttemplateids->values_num);
@@ -3621,7 +3621,7 @@ static int DBcopy_template_triggers(zbx_uint64_t hostid, const zbx_vector_uint64
zbx_vector_uint64_create(&new_triggerids);
zbx_vector_uint64_create(&cur_triggerids);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
sql_offset = 0;
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
@@ -3758,7 +3758,7 @@ static void DBcopy_graph_to_host(zbx_uint64_t hostid, zbx_uint64_t graphid,
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- sql = zbx_malloc(sql, sql_alloc * sizeof(char));
+ sql = (char *)zbx_malloc(sql, sql_alloc * sizeof(char));
name_esc = DBdyn_escape_string(name);
@@ -3956,7 +3956,7 @@ static void DBcopy_template_graphs(zbx_uint64_t hostid, const zbx_vector_uint64_
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select distinct g.graphid,g.name,g.width,g.height,g.yaxismin,"
@@ -4098,7 +4098,7 @@ static void DBget_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *temp
zbx_vector_uint64_create(&applications);
zbx_vector_uint64_create(&items);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select t.httptestid,t.name,t.applicationid,t.delay,t.status,t.agent,t.authentication,"
@@ -4115,7 +4115,7 @@ static void DBget_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *temp
while (NULL != (row = DBfetch(result)))
{
- httptest = zbx_calloc(NULL, 1, sizeof(httptest_t));
+ httptest = (httptest_t *)zbx_calloc(NULL, 1, sizeof(httptest_t));
ZBX_STR2UINT64(httptest->templateid, row[0]);
ZBX_DBROW2UINT64(httptest->httptestid, row[11]);
@@ -4178,7 +4178,7 @@ static void DBget_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *temp
httptest = (httptest_t *)httptests->values[i];
}
- httpfield = zbx_malloc(NULL, sizeof(httpfield_t));
+ httpfield = (httpfield_t *)zbx_malloc(NULL, sizeof(httpfield_t));
httpfield->type = atoi(row[1]);
httpfield->name = zbx_strdup(NULL, row[2]);
@@ -4219,7 +4219,7 @@ static void DBget_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *temp
httptest = (httptest_t *)httptests->values[i];
}
- httpstep = zbx_malloc(NULL, sizeof(httptest_t));
+ httpstep = (httpstep_t *)zbx_malloc(NULL, sizeof(httptest_t));
ZBX_STR2UINT64(httpstep->httpstepid, row[0]);
httpstep->name = zbx_strdup(NULL, row[2]);
@@ -4292,7 +4292,7 @@ static void DBget_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *temp
httpstep = (httpstep_t *)httptest->httpsteps.values[i];
}
- httpfield = zbx_malloc(NULL, sizeof(httpfield_t));
+ httpfield = (httpfield_t *)zbx_malloc(NULL, sizeof(httpfield_t));
httpfield->type = atoi(row[2]);
httpfield->name = zbx_strdup(NULL, row[3]);
@@ -4368,7 +4368,7 @@ static void DBget_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *temp
httptest = (httptest_t *)httptests->values[i];
}
- httptestitem = zbx_calloc(NULL, 1, sizeof(httptestitem_t));
+ httptestitem = (httptestitem_t *)zbx_calloc(NULL, 1, sizeof(httptestitem_t));
ZBX_STR2UINT64(httptestitem->t_itemid, row[1]);
httptestitem->type = (unsigned char)atoi(row[2]);
@@ -4430,7 +4430,7 @@ static void DBget_httptests(zbx_uint64_t hostid, const zbx_vector_uint64_t *temp
httpstep = (httpstep_t *)httptest->httpsteps.values[i];
}
- httpstepitem = zbx_calloc(NULL, 1, sizeof(httpstepitem_t));
+ httpstepitem = (httpstepitem_t *)zbx_calloc(NULL, 1, sizeof(httpstepitem_t));
ZBX_STR2UINT64(httpstepitem->t_itemid, row[2]);
httpstepitem->type = (unsigned char)atoi(row[3]);
@@ -4558,7 +4558,7 @@ static void DBsave_httptests(zbx_uint64_t hostid, zbx_vector_ptr_t *httptests)
}
if (httptests->values_num != num_httptests)
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
if (0 != num_httptestfields)
{
@@ -5312,7 +5312,7 @@ void DBdelete_groups(zbx_vector_uint64_t *groupids)
for (i = 0; i < groupids->values_num; i++)
DBdelete_action_conditions(CONDITION_TYPE_HOST_GROUP, groupids->values[i]);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_uint64_create(&screen_itemids);
zbx_vector_uint64_create(&selementids);
diff --git a/src/libs/zbxdbhigh/itservices.c b/src/libs/zbxdbhigh/itservices.c
index 363d0ccbf5f..068f7ddd12c 100644
--- a/src/libs/zbxdbhigh/itservices.c
+++ b/src/libs/zbxdbhigh/itservices.c
@@ -127,14 +127,14 @@ static void its_itservices_clean(zbx_itservices_t *itservices)
zbx_hashset_iter_reset(&itservices->index, &iter);
- while (NULL != (index = zbx_hashset_iter_next(&iter)))
+ while (NULL != (index = (zbx_itservice_index_t *)zbx_hashset_iter_next(&iter)))
zbx_vector_ptr_destroy(&index->itservices);
zbx_hashset_destroy(&itservices->index);
zbx_hashset_iter_reset(&itservices->itservices, &iter);
- while (NULL != (itservice = zbx_hashset_iter_next(&iter)))
+ while (NULL != (itservice = (zbx_itservice_t *)zbx_hashset_iter_next(&iter)))
{
zbx_vector_ptr_destroy(&itservice->children);
zbx_vector_ptr_destroy(&itservice->parents);
@@ -168,17 +168,17 @@ static zbx_itservice_t *its_itservice_create(zbx_itservices_t *itservices, zbx_u
zbx_vector_ptr_create(&itservice.children);
zbx_vector_ptr_create(&itservice.parents);
- pitservice = zbx_hashset_insert(&itservices->itservices, &itservice, sizeof(itservice));
+ pitservice = (zbx_itservice_t *)zbx_hashset_insert(&itservices->itservices, &itservice, sizeof(itservice));
if (0 != triggerid)
{
- if (NULL == (pindex = zbx_hashset_search(&itservices->index, &triggerid)))
+ if (NULL == (pindex = (zbx_itservice_index_t *)zbx_hashset_search(&itservices->index, &triggerid)))
{
zbx_itservice_index_t index = {.triggerid = triggerid};
zbx_vector_ptr_create(&index.itservices);
- pindex = zbx_hashset_insert(&itservices->index, &index, sizeof(index));
+ pindex = (zbx_itservice_index_t *)zbx_hashset_insert(&itservices->index, &index, sizeof(index));
}
zbx_vector_ptr_append(&pindex->itservices, pitservice);
@@ -203,7 +203,7 @@ static void its_updates_append(zbx_vector_ptr_t *updates, zbx_uint64_t sourceid,
{
zbx_status_update_t *update;
- update = zbx_malloc(NULL, sizeof(zbx_status_update_t));
+ update = (zbx_status_update_t *)zbx_malloc(NULL, sizeof(zbx_status_update_t));
update->sourceid = sourceid;
update->status = status;
@@ -245,7 +245,7 @@ static void its_itservices_load_children(zbx_itservices_t *itservices)
zbx_hashset_iter_reset(&itservices->itservices, &iter);
- while (NULL != (itservice = zbx_hashset_iter_next(&iter)))
+ while (NULL != (itservice = (zbx_itservice_t *)zbx_hashset_iter_next(&iter)))
{
if (0 == itservice->triggerid)
zbx_vector_uint64_append(&serviceids, itservice->serviceid);
@@ -272,13 +272,13 @@ static void its_itservices_load_children(zbx_itservices_t *itservices)
ZBX_STR2UINT64(serviceid, row[0]);
ZBX_STR2UINT64(parentid, row[3]);
- if (NULL == (parent = zbx_hashset_search(&itservices->itservices, &parentid)))
+ if (NULL == (parent = (zbx_itservice_t *)zbx_hashset_search(&itservices->itservices, &parentid)))
{
THIS_SHOULD_NEVER_HAPPEN;
continue;
}
- if (NULL == (itservice = zbx_hashset_search(&itservices->itservices, &serviceid)))
+ if (NULL == (itservice = (zbx_itservice_t *)zbx_hashset_search(&itservices->itservices, &serviceid)))
itservice = its_itservice_create(itservices, serviceid, 0, atoi(row[1]), atoi(row[2]));
if (FAIL == zbx_vector_ptr_search(&parent->children, itservice, ZBX_DEFAULT_PTR_COMPARE_FUNC))
@@ -339,14 +339,14 @@ static void its_itservices_load_parents(zbx_itservices_t *itservices, zbx_vector
ZBX_STR2UINT64(serviceid, row[3]);
/* find the service */
- if (NULL == (itservice = zbx_hashset_search(&itservices->itservices, &serviceid)))
+ if (NULL == (itservice = (zbx_itservice_t *)zbx_hashset_search(&itservices->itservices, &serviceid)))
{
THIS_SHOULD_NEVER_HAPPEN;
continue;
}
/* find/load the parent service */
- if (NULL == (parent = zbx_hashset_search(&itservices->itservices, &parentid)))
+ if (NULL == (parent = (zbx_itservice_t *)zbx_hashset_search(&itservices->itservices, &parentid)))
{
parent = its_itservice_create(itservices, parentid, 0, atoi(row[1]), atoi(row[2]));
zbx_vector_uint64_append(serviceids, parent->serviceid);
@@ -483,7 +483,7 @@ static void its_itservice_update_status(zbx_itservice_t *itservice, int clock, z
/* update parent services */
for (i = 0; i < itservice->parents.values_num; i++)
- its_itservice_update_status(itservice->parents.values[i], clock, alarms);
+ its_itservice_update_status((zbx_itservice_t *)itservice->parents.values[i], clock, alarms);
}
out:
;
@@ -531,7 +531,7 @@ static int its_write_status_and_alarms(zbx_itservices_t *itservices, zbx_vector_
zbx_vector_ptr_create(&updates);
zbx_hashset_iter_reset(&itservices->itservices, &iter);
- while (NULL != (itservice = zbx_hashset_iter_next(&iter)))
+ while (NULL != (itservice = (zbx_itservice_t *)zbx_hashset_iter_next(&iter)))
{
if (itservice->old_status != itservice->status)
its_updates_append(&updates, itservice->serviceid, itservice->status, 0);
@@ -547,7 +547,7 @@ static int its_write_status_and_alarms(zbx_itservices_t *itservices, zbx_vector_
for (i = 0; i < updates.values_num; i++)
{
- zbx_status_update_t *update = updates.values[i];
+ zbx_status_update_t *update = (zbx_status_update_t *)updates.values[i];
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"update services"
@@ -582,7 +582,7 @@ static int its_write_status_and_alarms(zbx_itservices_t *itservices, zbx_vector_
for (i = 0; i < alarms->values_num; i++)
{
- zbx_status_update_t *update = alarms->values[i];
+ zbx_status_update_t *update = (zbx_status_update_t *)alarms->values[i];
zbx_db_insert_add_values(&db_insert, alarmid++, update->sourceid, update->status,
update->clock);
@@ -664,9 +664,9 @@ static int its_flush_updates(const zbx_vector_ptr_t *updates)
/* apply status updates */
for (i = 0; i < updates->values_num; i++)
{
- update = updates->values[i];
+ update = (const zbx_status_update_t *)updates->values[i];
- if (NULL == (index = zbx_hashset_search(&itservices.index, update)))
+ if (NULL == (index = (zbx_itservice_index_t *)zbx_hashset_search(&itservices.index, update)))
continue;
/* change the status of services based on the update */
@@ -688,7 +688,7 @@ static int its_flush_updates(const zbx_vector_ptr_t *updates)
/* update parent services */
for (k = 0; k < itservice->parents.values_num; k++)
- its_itservice_update_status(itservice->parents.values[k], update->clock, &alarms);
+ its_itservice_update_status((zbx_itservice_t *)itservice->parents.values[k], update->clock, &alarms);
}
}
diff --git a/src/libs/zbxdbhigh/lld.c b/src/libs/zbxdbhigh/lld.c
index 90cc69a8d83..46deb81a07e 100644
--- a/src/libs/zbxdbhigh/lld.c
+++ b/src/libs/zbxdbhigh/lld.c
@@ -164,7 +164,7 @@ static int lld_filter_load(lld_filter_t *filter, zbx_uint64_t lld_ruleid, char *
while (NULL != (row = DBfetch(result)))
{
- condition = zbx_malloc(NULL, sizeof(lld_condition_t));
+ condition = (lld_condition_t *)zbx_malloc(NULL, sizeof(lld_condition_t));
ZBX_STR2UINT64(condition->id, row[0]);
condition->macro = zbx_strdup(NULL, row[1]);
condition->regexp = zbx_strdup(NULL, row[2]);
@@ -521,7 +521,7 @@ static int lld_rows_get(const char *value, lld_filter_t *filter, zbx_vector_ptr_
if (SUCCEED != filter_evaluate(filter, &jp_row))
continue;
- lld_row = zbx_malloc(NULL, sizeof(zbx_lld_row_t));
+ lld_row = (zbx_lld_row_t *)zbx_malloc(NULL, sizeof(zbx_lld_row_t));
lld_row->jp_row = jp_row;
zbx_vector_ptr_create(&lld_row->item_links);
@@ -587,7 +587,7 @@ void lld_process_discovery_rule(zbx_uint64_t lld_ruleid, const char *value, cons
lld_filter_init(&filter);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
result = DBselect(
"select hostid,key_,state,evaltype,formula,error,lifetime"
diff --git a/src/libs/zbxdbhigh/lld_graph.c b/src/libs/zbxdbhigh/lld_graph.c
index daa4c49d147..7b0f68916a4 100644
--- a/src/libs/zbxdbhigh/lld_graph.c
+++ b/src/libs/zbxdbhigh/lld_graph.c
@@ -171,7 +171,7 @@ static void lld_graphs_get(zbx_uint64_t parent_graphid, zbx_vector_ptr_t *graphs
while (NULL != (row = DBfetch(result)))
{
- graph = zbx_malloc(NULL, sizeof(zbx_lld_graph_t));
+ graph = (zbx_lld_graph_t *)zbx_malloc(NULL, sizeof(zbx_lld_graph_t));
ZBX_STR2UINT64(graph->graphid, row[0]);
graph->name = zbx_strdup(NULL, row[1]);
@@ -270,7 +270,7 @@ static void lld_gitems_get(zbx_uint64_t parent_graphid, zbx_vector_ptr_t *gitems
zbx_vector_uint64_sort(&graphids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select gitemid,graphid,itemid,drawtype,sortorder,color,yaxisside,calc_fnc,type"
@@ -285,7 +285,7 @@ static void lld_gitems_get(zbx_uint64_t parent_graphid, zbx_vector_ptr_t *gitems
while (NULL != (row = DBfetch(result)))
{
- gitem = zbx_malloc(NULL, sizeof(zbx_lld_gitem_t));
+ gitem = (zbx_lld_gitem_t *)zbx_malloc(NULL, sizeof(zbx_lld_gitem_t));
ZBX_STR2UINT64(gitem->gitemid, row[0]);
ZBX_STR2UINT64(graphid, row[1]);
@@ -381,7 +381,7 @@ static void lld_items_get(const zbx_vector_ptr_t *gitems_proto, zbx_uint64_t ymi
zbx_vector_uint64_sort(&itemids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select itemid,flags"
@@ -395,7 +395,7 @@ static void lld_items_get(const zbx_vector_ptr_t *gitems_proto, zbx_uint64_t ymi
while (NULL != (row = DBfetch(result)))
{
- item = zbx_malloc(NULL, sizeof(zbx_lld_item_t));
+ item = (zbx_lld_item_t *)zbx_malloc(NULL, sizeof(zbx_lld_item_t));
ZBX_STR2UINT64(item->itemid, row[0]);
ZBX_STR2UCHAR(item->flags, row[1]);
@@ -532,7 +532,7 @@ static int lld_gitems_make(const zbx_vector_ptr_t *gitems_proto, zbx_vector_ptr_
if (i == gitems->values_num)
{
- gitem = zbx_malloc(NULL, sizeof(zbx_lld_gitem_t));
+ gitem = (zbx_lld_gitem_t *)zbx_malloc(NULL, sizeof(zbx_lld_gitem_t));
gitem->gitemid = 0;
gitem->itemid = itemid;
@@ -668,7 +668,7 @@ static void lld_graph_make(const zbx_vector_ptr_t *gitems_proto, zbx_vector_ptr
}
else
{
- graph = zbx_malloc(NULL, sizeof(zbx_lld_graph_t));
+ graph = (zbx_lld_graph_t *)zbx_malloc(NULL, sizeof(zbx_lld_graph_t));
graph->graphid = 0;
@@ -849,7 +849,7 @@ static void lld_graphs_validate(zbx_uint64_t hostid, zbx_vector_ptr_t *graphs, c
char *sql = NULL;
size_t sql_alloc = 256, sql_offset = 0;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select g.name"
@@ -1013,7 +1013,7 @@ static int lld_graphs_save(zbx_uint64_t hostid, zbx_uint64_t parent_graphid, zbx
if (0 != upd_graphs || 0 != upd_gitems.values_num || 0 != del_gitemids.values_num)
{
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
}
diff --git a/src/libs/zbxdbhigh/lld_host.c b/src/libs/zbxdbhigh/lld_host.c
index 7e6fd79fb1f..4ea1d43b4a0 100644
--- a/src/libs/zbxdbhigh/lld_host.c
+++ b/src/libs/zbxdbhigh/lld_host.c
@@ -226,7 +226,7 @@ static void lld_hosts_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, z
while (NULL != (row = DBfetch(result)))
{
- host = zbx_malloc(NULL, sizeof(zbx_lld_host_t));
+ host = (zbx_lld_host_t *)zbx_malloc(NULL, sizeof(zbx_lld_host_t));
ZBX_STR2UINT64(host->hostid, row[0]);
host->host_proto = zbx_strdup(NULL, row[1]);
@@ -594,7 +594,7 @@ static zbx_lld_host_t *lld_host_make(zbx_vector_ptr_t *hosts, const char *host_p
if (i == hosts->values_num) /* no host found */
{
- host = zbx_malloc(NULL, sizeof(zbx_lld_host_t));
+ host = (zbx_lld_host_t *)zbx_malloc(NULL, sizeof(zbx_lld_host_t));
host->hostid = 0;
host->host_proto = NULL;
@@ -825,7 +825,7 @@ static void lld_group_prototypes_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_
while (NULL != (row = DBfetch(result)))
{
- group_prototype = zbx_malloc(NULL, sizeof(zbx_lld_group_prototype_t));
+ group_prototype = (zbx_lld_group_prototype_t *)zbx_malloc(NULL, sizeof(zbx_lld_group_prototype_t));
ZBX_STR2UINT64(group_prototype->group_prototypeid, row[0]);
group_prototype->name = zbx_strdup(NULL, row[1]);
@@ -870,7 +870,7 @@ static void lld_groups_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *groups)
while (NULL != (row = DBfetch(result)))
{
- group = zbx_malloc(NULL, sizeof(zbx_lld_group_t));
+ group = (zbx_lld_group_t *)zbx_malloc(NULL, sizeof(zbx_lld_group_t));
ZBX_STR2UINT64(group->groupid, row[0]);
ZBX_STR2UINT64(group->group_prototypeid, row[1]);
@@ -949,7 +949,7 @@ static zbx_lld_group_t *lld_group_make(zbx_vector_ptr_t *groups, zbx_uint64_t gr
/* otherwise create a new group */
- group = zbx_malloc(NULL, sizeof(zbx_lld_group_t));
+ group = (zbx_lld_group_t *)zbx_malloc(NULL, sizeof(zbx_lld_group_t));
group->groupid = 0;
group->group_prototypeid = group_prototypeid;
@@ -1601,7 +1601,7 @@ static void lld_hostmacros_get(zbx_uint64_t lld_ruleid, zbx_vector_ptr_t *hostma
while (NULL != (row = DBfetch(result)))
{
- hostmacro = zbx_malloc(NULL, sizeof(zbx_lld_hostmacro_t));
+ hostmacro = (zbx_lld_hostmacro_t *)zbx_malloc(NULL, sizeof(zbx_lld_hostmacro_t));
hostmacro->macro = zbx_strdup(NULL, row[0]);
hostmacro->value = zbx_strdup(NULL, row[1]);
@@ -1653,7 +1653,7 @@ static void lld_hostmacros_make(const zbx_vector_ptr_t *hostmacros, zbx_vector_p
zbx_vector_ptr_reserve(&host->new_hostmacros, hostmacros->values_num);
for (j = 0; j < hostmacros->values_num; j++)
{
- hostmacro = zbx_malloc(NULL, sizeof(zbx_lld_hostmacro_t));
+ hostmacro = (zbx_lld_hostmacro_t *)zbx_malloc(NULL, sizeof(zbx_lld_hostmacro_t));
hostmacro->hostmacroid = 0;
hostmacro->macro = zbx_strdup(NULL, ((zbx_lld_hostmacro_t *)hostmacros->values[j])->macro);
@@ -2617,7 +2617,7 @@ static void lld_interfaces_get(zbx_uint64_t lld_ruleid, zbx_vector_ptr_t *interf
while (NULL != (row = DBfetch(result)))
{
- interface = zbx_malloc(NULL, sizeof(zbx_lld_interface_t));
+ interface = (zbx_lld_interface_t *)zbx_malloc(NULL, sizeof(zbx_lld_interface_t));
ZBX_STR2UINT64(interface->interfaceid, row[0]);
interface->type = (unsigned char)atoi(row[1]);
@@ -2661,7 +2661,7 @@ static void lld_interface_make(zbx_vector_ptr_t *interfaces, zbx_uint64_t parent
if (i == interfaces->values_num)
{
/* interface which should be deleted */
- interface = zbx_malloc(NULL, sizeof(zbx_lld_interface_t));
+ interface = (zbx_lld_interface_t *)zbx_malloc(NULL, sizeof(zbx_lld_interface_t));
interface->interfaceid = interfaceid;
interface->parent_interfaceid = 0;
@@ -2742,7 +2742,7 @@ static void lld_interfaces_make(const zbx_vector_ptr_t *interfaces, zbx_vector_p
{
interface = (zbx_lld_interface_t *)interfaces->values[j];
- new_interface = zbx_malloc(NULL, sizeof(zbx_lld_interface_t));
+ new_interface = (zbx_lld_interface_t *)zbx_malloc(NULL, sizeof(zbx_lld_interface_t));
new_interface->interfaceid = 0;
new_interface->parent_interfaceid = interface->interfaceid;
diff --git a/src/libs/zbxdbhigh/lld_item.c b/src/libs/zbxdbhigh/lld_item.c
index 99bf9a24660..4d506bd279b 100644
--- a/src/libs/zbxdbhigh/lld_item.c
+++ b/src/libs/zbxdbhigh/lld_item.c
@@ -346,7 +346,7 @@ static int lld_items_keys_compare_func(const void *d1, const void *d2)
/* items - applications hashset support */
static zbx_hash_t lld_item_application_hash_func(const void *data)
{
- const zbx_lld_item_application_t *item_application = data;
+ const zbx_lld_item_application_t *item_application = (zbx_lld_item_application_t *)data;
zbx_hash_t hash;
hash = ZBX_DEFAULT_HASH_ALGO(&item_application->item_ref, sizeof(item_application->item_ref),
@@ -539,7 +539,7 @@ static void lld_items_get(const zbx_vector_ptr_t *item_prototypes, zbx_vector_pt
item_prototype = (zbx_lld_item_prototype_t *)item_prototypes->values[index];
- item = zbx_malloc(NULL, sizeof(zbx_lld_item_t));
+ item = (zbx_lld_item_t *)zbx_malloc(NULL, sizeof(zbx_lld_item_t));
ZBX_STR2UINT64(item->itemid, row[0]);
item->parent_itemid = itemid;
@@ -662,7 +662,7 @@ static void lld_items_get(const zbx_vector_ptr_t *item_prototypes, zbx_vector_pt
for (i = items->values_num - 1; i >= 0; i--)
{
- item = items->values[i];
+ item = (zbx_lld_item_t *)items->values[i];
if (0 == item->master_itemid)
continue;
@@ -902,7 +902,7 @@ static void lld_items_validate(zbx_uint64_t hostid, zbx_vector_ptr_t *items, cha
char *sql = NULL;
size_t sql_alloc = 256, sql_offset = 0;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select key_"
@@ -984,8 +984,8 @@ static int substitute_formula_macros(char **data, const struct zbx_json_parse *j
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- exp = zbx_malloc(NULL, exp_alloc);
- tmp = zbx_malloc(NULL, tmp_alloc);
+ exp = (char *)zbx_malloc(NULL, exp_alloc);
+ tmp = (char *)zbx_malloc(NULL, tmp_alloc);
for (e = *data; SUCCEED == zbx_function_find(e, &f_pos, &par_l, &par_r); e += par_r + 1)
{
@@ -1063,7 +1063,7 @@ static zbx_lld_item_t *lld_item_make(const zbx_lld_item_prototype_t *item_protot
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- item = zbx_malloc(NULL, sizeof(zbx_lld_item_t));
+ item = (zbx_lld_item_t *)zbx_malloc(NULL, sizeof(zbx_lld_item_t));
item->itemid = 0;
item->parent_itemid = item_prototype->itemid;
@@ -1379,7 +1379,7 @@ static void lld_items_make(const zbx_vector_ptr_t *item_prototypes, const zbx_ve
continue;
}
- item_prototype = item_prototypes->values[index];
+ item_prototype = (zbx_lld_item_prototype_t *)item_prototypes->values[index];
for (j = item_prototype->lld_rows.values_num - 1; j >= 0; j--)
{
@@ -1418,7 +1418,7 @@ static void lld_items_make(const zbx_vector_ptr_t *item_prototypes, const zbx_ve
{
item_index_local.lld_row = (zbx_lld_row_t *)lld_rows->values[j];
- if (NULL == (item_index = zbx_hashset_search(items_index, &item_index_local)))
+ if (NULL == (item_index = (zbx_lld_item_index_t *)zbx_hashset_search(items_index, &item_index_local)))
{
if (NULL != (item = lld_item_make(item_prototype, item_index_local.lld_row, error)))
{
@@ -1561,7 +1561,7 @@ static void lld_item_save(zbx_uint64_t hostid, const zbx_vector_ptr_t *item_prot
return;
}
- item_prototype = item_prototypes->values[index];
+ item_prototype = (zbx_lld_item_prototype_t *)item_prototypes->values[index];
if (0 == item->itemid)
{
@@ -1860,7 +1860,7 @@ static void lld_item_save(zbx_uint64_t hostid, const zbx_vector_ptr_t *item_prot
for (i = 0; i < item->dependent_items.values_num; i++)
{
- dependent = item->dependent_items.values[i];
+ dependent = (zbx_lld_item_t *)item->dependent_items.values[i];
dependent->master_itemid = item->itemid;
lld_item_save(hostid, item_prototypes, dependent, itemid, itemdiscoveryid, db_insert,
db_insert_idiscovery, sql, sql_alloc, sql_offset);
@@ -1946,7 +1946,7 @@ static int lld_items_save(zbx_uint64_t hostid, const zbx_vector_ptr_t *item_prot
if (0 != upd_items)
{
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
}
@@ -2428,7 +2428,7 @@ static void lld_items_applications_save(zbx_hashset_t *items_applications, const
/* count new item-application links */
zbx_hashset_iter_reset(items_applications, &iter);
- while (NULL != (item_application = zbx_hashset_iter_next(&iter)))
+ while (NULL != (item_application = (zbx_lld_item_application_t *)zbx_hashset_iter_next(&iter)))
{
if (0 == item_application->itemappid)
new_item_applications++;
@@ -2442,7 +2442,7 @@ static void lld_items_applications_save(zbx_hashset_t *items_applications, const
zbx_hashset_iter_reset(items_applications, &iter);
- while (NULL != (item_application = zbx_hashset_iter_next(&iter)))
+ while (NULL != (item_application = (zbx_lld_item_application_t *)zbx_hashset_iter_next(&iter)))
{
if (0 != item_application->itemappid)
{
@@ -2819,7 +2819,7 @@ static void lld_item_links_populate(const zbx_vector_ptr_t *item_prototypes, con
{
item_index_local.lld_row = (zbx_lld_row_t *)lld_rows->values[j];
- if (NULL == (item_index = zbx_hashset_search(items_index, &item_index_local)))
+ if (NULL == (item_index = (zbx_lld_item_index_t *)zbx_hashset_search(items_index, &item_index_local)))
continue;
if (0 == (item_index->item->flags & ZBX_FLAG_LLD_ITEM_DISCOVERED))
@@ -2955,7 +2955,7 @@ static void lld_item_application_prototypes_get(const zbx_vector_ptr_t *item_pro
item_application_prototype = (zbx_lld_item_application_ref_t *)zbx_malloc(NULL,
sizeof(zbx_lld_item_application_ref_t));
- item_application_prototype->application_prototype = application_prototypes->values[index];
+ item_application_prototype->application_prototype = (zbx_lld_application_prototype_t *)application_prototypes->values[index];
item_application_prototype->applicationid = 0;
ZBX_STR2UINT64(itemid, row[1]);
@@ -3076,7 +3076,7 @@ static void lld_application_make(const zbx_lld_application_prototype_t *applicat
application_index_local.application_prototypeid = application_prototype->application_prototypeid;
application_index_local.lld_row = lld_row;
- if (NULL == (application_index = zbx_hashset_search(applications_index, &application_index_local)))
+ if (NULL == (application_index = (zbx_lld_application_index_t *)zbx_hashset_search(applications_index, &application_index_local)))
{
application = (zbx_lld_application_t *)zbx_malloc(NULL, sizeof(zbx_lld_application_t));
application->applicationid = 0;
@@ -3181,7 +3181,7 @@ static void lld_applications_make(const zbx_vector_ptr_t *application_prototypes
{
for (j = 0; j < lld_rows->values_num; j++)
{
- lld_application_make(application_prototypes->values[i], lld_rows->values[j], applications,
+ lld_application_make((zbx_lld_application_prototype_t *)application_prototypes->values[i], (zbx_lld_row_t *)lld_rows->values[j], applications,
applications_index);
}
}
@@ -3272,7 +3272,7 @@ static void lld_applications_validate(zbx_uint64_t hostid, zbx_uint64_t lld_rule
application_index_local.application_prototypeid = application->application_prototypeid;
application_index_local.lld_row = application->lld_row;
- if (NULL == (application_index = zbx_hashset_search(applications_index,
+ if (NULL == (application_index = (zbx_lld_application_index_t *)zbx_hashset_search(applications_index,
&application_index_local)))
{
THIS_SHOULD_NEVER_HAPPEN;
@@ -3330,7 +3330,7 @@ static void lld_applications_validate(zbx_uint64_t hostid, zbx_uint64_t lld_rule
continue;
}
- application = applications->values[index];
+ application = (zbx_lld_application_t *)applications->values[index];
/* only discovered applications can be 'shared' between discovery rules */
if (ZBX_FLAG_DISCOVERY_CREATED != atoi(row[2]))
@@ -3414,7 +3414,7 @@ static void lld_applications_validate(zbx_uint64_t hostid, zbx_uint64_t lld_rule
continue;
}
- application = applications->values[index];
+ application = (zbx_lld_application_t *)applications->values[index];
/* add a pseudo application to remove the application discovery record */
/* of the shared application and current discovery rule */
@@ -3523,7 +3523,7 @@ static void lld_items_applications_make(const zbx_vector_ptr_t *item_prototypes,
for (i = 0; i < items->values_num; i++)
{
- item = items->values[i];
+ item = (zbx_lld_item_t *)items->values[i];
if (0 == (item->flags & ZBX_FLAG_LLD_ITEM_DISCOVERED))
continue;
@@ -3531,7 +3531,7 @@ static void lld_items_applications_make(const zbx_vector_ptr_t *item_prototypes,
/* if item is discovered its prototype must be in item_prototypes vector */
index = zbx_vector_ptr_bsearch(item_prototypes, &item->parent_itemid,
ZBX_DEFAULT_UINT64_PTR_COMPARE_FUNC);
- item_prototype = item_prototypes->values[index];
+ item_prototype = (zbx_lld_item_prototype_t *)item_prototypes->values[index];
application_index_local.lld_row = item->lld_row;
@@ -3542,14 +3542,14 @@ static void lld_items_applications_make(const zbx_vector_ptr_t *item_prototypes,
for (j = 0; j < item_prototype->applications.values_num; j++)
{
- itemapp_prototype = item_prototype->applications.values[j];
+ itemapp_prototype = (zbx_lld_item_application_ref_t *)item_prototype->applications.values[j];
if (NULL != itemapp_prototype->application_prototype)
{
application_index_local.application_prototypeid =
itemapp_prototype->application_prototype->application_prototypeid;
- if (NULL == (application_index = zbx_hashset_search(applications_index,
+ if (NULL == (application_index = (zbx_lld_application_index_t *)zbx_hashset_search(applications_index,
&application_index_local)))
{
continue;
@@ -3574,10 +3574,10 @@ static void lld_items_applications_make(const zbx_vector_ptr_t *item_prototypes,
item_application_local.application_ref.applicationid = itemapp_prototype->applicationid;
}
- if (NULL == (item_application = zbx_hashset_search(items_applications,
+ if (NULL == (item_application = (zbx_lld_item_application_t *)zbx_hashset_search(items_applications,
&item_application_local)))
{
- item_application = zbx_hashset_insert(items_applications, &item_application_local,
+ item_application = (zbx_lld_item_application_t *)zbx_hashset_insert(items_applications, &item_application_local,
sizeof(zbx_lld_item_application_t));
}
@@ -3744,7 +3744,7 @@ static void lld_link_dependent_items(zbx_vector_ptr_t *items, zbx_hashset_t *ite
item_index_local.parent_itemid = item->master_itemid;
item_index_local.lld_row = (zbx_lld_row_t *)item->lld_row;
- if (NULL == (item_index = zbx_hashset_search(items_index, &item_index_local)))
+ if (NULL == (item_index = (zbx_lld_item_index_t *)zbx_hashset_search(items_index, &item_index_local)))
{
/* dependent item without master item should be removed */
THIS_SHOULD_NEVER_HAPPEN;
diff --git a/src/libs/zbxdbhigh/lld_trigger.c b/src/libs/zbxdbhigh/lld_trigger.c
index 7742fe618ea..5f99f96bd35 100644
--- a/src/libs/zbxdbhigh/lld_trigger.c
+++ b/src/libs/zbxdbhigh/lld_trigger.c
@@ -297,7 +297,7 @@ static void lld_trigger_prototypes_get(zbx_uint64_t lld_ruleid, zbx_vector_ptr_t
/* run through trigger prototypes */
while (NULL != (row = DBfetch(result)))
{
- trigger_prototype = zbx_malloc(NULL, sizeof(zbx_lld_trigger_prototype_t));
+ trigger_prototype = (zbx_lld_trigger_prototype_t *)zbx_malloc(NULL, sizeof(zbx_lld_trigger_prototype_t));
ZBX_STR2UINT64(trigger_prototype->triggerid, row[0]);
trigger_prototype->description = zbx_strdup(NULL, row[1]);
@@ -360,7 +360,7 @@ static void lld_triggers_get(const zbx_vector_ptr_t *trigger_prototypes, zbx_vec
zbx_vector_uint64_append(&parent_triggerids, trigger_prototype->triggerid);
}
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select td.parent_triggerid,t.triggerid,t.description,t.expression,t.type,t.priority,"
@@ -396,7 +396,7 @@ static void lld_triggers_get(const zbx_vector_ptr_t *trigger_prototypes, zbx_vec
trigger_prototype = (zbx_lld_trigger_prototype_t *)trigger_prototypes->values[index];
- trigger = zbx_malloc(NULL, sizeof(zbx_lld_trigger_t));
+ trigger = (zbx_lld_trigger_t *)zbx_malloc(NULL, sizeof(zbx_lld_trigger_t));
ZBX_STR2UINT64(trigger->triggerid, row[1]);
trigger->parent_triggerid = parent_triggerid;
@@ -495,7 +495,7 @@ static void lld_functions_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vector_p
zbx_vector_uint64_sort(&triggerids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select functionid,triggerid,itemid,function,parameter"
@@ -510,7 +510,7 @@ static void lld_functions_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vector_p
while (NULL != (row = DBfetch(result)))
{
- function = zbx_malloc(NULL, sizeof(zbx_lld_function_t));
+ function = (zbx_lld_function_t *)zbx_malloc(NULL, sizeof(zbx_lld_function_t));
function->index = 0;
ZBX_STR2UINT64(function->functionid, row[0]);
@@ -610,7 +610,7 @@ static void lld_dependencies_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vecto
zbx_vector_uint64_sort(&triggerids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select triggerdepid,triggerid_down,triggerid_up"
@@ -627,7 +627,7 @@ static void lld_dependencies_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vecto
while (NULL != (row = DBfetch(result)))
{
- dependency = zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
+ dependency = (zbx_lld_dependency_t *)zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
ZBX_STR2UINT64(dependency->triggerdepid, row[0]);
ZBX_STR2UINT64(triggerid_down, row[1]);
@@ -714,7 +714,7 @@ static void lld_tags_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vector_ptr_t
zbx_vector_uint64_sort(&triggerids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select triggertagid,triggerid,tag,value"
@@ -731,7 +731,7 @@ static void lld_tags_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vector_ptr_t
while (NULL != (row = DBfetch(result)))
{
- tag = zbx_malloc(NULL, sizeof(zbx_lld_tag_t));
+ tag = (zbx_lld_tag_t *)zbx_malloc(NULL, sizeof(zbx_lld_tag_t));
ZBX_STR2UINT64(tag->triggertagid, row[0]);
ZBX_STR2UINT64(triggerid, row[1]);
@@ -815,7 +815,7 @@ static void lld_items_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vector_ptr_t
zbx_vector_uint64_append(&parent_triggerids, trigger_prototype->triggerid);
}
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
"select distinct i.itemid,i.flags"
@@ -833,7 +833,7 @@ static void lld_items_get(zbx_vector_ptr_t *trigger_prototypes, zbx_vector_ptr_t
while (NULL != (row = DBfetch(result)))
{
- item = zbx_malloc(NULL, sizeof(zbx_lld_item_t));
+ item = (zbx_lld_item_t *)zbx_malloc(NULL, sizeof(zbx_lld_item_t));
ZBX_STR2UINT64(item->itemid, row[0]);
ZBX_STR2UCHAR(item->flags, row[1]);
@@ -870,7 +870,7 @@ static zbx_lld_trigger_t *lld_trigger_get(zbx_uint64_t parent_triggerid, zbx_has
item_trigger_local.parent_triggerid = parent_triggerid;
item_trigger_local.itemid = item_link->itemid;
- if (NULL != (item_trigger = zbx_hashset_search(items_triggers, &item_trigger_local)))
+ if (NULL != (item_trigger = (zbx_lld_item_trigger_t *)zbx_hashset_search(items_triggers, &item_trigger_local)))
return item_trigger->trigger;
}
@@ -961,7 +961,7 @@ static char *lld_expression_expand(const char *expression, const zbx_vector_ptr_
zabbix_log(LOG_LEVEL_DEBUG, "In %s() expression:'%s'", __function_name, expression);
- buffer = zbx_malloc(buffer, buffer_alloc);
+ buffer = (char *)zbx_malloc(buffer, buffer_alloc);
*buffer = '\0';
@@ -1062,7 +1062,7 @@ static int lld_function_make(const zbx_lld_function_t *function_proto, zbx_vecto
if (i == functions->values_num)
{
- function = zbx_malloc(NULL, sizeof(zbx_lld_function_t));
+ function = (zbx_lld_function_t *)zbx_malloc(NULL, sizeof(zbx_lld_function_t));
function->index = function_proto->index;
function->functionid = 0;
@@ -1191,7 +1191,8 @@ static void lld_trigger_make(const zbx_lld_trigger_prototype_t *trigger_prototy
zbx_lld_trigger_t *trigger;
char *buffer = NULL, *expression = NULL, *recovery_expression = NULL, err[64];
- char *err_msg = NULL, *operation_msg;
+ char *err_msg = NULL;
+ const char *operation_msg;
const struct zbx_json_parse *jp_row = &lld_row->jp_row;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -1274,7 +1275,7 @@ static void lld_trigger_make(const zbx_lld_trigger_prototype_t *trigger_prototy
}
else
{
- trigger = zbx_malloc(NULL, sizeof(zbx_lld_trigger_t));
+ trigger = (zbx_lld_trigger_t *)zbx_malloc(NULL, sizeof(zbx_lld_trigger_t));
trigger->triggerid = 0;
trigger->parent_triggerid = trigger_prototype->triggerid;
@@ -1340,7 +1341,7 @@ out:
static zbx_hash_t items_triggers_hash_func(const void *data)
{
- const zbx_lld_item_trigger_t *item_trigger = data;
+ const zbx_lld_item_trigger_t *item_trigger = (zbx_lld_item_trigger_t *)data;
zbx_hash_t hash;
hash = ZBX_DEFAULT_UINT64_HASH_FUNC(&item_trigger->parent_triggerid);
@@ -1351,7 +1352,7 @@ static zbx_hash_t items_triggers_hash_func(const void *data)
static int items_triggers_compare_func(const void *d1, const void *d2)
{
- const zbx_lld_item_trigger_t *item_trigger1 = d1, *item_trigger2 = d2;
+ const zbx_lld_item_trigger_t *item_trigger1 = (zbx_lld_item_trigger_t *)d1, *item_trigger2 = (zbx_lld_item_trigger_t *)d2;
ZBX_RETURN_IF_NOT_EQUAL(item_trigger1->parent_triggerid, item_trigger2->parent_triggerid);
ZBX_RETURN_IF_NOT_EQUAL(item_trigger1->itemid, item_trigger2->itemid);
@@ -1447,7 +1448,7 @@ static void lld_trigger_dependency_make(const zbx_lld_trigger_prototype_t *trig
{
if (0 == dep_trigger->triggerid)
{
- dependency = zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
+ dependency = (zbx_lld_dependency_t *)zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
dependency->triggerdepid = 0;
dependency->triggerid_up = 0;
@@ -1469,7 +1470,7 @@ static void lld_trigger_dependency_make(const zbx_lld_trigger_prototype_t *trig
if (j == trigger->dependencies.values_num)
{
- dependency = zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
+ dependency = (zbx_lld_dependency_t *)zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
dependency->triggerdepid = 0;
dependency->triggerid_up = dep_trigger->triggerid;
@@ -1506,7 +1507,7 @@ static void lld_trigger_dependency_make(const zbx_lld_trigger_prototype_t *trig
if (j == trigger->dependencies.values_num)
{
- dependency = zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
+ dependency = (zbx_lld_dependency_t *)zbx_malloc(NULL, sizeof(zbx_lld_dependency_t));
dependency->triggerdepid = 0;
dependency->triggerid_up = triggerid_up;
@@ -1663,7 +1664,7 @@ static void lld_trigger_tag_make(zbx_lld_trigger_prototype_t *trigger_prototype
}
else
{
- tag = zbx_malloc(NULL, sizeof(zbx_lld_tag_t));
+ tag = (zbx_lld_tag_t *)zbx_malloc(NULL, sizeof(zbx_lld_tag_t));
tag->triggertagid = 0;
@@ -1969,7 +1970,7 @@ static void lld_triggers_validate(zbx_uint64_t hostid, zbx_vector_ptr_t *trigger
zbx_vector_str_sort(&descriptions, ZBX_DEFAULT_STR_COMPARE_FUNC);
zbx_vector_str_uniq(&descriptions, ZBX_DEFAULT_STR_COMPARE_FUNC);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select distinct t.triggerid,t.description,t.expression,t.recovery_expression"
@@ -1994,7 +1995,7 @@ static void lld_triggers_validate(zbx_uint64_t hostid, zbx_vector_ptr_t *trigger
while (NULL != (row = DBfetch(result)))
{
- db_trigger = zbx_malloc(NULL, sizeof(zbx_lld_trigger_t));
+ db_trigger = (zbx_lld_trigger_t *)zbx_malloc(NULL, sizeof(zbx_lld_trigger_t));
ZBX_STR2UINT64(db_trigger->triggerid, row[0]);
db_trigger->description = zbx_strdup(NULL, row[1]);
@@ -2442,7 +2443,7 @@ static int lld_triggers_save(zbx_uint64_t hostid, const zbx_vector_ptr_t *trigge
if (0 != upd_triggers || 0 != upd_functions.values_num || 0 != del_functionids.values_num ||
0 != del_triggerdepids.values_num || 0 != upd_tags || 0 != del_triggertagids.values_num)
{
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
}
@@ -2879,7 +2880,7 @@ static zbx_lld_trigger_node_t *lld_trigger_cache_append(zbx_hashset_t *cache, zb
zbx_vector_ptr_create(&node_local.dependencies);
- return zbx_hashset_insert(cache, &node_local, sizeof(node_local));
+ return (zbx_lld_trigger_node_t *)zbx_hashset_insert(cache, &node_local, sizeof(node_local));
}
/******************************************************************************
@@ -2908,7 +2909,7 @@ static void lld_trigger_cache_add_trigger_node(zbx_hashset_t *cache, zbx_lld_tri
trigger_node_local.trigger_ref.triggerid = trigger->triggerid;
trigger_node_local.trigger_ref.trigger = trigger;
- if (NULL != (trigger_node = zbx_hashset_search(cache, &trigger_node_local)))
+ if (NULL != (trigger_node = (zbx_lld_trigger_node_t *)zbx_hashset_search(cache, &trigger_node_local)))
return;
trigger_node = lld_trigger_cache_append(cache, trigger->triggerid, trigger);
@@ -2949,7 +2950,7 @@ static void lld_trigger_cache_add_trigger_node(zbx_hashset_t *cache, zbx_lld_tri
for (i = 0; i < trigger->dependents.values_num; i++)
{
- lld_trigger_cache_add_trigger_node(cache, trigger->dependents.values[i], triggerids_up,
+ lld_trigger_cache_add_trigger_node(cache, (zbx_lld_trigger_t *)trigger->dependents.values[i], triggerids_up,
triggerids_down);
}
@@ -3048,7 +3049,7 @@ static void lld_trigger_cache_init(zbx_hashset_t *cache, zbx_vector_ptr_t *trigg
ZBX_STR2UINT64(trigger_node_local.trigger_ref.triggerid, row[1]);
- if (NULL == (trigger_node_up = zbx_hashset_search(cache, &trigger_node_local)))
+ if (NULL == (trigger_node_up = (zbx_lld_trigger_node_t *)zbx_hashset_search(cache, &trigger_node_local)))
{
trigger_node_up = lld_trigger_cache_append(cache,
trigger_node_local.trigger_ref.triggerid, NULL);
@@ -3057,7 +3058,7 @@ static void lld_trigger_cache_init(zbx_hashset_t *cache, zbx_vector_ptr_t *trigg
ZBX_STR2UINT64(trigger_node_local.trigger_ref.triggerid, row[0]);
- if (NULL == (trigger_node = zbx_hashset_search(cache, &trigger_node_local)))
+ if (NULL == (trigger_node = (zbx_lld_trigger_node_t *)zbx_hashset_search(cache, &trigger_node_local)))
{
THIS_SHOULD_NEVER_HAPPEN;
continue;
@@ -3164,7 +3165,7 @@ static void zbx_trigger_cache_clean(zbx_hashset_t *cache)
zbx_lld_trigger_node_t *trigger_node;
zbx_hashset_iter_reset(cache, &iter);
- while (NULL != (trigger_node = zbx_hashset_iter_next(&iter)))
+ while (NULL != (trigger_node = (zbx_lld_trigger_node_t *)zbx_hashset_iter_next(&iter)))
{
zbx_vector_ptr_clear_ext(&trigger_node->dependencies, zbx_ptr_free);
zbx_vector_ptr_destroy(&trigger_node->dependencies);
@@ -3285,7 +3286,7 @@ static int lld_trigger_dependencies_iter(zbx_hashset_t *cache, zbx_vector_ptr_t
if (ZBX_LLD_TRIGGER_DEPENDENCY_DELETE == trigger_ref->flags)
continue;
- if (NULL == (trigger_node_up = zbx_hashset_search(cache, trigger_ref)))
+ if (NULL == (trigger_node_up = (zbx_lld_trigger_node_t *)zbx_hashset_search(cache, trigger_ref)))
{
THIS_SHOULD_NEVER_HAPPEN;
continue;
@@ -3354,11 +3355,11 @@ static void lld_trigger_dependencies_validate(zbx_vector_ptr_t *triggers, char *
zbx_vector_ptr_reserve(&nodes, cache.num_data);
zbx_hashset_iter_reset(&cache, &iter);
- while (NULL != (trigger_node = zbx_hashset_iter_next(&iter)))
+ while (NULL != (trigger_node = (zbx_lld_trigger_node_t *)zbx_hashset_iter_next(&iter)))
{
for (i = 0; i < trigger_node->dependencies.values_num; i++)
{
- if (NULL == (trigger_node_up = zbx_hashset_search(&cache,
+ if (NULL == (trigger_node_up = (zbx_lld_trigger_node_t *)zbx_hashset_search(&cache,
trigger_node->dependencies.values[i])))
{
THIS_SHOULD_NEVER_HAPPEN;
@@ -3374,7 +3375,7 @@ static void lld_trigger_dependencies_validate(zbx_vector_ptr_t *triggers, char *
for (i = 0; i < nodes.values_num; i++)
{
- if (NULL == (trigger_node = zbx_hashset_search(&cache, (zbx_lld_trigger_node_t *)nodes.values[i])))
+ if (NULL == (trigger_node = (zbx_lld_trigger_node_t *)zbx_hashset_search(&cache, (zbx_lld_trigger_node_t *)nodes.values[i])))
{
THIS_SHOULD_NEVER_HAPPEN;
continue;
diff --git a/src/libs/zbxdbhigh/proxy.c b/src/libs/zbxdbhigh/proxy.c
index e2912bada6d..60e052f6c0c 100644
--- a/src/libs/zbxdbhigh/proxy.c
+++ b/src/libs/zbxdbhigh/proxy.c
@@ -49,7 +49,7 @@ typedef struct
const char *field;
const char *tag;
zbx_json_type_t jt;
- char *default_value;
+ const char *default_value;
}
zbx_history_field_t;
@@ -404,7 +404,7 @@ static void db_update_proxies_lastaccess(const zbx_vector_uint64_pair_t *proxy_d
size_t sql_alloc = 256, sql_offset = 0;
int i;
- sql = zbx_malloc(NULL, sql_alloc);
+ sql = (char *)zbx_malloc(NULL, sql_alloc);
DBbegin();
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
@@ -478,7 +478,7 @@ static int get_proxyconfig_table(zbx_uint64_t proxy_hostid, struct zbx_json *j,
zbx_json_addobject(j, table->table);
zbx_json_addarray(j, "fields");
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "select t.%s", table->recid);
@@ -649,7 +649,7 @@ static void get_proxy_monitored_hosts(zbx_uint64_t proxy_hostid, zbx_vector_uint
char *sql = NULL;
size_t sql_alloc = 512, sql_offset;
- sql = zbx_malloc(sql, sql_alloc * sizeof(char));
+ sql = (char *)zbx_malloc(sql, sql_alloc * sizeof(char));
result = DBselect(
"select hostid"
@@ -841,14 +841,14 @@ static void remember_record(const ZBX_FIELD **fields, int fields_count, char **r
static zbx_hash_t id_offset_hash_func(const void *data)
{
- const zbx_id_offset_t *p = data;
+ const zbx_id_offset_t *p = (zbx_id_offset_t *)data;
return ZBX_DEFAULT_UINT64_HASH_ALGO(&p->id, sizeof(zbx_uint64_t), ZBX_DEFAULT_HASH_SEED);
}
static int id_offset_compare_func(const void *d1, const void *d2)
{
- const zbx_id_offset_t *p1 = d1, *p2 = d2;
+ const zbx_id_offset_t *p1 = (zbx_id_offset_t *)d1, *p2 = (zbx_id_offset_t *)d2;
return ZBX_DEFAULT_UINT64_COMPARE_FUNC(&p1->id, &p2->id);
}
@@ -1069,7 +1069,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
}
/* all records will be stored in one large string */
- recs = zbx_malloc(recs, recs_alloc);
+ recs = (char *)zbx_malloc(recs, recs_alloc);
/* hash set as index for fast access to records via IDs */
zbx_hashset_create(&h_id_offsets, 10000, id_offset_hash_func, id_offset_compare_func);
@@ -1077,7 +1077,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
/* a hash set as a list for finding records to be deleted */
zbx_hashset_create(&h_del, 10000, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
sql_offset = 0;
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset, "select ");
@@ -1181,7 +1181,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
/* locate a copy of this record as found in database */
id_offset.id = recid;
- if (NULL == (p_id_offset = zbx_hashset_search(&h_id_offsets, &id_offset)))
+ if (NULL == (p_id_offset = (zbx_id_offset_t *)zbx_hashset_search(&h_id_offsets, &id_offset)))
{
THIS_SHOULD_NEVER_HAPPEN;
goto clean2;
@@ -1218,7 +1218,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
/* copy IDs of records to be deleted from hash set to vector */
zbx_hashset_iter_reset(&h_del, &iter);
- while (NULL != (p_recid = zbx_hashset_iter_next(&iter)))
+ while (NULL != (p_recid = (uint64_t *)zbx_hashset_iter_next(&iter)))
zbx_vector_uint64_append(del, *p_recid);
zbx_vector_uint64_sort(del, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
@@ -1314,7 +1314,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
zbx_db_value_t *value;
/* add the id field */
- value = zbx_malloc(NULL, sizeof(zbx_db_value_t));
+ value = (zbx_db_value_t *)zbx_malloc(NULL, sizeof(zbx_db_value_t));
value->ui64 = recid;
zbx_vector_ptr_append(&values, value);
@@ -1336,7 +1336,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
goto clean;
}
- value = zbx_malloc(NULL, sizeof(zbx_db_value_t));
+ value = (zbx_db_value_t *)zbx_malloc(NULL, sizeof(zbx_db_value_t));
switch (fields[f]->type)
{
@@ -1383,7 +1383,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
case ZBX_TYPE_TEXT:
case ZBX_TYPE_SHORTTEXT:
case ZBX_TYPE_LONGTEXT:
- value = values.values[f];
+ value = (zbx_db_value_t *)values.values[f];
zbx_free(value->str);
}
}
@@ -1405,7 +1405,7 @@ static int process_proxyconfig_table(const ZBX_TABLE *table, struct zbx_json_par
/* locate a copy of this record as found in database */
id_offset.id = recid;
- if (NULL == (p_id_offset = zbx_hashset_search(&h_id_offsets, &id_offset)))
+ if (NULL == (p_id_offset = (zbx_id_offset_t *)zbx_hashset_search(&h_id_offsets, &id_offset)))
{
THIS_SHOULD_NEVER_HAPPEN;
goto clean;
@@ -1577,7 +1577,7 @@ void process_proxyconfig(struct zbx_json_parse *jp_data)
break;
}
- table_ids = zbx_malloc(NULL, sizeof(table_ids_t));
+ table_ids = (table_ids_t *)zbx_malloc(NULL, sizeof(table_ids_t));
table_ids->table = table;
zbx_vector_uint64_create(&table_ids->ids);
zbx_vector_ptr_append(&tables, table_ids);
@@ -1590,13 +1590,13 @@ void process_proxyconfig(struct zbx_json_parse *jp_data)
char *sql = NULL;
size_t sql_alloc = 512, sql_offset = 0;
- sql = zbx_malloc(sql, sql_alloc * sizeof(char));
+ sql = (char *)zbx_malloc(sql, sql_alloc * sizeof(char));
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
for (i = tables.values_num - 1; 0 <= i; i--)
{
- table_ids = tables.values[i];
+ table_ids = (table_ids_t *)tables.values[i];
if (0 == table_ids->ids.values_num)
continue;
@@ -1621,7 +1621,7 @@ void process_proxyconfig(struct zbx_json_parse *jp_data)
for (i = 0; i < tables.values_num; i++)
{
- table_ids = tables.values[i];
+ table_ids = (table_ids_t *)tables.values[i];
zbx_vector_uint64_destroy(&table_ids->ids);
zbx_free(table_ids);
@@ -1783,14 +1783,14 @@ static int process_host_availability_contents(struct zbx_json_parse *jp_data, ch
char *sql = NULL;
size_t sql_alloc = 4 * ZBX_KIBIBYTE, sql_offset = 0;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin();
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
for (i = 0; i < hosts.values_num; i++)
{
- if (SUCCEED == zbx_sql_add_host_availability(&sql, &sql_alloc, &sql_offset, hosts.values[i]))
+ if (SUCCEED == zbx_sql_add_host_availability(&sql, &sql_alloc, &sql_offset, (zbx_host_availability_t *)hosts.values[i]))
zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset, ";\n");
DBexecute_overflowed_sql(&sql, &sql_alloc, &sql_offset);
@@ -2064,7 +2064,7 @@ static void proxy_get_history_data(struct zbx_json *j, zbx_uint64_t *lastid, zbx
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
if (NULL == string_buffer)
- string_buffer = zbx_malloc(string_buffer, string_buffer_alloc);
+ string_buffer = (char *)zbx_malloc(string_buffer, string_buffer_alloc);
*more = ZBX_PROXY_DATA_DONE;
@@ -2109,8 +2109,8 @@ try_again:
if (data_alloc == data_num)
{
data_alloc += 8;
- data = zbx_realloc(data, sizeof(zbx_history_data_t) * data_alloc);
- itemids = zbx_realloc(itemids, sizeof(zbx_uint64_t) * data_alloc);
+ data = (zbx_history_data_t *)zbx_realloc(data, sizeof(zbx_history_data_t) * data_alloc);
+ itemids = (zbx_uint64_t *)zbx_realloc(itemids, sizeof(zbx_uint64_t) * data_alloc);
}
ZBX_STR2UINT64(itemids[data_num], row[1]);
@@ -2136,7 +2136,7 @@ try_again:
while (string_buffer_alloc < string_buffer_offset + len1 + len2)
string_buffer_alloc += ZBX_KIBIBYTE;
- string_buffer = zbx_realloc(string_buffer, string_buffer_alloc);
+ string_buffer = (char *)zbx_realloc(string_buffer, string_buffer_alloc);
}
hd->psource = string_buffer_offset;
@@ -2150,7 +2150,7 @@ try_again:
}
DBfree_result(result);
- dc_items = zbx_malloc(NULL, (sizeof(DC_ITEM) + sizeof(int)) * data_num);
+ dc_items = (DC_ITEM *)zbx_malloc(NULL, (sizeof(DC_ITEM) + sizeof(int)) * data_num);
errcodes = (int *)(dc_items + data_num);
DCconfig_get_items_by_itemids(dc_items, itemids, errcodes, data_num);
@@ -3258,7 +3258,7 @@ static int process_discovery_data_contents(struct zbx_json_parse *jp_data, const
memset(&drule, 0, sizeof(drule));
*last_ip = '\0';
- value = zbx_malloc(value, value_alloc);
+ value = (char *)zbx_malloc(value, value_alloc);
while (NULL != (p = zbx_json_next(jp_data, p)))
{
@@ -3470,7 +3470,7 @@ static int process_auto_registration_contents(struct zbx_json_parse *jp_data, zb
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
zbx_vector_ptr_create(&autoreg_hosts);
- host_metadata = zbx_malloc(host_metadata, host_metadata_alloc);
+ host_metadata = (char *)zbx_malloc(host_metadata, host_metadata_alloc);
while (NULL != (p = zbx_json_next(jp_data, p)))
{
@@ -3713,8 +3713,8 @@ static int process_proxy_history_data_33(const DC_PROXY *proxy, struct zbx_json_
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- items = zbx_malloc(NULL, sizeof(DC_ITEM) * ZBX_HISTORY_VALUES_MAX);
- errcodes = zbx_malloc(NULL, sizeof(int) * ZBX_HISTORY_VALUES_MAX);
+ items = (DC_ITEM *)zbx_malloc(NULL, sizeof(DC_ITEM) * ZBX_HISTORY_VALUES_MAX);
+ errcodes = (int *)zbx_malloc(NULL, sizeof(int) * ZBX_HISTORY_VALUES_MAX);
sec = zbx_time();
diff --git a/src/libs/zbxdbhigh/template_item.c b/src/libs/zbxdbhigh/template_item.c
index 6e08efe91ba..a14f8a42416 100644
--- a/src/libs/zbxdbhigh/template_item.c
+++ b/src/libs/zbxdbhigh/template_item.c
@@ -76,7 +76,7 @@ typedef struct
zbx_uint64_t item_conditionid;
char *macro;
char *value;
- unsigned char operator;
+ unsigned char op;
}
zbx_lld_rule_condition_t;
@@ -171,7 +171,7 @@ static void get_template_items(zbx_uint64_t hostid, const zbx_vector_uint64_t *t
while (NULL != (row = DBfetch(result)))
{
- item = zbx_malloc(NULL, sizeof(zbx_template_item_t));
+ item = (zbx_template_item_t *)zbx_malloc(NULL, sizeof(zbx_template_item_t));
ZBX_STR2UINT64(item->templateid, row[0]);
ZBX_STR2UCHAR(item->type, row[3]);
@@ -279,12 +279,12 @@ static void get_template_lld_rule_map(const zbx_vector_ptr_t *items, zbx_vector_
/* prepare discovery rules */
for (i = 0; i < items->values_num; i++)
{
- item = items->values[i];
+ item = (zbx_template_item_t *)items->values[i];
if (0 == (ZBX_FLAG_DISCOVERY_RULE & item->flags))
continue;
- rule = zbx_malloc(NULL, sizeof(zbx_lld_rule_map_t));
+ rule = (zbx_lld_rule_map_t *)zbx_malloc(NULL, sizeof(zbx_lld_rule_map_t));
rule->itemid = item->itemid;
rule->templateid = item->templateid;
@@ -322,10 +322,10 @@ static void get_template_lld_rule_map(const zbx_vector_ptr_t *items, zbx_vector_
rule = (zbx_lld_rule_map_t *)rules->values[index];
- condition = zbx_malloc(NULL, sizeof(zbx_lld_rule_condition_t));
+ condition = (zbx_lld_rule_condition_t *)zbx_malloc(NULL, sizeof(zbx_lld_rule_condition_t));
ZBX_STR2UINT64(condition->item_conditionid, row[0]);
- ZBX_STR2UCHAR(condition->operator, row[2]);
+ ZBX_STR2UCHAR(condition->op, row[2]);
condition->macro = zbx_strdup(NULL, row[3]);
condition->value = zbx_strdup(NULL, row[4]);
@@ -380,7 +380,7 @@ static int calculate_template_lld_rule_conditionids(zbx_vector_ptr_t *rules)
/* calculate the number of new conditions to be inserted */
for (i = 0; i < rules->values_num; i++)
{
- rule = rules->values[i];
+ rule = (zbx_lld_rule_map_t *)rules->values[i];
if (rule->conditions.values_num > rule->conditionids.values_num)
conditions_num += rule->conditions.values_num - rule->conditionids.values_num;
@@ -394,7 +394,7 @@ static int calculate_template_lld_rule_conditionids(zbx_vector_ptr_t *rules)
for (i = 0; i < rules->values_num; i++)
{
- rule = rules->values[i];
+ rule = (zbx_lld_rule_map_t *)rules->values[i];
if (rule->conditions.values_num <= rule->conditionids.values_num)
continue;
@@ -427,7 +427,7 @@ static void update_template_lld_rule_formulas(zbx_vector_ptr_t *items, zbx_vecto
for (i = 0; i < items->values_num; i++)
{
- zbx_template_item_t *item = items->values[i];
+ zbx_template_item_t *item = (zbx_template_item_t *)items->values[i];
if (0 == (ZBX_FLAG_DISCOVERY_RULE & item->flags) || CONDITION_EVAL_TYPE_EXPRESSION != item->evaltype)
continue;
@@ -440,7 +440,7 @@ static void update_template_lld_rule_formulas(zbx_vector_ptr_t *items, zbx_vecto
continue;
}
- rule = rules->values[index];
+ rule = (zbx_lld_rule_map_t *)rules->values[index];
formula = zbx_strdup(NULL, item->formula);
@@ -452,7 +452,7 @@ static void update_template_lld_rule_formulas(zbx_vector_ptr_t *items, zbx_vecto
char srcid[64], dstid[64], *ptr;
size_t pos = 0, len;
- zbx_lld_rule_condition_t *condition = rule->conditions.values[j];
+ zbx_lld_rule_condition_t *condition = (zbx_lld_rule_condition_t *)rule->conditions.values[j];
if (j < rule->conditionids.values_num)
id = rule->conditionids.values[j];
@@ -683,7 +683,7 @@ static void save_template_items(zbx_uint64_t hostid, zbx_vector_ptr_t *items)
if (0 != upd_items)
{
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
}
@@ -750,7 +750,7 @@ static void save_template_lld_rules(zbx_vector_ptr_t *items, zbx_vector_ptr_t *r
/* insert lld rule conditions for new items */
for (i = 0; i < items->values_num; i++)
{
- zbx_template_item_t *item = items->values[i];
+ zbx_template_item_t *item = (zbx_template_item_t *)items->values[i];
if (NULL == item->key)
continue;
@@ -766,14 +766,14 @@ static void save_template_lld_rules(zbx_vector_ptr_t *items, zbx_vector_ptr_t *r
continue;
}
- rule = rules->values[index];
+ rule = (zbx_lld_rule_map_t *)rules->values[index];
for (j = 0; j < rule->conditions.values_num; j++)
{
- condition = rule->conditions.values[j];
+ condition = (zbx_lld_rule_condition_t *)rule->conditions.values[j];
zbx_db_insert_add_values(&db_insert, rule->conditionid++, item->itemid,
- (int)condition->operator, condition->macro, condition->value);
+ (int)condition->op, condition->macro, condition->value);
}
}
}
@@ -783,7 +783,7 @@ static void save_template_lld_rules(zbx_vector_ptr_t *items, zbx_vector_ptr_t *r
/* update lld rule conditions for existing items */
for (i = 0; i < rules->values_num; i++)
{
- rule = rules->values[i];
+ rule = (zbx_lld_rule_map_t *)rules->values[i];
/* skip lld rules of new items */
if (0 == rule->itemid)
@@ -794,7 +794,7 @@ static void save_template_lld_rules(zbx_vector_ptr_t *items, zbx_vector_ptr_t *r
/* update intersecting rule conditions */
for (j = 0; j < index; j++)
{
- condition = rule->conditions.values[j];
+ condition = (zbx_lld_rule_condition_t *)rule->conditions.values[j];
macro_esc = DBdyn_escape_string(condition->macro);
value_esc = DBdyn_escape_string(condition->value);
@@ -802,7 +802,7 @@ static void save_template_lld_rules(zbx_vector_ptr_t *items, zbx_vector_ptr_t *r
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "update item_condition"
" set operator=%d,macro='%s',value='%s'"
" where item_conditionid=" ZBX_FS_UI64 ";\n",
- (int)condition->operator, macro_esc, value_esc, rule->conditionids.values[j]);
+ (int)condition->op, macro_esc, value_esc, rule->conditionids.values[j]);
DBexecute_overflowed_sql(&sql, &sql_alloc, &sql_offset);
@@ -817,10 +817,10 @@ static void save_template_lld_rules(zbx_vector_ptr_t *items, zbx_vector_ptr_t *r
/* insert new rule conditions */
for (j = index; j < rule->conditions.values_num; j++)
{
- condition = rule->conditions.values[j];
+ condition = (zbx_lld_rule_condition_t *)rule->conditions.values[j];
zbx_db_insert_add_values(&db_insert, rule->conditionid++, rule->itemid,
- (int)condition->operator, condition->macro, condition->value);
+ (int)condition->op, condition->macro, condition->value);
}
}
@@ -881,7 +881,7 @@ static void save_template_item_applications(zbx_vector_ptr_t *items)
for (i = 0; i < items->values_num; i++)
{
- zbx_template_item_t *item = items->values[i];
+ zbx_template_item_t *item = (zbx_template_item_t *)items->values[i];
zbx_vector_uint64_append(&itemids, item->itemid);
}
@@ -906,7 +906,7 @@ static void save_template_item_applications(zbx_vector_ptr_t *items)
while (NULL != (row = DBfetch(result)))
{
- itemapp = zbx_malloc(NULL, sizeof(zbx_itemapp_t));
+ itemapp = (zbx_itemapp_t *)zbx_malloc(NULL, sizeof(zbx_itemapp_t));
ZBX_STR2UINT64(itemapp->itemid, row[0]);
ZBX_STR2UINT64(itemapp->applicationid, row[1]);
@@ -922,7 +922,7 @@ static void save_template_item_applications(zbx_vector_ptr_t *items)
for (i = 0; i < itemapps.values_num; i++)
{
- itemapp = itemapps.values[i];
+ itemapp = (zbx_itemapp_t *)itemapps.values[i];
zbx_db_insert_add_values(&db_insert, __UINT64_C(0), itemapp->itemid, itemapp->applicationid);
}
@@ -973,7 +973,7 @@ static void save_template_discovery_prototypes(zbx_uint64_t hostid, zbx_vector_p
for (i = 0; i < items->values_num; i++)
{
- zbx_template_item_t *item = items->values[i];
+ zbx_template_item_t *item = (zbx_template_item_t *)items->values[i];
/* process only new prototype items */
if (NULL == item->key || 0 == (ZBX_FLAG_DISCOVERY_PROTOTYPE & item->flags))
@@ -1001,7 +1001,7 @@ static void save_template_discovery_prototypes(zbx_uint64_t hostid, zbx_vector_p
while (NULL != (row = DBfetch(result)))
{
- proto = zbx_malloc(NULL, sizeof(zbx_proto_t));
+ proto = (zbx_proto_t *)zbx_malloc(NULL, sizeof(zbx_proto_t));
ZBX_STR2UINT64(proto->itemid, row[0]);
ZBX_STR2UINT64(proto->parent_itemid, row[1]);
@@ -1018,7 +1018,7 @@ static void save_template_discovery_prototypes(zbx_uint64_t hostid, zbx_vector_p
for (i = 0; i < prototypes.values_num; i++)
{
- proto = prototypes.values[i];
+ proto = (zbx_proto_t *)prototypes.values[i];
zbx_db_insert_add_values(&db_insert, __UINT64_C(0), proto->itemid, proto->parent_itemid);
}
diff --git a/src/libs/zbxdbhigh/trigger.c b/src/libs/zbxdbhigh/trigger.c
index d1d6aad41bf..276b21d745b 100644
--- a/src/libs/zbxdbhigh/trigger.c
+++ b/src/libs/zbxdbhigh/trigger.c
@@ -274,7 +274,7 @@ void zbx_process_triggers(zbx_vector_ptr_t *triggers, zbx_vector_ptr_t *trigger_
zbx_vector_ptr_sort(triggers, zbx_trigger_topoindex_compare);
for (i = 0; i < triggers->values_num; i++)
- zbx_process_trigger(triggers->values[i], trigger_diff);
+ zbx_process_trigger((struct _DC_TRIGGER *)triggers->values[i], trigger_diff);
zbx_vector_ptr_sort(trigger_diff, ZBX_DEFAULT_UINT64_PTR_COMPARE_FUNC);
out:
diff --git a/src/libs/zbxdbupgrade/dbupgrade_2010.c b/src/libs/zbxdbupgrade/dbupgrade_2010.c
index 91777a0b8bd..1d931e2908e 100644
--- a/src/libs/zbxdbupgrade/dbupgrade_2010.c
+++ b/src/libs/zbxdbupgrade/dbupgrade_2010.c
@@ -113,7 +113,7 @@ static void parse_db_monitor_item_params(const char *params, char **dsn, char **
if (NULL == *var)
{
- *var = zbx_malloc(*var, pend - pvalue + 1);
+ *var = (char *)zbx_malloc(*var, pend - pvalue + 1);
memmove(*var, pvalue, pend - pvalue);
(*var)[pend - pvalue] = '\0';
}
@@ -499,7 +499,7 @@ static int DBpatch_2010049(void)
static int DBpatch_2010050(void)
{
- char *fields[] = {"ts_from", "ts_to", NULL};
+ const char *fields[] = {"ts_from", "ts_to", NULL};
DB_RESULT result;
DB_ROW row;
int i;
diff --git a/src/libs/zbxdbupgrade/dbupgrade_2050.c b/src/libs/zbxdbupgrade/dbupgrade_2050.c
index 6982ca8c32d..73c271c83a3 100644
--- a/src/libs/zbxdbupgrade/dbupgrade_2050.c
+++ b/src/libs/zbxdbupgrade/dbupgrade_2050.c
@@ -788,7 +788,7 @@ static int DBpatch_2050092(void)
int len, ret = FAIL, rc;
char *url = NULL, *url_esc;
size_t i, url_alloc = 0, url_offset;
- char *url_map[] = {
+ const char *url_map[] = {
"dashboard.php", "dashboard.view",
"discovery.php", "discovery.view",
"maps.php", "map.view",
diff --git a/src/libs/zbxdbupgrade/dbupgrade_3010.c b/src/libs/zbxdbupgrade/dbupgrade_3010.c
index c40a3b3caec..4f975997745 100644
--- a/src/libs/zbxdbupgrade/dbupgrade_3010.c
+++ b/src/libs/zbxdbupgrade/dbupgrade_3010.c
@@ -265,7 +265,7 @@ static int DBpatch_3010021_update_event_recovery(zbx_hashset_t *events, zbx_uint
zbx_object_events_t *object_events, object_events_local;
zbx_db_insert_t db_insert;
- sql = zbx_malloc(NULL, sql_alloc);
+ sql = (char *)zbx_malloc(NULL, sql_alloc);
/* source: 0 - EVENT_SOURCE_TRIGGERS, 3 - EVENT_SOURCE_INTERNAL */
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
diff --git a/src/libs/zbxdbupgrade/dbupgrade_3050.c b/src/libs/zbxdbupgrade/dbupgrade_3050.c
index 8273a85c900..04518174d2a 100644
--- a/src/libs/zbxdbupgrade/dbupgrade_3050.c
+++ b/src/libs/zbxdbupgrade/dbupgrade_3050.c
@@ -106,7 +106,7 @@ static int DBpatch_3050005(void)
static int DBpatch_3050008(void)
{
int res;
- char *trdefault = ZBX_DEFAULT_INTERNAL_TRIGGER_EVENT_NAME;
+ char *trdefault = (char *)ZBX_DEFAULT_INTERNAL_TRIGGER_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
@@ -123,7 +123,7 @@ static int DBpatch_3050008(void)
static int DBpatch_3050009(void)
{
int res;
- char *trdefault = ZBX_DEFAULT_INTERNAL_TRIGGER_EVENT_NAME;
+ char *trdefault = (char *)ZBX_DEFAULT_INTERNAL_TRIGGER_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
@@ -140,7 +140,7 @@ static int DBpatch_3050009(void)
static int DBpatch_3050010(void)
{
int res;
- char *itdefault = ZBX_DEFAULT_INTERNAL_ITEM_EVENT_NAME;
+ char *itdefault = (char *)ZBX_DEFAULT_INTERNAL_ITEM_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
@@ -157,7 +157,7 @@ static int DBpatch_3050010(void)
static int DBpatch_3050011(void)
{
int res;
- char *itdefault = ZBX_DEFAULT_INTERNAL_ITEM_EVENT_NAME;
+ char *itdefault = (char *)ZBX_DEFAULT_INTERNAL_ITEM_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
diff --git a/src/libs/zbxexec/execute.c b/src/libs/zbxexec/execute.c
index 0bbbfc03383..a3ca389a6f9 100644
--- a/src/libs/zbxexec/execute.c
+++ b/src/libs/zbxexec/execute.c
@@ -314,7 +314,7 @@ int zbx_execute(const char *command, char **output, char *error, size_t max_erro
if (NULL != output)
zbx_free(*output);
- buffer = zbx_malloc(buffer, buf_size);
+ buffer = (char *)zbx_malloc(buffer, buf_size);
*buffer = '\0';
#ifdef _WINDOWS
diff --git a/src/libs/zbxhistory/history_elastic.c b/src/libs/zbxhistory/history_elastic.c
index a6b48440bca..26e02332b87 100644
--- a/src/libs/zbxhistory/history_elastic.c
+++ b/src/libs/zbxhistory/history_elastic.c
@@ -74,7 +74,7 @@ static size_t curl_write_cb(void *ptr, size_t size, size_t nmemb, void *userdata
ZBX_UNUSED(userdata);
- zbx_strncpy_alloc(&page.data, &page.alloc, &page.offset, ptr, r_size);
+ zbx_strncpy_alloc(&page.data, &page.alloc, &page.offset, (const char *)ptr, r_size);
return r_size;
}
@@ -100,7 +100,7 @@ static history_value_t history_str2value(char *str, unsigned char value_type)
switch (value_type)
{
case ITEM_VALUE_TYPE_LOG:
- value.log = zbx_malloc(NULL, sizeof(zbx_log_value_t));
+ value.log = (zbx_log_value_t *)zbx_malloc(NULL, sizeof(zbx_log_value_t));
memset(value.log, 0, sizeof(zbx_log_value_t));
value.log->value = zbx_strdup(NULL, str);
break;
@@ -230,7 +230,7 @@ static void elastic_log_error(CURL *handle, CURLcode error)
************************************************************************************/
static void elastic_close(zbx_history_iface_t *hist)
{
- zbx_elastic_data_t *data = hist->data;
+ zbx_elastic_data_t *data = (zbx_elastic_data_t *)hist->data;
zbx_free(data->buf);
zbx_free(data->post_url);
@@ -289,7 +289,7 @@ static void elastic_writer_release(void)
int i;
for (i = 0; i < writer.ifaces.values_num; i++)
- elastic_close(writer.ifaces.values[i]);
+ elastic_close((zbx_history_iface_t *)writer.ifaces.values[i]);
curl_multi_cleanup(writer.handle);
writer.handle = NULL;
@@ -310,7 +310,7 @@ static void elastic_writer_release(void)
************************************************************************************/
static void elastic_writer_add_iface(zbx_history_iface_t *hist)
{
- zbx_elastic_data_t *data = hist->data;
+ zbx_elastic_data_t *data = (zbx_elastic_data_t *)hist->data;
elastic_writer_init();
@@ -361,7 +361,7 @@ static int elastic_writer_flush(void)
for (i = 0; i < writer.ifaces.values_num; i++)
{
zbx_history_iface_t *hist = (zbx_history_iface_t *)writer.ifaces.values[i];
- zbx_elastic_data_t *data = hist->data;
+ zbx_elastic_data_t *data = (zbx_elastic_data_t *)hist->data;
(void)curl_easy_setopt(data->handle, CURLOPT_HTTPHEADER, curl_headers);
@@ -462,7 +462,7 @@ try_again:
************************************************************************************/
static void elastic_destroy(zbx_history_iface_t *hist)
{
- zbx_elastic_data_t *data = hist->data;
+ zbx_elastic_data_t *data = (zbx_elastic_data_t *)hist->data;
elastic_close(hist);
@@ -495,7 +495,7 @@ static int elastic_get_values(zbx_history_iface_t *hist, zbx_uint64_t itemid, in
{
const char *__function_name = "elastic_get_values";
- zbx_elastic_data_t *data = hist->data;
+ zbx_elastic_data_t *data = (zbx_elastic_data_t *)hist->data;
size_t url_alloc = 0, url_offset = 0, id_alloc = 0, scroll_alloc = 0, scroll_offset = 0;
int total, empty, ret;
CURLcode err;
@@ -704,7 +704,7 @@ static int elastic_add_values(zbx_history_iface_t *hist, const zbx_vector_ptr_t
{
const char *__function_name = "elastic_add_values";
- zbx_elastic_data_t *data = hist->data;
+ zbx_elastic_data_t *data = (zbx_elastic_data_t *)hist->data;
int i, num = 0;
ZBX_DC_HISTORY *h;
struct zbx_json json_idx, json;
@@ -815,7 +815,7 @@ int zbx_history_elastic_init(zbx_history_iface_t *hist, unsigned char value_type
return FAIL;
}
- data = zbx_malloc(NULL, sizeof(zbx_elastic_data_t));
+ data = (zbx_elastic_data_t *)zbx_malloc(NULL, sizeof(zbx_elastic_data_t));
memset(data, 0, sizeof(zbx_elastic_data_t));
data->base_url = zbx_strdup(NULL, CONFIG_HISTORY_STORAGE_URL);
zbx_rtrim(data->base_url, "/");
diff --git a/src/libs/zbxhistory/history_sql.c b/src/libs/zbxhistory/history_sql.c
index e66e4416296..fece020cc40 100644
--- a/src/libs/zbxhistory/history_sql.c
+++ b/src/libs/zbxhistory/history_sql.c
@@ -70,7 +70,7 @@ static void row2value_ui64(history_value_t *value, DB_ROW row)
/* timestamp, logeventid, severity, source, value */
static void row2value_log(history_value_t *value, DB_ROW row)
{
- value->log = zbx_malloc(NULL, sizeof(zbx_log_value_t));
+ value->log = (zbx_log_value_t *)zbx_malloc(NULL, sizeof(zbx_log_value_t));
value->log->timestamp = atoi(row[0]);
value->log->logeventid = atoi(row[1]);
@@ -207,7 +207,7 @@ static void add_history_dbl(const zbx_vector_ptr_t *history)
for (i = 0; i < history->values_num; i++)
{
- const ZBX_DC_HISTORY *h = history->values[i];
+ const ZBX_DC_HISTORY *h = (ZBX_DC_HISTORY *)history->values[i];
if (ITEM_VALUE_TYPE_FLOAT != h->value_type)
continue;
@@ -233,7 +233,7 @@ static void add_history_uint(zbx_vector_ptr_t *history)
for (i = 0; i < history->values_num; i++)
{
- const ZBX_DC_HISTORY *h = history->values[i];
+ const ZBX_DC_HISTORY *h = (ZBX_DC_HISTORY *)history->values[i];
if (ITEM_VALUE_TYPE_UINT64 != h->value_type)
continue;
@@ -259,7 +259,7 @@ static void add_history_str(zbx_vector_ptr_t *history)
for (i = 0; i < history->values_num; i++)
{
- const ZBX_DC_HISTORY *h = history->values[i];
+ const ZBX_DC_HISTORY *h = (ZBX_DC_HISTORY *)history->values[i];
if (ITEM_VALUE_TYPE_STR != h->value_type)
continue;
@@ -285,7 +285,7 @@ static void add_history_text(zbx_vector_ptr_t *history)
for (i = 0; i < history->values_num; i++)
{
- const ZBX_DC_HISTORY *h = history->values[i];
+ const ZBX_DC_HISTORY *h = (ZBX_DC_HISTORY *)history->values[i];
if (ITEM_VALUE_TYPE_TEXT != h->value_type)
continue;
@@ -312,7 +312,7 @@ static void add_history_log(zbx_vector_ptr_t *history)
for (i = 0; i < history->values_num; i++)
{
- const ZBX_DC_HISTORY *h = history->values[i];
+ const ZBX_DC_HISTORY *h = (ZBX_DC_HISTORY *)history->values[i];
const zbx_log_value_t *log;
if (ITEM_VALUE_TYPE_LOG != h->value_type)
@@ -666,7 +666,7 @@ static int sql_add_values(zbx_history_iface_t *hist, const zbx_vector_ptr_t *his
for (i = 0; i < history->values_num; i++)
{
- const ZBX_DC_HISTORY *h = history->values[i];
+ const ZBX_DC_HISTORY *h = (ZBX_DC_HISTORY *)history->values[i];
if (h->value_type == hist->value_type)
h_num++;
diff --git a/src/libs/zbxhttp/punycode.c b/src/libs/zbxhttp/punycode.c
index 7c465c59458..9602c335d1d 100644
--- a/src/libs/zbxhttp/punycode.c
+++ b/src/libs/zbxhttp/punycode.c
@@ -248,7 +248,7 @@ int zbx_http_punycode_encode(const char *text, char **output)
zbx_uint32_t n, tmp, count = 0, *codepoints;
zbx_free(*output);
- codepoints = zbx_malloc(NULL, strlen(text) * sizeof(zbx_uint32_t));
+ codepoints = (zbx_uint32_t *)zbx_malloc(NULL, strlen(text) * sizeof(zbx_uint32_t));
while ('\0' != *text)
{
diff --git a/src/libs/zbxhttp/urlencode.c b/src/libs/zbxhttp/urlencode.c
index 9934cb66f86..59f137007a2 100644
--- a/src/libs/zbxhttp/urlencode.c
+++ b/src/libs/zbxhttp/urlencode.c
@@ -37,7 +37,7 @@ void zbx_http_url_encode(const char *source, char **result)
char *target, *buffer;
const char *hex = "0123456789ABCDEF";
- buffer = zbx_malloc(NULL, strlen(source) * 3 + 1);
+ buffer = (char *)zbx_malloc(NULL, strlen(source) * 3 + 1);
target = buffer;
while ('\0' != *source)
@@ -77,7 +77,7 @@ void zbx_http_url_encode(const char *source, char **result)
int zbx_http_url_decode(const char *source, char **result)
{
const char *url = source;
- char *target, *buffer = zbx_malloc(NULL, strlen(source) + 1);
+ char *target, *buffer = (char *)zbx_malloc(NULL, strlen(source) + 1);
target = buffer;
diff --git a/src/libs/zbxicmpping/icmpping.c b/src/libs/zbxicmpping/icmpping.c
index 6530a8d0a45..fe29a03c593 100644
--- a/src/libs/zbxicmpping/icmpping.c
+++ b/src/libs/zbxicmpping/icmpping.c
@@ -261,7 +261,7 @@ static int process_ping(ZBX_FPING_HOST *hosts, int hosts_count, int count, int i
{
for (i = 0; i < hosts_count; i++)
{
- hosts[i].status = zbx_malloc(NULL, count);
+ hosts[i].status = (char *)zbx_malloc(NULL, count);
memset(hosts[i].status, 0, count);
}
diff --git a/src/libs/zbxipcservice/ipcservice.c b/src/libs/zbxipcservice/ipcservice.c
index 2fb53c876d5..74bc3cfee54 100644
--- a/src/libs/zbxipcservice/ipcservice.c
+++ b/src/libs/zbxipcservice/ipcservice.c
@@ -377,7 +377,7 @@ static int ipc_read_buffer(zbx_uint32_t *header, unsigned char **data, zbx_uint3
return SUCCEED;
}
- *data = zbx_malloc(NULL, data_size);
+ *data = (unsigned char *)zbx_malloc(NULL, data_size);
data_offset = 0;
}
else
@@ -538,13 +538,13 @@ static void ipc_client_free(zbx_ipc_client_t *client)
zbx_ipc_socket_close(&client->csocket);
- while (NULL != (message = zbx_queue_ptr_pop(&client->rx_queue)))
+ while (NULL != (message = (zbx_ipc_message_t *)zbx_queue_ptr_pop(&client->rx_queue)))
zbx_ipc_message_free(message);
zbx_queue_ptr_destroy(&client->rx_queue);
zbx_free(client->rx_data);
- while (NULL != (message = zbx_queue_ptr_pop(&client->tx_queue)))
+ while (NULL != (message = (zbx_ipc_message_t *)zbx_queue_ptr_pop(&client->tx_queue)))
zbx_ipc_message_free(message);
zbx_queue_ptr_destroy(&client->tx_queue);
@@ -594,7 +594,7 @@ static void ipc_client_pop_tx_message(zbx_ipc_client_t *client)
zbx_free(client->tx_data);
client->tx_bytes = 0;
- if (NULL == (message = zbx_queue_ptr_pop(&client->tx_queue)))
+ if (NULL == (message = (zbx_ipc_message_t *)zbx_queue_ptr_pop(&client->tx_queue)))
return;
client->tx_bytes = ZBX_IPC_HEADER_SIZE + message->size;
@@ -924,7 +924,7 @@ static zbx_ipc_message_t *ipc_message_create(zbx_uint32_t code, const unsigned c
if (0 != size)
{
- message->data = zbx_malloc(NULL, size);
+ message->data = (unsigned char *)zbx_malloc(NULL, size);
memcpy(message->data, data, size);
}
else
@@ -1293,7 +1293,7 @@ void zbx_ipc_message_format(const zbx_ipc_message_t *message, char **data)
if (ZBX_IPC_DATA_DUMP_SIZE < data_num)
data_num = ZBX_IPC_DATA_DUMP_SIZE;
- *data = zbx_malloc(*data, data_alloc);
+ *data = (char *)zbx_malloc(*data, data_alloc);
zbx_snprintf_alloc(data, &data_alloc, &data_offset, "code:%u size:%u data:", message->code, message->size);
for (i = 0; i < data_num; i++)
@@ -1321,7 +1321,7 @@ void zbx_ipc_message_copy(zbx_ipc_message_t *dst, const zbx_ipc_message_t *src)
{
dst->code = src->code;
dst->size = src->size;
- dst->data = zbx_malloc(NULL, src->size);
+ dst->data = (unsigned char *)zbx_malloc(NULL, src->size);
memcpy(dst->data, src->data, src->size);
}
@@ -1520,7 +1520,7 @@ void zbx_ipc_service_close(zbx_ipc_service_t *service)
close(service->fd);
for (i = 0; i < service->clients.values_num; i++)
- ipc_client_free(service->clients.values[i]);
+ ipc_client_free((zbx_ipc_client_t *)service->clients.values[i]);
zbx_free(service->path);
@@ -1583,7 +1583,7 @@ int zbx_ipc_service_recv(zbx_ipc_service_t *service, int timeout, zbx_ipc_client
if (NULL != (*client = ipc_service_pop_client(service)))
{
- if (NULL != (*message = zbx_queue_ptr_pop(&(*client)->rx_queue)))
+ if (NULL != (*message = (zbx_ipc_message_t *)zbx_queue_ptr_pop(&(*client)->rx_queue)))
{
if (SUCCEED == zabbix_check_log_level(LOG_LEVEL_TRACE))
{
@@ -1652,7 +1652,7 @@ int zbx_ipc_client_send(zbx_ipc_client_t *client, zbx_uint32_t code, const unsig
{
client->tx_header[ZBX_IPC_MESSAGE_CODE] = code;
client->tx_header[ZBX_IPC_MESSAGE_SIZE] = size;
- client->tx_data = zbx_malloc(NULL, size);
+ client->tx_data = (unsigned char *)zbx_malloc(NULL, size);
memcpy(client->tx_data, data, size);
client->tx_bytes = ZBX_IPC_HEADER_SIZE + size - tx_size;
event_add(client->tx_event, NULL);
diff --git a/src/libs/zbxjson/json.c b/src/libs/zbxjson/json.c
index 3f148691525..6baeab50373 100644
--- a/src/libs/zbxjson/json.c
+++ b/src/libs/zbxjson/json.c
@@ -73,7 +73,7 @@ static void __zbx_json_realloc(struct zbx_json *j, size_t need)
if (need > sizeof(j->buf_stat))
{
j->buffer_allocated = need;
- j->buffer = zbx_malloc(j->buffer, j->buffer_allocated);
+ j->buffer = (char *)zbx_malloc(j->buffer, j->buffer_allocated);
}
else
{
@@ -97,11 +97,11 @@ static void __zbx_json_realloc(struct zbx_json *j, size_t need)
if (j->buffer == j->buf_stat)
{
j->buffer = NULL;
- j->buffer = zbx_malloc(j->buffer, j->buffer_allocated);
+ j->buffer = (char *)zbx_malloc(j->buffer, j->buffer_allocated);
memcpy(j->buffer, j->buf_stat, sizeof(j->buf_stat));
}
else
- j->buffer = zbx_realloc(j->buffer, j->buffer_allocated);
+ j->buffer = (char *)zbx_realloc(j->buffer, j->buffer_allocated);
}
}
@@ -761,7 +761,7 @@ static const char *zbx_json_decodevalue_dyn(const char *p, char **string, size_t
if (*string_alloc <= len)
{
*string_alloc = len + 1;
- *string = zbx_realloc(*string, *string_alloc);
+ *string = (char *)zbx_realloc(*string, *string_alloc);
}
return zbx_json_copy_value(p, len, *string, *string_alloc);
@@ -772,7 +772,7 @@ static const char *zbx_json_decodevalue_dyn(const char *p, char **string, size_t
if (*string_alloc < 1)
{
*string_alloc = 1;
- *string = zbx_realloc(*string, *string_alloc);
+ *string = (char *)zbx_realloc(*string, *string_alloc);
}
**string = '\0';
@@ -1211,7 +1211,7 @@ void zbx_json_value_dyn(const struct zbx_json_parse *jp, char **string, size_t *
size_t len = jp->end - jp->start + 2;
if (*string_alloc < len)
- *string = zbx_realloc(*string, len);
+ *string = (char *)zbx_realloc(*string, len);
zbx_strlcpy(*string, jp->start, len);
}
diff --git a/src/libs/zbxmedia/email.c b/src/libs/zbxmedia/email.c
index c76c279aa5b..adc195c62e2 100644
--- a/src/libs/zbxmedia/email.c
+++ b/src/libs/zbxmedia/email.c
@@ -59,7 +59,7 @@ static void str_base64_encode_rfc2047(const char *src, char **p_base64)
assert(NULL == *p_base64); /* do not accept already allocated memory */
p_base64_alloc = ZBX_EMAIL_B64_MAXWORD_RFC2047 + sizeof(ZBX_EMAIL_ENCODED_WORD_SEPARATOR);
- *p_base64 = zbx_malloc(NULL, p_base64_alloc);
+ *p_base64 = (char *)zbx_malloc(NULL, p_base64_alloc);
**p_base64 = '\0';
for (p0 = src; '\0' != *p0; p0 = p1)
@@ -239,7 +239,7 @@ static int smtp_parse_mailbox(const char *mailbox, char *error, size_t max_error
if (pstart < angle_addr_start) /* display name */
{
- mailaddr->disp_name = zbx_malloc(mailaddr->disp_name,
+ mailaddr->disp_name = (char *)zbx_malloc(mailaddr->disp_name,
(size_t)(angle_addr_start - pstart + 1));
memcpy(mailaddr->disp_name, pstart, (size_t)(angle_addr_start - pstart));
*(mailaddr->disp_name + (angle_addr_start - pstart)) = '\0';
@@ -626,8 +626,9 @@ static int send_email_curl(const char *smtp_server, unsigned short smtp_port, co
#ifdef HAVE_SMTP_AUTHENTICATION
const char *__function_name = "send_email_curl";
- int err, ret = FAIL, i;
- CURL *easyhandle;
+ int ret = FAIL, i;
+ CURL *easyhandle;
+ CURLcode err;
char url[MAX_STRING_LEN], errbuf[CURL_ERROR_SIZE] = "";
size_t url_offset= 0;
struct curl_slist *recipients = NULL;
diff --git a/src/libs/zbxmedia/eztexting.c b/src/libs/zbxmedia/eztexting.c
index d68b3763300..0cbef47ffc5 100644
--- a/src/libs/zbxmedia/eztexting.c
+++ b/src/libs/zbxmedia/eztexting.c
@@ -47,10 +47,10 @@ static size_t WRITEFUNCTION2(void *ptr, size_t size, size_t nmemb, void *userdat
{
page.allocated = MAX(64, r_size);
page.offset = 0;
- page.data = zbx_malloc(page.data, page.allocated);
+ page.data = (char *)zbx_malloc(page.data, page.allocated);
}
- zbx_strncpy_alloc(&page.data, &page.allocated, &page.offset, ptr, r_size);
+ zbx_strncpy_alloc(&page.data, &page.allocated, &page.offset, (char *)ptr, r_size);
return r_size;
}
@@ -102,11 +102,13 @@ int send_ez_texting(const char *username, const char *password, const char *send
int ret = FAIL;
int max_message_len;
- int i, len, opt, err;
+ int i, len;
char *sendto_digits = NULL, *message_ascii = NULL;
char *username_esc = NULL, *password_esc = NULL, *sendto_esc = NULL, *message_esc = NULL;
char postfields[MAX_STRING_LEN];
CURL *easy_handle = NULL;
+ CURLoption opt;
+ CURLcode err;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() sendto:'%s' message:'%s'", __function_name, sendto, message);
diff --git a/src/libs/zbxmemory/memalloc.c b/src/libs/zbxmemory/memalloc.c
index 8bec17a0315..c745e9a74bd 100644
--- a/src/libs/zbxmemory/memalloc.c
+++ b/src/libs/zbxmemory/memalloc.c
@@ -586,25 +586,25 @@ int zbx_mem_create(zbx_mem_info_t **info, zbx_uint64_t size, const char *descr,
/* allocate zbx_mem_info_t structure, its buckets, and description inside shared memory */
- *info = ALIGN8(base);
+ *info = (zbx_mem_info_t *)ALIGN8(base);
(*info)->shm_id = shm_id;
(*info)->orig_size = size;
size -= (char *)(*info + 1) - (char *)base;
base = (void *)(*info + 1);
- (*info)->buckets = ALIGNPTR(base);
+ (*info)->buckets = (void **)ALIGNPTR(base);
memset((*info)->buckets, 0, MEM_BUCKET_COUNT * ZBX_PTR_SIZE);
size -= (char *)((*info)->buckets + MEM_BUCKET_COUNT) - (char *)base;
base = (void *)((*info)->buckets + MEM_BUCKET_COUNT);
- zbx_strlcpy(base, descr, size);
- (*info)->mem_descr = base;
+ zbx_strlcpy((char *)base, descr, size);
+ (*info)->mem_descr = (char *)base;
size -= strlen(descr) + 1;
base = (void *)((char *)base + strlen(descr) + 1);
- zbx_strlcpy(base, param, size);
- (*info)->mem_param = base;
+ zbx_strlcpy((char *)base, param, size);
+ (*info)->mem_param = (char *)base;
size -= strlen(param) + 1;
base = (void *)((char *)base + strlen(param) + 1);
diff --git a/src/libs/zbxmodules/modules.c b/src/libs/zbxmodules/modules.c
index 1e02f55c082..10413f2cd8d 100644
--- a/src/libs/zbxmodules/modules.c
+++ b/src/libs/zbxmodules/modules.c
@@ -84,7 +84,7 @@ static zbx_module_t *zbx_register_module(void *lib, char *name)
{
zbx_module_t *module;
- module = zbx_malloc(NULL, sizeof(zbx_module_t));
+ module = (zbx_module_t *)zbx_malloc(NULL, sizeof(zbx_module_t));
module->lib = lib;
module->name = zbx_strdup(NULL, name);
zbx_vector_ptr_append(&modules, module);
@@ -110,14 +110,14 @@ static void zbx_register_history_write_cbs(zbx_module_t *module, ZBX_HISTORY_WRI
if (NULL == history_float_cbs)
{
- history_float_cbs = zbx_malloc(history_float_cbs, sizeof(zbx_history_float_cb_t));
+ history_float_cbs = (zbx_history_float_cb_t *)zbx_malloc(history_float_cbs, sizeof(zbx_history_float_cb_t));
history_float_cbs[0].module = NULL;
}
while (NULL != history_float_cbs[j].module)
j++;
- history_float_cbs = zbx_realloc(history_float_cbs, (j + 2) * sizeof(zbx_history_float_cb_t));
+ history_float_cbs = (zbx_history_float_cb_t *)zbx_realloc(history_float_cbs, (j + 2) * sizeof(zbx_history_float_cb_t));
history_float_cbs[j].module = module;
history_float_cbs[j].history_float_cb = history_write_cbs.history_float_cb;
history_float_cbs[j + 1].module = NULL;
@@ -129,14 +129,14 @@ static void zbx_register_history_write_cbs(zbx_module_t *module, ZBX_HISTORY_WRI
if (NULL == history_integer_cbs)
{
- history_integer_cbs = zbx_malloc(history_integer_cbs, sizeof(zbx_history_integer_cb_t));
+ history_integer_cbs = (zbx_history_integer_cb_t *)zbx_malloc(history_integer_cbs, sizeof(zbx_history_integer_cb_t));
history_integer_cbs[0].module = NULL;
}
while (NULL != history_integer_cbs[j].module)
j++;
- history_integer_cbs = zbx_realloc(history_integer_cbs, (j + 2) * sizeof(zbx_history_integer_cb_t));
+ history_integer_cbs = (zbx_history_integer_cb_t *)zbx_realloc(history_integer_cbs, (j + 2) * sizeof(zbx_history_integer_cb_t));
history_integer_cbs[j].module = module;
history_integer_cbs[j].history_integer_cb = history_write_cbs.history_integer_cb;
history_integer_cbs[j + 1].module = NULL;
@@ -148,14 +148,14 @@ static void zbx_register_history_write_cbs(zbx_module_t *module, ZBX_HISTORY_WRI
if (NULL == history_string_cbs)
{
- history_string_cbs = zbx_malloc(history_string_cbs, sizeof(zbx_history_string_cb_t));
+ history_string_cbs = (zbx_history_string_cb_t *)zbx_malloc(history_string_cbs, sizeof(zbx_history_string_cb_t));
history_string_cbs[0].module = NULL;
}
while (NULL != history_string_cbs[j].module)
j++;
- history_string_cbs = zbx_realloc(history_string_cbs, (j + 2) * sizeof(zbx_history_string_cb_t));
+ history_string_cbs = (zbx_history_string_cb_t *)zbx_realloc(history_string_cbs, (j + 2) * sizeof(zbx_history_string_cb_t));
history_string_cbs[j].module = module;
history_string_cbs[j].history_string_cb = history_write_cbs.history_string_cb;
history_string_cbs[j + 1].module = NULL;
@@ -167,14 +167,14 @@ static void zbx_register_history_write_cbs(zbx_module_t *module, ZBX_HISTORY_WRI
if (NULL == history_text_cbs)
{
- history_text_cbs = zbx_malloc(history_text_cbs, sizeof(zbx_history_text_cb_t));
+ history_text_cbs = (zbx_history_text_cb_t *)zbx_malloc(history_text_cbs, sizeof(zbx_history_text_cb_t));
history_text_cbs[0].module = NULL;
}
while (NULL != history_text_cbs[j].module)
j++;
- history_text_cbs = zbx_realloc(history_text_cbs, (j + 2) * sizeof(zbx_history_text_cb_t));
+ history_text_cbs = (zbx_history_text_cb_t *)zbx_realloc(history_text_cbs, (j + 2) * sizeof(zbx_history_text_cb_t));
history_text_cbs[j].module = module;
history_text_cbs[j].history_text_cb = history_write_cbs.history_text_cb;
history_text_cbs[j + 1].module = NULL;
@@ -186,14 +186,14 @@ static void zbx_register_history_write_cbs(zbx_module_t *module, ZBX_HISTORY_WRI
if (NULL == history_log_cbs)
{
- history_log_cbs = zbx_malloc(history_log_cbs, sizeof(zbx_history_log_cb_t));
+ history_log_cbs = (zbx_history_log_cb_t *)zbx_malloc(history_log_cbs, sizeof(zbx_history_log_cb_t));
history_log_cbs[0].module = NULL;
}
while (NULL != history_log_cbs[j].module)
j++;
- history_log_cbs = zbx_realloc(history_log_cbs, (j + 2) * sizeof(zbx_history_log_cb_t));
+ history_log_cbs = (zbx_history_log_cb_t *)zbx_realloc(history_log_cbs, (j + 2) * sizeof(zbx_history_log_cb_t));
history_log_cbs[j].module = module;
history_log_cbs[j].history_log_cb = history_write_cbs.history_log_cb;
history_log_cbs[j + 1].module = NULL;
diff --git a/src/libs/zbxregexp/zbxregexp.c b/src/libs/zbxregexp/zbxregexp.c
index f2b5de5d62a..f2ea995b8a6 100644
--- a/src/libs/zbxregexp/zbxregexp.c
+++ b/src/libs/zbxregexp/zbxregexp.c
@@ -435,7 +435,7 @@ void zbx_regexp_clean_expressions(zbx_vector_ptr_t *expressions)
for (i = 0; i < expressions->values_num; i++)
{
- zbx_expression_t *regexp = expressions->values[i];
+ zbx_expression_t *regexp = (zbx_expression_t *)expressions->values[i];
zbx_free(regexp->name);
zbx_free(regexp->expression);
@@ -450,7 +450,7 @@ void add_regexp_ex(zbx_vector_ptr_t *regexps, const char *name, const char *expr
{
zbx_expression_t *regexp;
- regexp = zbx_malloc(NULL, sizeof(zbx_expression_t));
+ regexp = (zbx_expression_t *)zbx_malloc(NULL, sizeof(zbx_expression_t));
regexp->name = zbx_strdup(NULL, name);
regexp->expression = zbx_strdup(NULL, expression);
@@ -542,7 +542,7 @@ static int regexp_match_ex_regsub(const char *string, const char *pattern, int c
**********************************************************************************/
static int regexp_match_ex_substring(const char *string, const char *pattern, int case_sensitive)
{
- char *ptr = NULL;
+ const char *ptr = NULL;
switch (case_sensitive)
{
@@ -662,7 +662,7 @@ int regexp_sub_ex(const zbx_vector_ptr_t *regexps, const char *string, const cha
for (i = 0; i < regexps->values_num; i++) /* loop over global regexp subexpressions */
{
- const zbx_expression_t *regexp = regexps->values[i];
+ const zbx_expression_t *regexp = (zbx_expression_t *)regexps->values[i];
if (0 != strcmp(regexp->name, pattern))
continue;
diff --git a/src/libs/zbxself/selfmon.c b/src/libs/zbxself/selfmon.c
index c60038db69e..80476c5297e 100644
--- a/src/libs/zbxself/selfmon.c
+++ b/src/libs/zbxself/selfmon.c
@@ -333,7 +333,7 @@ int init_selfmon_collector(char **error)
goto out;
}
- if ((void *)(-1) == (p = shmat(shm_id, NULL, 0)))
+ if ((void *)(-1) == (p = (char *)shmat(shm_id, NULL, 0)))
{
*error = zbx_dsprintf(*error, "cannot attach shared memory for a self-monitoring collector: %s",
zbx_strerror(errno));
diff --git a/src/libs/zbxserver/evalfunc.c b/src/libs/zbxserver/evalfunc.c
index f323d97ea14..a4639706a6e 100644
--- a/src/libs/zbxserver/evalfunc.c
+++ b/src/libs/zbxserver/evalfunc.c
@@ -2181,8 +2181,8 @@ static int evaluate_FORECAST(char *value, DC_ITEM *item, const char *parameters,
if (0 < values.values_num)
{
- t = zbx_malloc(t, values.values_num * sizeof(double));
- x = zbx_malloc(x, values.values_num * sizeof(double));
+ t = (double *)zbx_malloc(t, values.values_num * sizeof(double));
+ x = (double *)zbx_malloc(x, values.values_num * sizeof(double));
zero_time.sec = values.values[values.values_num - 1].timestamp.sec;
zero_time.ns = values.values[values.values_num - 1].timestamp.ns;
@@ -2326,8 +2326,8 @@ static int evaluate_TIMELEFT(char *value, DC_ITEM *item, const char *parameters,
if (0 < values.values_num)
{
- t = zbx_malloc(t, values.values_num * sizeof(double));
- x = zbx_malloc(x, values.values_num * sizeof(double));
+ t = (double *)zbx_malloc(t, values.values_num * sizeof(double));
+ x = (double *)zbx_malloc(x, values.values_num * sizeof(double));
zero_time.sec = values.values[values.values_num - 1].timestamp.sec;
zero_time.ns = values.values[values.values_num - 1].timestamp.ns;
diff --git a/src/libs/zbxserver/expression.c b/src/libs/zbxserver/expression.c
index ab2a1c515ae..567f452eafc 100644
--- a/src/libs/zbxserver/expression.c
+++ b/src/libs/zbxserver/expression.c
@@ -267,7 +267,7 @@ static void DCexpand_trigger_expression(char **expression)
zabbix_log(LOG_LEVEL_DEBUG, "In %s() expression:'%s'", __function_name, *expression);
- tmp = zbx_malloc(tmp, tmp_alloc);
+ tmp = (char *)zbx_malloc(tmp, tmp_alloc);
for (l = 0; '\0' != (*expression)[l]; l++)
{
@@ -568,10 +568,10 @@ static int DBget_trigger_template_name(zbx_uint64_t triggerid, const zbx_uint64_
goto out;
}
- *replace_to = zbx_realloc(*replace_to, replace_to_alloc);
+ *replace_to = (char *)zbx_realloc(*replace_to, replace_to_alloc);
**replace_to = '\0';
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select distinct h.name"
@@ -654,10 +654,10 @@ static int DBget_trigger_hostgroup_name(zbx_uint64_t triggerid, const zbx_uint64
}
}
- *replace_to = zbx_realloc(*replace_to, replace_to_alloc);
+ *replace_to = (char *)zbx_realloc(*replace_to, replace_to_alloc);
**replace_to = '\0';
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select distinct g.name"
@@ -1429,7 +1429,7 @@ static void get_escalation_history(zbx_uint64_t actionid, const DB_EVENT *event,
time_t now;
zbx_uint64_t userid;
- buf = zbx_malloc(buf, buf_alloc);
+ buf = (char *)zbx_malloc(buf, buf_alloc);
zbx_snprintf_alloc(&buf, &buf_alloc, &buf_offset, "Problem started: %s %s Age: %s\n",
zbx_date2str(event->clock), zbx_time2str(event->clock),
@@ -1569,7 +1569,7 @@ static void get_event_ack_history(const DB_EVENT *event, char **replace_to, cons
return;
}
- buf = zbx_malloc(buf, buf_alloc);
+ buf = (char *)zbx_malloc(buf, buf_alloc);
*buf = '\0';
result = DBselect("select clock,userid,message,action"
@@ -2510,7 +2510,7 @@ static void wrap_negative_double_suffix(char **replace_to, size_t *replace_to_al
if (NULL != replace_to_alloc)
*replace_to_alloc = replace_to_len + 3;
- buffer = zbx_malloc(NULL, replace_to_len + 3);
+ buffer = (char *)zbx_malloc(NULL, replace_to_len + 3);
memcpy(buffer + 1, *replace_to, replace_to_len);
@@ -4210,7 +4210,7 @@ static void zbx_link_triggers_with_functions(zbx_vector_ptr_t *triggers_func_pos
if (SUCCEED == extract_expression_functionids(&funcids, tr->expression))
{
- tr_func_pos = zbx_malloc(NULL, sizeof(zbx_trigger_func_position_t));
+ tr_func_pos = (zbx_trigger_func_position_t *)zbx_malloc(NULL, sizeof(zbx_trigger_func_position_t));
tr_func_pos->trigger = tr;
tr_func_pos->start_index = functionids->values_num;
tr_func_pos->count = funcids.values_num;
@@ -4259,8 +4259,8 @@ void zbx_determine_items_in_expressions(zbx_vector_ptr_t *trigger_order, const z
zbx_link_triggers_with_functions(&triggers_func_pos, &functionids, trigger_order);
- functions = zbx_malloc(functions, sizeof(DC_FUNCTION) * functionids.values_num);
- errcodes = zbx_malloc(errcodes, sizeof(int) * functionids.values_num);
+ functions = (DC_FUNCTION *)zbx_malloc(functions, sizeof(DC_FUNCTION) * functionids.values_num);
+ errcodes = (int *)zbx_malloc(errcodes, sizeof(int) * functionids.values_num);
DCconfig_get_functions_by_functionids(functions, functionids.values, errcodes, functionids.values_num);
@@ -4375,8 +4375,8 @@ static void zbx_populate_function_items(zbx_vector_uint64_t *functionids, zbx_ha
func_local.value = NULL;
func_local.error = NULL;
- functions = zbx_malloc(functions, sizeof(DC_FUNCTION) * functionids->values_num);
- errcodes = zbx_malloc(errcodes, sizeof(int) * functionids->values_num);
+ functions = (DC_FUNCTION *)zbx_malloc(functions, sizeof(DC_FUNCTION) * functionids->values_num);
+ errcodes = (int *)zbx_malloc(errcodes, sizeof(int) * functionids->values_num);
DCconfig_get_functions_by_functionids(functions, functionids->values, errcodes, functionids->values_num);
@@ -4402,9 +4402,9 @@ static void zbx_populate_function_items(zbx_vector_uint64_t *functionids, zbx_ha
func_local.function = functions[i].function;
func_local.parameter = functions[i].parameter;
- if (NULL == (func = zbx_hashset_search(funcs, &func_local)))
+ if (NULL == (func = (zbx_func_t *)zbx_hashset_search(funcs, &func_local)))
{
- func = zbx_hashset_insert(funcs, &func_local, sizeof(func_local));
+ func = (zbx_func_t *)zbx_hashset_insert(funcs, &func_local, sizeof(func_local));
func->function = zbx_strdup(NULL, func_local.function);
func->parameter = zbx_strdup(NULL, func_local.parameter);
}
@@ -4440,19 +4440,19 @@ static void zbx_evaluate_item_functions(zbx_hashset_t *funcs, zbx_vector_ptr_t *
zbx_vector_uint64_reserve(&itemids, funcs->num_data);
zbx_hashset_iter_reset(funcs, &iter);
- while (NULL != (func = zbx_hashset_iter_next(&iter)))
+ while (NULL != (func = (zbx_func_t *)zbx_hashset_iter_next(&iter)))
zbx_vector_uint64_append(&itemids, func->itemid);
zbx_vector_uint64_sort(&itemids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
zbx_vector_uint64_uniq(&itemids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- items = zbx_malloc(items, sizeof(DC_ITEM) * (size_t)itemids.values_num);
- errcodes = zbx_malloc(errcodes, sizeof(int) * (size_t)itemids.values_num);
+ items = (DC_ITEM *)zbx_malloc(items, sizeof(DC_ITEM) * (size_t)itemids.values_num);
+ errcodes = (int *)zbx_malloc(errcodes, sizeof(int) * (size_t)itemids.values_num);
DCconfig_get_items_by_itemids(items, itemids.values, errcodes, itemids.values_num);
zbx_hashset_iter_reset(funcs, &iter);
- while (NULL != (func = zbx_hashset_iter_next(&iter)))
+ while (NULL != (func = (zbx_func_t *)zbx_hashset_iter_next(&iter)))
{
int ret_unknown = 0; /* flag raised if current function evaluates to ZBX_UNKNOWN */
char *unknown_msg;
@@ -4580,7 +4580,7 @@ static int substitute_expression_functions_results(zbx_hashset_t *ifuncs, char *
*br++ = '}';
bl = br;
- if (NULL == (ifunc = zbx_hashset_search(ifuncs, &functionid)))
+ if (NULL == (ifunc = (zbx_ifunc_t *)zbx_hashset_search(ifuncs, &functionid)))
{
*error = zbx_dsprintf(*error, "Cannot obtain function"
" and item for functionid: " ZBX_FS_UI64, functionid);
@@ -4628,7 +4628,7 @@ static void zbx_substitute_functions_results(zbx_hashset_t *ifuncs, zbx_vector_p
zabbix_log(LOG_LEVEL_DEBUG, "In %s() ifuncs_num:%d tr_num:%d",
__function_name, ifuncs->num_data, triggers->values_num);
- out = zbx_malloc(out, out_alloc);
+ out = (char *)zbx_malloc(out, out_alloc);
for (i = 0; i < triggers->values_num; i++)
{
@@ -4867,7 +4867,7 @@ static int process_simple_macro_token(char **data, zbx_token_t *token, const str
goto out;
}
- replace_to = zbx_malloc(NULL, replace_to_alloc);
+ replace_to = (char *)zbx_malloc(NULL, replace_to_alloc);
lld_start = token->data.simple_macro.key.l;
lld_end = token->data.simple_macro.func_param.r - 1;
diff --git a/src/libs/zbxsysinfo/common/dir.c b/src/libs/zbxsysinfo/common/dir.c
index f88f33ccb23..4869c776814 100644
--- a/src/libs/zbxsysinfo/common/dir.c
+++ b/src/libs/zbxsysinfo/common/dir.c
@@ -241,11 +241,11 @@ static int prepare_mode_parameter(const AGENT_REQUEST *request, AGENT_RESULT *re
static int etype_to_mask(char *etype)
{
- static char *template = DET_TEMPLATE;
- char *tmp;
- int ret = 1;
+ static const char *template_list = DET_TEMPLATE;
+ const char *tmp;
+ int ret = 1;
- for (tmp = template; '\0' != *tmp; tmp += strlen(tmp) + 1)
+ for (tmp = template_list; '\0' != *tmp; tmp += strlen(tmp) + 1)
{
if (0 == strcmp(etype, tmp))
break;
@@ -392,7 +392,7 @@ static void list_vector_destroy(zbx_vector_ptr_t *list)
while (0 < list->values_num)
{
- item = list->values[--list->values_num];
+ item = (zbx_directory_item_t *)list->values[--list->values_num];
zbx_free(item->path);
zbx_free(item);
}
@@ -405,7 +405,7 @@ static void descriptors_vector_destroy(zbx_vector_ptr_t *descriptors)
while (0 < descriptors->values_num)
{
- file = descriptors->values[--descriptors->values_num];
+ file = (zbx_file_descriptor_t *)descriptors->values[--descriptors->values_num];
zbx_free(file);
}
zbx_vector_ptr_destroy(descriptors);
@@ -609,7 +609,7 @@ static int vfs_dir_size(AGENT_REQUEST *request, AGENT_RESULT *result)
while (0 < list.values_num)
{
- item = list.values[--list.values_num];
+ item = (zbx_directory_item_t *)list.values[--list.values_num];
if (NULL == (directory = opendir(item->path)))
{
@@ -894,7 +894,7 @@ static int vfs_dir_count(AGENT_REQUEST *request, AGENT_RESULT *result)
while (0 < list.values_num)
{
- item = list.values[--list.values_num];
+ item = (zbx_directory_item_t *)list.values[--list.values_num];
if (NULL == (directory = opendir(item->path)))
{
diff --git a/src/libs/zbxsysinfo/common/file.c b/src/libs/zbxsysinfo/common/file.c
index 3394a1b988c..03f13db39dc 100644
--- a/src/libs/zbxsysinfo/common/file.c
+++ b/src/libs/zbxsysinfo/common/file.c
@@ -549,7 +549,7 @@ int VFS_FILE_MD5SUM(AGENT_REQUEST *request, AGENT_RESULT *result)
/* convert MD5 hash to text form */
sz = MD5_DIGEST_SIZE * 2 + 1;
- hash_text = zbx_malloc(hash_text, sz);
+ hash_text = (char *)zbx_malloc(hash_text, sz);
for (i = 0; i < MD5_DIGEST_SIZE; i++)
{
diff --git a/src/libs/zbxsysinfo/common/http.c b/src/libs/zbxsysinfo/common/http.c
index 39368e87511..b77a66c792a 100644
--- a/src/libs/zbxsysinfo/common/http.c
+++ b/src/libs/zbxsysinfo/common/http.c
@@ -214,7 +214,7 @@ int WEB_PAGE_REGEXP(AGENT_REQUEST *request, AGENT_RESULT *result)
if (NULL == output || '\0' == *output)
output = "\\0";
- buffer = zbx_malloc(buffer, ZBX_MAX_WEBPAGE_SIZE);
+ buffer = (char *)zbx_malloc(buffer, ZBX_MAX_WEBPAGE_SIZE);
if (SYSINFO_RET_OK == get_http_page(hostname, path, port_number, buffer, ZBX_MAX_WEBPAGE_SIZE))
{
diff --git a/src/libs/zbxsysinfo/common/net.c b/src/libs/zbxsysinfo/common/net.c
index c62e119522a..d2cce19d9db 100644
--- a/src/libs/zbxsysinfo/common/net.c
+++ b/src/libs/zbxsysinfo/common/net.c
@@ -194,8 +194,8 @@ static int dns_query(AGENT_REQUEST *request, AGENT_RESULT *result, int short_ans
#endif
typedef struct
{
- char *name;
- int type;
+ const char *name;
+ int type;
}
resolv_querytype_t;
diff --git a/src/libs/zbxsysinfo/linux/hardware.c b/src/libs/zbxsysinfo/linux/hardware.c
index a0962eccdab..92072fa3259 100644
--- a/src/libs/zbxsysinfo/linux/hardware.c
+++ b/src/libs/zbxsysinfo/linux/hardware.c
@@ -110,7 +110,7 @@ static int get_dmi_info(char *buf, int bufsize, int flags)
if (-1 == fstat(fd, &file_buf))
goto close;
- smbuf = zbx_malloc(NULL, file_buf.st_size);
+ smbuf = (unsigned char *)zbx_malloc(NULL, file_buf.st_size);
if (-1 == (ssize_t)(smbios_len = read(fd, smbuf, file_buf.st_size)))
goto clean;
@@ -153,7 +153,7 @@ static int get_dmi_info(char *buf, int bufsize, int flags)
goto close;
}
- smbuf = zbx_malloc(smbuf, smbios_len);
+ smbuf = (unsigned char *)zbx_malloc(smbuf, smbios_len);
len = smbios % pagesize; /* mmp needs to be a multiple of pagesize for munmap */
if (MAP_FAILED == (mmp = mmap(0, len + smbios_len, PROT_READ, MAP_SHARED, fd, smbios - len)))
diff --git a/src/libs/zbxsysinfo/linux/linux.c b/src/libs/zbxsysinfo/linux/linux.c
index bd4adf76b5f..5c27ff20e6c 100644
--- a/src/libs/zbxsysinfo/linux/linux.c
+++ b/src/libs/zbxsysinfo/linux/linux.c
@@ -21,7 +21,7 @@
#include "sysinfo.h"
#include "proc.h"
-ZBX_METRIC parameters_specific[] =
+ZBX_METRIC parameters_specific[] =
/* KEY FLAG FUNCTION TEST PARAMETERS */
{
{"kernel.maxfiles", 0, KERNEL_MAXFILES, NULL},
diff --git a/src/libs/zbxsysinfo/linux/net.c b/src/libs/zbxsysinfo/linux/net.c
index 13d17b14cfe..e42370f2555 100644
--- a/src/libs/zbxsysinfo/linux/net.c
+++ b/src/libs/zbxsysinfo/linux/net.c
@@ -149,7 +149,7 @@ static int find_tcp_port_by_state_nl(unsigned short port, int state, int *found)
for (r_hdr = (struct nlmsghdr *)buffer; NLMSG_OK(r_hdr, (unsigned)status);
r_hdr = NLMSG_NEXT(r_hdr, status))
{
- struct inet_diag_msg *r = NLMSG_DATA(r_hdr);
+ struct inet_diag_msg *r = (struct inet_diag_msg *)NLMSG_DATA(r_hdr);
if (sequence != r_hdr->nlmsg_seq)
continue;
@@ -294,7 +294,7 @@ static int proc_read_tcp_listen(const char *filename, char **buffer, int *buf
if (offset == *buffer_alloc)
{
*buffer_alloc *= 2;
- *buffer = zbx_realloc(*buffer, *buffer_alloc);
+ *buffer = (char *)zbx_realloc(*buffer, *buffer_alloc);
}
(*buffer)[offset] = '\0';
@@ -375,7 +375,7 @@ static int proc_read_file(const char *filename, char **buffer, int *buffer_alloc
if (offset == *buffer_alloc)
{
*buffer_alloc *= 2;
- *buffer = zbx_realloc(*buffer, *buffer_alloc);
+ *buffer = (char *)zbx_realloc(*buffer, *buffer_alloc);
}
}
@@ -632,7 +632,7 @@ int NET_TCP_LISTEN(AGENT_REQUEST *request, AGENT_RESULT *result)
zabbix_log(LOG_LEVEL_DEBUG, "netlink interface error: %s", error);
zabbix_log(LOG_LEVEL_DEBUG, "falling back on reading /proc/net/tcp...");
#endif
- buffer = zbx_malloc(NULL, buffer_alloc);
+ buffer = (char *)zbx_malloc(NULL, buffer_alloc);
if (0 < (n = proc_read_tcp_listen("/proc/net/tcp", &buffer, &buffer_alloc)))
{
@@ -688,7 +688,7 @@ int NET_UDP_LISTEN(AGENT_REQUEST *request, AGENT_RESULT *result)
return SYSINFO_RET_FAIL;
}
- buffer = zbx_malloc(NULL, buffer_alloc);
+ buffer = (char *)zbx_malloc(NULL, buffer_alloc);
if (0 < (n = proc_read_file("/proc/net/udp", &buffer, &buffer_alloc)))
{
diff --git a/src/libs/zbxsysinfo/linux/proc.c b/src/libs/zbxsysinfo/linux/proc.c
index a0d003e7cba..164d6822860 100644
--- a/src/libs/zbxsysinfo/linux/proc.c
+++ b/src/libs/zbxsysinfo/linux/proc.c
@@ -62,7 +62,7 @@ static int get_cmdline(FILE *f_cmd, char **line, size_t *line_offset)
rewind(f_cmd);
- *line = zbx_malloc(*line, line_alloc + 2);
+ *line = (char *)zbx_malloc(*line, line_alloc + 2);
*line_offset = 0;
while (0 != (n = fread(*line + *line_offset, 1, line_alloc - *line_offset, f_cmd)))
@@ -73,7 +73,7 @@ static int get_cmdline(FILE *f_cmd, char **line, size_t *line_offset)
break;
line_alloc *= 2;
- *line = zbx_realloc(*line, line_alloc + 2);
+ *line = (char *)zbx_realloc(*line, line_alloc + 2);
}
if (0 == ferror(f_cmd))
@@ -898,7 +898,7 @@ static int proc_get_process_cmdline(pid_t pid, char **cmdline, size_t *cmdline_n
if (-1 == (fd = open(tmp, O_RDONLY)))
return FAIL;
- *cmdline = zbx_malloc(NULL, cmdline_alloc);
+ *cmdline = (char *)zbx_malloc(NULL, cmdline_alloc);
while (0 < (n = read(fd, *cmdline + *cmdline_nbytes, cmdline_alloc - *cmdline_nbytes)))
{
@@ -907,7 +907,7 @@ static int proc_get_process_cmdline(pid_t pid, char **cmdline, size_t *cmdline_n
if (*cmdline_nbytes == cmdline_alloc)
{
cmdline_alloc *= 2;
- *cmdline = zbx_realloc(*cmdline, cmdline_alloc);
+ *cmdline = (char *)zbx_realloc(*cmdline, cmdline_alloc);
}
}
@@ -921,7 +921,7 @@ static int proc_get_process_cmdline(pid_t pid, char **cmdline, size_t *cmdline_n
if (*cmdline_nbytes == cmdline_alloc)
{
cmdline_alloc += 1;
- *cmdline = zbx_realloc(*cmdline, cmdline_alloc);
+ *cmdline = (char *)zbx_realloc(*cmdline, cmdline_alloc);
}
(*cmdline)[*cmdline_nbytes] = '\0';
diff --git a/src/libs/zbxsysinfo/linux/sensors.c b/src/libs/zbxsysinfo/linux/sensors.c
index e5e2c83a4ce..085532d1cd3 100644
--- a/src/libs/zbxsysinfo/linux/sensors.c
+++ b/src/libs/zbxsysinfo/linux/sensors.c
@@ -24,7 +24,7 @@
#define DEVICE_DIR "/proc/sys/dev/sensors"
#else
#define DEVICE_DIR "/sys/class/hwmon"
-static char *locations[] = {"", "/device", NULL};
+static const char *locations[] = {"", "/device", NULL};
#endif
#define ATTR_MAX 128
@@ -92,8 +92,9 @@ static void count_sensor(int do_task, const char *filename, double *aggr, int *c
*********************************************************************************/
static const char *sysfs_read_attr(const char *device, char **attribute)
{
- char path[MAX_STRING_LEN], buf[ATTR_MAX], *p, **location;
- FILE *f;
+ const char **location;
+ char path[MAX_STRING_LEN], buf[ATTR_MAX], *p;
+ FILE *f;
for (location = locations; NULL != *location; location++)
{
diff --git a/src/libs/zbxsysinfo/linux/software.h b/src/libs/zbxsysinfo/linux/software.h
index 42c75822109..d0cb174333f 100644
--- a/src/libs/zbxsysinfo/linux/software.h
+++ b/src/libs/zbxsysinfo/linux/software.h
@@ -32,7 +32,7 @@ typedef struct
const char *name;
const char *test_cmd; /* if this shell command has stdout output, package manager is present */
const char *list_cmd; /* this command lists the installed packages */
- int (*parser)(); /* for non-standard list (package per line), add a parser function */
+ int (*parser)(const char *line, char *package, size_t max_package_len); /* for non-standard list (package per line), add a parser function */
}
ZBX_PACKAGE_MANAGER;
diff --git a/src/libs/zbxsysinfo/simple/simple.c b/src/libs/zbxsysinfo/simple/simple.c
index 6b505efdd59..2bb74e2a4bb 100644
--- a/src/libs/zbxsysinfo/simple/simple.c
+++ b/src/libs/zbxsysinfo/simple/simple.c
@@ -53,7 +53,7 @@ static int check_ldap(const char *host, unsigned short port, int timeout, int
LDAPMessage *msg = NULL;
BerElement *ber = NULL;
- char *attrs[2] = { "namingContexts", NULL };
+ char *attrs[2] = {"namingContexts", NULL };
char *attr = NULL;
char **valRes = NULL;
int ldapErr = 0;
@@ -178,9 +178,10 @@ static int check_ssh(const char *host, unsigned short port, int timeout, int *va
static int check_https(const char *host, unsigned short port, int timeout, int *value_int)
{
const char *__function_name = "check_https";
- int err, opt;
- char https_host[MAX_STRING_LEN];
CURL *easyhandle;
+ CURLoption opt;
+ CURLcode err;
+ char https_host[MAX_STRING_LEN];
*value_int = 0;
diff --git a/src/libs/zbxsysinfo/sysinfo.c b/src/libs/zbxsysinfo/sysinfo.c
index fabe2662360..58da9cd6462 100644
--- a/src/libs/zbxsysinfo/sysinfo.c
+++ b/src/libs/zbxsysinfo/sysinfo.c
@@ -123,7 +123,7 @@ int add_metric(ZBX_METRIC *metric, char *error, size_t max_error_len)
commands[i].function = metric->function;
commands[i].test_param = (NULL == metric->test_param ? NULL : zbx_strdup(NULL, metric->test_param));
- commands = zbx_realloc(commands, (i + 2) * sizeof(ZBX_METRIC));
+ commands = (ZBX_METRIC *)zbx_realloc(commands, (i + 2) * sizeof(ZBX_METRIC));
memset(&commands[i + 1], 0, sizeof(ZBX_METRIC));
return SUCCEED;
@@ -168,7 +168,7 @@ void init_metrics()
int i;
char error[MAX_STRING_LEN];
- commands = zbx_malloc(commands, sizeof(ZBX_METRIC));
+ commands = (ZBX_METRIC *)zbx_malloc(commands, sizeof(ZBX_METRIC));
commands[0].key = NULL;
#ifdef WITH_AGENT_METRICS
@@ -341,7 +341,7 @@ void free_request(AGENT_REQUEST *request)
static void add_request_param(AGENT_REQUEST *request, char *pvalue)
{
request->nparam++;
- request->params = zbx_realloc(request->params, request->nparam * sizeof(char *));
+ request->params = (char **)zbx_realloc(request->params, request->nparam * sizeof(char *));
request->params[request->nparam - 1] = pvalue;
}
@@ -366,7 +366,7 @@ int parse_item_key(const char *itemkey, AGENT_REQUEST *request)
case ZBX_COMMAND_WITH_PARAMS:
if (0 == (request->nparam = num_param(params)))
goto out; /* key is badly formatted */
- request->params = zbx_malloc(request->params, request->nparam * sizeof(char *));
+ request->params = (char **)zbx_malloc(request->params, request->nparam * sizeof(char *));
for (i = 0; i < request->nparam; i++)
request->params[i] = get_param_dyn(params, i + 1);
break;
@@ -474,7 +474,7 @@ static int zbx_check_user_parameter(const char *param, char *error, int max_erro
if (NULL == strchr(param, *c))
continue;
- buf = zbx_malloc(buf, buf_alloc);
+ buf = (char *)zbx_malloc(buf, buf_alloc);
for (c = suppressed_chars; '\0' != *c; c++)
{
@@ -653,7 +653,7 @@ notsupported:
static void add_log_result(AGENT_RESULT *result, const char *value)
{
- result->log = zbx_malloc(result->log, sizeof(zbx_log_t));
+ result->log = (zbx_log_t *)zbx_malloc(result->log, sizeof(zbx_log_t));
zbx_log_init(result->log);
@@ -876,7 +876,7 @@ static zbx_log_t *get_result_log_value(AGENT_RESULT *result)
if (0 != ISSET_VALUE(result))
{
- result->log = zbx_malloc(result->log, sizeof(zbx_log_t));
+ result->log = (zbx_log_t *)zbx_malloc(result->log, sizeof(zbx_log_t));
zbx_log_init(result->log);
@@ -1013,7 +1013,7 @@ int quote_key_param(char **param, int forced)
sz_dst = zbx_get_escape_string_len(*param, "\"") + 3;
- *param = zbx_realloc(*param, sz_dst);
+ *param = (char *)zbx_realloc(*param, sz_dst);
(*param)[--sz_dst] = '\0';
(*param)[--sz_dst] = '"';
@@ -1122,7 +1122,7 @@ static void serialize_agent_result(char **data, size_t *data_alloc, size_t *data
while (*data_alloc - *data_offset < value_len + 1 + sizeof(int))
*data_alloc *= 1.5;
- *data = zbx_realloc(*data, *data_alloc);
+ *data = (char *)zbx_realloc(*data, *data_alloc);
}
memcpy(*data + *data_offset, &agent_ret, sizeof(int));
@@ -1262,7 +1262,7 @@ int zbx_execute_threaded_metric(zbx_metric_func_t metric_func, AGENT_REQUEST *re
goto out;
}
- data = zbx_malloc(NULL, data_alloc);
+ data = (char *)zbx_malloc(NULL, data_alloc);
if (0 == pid)
{
@@ -1312,7 +1312,7 @@ int zbx_execute_threaded_metric(zbx_metric_func_t metric_func, AGENT_REQUEST *re
while ((int)(data_alloc - data_offset) < n + 1)
data_alloc *= 1.5;
- data = zbx_realloc(data, data_alloc);
+ data = (char *)zbx_realloc(data, data_alloc);
}
memcpy(data + data_offset, buffer, n);
diff --git a/src/libs/zbxtasks/task.c b/src/libs/zbxtasks/task.c
index b804561e78c..d6621e0d232 100644
--- a/src/libs/zbxtasks/task.c
+++ b/src/libs/zbxtasks/task.c
@@ -74,10 +74,10 @@ void zbx_tm_task_clear(zbx_tm_task_t *task)
switch (task->type)
{
case ZBX_TM_TASK_REMOTE_COMMAND:
- tm_remote_command_clear(task->data);
+ tm_remote_command_clear((zbx_tm_remote_command_t *)task->data);
break;
case ZBX_TM_TASK_REMOTE_COMMAND_RESULT:
- tm_remote_command_result_clear(task->data);
+ tm_remote_command_result_clear((zbx_tm_remote_command_result_t *)task->data);
break;
default:
THIS_SHOULD_NEVER_HAPPEN;
@@ -195,7 +195,7 @@ zbx_tm_task_t *zbx_tm_task_create(zbx_uint64_t taskid, unsigned char type, unsig
{
zbx_tm_task_t *task;
- task = zbx_malloc(NULL, sizeof(zbx_tm_task_t));
+ task = (zbx_tm_task_t *)zbx_malloc(NULL, sizeof(zbx_tm_task_t));
task->taskid = taskid;
task->type = type;
@@ -540,10 +540,10 @@ void zbx_tm_json_serialize_tasks(struct zbx_json *json, const zbx_vector_ptr_t *
switch (task->type)
{
case ZBX_TM_TASK_REMOTE_COMMAND:
- tm_json_serialize_remote_command(json, task->data);
+ tm_json_serialize_remote_command(json, (zbx_tm_remote_command_t *)task->data);
break;
case ZBX_TM_TASK_REMOTE_COMMAND_RESULT:
- tm_json_serialize_remote_command_result(json, task->data);
+ tm_json_serialize_remote_command_result(json, (zbx_tm_remote_command_result_t *)task->data);
break;
default:
THIS_SHOULD_NEVER_HAPPEN;
diff --git a/src/zabbix_agent/active.c b/src/zabbix_agent/active.c
index 74311644705..8a3396c40c8 100644
--- a/src/zabbix_agent/active.c
+++ b/src/zabbix_agent/active.c
@@ -96,7 +96,7 @@ static void init_active_metrics(void)
{
zabbix_log(LOG_LEVEL_DEBUG, "buffer: first allocation for %d elements", CONFIG_BUFFER_SIZE);
sz = CONFIG_BUFFER_SIZE * sizeof(ZBX_ACTIVE_BUFFER_ELEMENT);
- buffer.data = zbx_malloc(buffer.data, sz);
+ buffer.data = (ZBX_ACTIVE_BUFFER_ELEMENT *)zbx_malloc(buffer.data, sz);
memset(buffer.data, 0, sz);
buffer.count = 0;
buffer.pcount = 0;
@@ -231,7 +231,7 @@ static void add_check(const char *key, const char *key_orig, int refresh, zbx_ui
goto out;
}
- metric = zbx_malloc(NULL, sizeof(ZBX_ACTIVE_METRIC));
+ metric = (ZBX_ACTIVE_METRIC *)zbx_malloc(NULL, sizeof(ZBX_ACTIVE_METRIC));
/* add new metric */
metric->key = zbx_strdup(NULL, key);
@@ -1049,7 +1049,7 @@ static int process_log_check(char *server, unsigned short port, ZBX_ACTIVE_METRI
zbx_uint64_t *lastlogsize_sent, int *mtime_sent, char **error)
{
AGENT_REQUEST request;
- const char *filename, *pattern, *encoding, *maxlines_persec, *skip, *template;
+ const char *filename, *pattern, *encoding, *maxlines_persec, *skip, *output_template;
char *encoding_uc = NULL, *max_delay_str;
int rate, ret = FAIL, s_count, p_count, s_count_orig, is_count_item, max_delay_par_nr,
mtime_orig, big_rec_orig, logfiles_num_new = 0, jumped = 0;
@@ -1138,8 +1138,8 @@ static int process_log_check(char *server, unsigned short port, ZBX_ACTIVE_METRI
/* parameter 5 is <output> for log[], logrt[], but <maxdelay> for log.count[], logrt.count[] */
- if (1 == is_count_item || (NULL == (template = get_rparam(&request, 5))))
- template = "";
+ if (1 == is_count_item || (NULL == (output_template = get_rparam(&request, 5))))
+ output_template = "";
/* <maxdelay> is parameter 6 for log[], logrt[], but parameter 5 for log.count[], logrt.count[] */
@@ -1189,7 +1189,7 @@ static int process_log_check(char *server, unsigned short port, ZBX_ACTIVE_METRI
ret = process_logrt(metric->flags, filename, &metric->lastlogsize, &metric->mtime, lastlogsize_sent, mtime_sent,
&metric->skip_old_data, &metric->big_rec, &metric->use_ino, error, &metric->logfiles,
- &metric->logfiles_num, &logfiles_new, &logfiles_num_new, encoding, &regexps, pattern, template,
+ &metric->logfiles_num, &logfiles_new, &logfiles_num_new, encoding, &regexps, pattern, output_template,
&p_count, &s_count, process_value, server, port, CONFIG_HOSTNAME, metric->key_orig, &jumped,
max_delay, &metric->start_time, &metric->processed_bytes);
diff --git a/src/zabbix_agent/cpustat.c b/src/zabbix_agent/cpustat.c
index 5fed3e4a8d9..9fd2aeaa40b 100644
--- a/src/zabbix_agent/cpustat.c
+++ b/src/zabbix_agent/cpustat.c
@@ -365,7 +365,7 @@ static void update_cpustats(ZBX_CPUS_STAT_DATA *pcpus)
goto exit;
}
- cpu_status = zbx_malloc(cpu_status, sizeof(unsigned char) * (pcpus->count + 1));
+ cpu_status = (unsigned char *)zbx_malloc(cpu_status, sizeof(unsigned char) * (pcpus->count + 1));
for (idx = 0; idx <= pcpus->count; idx++)
cpu_status[idx] = SYSINFO_RET_FAIL;
diff --git a/src/zabbix_agent/listener.c b/src/zabbix_agent/listener.c
index cbb8ec22915..09897b11568 100644
--- a/src/zabbix_agent/listener.c
+++ b/src/zabbix_agent/listener.c
@@ -76,7 +76,7 @@ static void process_listener(zbx_socket_t *s)
zabbix_log(LOG_LEVEL_DEBUG, "Sending back [" ZBX_NOTSUPPORTED ": %s]", *value);
if (NULL == buffer)
- buffer = zbx_malloc(buffer, buffer_alloc);
+ buffer = (char *)zbx_malloc(buffer, buffer_alloc);
zbx_strncpy_alloc(&buffer, &buffer_alloc, &buffer_offset,
ZBX_NOTSUPPORTED, ZBX_CONST_STRLEN(ZBX_NOTSUPPORTED));
diff --git a/src/zabbix_agent/logfiles.c b/src/zabbix_agent/logfiles.c
index f6cc98c83d5..5b4871c89f0 100644
--- a/src/zabbix_agent/logfiles.c
+++ b/src/zabbix_agent/logfiles.c
@@ -79,10 +79,10 @@ static int split_string(const char *str, const char *del, char **part1, char **p
part1_length = (size_t)(del - str + 1);
part2_length = str_length - part1_length;
- *part1 = zbx_malloc(*part1, part1_length + 1);
+ *part1 = (char *)zbx_malloc(*part1, part1_length + 1);
zbx_strlcpy(*part1, str, part1_length + 1);
- *part2 = zbx_malloc(*part2, part2_length + 1);
+ *part2 = (char *)zbx_malloc(*part2, part2_length + 1);
zbx_strlcpy(*part2, str + part1_length, part2_length + 1);
ret = SUCCEED;
@@ -466,12 +466,12 @@ static void print_logfile_list(const struct st_logfile *logfiles, int logfiles_n
* list could be the same file *
* *
* Parameters: *
- * old - [IN] file from the old list *
- * new - [IN] file from the new list *
- * use_ino - [IN] 0 - do not use inodes in comparison, *
- * 1 - use up to 64-bit inodes in comparison, *
- * 2 - use 128-bit inodes in comparison. *
- * err_msg - [IN/OUT] error message why an item became *
+ * old_file - [IN] file from the old list *
+ * new_file - [IN] file from the new list *
+ * use_ino - [IN] 0 - do not use inodes in comparison, *
+ * 1 - use up to 64-bit inodes in comparison, *
+ * 2 - use 128-bit inodes in comparison. *
+ * err_msg - [IN/OUT] error message why an item became *
* NOTSUPPORTED *
* *
* Return value: ZBX_SAME_FILE_NO - it is not the same file, *
@@ -484,39 +484,39 @@ static void print_logfile_list(const struct st_logfile *logfiles, int logfiles_n
* truncated and replaced with a similar one. *
* *
******************************************************************************/
-static int is_same_file(const struct st_logfile *old, const struct st_logfile *new, int use_ino, char **err_msg)
+static int is_same_file(const struct st_logfile *old_file, const struct st_logfile *new_file, int use_ino, char **err_msg)
{
int ret = ZBX_SAME_FILE_NO;
if (1 == use_ino || 2 == use_ino)
{
- if (old->ino_lo != new->ino_lo || old->dev != new->dev)
+ if (old_file->ino_lo != new_file->ino_lo || old_file->dev != new_file->dev)
{
/* file inode and device id cannot differ */
goto out;
}
}
- if (2 == use_ino && old->ino_hi != new->ino_hi)
+ if (2 == use_ino && old_file->ino_hi != new_file->ino_hi)
{
/* file inode (older 64-bits) cannot differ */
goto out;
}
- if (old->mtime > new->mtime)
+ if (old_file->mtime > new_file->mtime)
{
/* file mtime cannot decrease unless manipulated */
goto out;
}
- if (old->size > new->size)
+ if (old_file->size > new_file->size)
{
/* File size cannot decrease. Truncating or replacing a file with a smaller one */
/* counts as 2 different files. */
goto out;
}
- if (old->size == new->size && old->mtime < new->mtime)
+ if (old_file->size == new_file->size && old_file->mtime < new_file->mtime)
{
/* Depending on file system it's possible that stat() was called */
/* between mtime and file size update. In this situation we will */
@@ -526,36 +526,36 @@ static int is_same_file(const struct st_logfile *old, const struct st_logfile *n
/* If the size has not changed on the next check, then we assume */
/* that some tampering was done and to be safe we will treat it */
/* as a different file. */
- if (0 == old->retry)
+ if (0 == old_file->retry)
{
zabbix_log(LOG_LEVEL_WARNING, "the modification time of log file \"%s\" has been updated"
- " without changing its size, try checking again later", old->filename);
+ " without changing its size, try checking again later", old_file->filename);
ret = ZBX_SAME_FILE_RETRY;
}
else
{
zabbix_log(LOG_LEVEL_WARNING, "after changing modification time the size of log file \"%s\""
- " still has not been updated, consider it to be a new file", old->filename);
+ " still has not been updated, consider it to be a new file", old_file->filename);
}
goto out;
}
- if (-1 == old->md5size || -1 == new->md5size)
+ if (-1 == old_file->md5size || -1 == new_file->md5size)
{
/* Cannot compare MD5 sums. Assume two different files - reporting twice is better than skipping. */
goto out;
}
- if (old->md5size > new->md5size)
+ if (old_file->md5size > new_file->md5size)
{
/* file initial block size from which MD5 sum is calculated cannot decrease */
goto out;
}
- if (old->md5size == new->md5size)
+ if (old_file->md5size == new_file->md5size)
{
- if (0 != memcmp(old->md5buf, new->md5buf, sizeof(new->md5buf)))
+ if (0 != memcmp(old_file->md5buf, new_file->md5buf, sizeof(new_file->md5buf)))
{
/* MD5 sums differ */
goto out;
@@ -563,24 +563,24 @@ static int is_same_file(const struct st_logfile *old, const struct st_logfile *n
}
else
{
- if (0 < old->md5size)
+ if (0 < old_file->md5size)
{
/* MD5 for the old file has been calculated from a smaller block than for the new file */
int f;
md5_byte_t md5tmp[MD5_DIGEST_SIZE];
- if (-1 == (f = zbx_open(new->filename, O_RDONLY)))
+ if (-1 == (f = zbx_open(new_file->filename, O_RDONLY)))
{
- *err_msg = zbx_dsprintf(*err_msg, "Cannot open file \"%s\": %s", new->filename,
+ *err_msg = zbx_dsprintf(*err_msg, "Cannot open file \"%s\": %s", new_file->filename,
zbx_strerror(errno));
ret = ZBX_SAME_FILE_ERROR;
goto out;
}
- if (SUCCEED == file_start_md5(f, old->md5size, md5tmp, new->filename, err_msg))
+ if (SUCCEED == file_start_md5(f, old_file->md5size, md5tmp, new_file->filename, err_msg))
{
- ret = (0 == memcmp(old->md5buf, &md5tmp, sizeof(md5tmp))) ? ZBX_SAME_FILE_YES :
+ ret = (0 == memcmp(old_file->md5buf, &md5tmp, sizeof(md5tmp))) ? ZBX_SAME_FILE_YES :
ZBX_SAME_FILE_NO;
}
else
@@ -590,7 +590,7 @@ static int is_same_file(const struct st_logfile *old, const struct st_logfile *n
{
if (ZBX_SAME_FILE_ERROR != ret)
{
- *err_msg = zbx_dsprintf(*err_msg, "Cannot close file \"%s\": %s", new->filename,
+ *err_msg = zbx_dsprintf(*err_msg, "Cannot close file \"%s\": %s", new_file->filename,
zbx_strerror(errno));
ret = ZBX_SAME_FILE_ERROR;
}
@@ -613,13 +613,13 @@ out:
* new log files. *
* *
* Parameters: *
- * old2new - [IN] two dimensional array of possible mappings *
- * old - [IN] old file list *
- * num_old - [IN] number of elements in the old file list *
- * new - [IN] new file list *
- * num_new - [IN] number of elements in the new file list *
- * use_ino - [IN] how to use inodes in is_same_file() *
- * err_msg - [IN/OUT] error message why an item became NOTSUPPORTED *
+ * old2new - [IN] two dimensional array of possible mappings *
+ * old_files - [IN] old file list *
+ * num_old - [IN] number of elements in the old file list *
+ * new_files - [IN] new file list *
+ * num_new - [IN] number of elements in the new file list *
+ * use_ino - [IN] how to use inodes in is_same_file() *
+ * err_msg - [IN/OUT] error message why an item became NOTSUPPORTED*
* *
* Return value: SUCCEED or FAIL *
* *
@@ -629,8 +629,8 @@ out:
* old2new[i][j] = '1' - the i-th old file COULD BE the j-th new file *
* *
******************************************************************************/
-static int setup_old2new(char *old2new, struct st_logfile *old, int num_old,
- const struct st_logfile *new, int num_new, int use_ino, char **err_msg)
+static int setup_old2new(char *old2new, struct st_logfile *old_files, int num_old,
+ const struct st_logfile *new_files, int num_new, int use_ino, char **err_msg)
{
int i, j, rc;
char *p = old2new;
@@ -639,7 +639,7 @@ static int setup_old2new(char *old2new, struct st_logfile *old, int num_old,
{
for (j = 0; j < num_new; j++)
{
- rc = is_same_file(old + i, new + j, use_ino, err_msg);
+ rc = is_same_file(old_files + i, new_files + j, use_ino, err_msg);
switch (rc)
{
@@ -647,17 +647,17 @@ static int setup_old2new(char *old2new, struct st_logfile *old, int num_old,
p[j] = '0';
break;
case ZBX_SAME_FILE_YES:
- if (1 == old[i].retry)
+ if (1 == old_files[i].retry)
{
zabbix_log(LOG_LEVEL_DEBUG, "the size of log file \"%s\" has been"
" updated since modification time change, consider"
- " it to be the same file", old->filename);
- old[i].retry = 0;
+ " it to be the same file", old_files->filename);
+ old_files[i].retry = 0;
}
p[j] = '1';
break;
case ZBX_SAME_FILE_RETRY:
- old[i].retry = 1;
+ old_files[i].retry = 1;
/* break; is not missing here */
case ZBX_SAME_FILE_ERROR:
return FAIL;
@@ -666,7 +666,7 @@ static int setup_old2new(char *old2new, struct st_logfile *old, int num_old,
if (SUCCEED == zabbix_check_log_level(LOG_LEVEL_DEBUG))
{
zabbix_log(LOG_LEVEL_DEBUG, "setup_old2new: is_same_file(%s, %s) = %c",
- old[i].filename, new[j].filename, p[j]);
+ old_files[i].filename, new_files[j].filename, p[j]);
}
}
@@ -874,8 +874,8 @@ non_unique:
/* protect unique mappings from further modifications */
- protected_rows = zbx_calloc(protected_rows, (size_t)num_old, sizeof(char));
- protected_cols = zbx_calloc(protected_cols, (size_t)num_new, sizeof(char));
+ protected_rows = (char *)zbx_calloc(protected_rows, (size_t)num_old, sizeof(char));
+ protected_cols = (char *)zbx_calloc(protected_cols, (size_t)num_new, sizeof(char));
for (i = 0; i < num_old; i++)
{
@@ -1055,7 +1055,7 @@ static void add_logfile(struct st_logfile **logfiles, int *logfiles_alloc, int *
if (*logfiles_alloc == *logfiles_num)
{
*logfiles_alloc += 64;
- *logfiles = zbx_realloc(*logfiles, (size_t)*logfiles_alloc * sizeof(struct st_logfile));
+ *logfiles = (struct st_logfile *)zbx_realloc(*logfiles, (size_t)*logfiles_alloc * sizeof(struct st_logfile));
zabbix_log(LOG_LEVEL_DEBUG, "%s() logfiles:%p logfiles_alloc:%d",
__function_name, *logfiles, *logfiles_alloc);
@@ -1550,7 +1550,7 @@ static int zbx_read2(int fd, unsigned char flags, zbx_uint64_t *lastlogsize, int
/* required. */
if (NULL == buf)
- buf = zbx_malloc(buf, (size_t)(BUF_SIZE + 1));
+ buf = (char *)zbx_malloc(buf, (size_t)(BUF_SIZE + 1));
find_cr_lf_szbyte(encoding, &cr, &lf, &szbyte);
@@ -2378,7 +2378,7 @@ int process_logrt(unsigned char flags, const char *filename, zbx_uint64_t *lastl
if (0 < *logfiles_num_old && 0 < logfiles_num)
{
/* set up a mapping array from old files to new files */
- old2new = zbx_malloc(old2new, (size_t)logfiles_num * (size_t)(*logfiles_num_old) * sizeof(char));
+ old2new = (char *)zbx_malloc(old2new, (size_t)logfiles_num * (size_t)(*logfiles_num_old) * sizeof(char));
if (SUCCEED != setup_old2new(old2new, *logfiles_old, *logfiles_num_old, logfiles, logfiles_num,
*use_ino, err_msg))
diff --git a/src/zabbix_agent/stats.c b/src/zabbix_agent/stats.c
index 08bb5500cf4..3d91bc02fcc 100644
--- a/src/zabbix_agent/stats.c
+++ b/src/zabbix_agent/stats.c
@@ -196,7 +196,7 @@ int init_collector_data(char **error)
goto out;
}
- if ((void *)(-1) == (collector = shmat(shm_id, NULL, 0)))
+ if ((void *)(-1) == (collector = (ZBX_COLLECTOR_DATA *)shmat(shm_id, NULL, 0)))
{
*error = zbx_dsprintf(*error, "cannot attach shared memory for collector: %s", zbx_strerror(errno));
goto out;
@@ -294,7 +294,7 @@ void diskstat_shm_init(void)
exit(EXIT_FAILURE);
}
- if ((void *)(-1) == (diskdevices = shmat(collector->diskstat_shmid, NULL, 0)))
+ if ((void *)(-1) == (diskdevices = (ZBX_DISKDEVICES_DATA *)shmat(collector->diskstat_shmid, NULL, 0)))
{
zabbix_log(LOG_LEVEL_CRIT, "cannot attach shared memory for disk statistics collector: %s",
zbx_strerror(errno));
@@ -338,7 +338,7 @@ void diskstat_shm_reattach(void)
my_diskstat_shmid = ZBX_NONEXISTENT_SHMID;
}
- if ((void *)(-1) == (diskdevices = shmat(collector->diskstat_shmid, NULL, 0)))
+ if ((void *)(-1) == (diskdevices = (ZBX_DISKDEVICES_DATA *)shmat(collector->diskstat_shmid, NULL, 0)))
{
zabbix_log(LOG_LEVEL_CRIT, "cannot attach shared memory for disk statistics collector: %s",
zbx_strerror(errno));
@@ -389,7 +389,7 @@ void diskstat_shm_extend(void)
exit(EXIT_FAILURE);
}
- if ((void *)(-1) == (new_diskdevices = shmat(new_shmid, NULL, 0)))
+ if ((void *)(-1) == (new_diskdevices = (ZBX_DISKDEVICES_DATA *)shmat(new_shmid, NULL, 0)))
{
zabbix_log(LOG_LEVEL_CRIT, "cannot attach shared memory for extending disk statistics collector: %s",
zbx_strerror(errno));
diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c
index c60bac15111..9d2ccf2bf33 100644
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -572,7 +572,7 @@ static void set_defaults(void)
CONFIG_LOAD_MODULE_PATH = zbx_strdup(CONFIG_LOAD_MODULE_PATH, LIBDIR "/modules");
if (NULL == CONFIG_PID_FILE)
- CONFIG_PID_FILE = "/tmp/zabbix_agentd.pid";
+ CONFIG_PID_FILE = (char *)"/tmp/zabbix_agentd.pid";
#endif
if (NULL == CONFIG_LOG_TYPE_STR)
CONFIG_LOG_TYPE_STR = zbx_strdup(CONFIG_LOG_TYPE_STR, ZBX_OPTION_LOGTYPE_FILE);
@@ -669,7 +669,7 @@ static int add_activechk_host(const char *host, unsigned short port)
}
CONFIG_ACTIVE_FORKS++;
- CONFIG_ACTIVE_ARGS = zbx_realloc(CONFIG_ACTIVE_ARGS, sizeof(ZBX_THREAD_ACTIVECHK_ARGS) * CONFIG_ACTIVE_FORKS);
+ CONFIG_ACTIVE_ARGS = (ZBX_THREAD_ACTIVECHK_ARGS *)zbx_realloc(CONFIG_ACTIVE_ARGS, sizeof(ZBX_THREAD_ACTIVECHK_ARGS) * CONFIG_ACTIVE_FORKS);
CONFIG_ACTIVE_ARGS[CONFIG_ACTIVE_FORKS - 1].host = zbx_strdup(NULL, host);
CONFIG_ACTIVE_ARGS[CONFIG_ACTIVE_FORKS - 1].port = port;
@@ -1012,7 +1012,7 @@ int MAIN_ZABBIX_ENTRY(int flags)
exit(EXIT_FAILURE);
}
#endif
- threads = zbx_calloc(threads, threads_num, sizeof(ZBX_THREAD_HANDLE));
+ threads = (pid_t *)zbx_calloc(threads, threads_num, sizeof(ZBX_THREAD_HANDLE));
zabbix_log(LOG_LEVEL_INFORMATION, "agent #0 started [main process]");
diff --git a/src/zabbix_proxy/proxy.c b/src/zabbix_proxy/proxy.c
index cccc16f6eb1..c330376bb65 100644
--- a/src/zabbix_proxy/proxy.c
+++ b/src/zabbix_proxy/proxy.c
@@ -1022,7 +1022,7 @@ int MAIN_ZABBIX_ENTRY(int flags)
+ CONFIG_JAVAPOLLER_FORKS + CONFIG_SNMPTRAPPER_FORKS + CONFIG_SELFMON_FORKS
+ CONFIG_VMWARE_FORKS + CONFIG_IPMIMANAGER_FORKS + CONFIG_TASKMANAGER_FORKS;
- threads = zbx_calloc(threads, threads_num, sizeof(pid_t));
+ threads = (pid_t *)zbx_calloc(threads, threads_num, sizeof(pid_t));
if (0 != CONFIG_TRAPPER_FORKS)
{
diff --git a/src/zabbix_proxy/taskmanager/taskmanager.c b/src/zabbix_proxy/taskmanager/taskmanager.c
index 4f274d856e6..7be36448b60 100644
--- a/src/zabbix_proxy/taskmanager/taskmanager.c
+++ b/src/zabbix_proxy/taskmanager/taskmanager.c
@@ -90,7 +90,7 @@ static int tm_execute_remote_command(zbx_uint64_t taskid, int clock, int ttl, in
ZBX_STR2UCHAR(script.type, row[0]);
ZBX_STR2UCHAR(script.execute_on, row[1]);
- script.port = (0 == atoi(row[2]) ? "" : row[2]);
+ script.port = (0 == atoi(row[2]) ? (char *)"" : row[2]);
ZBX_STR2UCHAR(script.authtype, row[3]);
script.username = row[4];
script.password = row[5];
diff --git a/src/zabbix_sender/zabbix_sender.c b/src/zabbix_sender/zabbix_sender.c
index 7dc94315a75..42bf5b2949d 100644
--- a/src/zabbix_sender/zabbix_sender.c
+++ b/src/zabbix_sender/zabbix_sender.c
@@ -982,7 +982,7 @@ static char *zbx_fgets_alloc(char **buffer, size_t *buffer_alloc, FILE *fp)
if (*buffer_alloc - buffer_offset < len + 1)
{
*buffer_alloc = (buffer_offset + len + 1) * 3 / 2;
- *buffer = zbx_realloc(*buffer, *buffer_alloc);
+ *buffer = (char *)zbx_realloc(*buffer, *buffer_alloc);
}
memcpy(*buffer + buffer_offset, tmp, len);
@@ -1104,7 +1104,7 @@ int main(int argc, char **argv)
}
sendval_args.sync_timestamp = WITH_TIMESTAMPS;
- in_line = zbx_malloc(NULL, in_line_alloc);
+ in_line = (char *)zbx_malloc(NULL, in_line_alloc);
ret = SUCCEED;
@@ -1167,7 +1167,7 @@ int main(int argc, char **argv)
if (key_value_alloc != in_line_alloc)
{
key_value_alloc = in_line_alloc;
- key_value = zbx_realloc(key_value, key_value_alloc);
+ key_value = (char *)zbx_realloc(key_value, key_value_alloc);
}
if ('\0' != *p && '"' != *p)
diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c
index 36933b3a051..e64e0874aba 100644
--- a/src/zabbix_server/actions.c
+++ b/src/zabbix_server/actions.c
@@ -42,7 +42,7 @@ static int check_condition_event_tag(const DB_EVENT *event, const DB_CONDITION *
{
int i, ret, ret_continue;
- if (CONDITION_OPERATOR_NOT_EQUAL == condition->operator || CONDITION_OPERATOR_NOT_LIKE == condition->operator)
+ if (CONDITION_OPERATOR_NOT_EQUAL == condition->op || CONDITION_OPERATOR_NOT_LIKE == condition->op)
ret_continue = SUCCEED;
else
ret_continue = FAIL;
@@ -53,7 +53,7 @@ static int check_condition_event_tag(const DB_EVENT *event, const DB_CONDITION *
{
zbx_tag_t *tag = (zbx_tag_t *)event->tags.values[i];
- ret = zbx_strmatch_condition(tag->tag, condition->value, condition->operator);
+ ret = zbx_strmatch_condition(tag->tag, condition->value, condition->op);
}
return ret;
@@ -75,7 +75,7 @@ static int check_condition_event_tag_value(const DB_EVENT *event, DB_CONDITION *
{
int i, ret, ret_continue;
- if (CONDITION_OPERATOR_NOT_EQUAL == condition->operator || CONDITION_OPERATOR_NOT_LIKE == condition->operator)
+ if (CONDITION_OPERATOR_NOT_EQUAL == condition->op || CONDITION_OPERATOR_NOT_LIKE == condition->op)
ret_continue = SUCCEED;
else
ret_continue = FAIL;
@@ -87,7 +87,7 @@ static int check_condition_event_tag_value(const DB_EVENT *event, DB_CONDITION *
zbx_tag_t *tag = (zbx_tag_t *)event->tags.values[i];
if (0 == strcmp(condition->value2, tag->tag))
- ret = zbx_strmatch_condition(tag->value, condition->value, condition->operator);
+ ret = zbx_strmatch_condition(tag->value, condition->value, condition->op);
}
return ret;
@@ -148,7 +148,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
zbx_free(sql);
zbx_vector_uint64_destroy(&groupids);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (NULL != DBfetch(result))
@@ -169,7 +169,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
ZBX_STR2UINT64(condition_value, condition->value);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
case CONDITION_OPERATOR_NOT_EQUAL:
@@ -219,7 +219,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
}
while (SUCCEED != ret && 0 != triggerid);
- if (CONDITION_OPERATOR_NOT_EQUAL == condition->operator)
+ if (CONDITION_OPERATOR_NOT_EQUAL == condition->op)
ret = (SUCCEED == ret) ? FAIL : SUCCEED;
break;
default:
@@ -230,7 +230,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
{
ZBX_STR2UINT64(condition_value, condition->value);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
case CONDITION_OPERATOR_NOT_EQUAL:
@@ -248,7 +248,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
ret = SUCCEED;
DBfree_result(result);
- if (CONDITION_OPERATOR_NOT_EQUAL == condition->operator)
+ if (CONDITION_OPERATOR_NOT_EQUAL == condition->op)
ret = (SUCCEED == ret) ? FAIL : SUCCEED;
break;
default:
@@ -261,7 +261,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
ZBX_STR2UINT64(condition_value, condition->value);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
case CONDITION_OPERATOR_NOT_EQUAL:
@@ -293,7 +293,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
}
}
- if (CONDITION_OPERATOR_NOT_EQUAL == condition->operator)
+ if (CONDITION_OPERATOR_NOT_EQUAL == condition->op)
ret = (SUCCEED == ret) ? FAIL : SUCCEED;
break;
default:
@@ -307,7 +307,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
substitute_simple_macros(NULL, event, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&tmp_str, MACRO_TYPE_TRIGGER_DESCRIPTION, NULL, 0);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_LIKE:
if (NULL != strstr(tmp_str, condition->value))
@@ -326,7 +326,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
{
condition_value = atoi(condition->value);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (event->trigger.priority == condition_value)
@@ -359,7 +359,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
if (SUCCEED == zbx_check_time_period(period, (time_t)event->clock, &res))
{
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_IN:
if (SUCCEED == res)
@@ -383,7 +383,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
}
else if (CONDITION_TYPE_MAINTENANCE == condition->conditiontype)
{
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_IN:
result = DBselect(
@@ -431,7 +431,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
atoi(condition->value),
event->eventid);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (NULL != (row = DBfetch(result)))
@@ -453,7 +453,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
" and t.triggerid=" ZBX_FS_UI64,
event->objectid);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
while (NULL != (row = DBfetch(result)))
@@ -508,7 +508,7 @@ static int check_trigger_condition(const DB_EVENT *event, DB_CONDITION *conditio
if (NOTSUPPORTED == ret)
{
zabbix_log(LOG_LEVEL_ERR, "unsupported operator [%d] for condition id [" ZBX_FS_UI64 "]",
- (int)condition->operator, condition->conditionid);
+ (int)condition->op, condition->conditionid);
ret = FAIL;
}
@@ -568,7 +568,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
event->objectid);
}
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (NULL != DBfetch(result))
@@ -597,7 +597,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
condition_value,
event->objectid);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (NULL != DBfetch(result))
@@ -617,7 +617,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
{
int condition_value_i = atoi(condition->value);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (event->object == condition_value_i)
@@ -655,7 +655,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
event->objectid);
}
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (NULL != DBfetch(result))
@@ -682,7 +682,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
if (NULL != (row = DBfetch(result)))
{
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (0 == strcmp(condition->value, row[0]))
@@ -736,7 +736,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
while (NULL != (row = DBfetch(result)) && FAIL == ret)
{
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (SUCCEED == ip_in_list(condition->value, row[0]))
@@ -769,7 +769,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
{
tmp_int = atoi(row[0]);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (condition_value_i == tmp_int)
@@ -790,7 +790,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
{
int condition_value_i = atoi(condition->value);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (condition_value_i == event->value)
@@ -832,7 +832,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
now = time(NULL);
tmp_int = DOBJECT_STATUS_UP == atoi(row[0]) ? atoi(row[1]) : atoi(row[2]);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_LESS_EQUAL:
if (0 != tmp_int && (now - tmp_int) <= condition_value_i)
@@ -860,7 +860,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
if (NULL != (row = DBfetch(result)))
{
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (SUCCEED == int_in_list(condition->value, atoi(row[0])))
@@ -886,7 +886,7 @@ static int check_discovery_condition(const DB_EVENT *event, DB_CONDITION *condit
if (NOTSUPPORTED == ret)
{
zabbix_log(LOG_LEVEL_ERR, "unsupported operator [%d] for condition id [" ZBX_FS_UI64 "]",
- (int)condition->operator, condition->conditionid);
+ (int)condition->op, condition->conditionid);
ret = FAIL;
}
@@ -938,7 +938,7 @@ static int check_auto_registration_condition(const DB_EVENT *event, DB_CONDITION
if (NULL != (row = DBfetch(result)))
{
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_LIKE:
if (NULL != strstr(row[0], condition->value))
@@ -968,7 +968,7 @@ static int check_auto_registration_condition(const DB_EVENT *event, DB_CONDITION
{
ZBX_DBROW2UINT64(id, row[0]);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (id == condition_value)
@@ -993,7 +993,7 @@ static int check_auto_registration_condition(const DB_EVENT *event, DB_CONDITION
if (NOTSUPPORTED == ret)
{
zabbix_log(LOG_LEVEL_ERR, "unsupported operator [%d] for condition id [" ZBX_FS_UI64 "]",
- (int)condition->operator, condition->conditionid);
+ (int)condition->op, condition->conditionid);
ret = FAIL;
}
@@ -1099,7 +1099,7 @@ static int check_internal_condition(const DB_EVENT *event, DB_CONDITION *conditi
zbx_free(sqlcond);
zbx_vector_uint64_destroy(&groupids);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (NULL != DBfetch(result))
@@ -1120,7 +1120,7 @@ static int check_internal_condition(const DB_EVENT *event, DB_CONDITION *conditi
ZBX_STR2UINT64(condition_value, condition->value);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
case CONDITION_OPERATOR_NOT_EQUAL:
@@ -1195,7 +1195,7 @@ static int check_internal_condition(const DB_EVENT *event, DB_CONDITION *conditi
}
while (SUCCEED != ret && 0 != objectid);
- if (CONDITION_OPERATOR_NOT_EQUAL == condition->operator)
+ if (CONDITION_OPERATOR_NOT_EQUAL == condition->op)
ret = (SUCCEED == ret) ? FAIL : SUCCEED;
break;
default:
@@ -1229,7 +1229,7 @@ static int check_internal_condition(const DB_EVENT *event, DB_CONDITION *conditi
result = DBselectN(sql, 1);
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
if (NULL != DBfetch(result))
@@ -1267,7 +1267,7 @@ static int check_internal_condition(const DB_EVENT *event, DB_CONDITION *conditi
event->objectid);
}
- switch (condition->operator)
+ switch (condition->op)
{
case CONDITION_OPERATOR_EQUAL:
while (NULL != (row = DBfetch(result)))
@@ -1314,7 +1314,7 @@ static int check_internal_condition(const DB_EVENT *event, DB_CONDITION *conditi
if (NOTSUPPORTED == ret)
{
zabbix_log(LOG_LEVEL_ERR, "unsupported operator [%d] for condition id [" ZBX_FS_UI64 "]",
- (int)condition->operator, condition->conditionid);
+ (int)condition->op, condition->conditionid);
ret = FAIL;
}
out:
@@ -1675,11 +1675,11 @@ static int is_recovery_event(const DB_EVENT *event)
******************************************************************************/
static int uniq_conditions_compare_func(const void *d1, const void *d2)
{
- const DB_CONDITION *condition1 = d1, *condition2 = d2;
+ const DB_CONDITION *condition1 = (const DB_CONDITION *)d1, *condition2 = (const DB_CONDITION *)d2;
int ret;
ZBX_RETURN_IF_NOT_EQUAL(condition1->conditiontype, condition2->conditiontype);
- ZBX_RETURN_IF_NOT_EQUAL(condition1->operator, condition2->operator);
+ ZBX_RETURN_IF_NOT_EQUAL(condition1->op, condition2->op);
if (0 != (ret = strcmp(condition1->value, condition2->value)))
return ret;
@@ -1704,13 +1704,13 @@ static int uniq_conditions_compare_func(const void *d1, const void *d2)
******************************************************************************/
static zbx_hash_t uniq_conditions_hash_func(const void *data)
{
- const DB_CONDITION *condition = data;
+ const DB_CONDITION *condition = (const DB_CONDITION *)data;
zbx_hash_t hash;
hash = ZBX_DEFAULT_STRING_HASH_ALGO(condition->value, strlen(condition->value), ZBX_DEFAULT_HASH_SEED);
hash = ZBX_DEFAULT_STRING_HASH_ALGO(condition->value2, strlen(condition->value2), hash);
hash = ZBX_DEFAULT_STRING_HASH_ALGO((char *)&condition->conditiontype, 1, hash);
- hash = ZBX_DEFAULT_STRING_HASH_ALGO((char *)&condition->operator, 1, hash);
+ hash = ZBX_DEFAULT_STRING_HASH_ALGO((char *)&condition->op, 1, hash);
return hash;
}
@@ -1812,7 +1812,7 @@ void process_actions(const DB_EVENT *events, size_t events_num, zbx_vector_uint6
/* command and message operations handled by escalators even for */
/* EVENT_SOURCE_DISCOVERY and EVENT_SOURCE_AUTO_REGISTRATION events */
- new_escalation = zbx_malloc(NULL, sizeof(zbx_escalation_new_t));
+ new_escalation = (zbx_escalation_new_t *)zbx_malloc(NULL, sizeof(zbx_escalation_new_t));
new_escalation->actionid = action->actionid;
new_escalation->event = event;
zbx_vector_ptr_append(&new_escalations, new_escalation);
@@ -1882,12 +1882,12 @@ void process_actions(const DB_EVENT *events, size_t events_num, zbx_vector_uint6
r_eventid = closed_events->values[index].second;
- if (NULL == (rec_escalation = zbx_hashset_search(&rec_escalations, &r_eventid)))
+ if (NULL == (rec_escalation = (zbx_escalation_rec_t *)zbx_hashset_search(&rec_escalations, &r_eventid)))
{
zbx_escalation_rec_t esc_rec_local;
esc_rec_local.r_eventid = r_eventid;
- rec_escalation = zbx_hashset_insert(&rec_escalations, &esc_rec_local,
+ rec_escalation = (zbx_escalation_rec_t *)zbx_hashset_insert(&rec_escalations, &esc_rec_local,
sizeof(esc_rec_local));
zbx_vector_uint64_create(&rec_escalation->escalationids);
diff --git a/src/zabbix_server/alerter/alert_manager.c b/src/zabbix_server/alerter/alert_manager.c
index 4ae6b69f654..ae8fe9dfbf6 100644
--- a/src/zabbix_server/alerter/alert_manager.c
+++ b/src/zabbix_server/alerter/alert_manager.c
@@ -1187,7 +1187,7 @@ static int am_db_get_alerts(zbx_am_t *manager, zbx_vector_ptr_t *alerts, int now
if (SUCCEED == DBis_null(row[7]))
{
am_db_update_alert(manager, alertid, ALERT_STATUS_FAILED, 0,
- "Related event was removed.");
+ (char *)"Related event was removed.");
continue;
}
@@ -1570,7 +1570,7 @@ static int am_db_sync_watchdog(zbx_am_t *manager)
if (NULL == (media = (zbx_am_media_t *)zbx_hashset_search(&manager->watchdog, &mediaid)))
{
media_local.mediaid = mediaid;
- media = zbx_hashset_insert(&manager->watchdog, &media_local, sizeof(media_local));
+ media = (zbx_am_media_t *)zbx_hashset_insert(&manager->watchdog, &media_local, sizeof(media_local));
media->sendto = NULL;
zbx_vector_ptr_append(&media_new, media);
@@ -1659,7 +1659,7 @@ static int am_prepare_mediatype_exec_command(zbx_am_mediatype_t *mediatype, zbx_
size_t cmd_alloc = ZBX_KIBIBYTE, cmd_offset = 0;
int ret = FAIL;
- *cmd = zbx_malloc(NULL, cmd_alloc);
+ *cmd = (char *)zbx_malloc(NULL, cmd_alloc);
zbx_snprintf_alloc(cmd, &cmd_alloc, &cmd_offset, "%s/%s", CONFIG_ALERT_SCRIPTS_PATH, mediatype->exec_path);
@@ -1774,7 +1774,7 @@ static int am_process_alert(zbx_am_t *manager, zbx_am_alerter_t *alerter, zbx_am
zbx_free(cmd);
break;
default:
- am_db_update_alert(manager, alert->alertid, ALERT_STATUS_FAILED, 0, "unsupported media type");
+ am_db_update_alert(manager, alert->alertid, ALERT_STATUS_FAILED, 0, (char *)"unsupported media type");
zabbix_log(LOG_LEVEL_ERR, "cannot process alertid:" ZBX_FS_UI64 ": unsupported media type: %d",
alert->alertid, mediatype->type);
am_remove_alert(manager, alert);
@@ -2015,7 +2015,7 @@ ZBX_THREAD_ENTRY(alert_manager_thread, args)
while (SUCCEED == am_check_queue(&manager, now))
{
- if (NULL == (alerter = zbx_queue_ptr_pop(&manager.free_alerters)))
+ if (NULL == (alerter = (zbx_am_alerter_t *)zbx_queue_ptr_pop(&manager.free_alerters)))
break;
if (FAIL == am_process_alert(&manager, alerter, am_pop_alert(&manager)))
diff --git a/src/zabbix_server/alerter/alerter_protocol.c b/src/zabbix_server/alerter/alerter_protocol.c
index a5d247a0d90..db6ee0dd6b0 100644
--- a/src/zabbix_server/alerter/alerter_protocol.c
+++ b/src/zabbix_server/alerter/alerter_protocol.c
@@ -32,7 +32,7 @@ zbx_uint32_t zbx_alerter_serialize_result(unsigned char **data, int errcode, con
zbx_serialize_prepare_value(data_len, errcode);
zbx_serialize_prepare_str(data_len, errmsg);
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_value(ptr, errcode);
@@ -74,7 +74,7 @@ zbx_uint32_t zbx_alerter_serialize_email(unsigned char **data, zbx_uint64_t aler
zbx_serialize_prepare_str(data_len, username);
zbx_serialize_prepare_str(data_len, password);
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_value(ptr, alertid);
@@ -131,7 +131,7 @@ zbx_uint32_t zbx_alerter_serialize_jabber(unsigned char **data, zbx_uint64_t ale
zbx_serialize_prepare_str(data_len, username);
zbx_serialize_prepare_str(data_len, password);
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_value(ptr, alertid);
@@ -168,7 +168,7 @@ zbx_uint32_t zbx_alerter_serialize_sms(unsigned char **data, zbx_uint64_t alerti
zbx_serialize_prepare_str(data_len, message);
zbx_serialize_prepare_str(data_len, gsm_modem);
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_value(ptr, alertid);
@@ -203,7 +203,7 @@ zbx_uint32_t zbx_alerter_serialize_eztexting(unsigned char **data, zbx_uint64_t
zbx_serialize_prepare_str(data_len, password);
zbx_serialize_prepare_str(data_len, exec_path);
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_value(ptr, alertid);
@@ -237,7 +237,7 @@ zbx_uint32_t zbx_alerter_serialize_exec(unsigned char **data, zbx_uint64_t alert
zbx_serialize_prepare_value(data_len, alertid);
zbx_serialize_prepare_str(data_len, command);
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_value(ptr, alertid);
diff --git a/src/zabbix_server/discoverer/discoverer.c b/src/zabbix_server/discoverer/discoverer.c
index de8fa00e7e3..2069e4cff8b 100644
--- a/src/zabbix_server/discoverer/discoverer.c
+++ b/src/zabbix_server/discoverer/discoverer.c
@@ -336,7 +336,7 @@ static void process_check(DB_DRULE *drule, DB_DCHECK *dcheck, DB_DHOST *dhost, i
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- value = zbx_malloc(value, value_alloc);
+ value = (char *)zbx_malloc(value, value_alloc);
for (start = dcheck->ports; '\0' != *start;)
{
diff --git a/src/zabbix_server/escalator/escalator.c b/src/zabbix_server/escalator/escalator.c
index 27f3f3d31cc..d95b1356e4f 100644
--- a/src/zabbix_server/escalator/escalator.c
+++ b/src/zabbix_server/escalator/escalator.c
@@ -254,7 +254,7 @@ static void add_user_msg(zbx_uint64_t userid, zbx_uint64_t mediatypeid, ZBX_USER
if (p->userid == userid && p->ackid == ackid && 0 == strcmp(p->subject, subject) &&
0 == strcmp(p->message, message) && 0 != p->mediatypeid)
{
- *pnext = p->next;
+ *pnext = (ZBX_USER_MSG *)p->next;
zbx_free(p->subject);
zbx_free(p->message);
@@ -265,7 +265,7 @@ static void add_user_msg(zbx_uint64_t userid, zbx_uint64_t mediatypeid, ZBX_USER
}
}
- for (p = *user_msg; NULL != p; p = p->next)
+ for (p = *user_msg; NULL != p; p = (ZBX_USER_MSG *)p->next)
{
if (p->userid == userid && p->ackid == ackid && 0 == strcmp(p->subject, subject) &&
0 == strcmp(p->message, message) &&
@@ -277,7 +277,7 @@ static void add_user_msg(zbx_uint64_t userid, zbx_uint64_t mediatypeid, ZBX_USER
if (NULL == p)
{
- p = zbx_malloc(p, sizeof(ZBX_USER_MSG));
+ p = (ZBX_USER_MSG *)zbx_malloc(p, sizeof(ZBX_USER_MSG));
p->userid = userid;
p->mediatypeid = mediatypeid;
@@ -535,7 +535,7 @@ static void flush_user_msg(ZBX_USER_MSG **user_msg, int esc_step, const DB_EVENT
while (NULL != *user_msg)
{
p = *user_msg;
- *user_msg = (*user_msg)->next;
+ *user_msg = (ZBX_USER_MSG *)(*user_msg)->next;
add_message_alert(event, r_event, actionid, esc_step, p->userid, p->mediatypeid, p->subject,
p->message, p->ackid);
@@ -760,7 +760,7 @@ static void execute_commands(const DB_EVENT *event, const DB_EVENT *r_event, con
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- buffer = zbx_malloc(buffer, buffer_alloc);
+ buffer = (char *)zbx_malloc(buffer, buffer_alloc);
/* get hosts operation's hosts */
@@ -974,7 +974,8 @@ static void add_message_alert(const DB_EVENT *event, const DB_EVENT *r_event, zb
DB_RESULT result;
DB_ROW row;
int now, severity, medias_num = 0, status, res;
- char error[MAX_STRING_LEN], *perror, *period = NULL;
+ char error[MAX_STRING_LEN], *period = NULL;
+ const char *perror;
zbx_db_insert_t db_insert;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -1143,7 +1144,7 @@ static int check_operation_conditions(const DB_EVENT *event, zbx_uint64_t operat
{
memset(&condition, 0, sizeof(condition));
condition.conditiontype = (unsigned char)atoi(row[0]);
- condition.operator = (unsigned char)atoi(row[1]);
+ condition.op = (unsigned char)atoi(row[1]);
condition.value = row[2];
switch (evaltype)
@@ -1624,8 +1625,8 @@ static int check_escalation_trigger(zbx_uint64_t triggerid, unsigned char source
get_functionids(&functionids, trigger.expression_orig);
- functions = zbx_malloc(functions, sizeof(DC_FUNCTION) * functionids.values_num);
- errcodes = zbx_malloc(errcodes, sizeof(int) * functionids.values_num);
+ functions = (DC_FUNCTION *)zbx_malloc(functions, sizeof(DC_FUNCTION) * functionids.values_num);
+ errcodes = (int *)zbx_malloc(errcodes, sizeof(int) * functionids.values_num);
DCconfig_get_functions_by_functionids(functions, functionids.values, errcodes, functionids.values_num);
@@ -1641,8 +1642,8 @@ static int check_escalation_trigger(zbx_uint64_t triggerid, unsigned char source
zbx_vector_uint64_sort(&itemids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
zbx_vector_uint64_uniq(&itemids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
- items = zbx_malloc(items, sizeof(DC_ITEM) * itemids.values_num);
- errcodes = zbx_realloc(errcodes, sizeof(int) * itemids.values_num);
+ items = (DC_ITEM *)zbx_malloc(items, sizeof(DC_ITEM) * itemids.values_num);
+ errcodes = (int *)zbx_realloc(errcodes, sizeof(int) * itemids.values_num);
DCconfig_get_items_by_itemids(items, itemids.values, errcodes, itemids.values_num);
@@ -2242,7 +2243,7 @@ cancel_warning:
char *sql = NULL;
size_t sql_alloc = ZBX_KIBIBYTE, sql_offset = 0;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_vector_ptr_sort(&diffs, ZBX_DEFAULT_UINT64_PTR_COMPARE_FUNC);
diff --git a/src/zabbix_server/events.c b/src/zabbix_server/events.c
index 78118752a49..af019eab397 100644
--- a/src/zabbix_server/events.c
+++ b/src/zabbix_server/events.c
@@ -116,7 +116,7 @@ int zbx_add_event(unsigned char source, unsigned char object, zbx_uint64_t objec
if (events_num == events_alloc)
{
events_alloc += 64;
- events = zbx_realloc(events, sizeof(DB_EVENT) * events_alloc);
+ events = (DB_EVENT *)zbx_realloc(events, sizeof(DB_EVENT) * events_alloc);
}
events[events_num].eventid = 0;
@@ -158,7 +158,7 @@ int zbx_add_event(unsigned char source, unsigned char object, zbx_uint64_t objec
const zbx_tag_t *trigger_tag = (const zbx_tag_t *)trigger_tags->values[i];
zbx_tag_t *tag;
- tag = zbx_malloc(NULL, sizeof(zbx_tag_t));
+ tag = (zbx_tag_t *)zbx_malloc(NULL, sizeof(zbx_tag_t));
tag->tag = zbx_strdup(NULL, trigger_tag->tag);
tag->value = zbx_strdup(NULL, trigger_tag->value);
@@ -442,7 +442,7 @@ static void save_event_recovery(void)
"userid", NULL);
zbx_hashset_iter_reset(&event_recovery, &iter);
- while (NULL != (recovery = zbx_hashset_iter_next(&iter)))
+ while (NULL != (recovery = (zbx_event_recovery_t *)zbx_hashset_iter_next(&iter)))
{
r_event = &events[recovery->r_event_index];
@@ -665,7 +665,8 @@ static int correlation_condition_match_new_event(zbx_corr_condition_t *condition
******************************************************************************/
static int correlation_match_new_event(zbx_correlation_t *correlation, const DB_EVENT *event, int old_value)
{
- char *expression, *value, error[256];
+ char *expression, error[256];
+ const char *value;
zbx_token_t token;
int pos = 0, ret = FAIL;
zbx_uint64_t conditionid;
@@ -688,7 +689,7 @@ static int correlation_match_new_event(zbx_correlation_t *correlation, const DB_
if (SUCCEED != is_uint64_n(expression + loc->l, loc->r - loc->l + 1, &conditionid))
continue;
- if (NULL == (condition = zbx_hashset_search(&correlation_rules.conditions, &conditionid)))
+ if (NULL == (condition = (zbx_corr_condition_t *)zbx_hashset_search(&correlation_rules.conditions, &conditionid)))
goto out;
if (SUCCEED == correlation_condition_match_new_event(condition, event, old_value))
@@ -854,9 +855,9 @@ static char *correlation_condition_get_event_filter(zbx_corr_condition_t *condit
case ZBX_CORR_CONDITION_NEW_EVENT_TAG_VALUE:
case ZBX_CORR_CONDITION_NEW_EVENT_HOSTGROUP:
if (SUCCEED == correlation_condition_match_new_event(condition, event, SUCCEED))
- filter = "1=1";
+ filter = (char *)"1=1";
else
- filter = "0=1";
+ filter = (char *)"0=1";
return zbx_strdup(NULL, filter);
}
@@ -963,7 +964,7 @@ static int correlation_add_event_filter(char **sql, size_t *sql_alloc, size_t *s
if (SUCCEED != is_uint64_n(expression + loc->l, loc->r - loc->l + 1, &conditionid))
continue;
- if (NULL == (condition = zbx_hashset_search(&correlation_rules.conditions, &conditionid)))
+ if (NULL == (condition = (zbx_corr_condition_t *)zbx_hashset_search(&correlation_rules.conditions, &conditionid)))
goto out;
if (NULL == (filter = correlation_condition_get_event_filter(condition, event)))
@@ -1074,7 +1075,8 @@ static void correlate_event_by_global_rules(DB_EVENT *event)
int i;
zbx_correlation_t *correlation;
zbx_vector_ptr_t corr_old, corr_new;
- char *sql = NULL, *delim = "";
+ char *sql = NULL;
+ const char *delim = "";
size_t sql_alloc = 0, sql_offset = 0;
zbx_uint64_t eventid, correlationid, objectid;
DB_RESULT result;
@@ -1107,7 +1109,7 @@ static void correlate_event_by_global_rules(DB_EVENT *event)
/* Process correlations that matches new event and does not use or affect old events. */
/* Those correlations can be executed directly, without checking database. */
for (i = 0; i < corr_new.values_num; i++)
- correlation_execute_operations(corr_new.values[i], event, 0, 0);
+ correlation_execute_operations((zbx_correlation_t *)corr_new.values[i], event, 0, 0);
}
if (0 != corr_old.values_num)
@@ -1150,7 +1152,7 @@ static void correlate_event_by_global_rules(DB_EVENT *event)
}
ZBX_STR2UINT64(objectid, row[1]);
- correlation_execute_operations(corr_old.values[i], event, eventid, objectid);
+ correlation_execute_operations((zbx_correlation_t *)corr_old.values[i], event, eventid, objectid);
}
DBfree_result(result);
@@ -1238,7 +1240,7 @@ static void flush_correlation_queue(zbx_vector_ptr_t *trigger_diff, zbx_vector_u
/* create a list of triggers that must be locked to close correlated events */
zbx_hashset_iter_reset(&correlation_cache, &iter);
- while (NULL != (recovery = zbx_hashset_iter_next(&iter)))
+ while (NULL != (recovery = (zbx_event_recovery_t *)zbx_hashset_iter_next(&iter)))
{
if (FAIL != zbx_vector_uint64_bsearch(triggerids_lock, recovery->objectid,
ZBX_DEFAULT_UINT64_COMPARE_FUNC))
@@ -1311,7 +1313,7 @@ static void flush_correlation_queue(zbx_vector_ptr_t *trigger_diff, zbx_vector_u
/* get correlated eventids that are still open (unresolved) */
zbx_hashset_iter_reset(&correlation_cache, &iter);
- while (NULL != (recovery = zbx_hashset_iter_next(&iter)))
+ while (NULL != (recovery = (zbx_event_recovery_t *)zbx_hashset_iter_next(&iter)))
{
/* close event only if its source trigger has been locked */
if (FAIL == (index = zbx_vector_uint64_bsearch(&triggerids, recovery->objectid,
@@ -1336,7 +1338,7 @@ static void flush_correlation_queue(zbx_vector_ptr_t *trigger_diff, zbx_vector_u
/* generate OK events and add event_recovery data for closed events */
zbx_hashset_iter_reset(&correlation_cache, &iter);
- while (NULL != (recovery = zbx_hashset_iter_next(&iter)))
+ while (NULL != (recovery = (zbx_event_recovery_t *)zbx_hashset_iter_next(&iter)))
{
if (FAIL == (index = zbx_vector_uint64_bsearch(&triggerids, recovery->objectid,
ZBX_DEFAULT_UINT64_COMPARE_FUNC)))
@@ -1598,7 +1600,7 @@ static int flush_events(void)
zbx_vector_uint64_pair_create(&closed_events);
zbx_hashset_iter_reset(&event_recovery, &iter);
- while (NULL != (recovery = zbx_hashset_iter_next(&iter)))
+ while (NULL != (recovery = (zbx_event_recovery_t *)zbx_hashset_iter_next(&iter)))
{
zbx_uint64_pair_t pair = {recovery->eventid, events[recovery->r_event_index].eventid};
@@ -1665,7 +1667,8 @@ static void process_internal_ok_events(zbx_vector_ptr_t *ok_events)
{
int i, object;
zbx_uint64_t objectid, eventid;
- char *sql = NULL, *separator = "";
+ char *sql = NULL;
+ const char *separator = "";
size_t sql_alloc = 0, sql_offset = 0;
zbx_vector_uint64_t triggerids, itemids, lldruleids;
DB_RESULT result;
diff --git a/src/zabbix_server/housekeeper/housekeeper.c b/src/zabbix_server/housekeeper/housekeeper.c
index b81d54705b5..ee3917948e5 100644
--- a/src/zabbix_server/housekeeper/housekeeper.c
+++ b/src/zabbix_server/housekeeper/housekeeper.c
@@ -49,19 +49,19 @@ static zbx_config_t cfg;
typedef struct
{
/* target table name */
- char *table;
+ const char *table;
/* Optional filter, must be empty string if not used. Only the records matching */
/* filter are subject to housekeeping procedures. */
- char *filter;
+ const char *filter;
/* The oldest record in table (with filter in effect). The min_clock value is */
/* read from the database when accessed for the first time and then during */
/* housekeeping procedures updated to the last 'cutoff' value. */
- int min_clock;
+ int min_clock;
/* a reference to the settings value specifying number of seconds the records must be kept */
- int *phistory;
+ int *phistory;
}
zbx_hk_rule_t;
@@ -71,10 +71,10 @@ zbx_hk_rule_t;
typedef struct
{
/* housekeeper table name */
- char *name;
+ const char *name;
/* a reference to housekeeping configuration enable value for this table */
- unsigned char *poption_mode;
+ unsigned char *poption_mode;
}
zbx_hk_cleanup_table_t;
@@ -123,10 +123,10 @@ zbx_hk_delete_queue_t;
typedef struct
{
/* the target table name */
- char *table;
+ const char *table;
/* history setting field name in items table (history|trends) */
- char *history;
+ const char *history;
/* a reference to the housekeeping configuration mode (enable) option for this table */
unsigned char *poption_mode;
@@ -137,14 +137,14 @@ typedef struct
/* a reference to the housekeeping configuration history value for this table */
int *poption;
+ /* type for checking which values are sent to the history storage */
+ unsigned char type;
+
/* the oldest item record timestamp cache for target table */
zbx_hashset_t item_cache;
/* the item delete queue */
zbx_vector_ptr_t delete_queue;
-
- /* type for checking which values are sent to the history storage */
- unsigned char type;
}
zbx_hk_history_rule_t;
@@ -252,7 +252,7 @@ static void hk_history_delete_queue_append(zbx_hk_history_rule_t *rule, int now,
/* update oldest timestamp in item cache */
item_record->min_clock = MIN(keep_from, item_record->min_clock + HK_MAX_DELETE_PERIODS * hk_period);
- update_record = zbx_malloc(NULL, sizeof(zbx_hk_delete_queue_t));
+ update_record = (zbx_hk_delete_queue_t *)zbx_malloc(NULL, sizeof(zbx_hk_delete_queue_t));
update_record->itemid = item_record->itemid;
update_record->min_clock = item_record->min_clock;
zbx_vector_ptr_append(&rule->delete_queue, update_record);
@@ -351,13 +351,13 @@ static void hk_history_item_update(zbx_hk_history_rule_t *rule, int now, zbx_uin
if (ZBX_HK_OPTION_DISABLED == *rule->poption_mode)
return;
- item_record = zbx_hashset_search(&rule->item_cache, &itemid);
+ item_record = (zbx_hk_item_cache_t *)zbx_hashset_search(&rule->item_cache, &itemid);
if (NULL == item_record)
{
zbx_hk_item_cache_t item_data = {itemid, now};
- item_record = zbx_hashset_insert(&rule->item_cache, &item_data, sizeof(zbx_hk_item_cache_t));
+ item_record = (zbx_hk_item_cache_t *)zbx_hashset_insert(&rule->item_cache, &item_data, sizeof(zbx_hk_item_cache_t));
if (NULL == item_record)
return;
}
@@ -554,7 +554,7 @@ static int housekeeping_history_and_trends(int now)
for (i = 0; i < rule->delete_queue.values_num; i++)
{
- zbx_hk_delete_queue_t *item_record = rule->delete_queue.values[i];
+ zbx_hk_delete_queue_t *item_record = (zbx_hk_delete_queue_t *)rule->delete_queue.values[i];
rc = DBexecute("delete from %s where itemid=" ZBX_FS_UI64 " and clock<%d",
rule->table, item_record->itemid, item_record->min_clock);
diff --git a/src/zabbix_server/httppoller/httpmacro.c b/src/zabbix_server/httppoller/httpmacro.c
index f1469bb12f0..9ae78ab39e2 100644
--- a/src/zabbix_server/httppoller/httpmacro.c
+++ b/src/zabbix_server/httppoller/httpmacro.c
@@ -214,7 +214,7 @@ int http_substitute_variables(const zbx_httptest_t *httptest, char **data)
if (FAIL == index)
continue;
- substitute = httptest->macros.values[index].second;
+ substitute = (char *)httptest->macros.values[index].second;
if ('.' == replace_char && 1 == offset)
{
@@ -234,14 +234,14 @@ int http_substitute_variables(const zbx_httptest_t *httptest, char **data)
/* http_variable_urlencode cannot fail (except for "out of memory") */
/* so no check is needed */
substitute = NULL;
- zbx_http_url_encode(httptest->macros.values[index].second, &substitute);
+ zbx_http_url_encode((char *)httptest->macros.values[index].second, &substitute);
}
else if (ZBX_CONST_STRLEN("urldecode()") == len &&
0 == strncmp(*data + offset, "urldecode()", len))
{
/* on error substitute will remain unchanged */
substitute = NULL;
- if (FAIL == (ret = zbx_http_url_decode(httptest->macros.values[index].second,
+ if (FAIL == (ret = zbx_http_url_decode((char *)httptest->macros.values[index].second,
&substitute)))
{
break;
diff --git a/src/zabbix_server/httppoller/httptest.c b/src/zabbix_server/httppoller/httptest.c
index 604bea18393..6707bc8c6f4 100644
--- a/src/zabbix_server/httppoller/httptest.c
+++ b/src/zabbix_server/httppoller/httptest.c
@@ -73,10 +73,10 @@ static size_t WRITEFUNCTION2(void *ptr, size_t size, size_t nmemb, void *userdat
{
page.allocated = MAX(8096, r_size);
page.offset = 0;
- page.data = zbx_malloc(page.data, page.allocated);
+ page.data = (char *)zbx_malloc(page.data, page.allocated);
}
- zbx_strncpy_alloc(&page.data, &page.allocated, &page.offset, ptr, r_size);
+ zbx_strncpy_alloc(&page.data, &page.allocated, &page.offset, (char *)ptr, r_size);
return r_size;
}
@@ -225,8 +225,8 @@ static void process_test_data(zbx_uint64_t httptestid, int lastfailedstep, doubl
* pairs - [IN] vector of pairs *
* *
******************************************************************************/
-static void httpstep_pairs_join(char **str, size_t *alloc_len, size_t *offset, char *value_delimiter,
- char *pair_delimiter, zbx_vector_ptr_pair_t *pairs)
+static void httpstep_pairs_join(char **str, size_t *alloc_len, size_t *offset, const char *value_delimiter,
+ const char *pair_delimiter, zbx_vector_ptr_pair_t *pairs)
{
int p;
char *key, *value;
@@ -714,10 +714,10 @@ static void process_httptest(DC_HOST *host, zbx_httptest_t *httptest)
#ifdef HAVE_LIBCURL
DB_ROW row;
zbx_httpstat_t stat;
- int err;
char *auth = NULL, errbuf[CURL_ERROR_SIZE];
size_t auth_alloc = 0, auth_offset;
CURL *easyhandle = NULL;
+ CURLcode err;
zbx_httpstep_t httpstep;
#endif
diff --git a/src/zabbix_server/ipmi/checks_ipmi.c b/src/zabbix_server/ipmi/checks_ipmi.c
index 1f25729e008..250edaa3d22 100644
--- a/src/zabbix_server/ipmi/checks_ipmi.c
+++ b/src/zabbix_server/ipmi/checks_ipmi.c
@@ -207,7 +207,7 @@ static zbx_ipmi_host_t *zbx_allocate_ipmi_host(const char *ip, int port, int aut
zabbix_log(LOG_LEVEL_DEBUG, "In %s() host:'[%s]:%d'", __function_name, ip, port);
- h = zbx_malloc(NULL, sizeof(zbx_ipmi_host_t));
+ h = (zbx_ipmi_host_t *)zbx_malloc(NULL, sizeof(zbx_ipmi_host_t));
memset(h, 0, sizeof(zbx_ipmi_host_t));
@@ -298,9 +298,9 @@ static zbx_ipmi_sensor_t *zbx_allocate_ipmi_sensor(zbx_ipmi_host_t *h, ipmi_sens
sz = (size_t)h->sensor_count * sizeof(zbx_ipmi_sensor_t);
if (NULL == h->sensors)
- h->sensors = zbx_malloc(h->sensors, sz);
+ h->sensors = (zbx_ipmi_sensor_t *)zbx_malloc(h->sensors, sz);
else
- h->sensors = zbx_realloc(h->sensors, sz);
+ h->sensors = (zbx_ipmi_sensor_t *)zbx_realloc(h->sensors, sz);
s = &h->sensors[h->sensor_count - 1];
s->sensor = sensor;
@@ -352,7 +352,7 @@ static void zbx_delete_ipmi_sensor(zbx_ipmi_host_t *h, ipmi_sensor_t *sensor)
h->sensor_count--;
if (h->sensor_count != i)
memmove(&h->sensors[i], &h->sensors[i + 1], sz * (size_t)(h->sensor_count - i));
- h->sensors = zbx_realloc(h->sensors, sz * (size_t)h->sensor_count);
+ h->sensors = (zbx_ipmi_sensor_t *)zbx_realloc(h->sensors, sz * (size_t)h->sensor_count);
break;
}
@@ -412,7 +412,7 @@ static zbx_ipmi_control_t *zbx_allocate_ipmi_control(zbx_ipmi_host_t *h, ipmi_co
char *c_name = NULL;
sz = (size_t)ipmi_control_get_id_length(control);
- c_name = zbx_malloc(c_name, sz + 1);
+ c_name = (char *)zbx_malloc(c_name, sz + 1);
ipmi_control_get_id(control, c_name, sz);
zabbix_log(LOG_LEVEL_DEBUG, "In %s() control:'%s@[%s]:%d'", __function_name, c_name, h->ip, h->port);
@@ -421,9 +421,9 @@ static zbx_ipmi_control_t *zbx_allocate_ipmi_control(zbx_ipmi_host_t *h, ipmi_co
sz = (size_t)h->control_count * sizeof(zbx_ipmi_control_t);
if (NULL == h->controls)
- h->controls = zbx_malloc(h->controls, sz);
+ h->controls = (zbx_ipmi_control_t *)zbx_malloc(h->controls, sz);
else
- h->controls = zbx_realloc(h->controls, sz);
+ h->controls = (zbx_ipmi_control_t *)zbx_realloc(h->controls, sz);
c = &h->controls[h->control_count - 1];
@@ -433,7 +433,7 @@ static zbx_ipmi_control_t *zbx_allocate_ipmi_control(zbx_ipmi_host_t *h, ipmi_co
c->c_name = c_name;
c->num_values = ipmi_control_get_num_vals(control);
sz = sizeof(int) * (size_t)c->num_values;
- c->val = zbx_malloc(c->val, sz);
+ c->val = (int *)zbx_malloc(c->val, sz);
memset(c->val, 0, sz);
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%p", __function_name, c);
@@ -464,7 +464,7 @@ static void zbx_delete_ipmi_control(zbx_ipmi_host_t *h, ipmi_control_t *control)
h->control_count--;
if (h->control_count != i)
memmove(&h->controls[i], &h->controls[i + 1], sz * (size_t)(h->control_count - i));
- h->controls = zbx_realloc(h->controls, sz * (size_t)h->control_count);
+ h->controls = (zbx_ipmi_control_t *)zbx_realloc(h->controls, sz * (size_t)h->control_count);
break;
}
@@ -478,7 +478,7 @@ static void zbx_got_thresh_reading_cb(ipmi_sensor_t *sensor, int err, enum ipmi_
{
const char *__function_name = "zbx_got_thresh_reading_cb";
char id_str[2 * IPMI_SENSOR_ID_SZ + 1];
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
zbx_ipmi_sensor_t *s;
ZBX_UNUSED(raw_value);
@@ -574,7 +574,7 @@ static void zbx_got_discrete_states_cb(ipmi_sensor_t *sensor, int err, ipmi_stat
const char *__function_name = "zbx_got_discrete_states_cb";
char id_str[2 * IPMI_SENSOR_ID_SZ + 1];
int id, i, val, ret, is_state_set;
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
zbx_ipmi_sensor_t *s;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -769,7 +769,7 @@ out:
static void zbx_got_control_reading_cb(ipmi_control_t *control, int err, int *val, void *cb_data)
{
const char *__function_name = "zbx_got_control_reading_cb";
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
int n;
zbx_ipmi_control_t *c;
const char *e_string;
@@ -826,7 +826,7 @@ out:
static void zbx_got_control_setting_cb(ipmi_control_t *control, int err, void *cb_data)
{
const char *__function_name = "zbx_got_control_setting_cb";
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
zbx_ipmi_control_t *c;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -948,7 +948,7 @@ out:
static void zbx_sensor_change_cb(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_sensor_t *sensor, void *cb_data)
{
const char *__function_name = "zbx_sensor_change_cb";
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -981,7 +981,7 @@ static void zbx_sensor_change_cb(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi
static void zbx_control_change_cb(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_control_t *control, void *cb_data)
{
const char *__function_name = "zbx_control_change_cb";
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -1011,7 +1011,7 @@ static void zbx_entity_change_cb(enum ipmi_update_e op, ipmi_domain_t *domain, i
{
const char *__function_name = "zbx_entity_change_cb";
int ret;
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -1041,7 +1041,7 @@ static void zbx_entity_change_cb(enum ipmi_update_e op, ipmi_domain_t *domain, i
static void zbx_domain_closed_cb(void *cb_data)
{
const char *__function_name = "zbx_domain_closed_cb";
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -1061,7 +1061,7 @@ static void zbx_connection_change_cb(ipmi_domain_t *domain, int err, unsigned in
const char *__function_name = "zbx_connection_change_cb";
int ret;
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -1092,7 +1092,7 @@ out:
static void zbx_domain_up_cb(ipmi_domain_t *domain, void *cb_data)
{
const char *__function_name = "zbx_domain_up_cb";
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
RETURN_IF_CB_DATA_NULL(cb_data, __function_name);
@@ -1306,7 +1306,7 @@ static int domain_close_ok;
/* callback function invoked from OpenIPMI */
static void zbx_get_domain_id_by_name_cb(ipmi_domain_t *domain, void *cb_data)
{
- char name[IPMI_DOMAIN_NAME_LEN], *domain_name = cb_data;
+ char name[IPMI_DOMAIN_NAME_LEN], *domain_name = (char *)cb_data;
RETURN_IF_CB_DATA_NULL(cb_data, "zbx_get_domain_id_by_name_cb");
@@ -1324,7 +1324,7 @@ static void zbx_get_domain_id_by_name_cb(ipmi_domain_t *domain, void *cb_data)
/* callback function invoked from OpenIPMI */
static void zbx_domain_close_cb(ipmi_domain_t *domain, void *cb_data)
{
- zbx_ipmi_host_t *h = cb_data;
+ zbx_ipmi_host_t *h = (zbx_ipmi_host_t *)cb_data;
int ret;
RETURN_IF_CB_DATA_NULL(cb_data, "zbx_domain_close_cb");
diff --git a/src/zabbix_server/ipmi/ipmi_manager.c b/src/zabbix_server/ipmi/ipmi_manager.c
index 7150c939c01..ea09e76f4c7 100644
--- a/src/zabbix_server/ipmi/ipmi_manager.c
+++ b/src/zabbix_server/ipmi/ipmi_manager.c
@@ -576,7 +576,7 @@ static void ipmi_manager_process_poller_queue(zbx_ipmi_manager_t *manager, zbx_i
case ZBX_IPC_IPMI_CLEANUP_REQUEST:
break;
case ZBX_IPC_IPMI_VALUE_REQUEST:
- if (NULL == (host = zbx_hashset_search(&manager->hosts, &request->hostid)))
+ if (NULL == (host = (zbx_ipmi_manager_host_t *)zbx_hashset_search(&manager->hosts, &request->hostid)))
{
THIS_SHOULD_NEVER_HAPPEN;
ipmi_request_free(request);
@@ -618,7 +618,7 @@ static zbx_ipmi_manager_host_t *ipmi_manager_cache_host(zbx_ipmi_manager_t *mana
zbx_ipmi_manager_host_t host_local;
host_local.hostid = hostid;
- host = zbx_hashset_insert(&manager->hosts, &host_local, sizeof(host_local));
+ host = (zbx_ipmi_manager_host_t *)zbx_hashset_insert(&manager->hosts, &host_local, sizeof(host_local));
host->disable_until = 0;
host->poller = ipmi_manager_get_host_poller(manager);
diff --git a/src/zabbix_server/ipmi/ipmi_protocol.c b/src/zabbix_server/ipmi/ipmi_protocol.c
index d170e32f3fb..4dfc49e271a 100644
--- a/src/zabbix_server/ipmi/ipmi_protocol.c
+++ b/src/zabbix_server/ipmi/ipmi_protocol.c
@@ -41,7 +41,7 @@ zbx_uint32_t zbx_ipmi_serialize_request(unsigned char **data, zbx_uint64_t objec
data_len = sizeof(zbx_uint64_t) + sizeof(short) + sizeof(char) * 2 + addr_len + username_len + password_len +
sensor_len + sizeof(zbx_uint32_t) * 4 + sizeof(int);
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_uint64(ptr, objectid);
ptr += zbx_serialize_str(ptr, addr, addr_len);
@@ -87,7 +87,7 @@ zbx_uint32_t zbx_ipmi_serialize_result(unsigned char **data, const zbx_timespec_
value_len = (NULL != value ? strlen(value) + 1 : 0);
data_len = value_len + sizeof(zbx_uint32_t) + sizeof(int) * 3;
- *data = zbx_malloc(NULL, data_len);
+ *data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_int(ptr, ts->sec);
diff --git a/src/zabbix_server/odbc/odbc.c b/src/zabbix_server/odbc/odbc.c
index e65d7eb1aed..36a720bcbac 100644
--- a/src/zabbix_server/odbc/odbc.c
+++ b/src/zabbix_server/odbc/odbc.c
@@ -229,7 +229,7 @@ zbx_odbc_data_source_t *zbx_odbc_connect(const char *dsn, const char *user, cons
zabbix_log(LOG_LEVEL_DEBUG, "In %s() dsn:'%s' user:'%s'", __function_name, dsn, user);
- data_source = zbx_malloc(data_source, sizeof(zbx_odbc_data_source_t));
+ data_source = (zbx_odbc_data_source_t *)zbx_malloc(data_source, sizeof(zbx_odbc_data_source_t));
if (0 != SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &data_source->henv)))
{
@@ -327,7 +327,7 @@ zbx_odbc_query_result_t *zbx_odbc_select(const zbx_odbc_data_source_t *data_sour
zabbix_log(LOG_LEVEL_DEBUG, "In %s() query:'%s'", __function_name, query);
- query_result = zbx_malloc(query_result, sizeof(zbx_odbc_query_result_t));
+ query_result = (zbx_odbc_query_result_t *)zbx_malloc(query_result, sizeof(zbx_odbc_query_result_t));
rc = SQLAllocHandle(SQL_HANDLE_STMT, data_source->hdbc, &query_result->hstmt);
@@ -344,9 +344,9 @@ zbx_odbc_query_result_t *zbx_odbc_select(const zbx_odbc_data_source_t *data_sour
SQLSMALLINT i;
SQLLEN col_type;
- query_result->c_types = zbx_malloc(NULL,
+ query_result->c_types = (SQLSMALLINT *)zbx_malloc(NULL,
sizeof(SQLSMALLINT) * (size_t)query_result->col_num);
- query_result->row = zbx_malloc(NULL, sizeof(char *) * (size_t)query_result->col_num);
+ query_result->row = (char **)zbx_malloc(NULL, sizeof(char *) * (size_t)query_result->col_num);
for (i = 0; ; i++)
{
diff --git a/src/zabbix_server/operations.c b/src/zabbix_server/operations.c
index 9d8c99e5d21..29992a2376b 100644
--- a/src/zabbix_server/operations.c
+++ b/src/zabbix_server/operations.c
@@ -122,7 +122,7 @@ static void add_discovered_host_groups(zbx_uint64_t hostid, zbx_vector_uint64_t
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"select groupid"
@@ -653,7 +653,7 @@ void op_groups_del(const DB_EVENT *event, zbx_vector_uint64_t *groupids)
if (0 == (hostid = select_discovered_host(event)))
return;
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
/* make sure host belongs to at least one hostgroup */
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
diff --git a/src/zabbix_server/pinger/pinger.c b/src/zabbix_server/pinger/pinger.c
index 348931310d5..9e7eebae179 100644
--- a/src/zabbix_server/pinger/pinger.c
+++ b/src/zabbix_server/pinger/pinger.c
@@ -159,7 +159,7 @@ static void process_values(icmpitem_t *items, int first_index, int last_index, Z
if (0 == host->cnt)
{
process_value(item->itemid, NULL, NULL, ts, NOTSUPPORTED,
- "Cannot send ICMP ping packets to this host.");
+ (char *)"Cannot send ICMP ping packets to this host.");
continue;
}
@@ -372,7 +372,7 @@ static void add_icmpping_item(icmpitem_t **items, int *items_alloc, int *items_c
{
*items_alloc += 4;
sz = *items_alloc * sizeof(icmpitem_t);
- *items = zbx_realloc(*items, sz);
+ *items = (icmpitem_t *)zbx_realloc(*items, sz);
}
memmove(&(*items)[index + 1], &(*items)[index], sizeof(icmpitem_t) * (*items_count - index));
@@ -492,7 +492,7 @@ static void add_pinger_host(ZBX_FPING_HOST **hosts, int *hosts_alloc, int *hosts
{
*hosts_alloc += 4;
sz = *hosts_alloc * sizeof(ZBX_FPING_HOST);
- *hosts = zbx_realloc(*hosts, sz);
+ *hosts = (ZBX_FPING_HOST *)zbx_realloc(*hosts, sz);
}
h = &(*hosts)[*hosts_count - 1];
@@ -530,7 +530,7 @@ static void process_pinger_hosts(icmpitem_t *items, int items_count)
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
if (NULL == hosts)
- hosts = zbx_malloc(hosts, sizeof(ZBX_FPING_HOST) * hosts_alloc);
+ hosts = (ZBX_FPING_HOST *)zbx_malloc(hosts, sizeof(ZBX_FPING_HOST) * hosts_alloc);
for (i = 0; i < items_count; i++)
{
@@ -587,7 +587,7 @@ ZBX_THREAD_ENTRY(pinger_thread, args)
server_num, get_process_type_string(process_type), process_num);
if (NULL == items)
- items = zbx_malloc(items, sizeof(icmpitem_t) * items_alloc);
+ items = (icmpitem_t *)zbx_malloc(items, sizeof(icmpitem_t) * items_alloc);
for (;;)
{
diff --git a/src/zabbix_server/poller/checks_aggregate.c b/src/zabbix_server/poller/checks_aggregate.c
index 9d0f34146c3..feb332e6b19 100644
--- a/src/zabbix_server/poller/checks_aggregate.c
+++ b/src/zabbix_server/poller/checks_aggregate.c
@@ -247,7 +247,7 @@ static void quote_string(char **str, size_t sz_src)
sz_dst = zbx_get_escape_string_len(*str, "\"") + 3;
- *str = zbx_realloc(*str, sz_dst);
+ *str = (char *)zbx_realloc(*str, sz_dst);
(*str)[--sz_dst] = '\0';
(*str)[--sz_dst] = '"';
@@ -282,7 +282,7 @@ static void aggregate_quote_groups(char **str, size_t *str_alloc, size_t *str_of
continue;
zbx_strcpy_alloc(str, str_alloc, str_offset, separator);
- separator = ", ";
+ separator = (char *)", ";
quote_string(&group, strlen(group));
zbx_strcpy_alloc(str, str_alloc, str_offset, group);
@@ -346,7 +346,7 @@ static int aggregate_get_items(zbx_vector_uint64_t *itemids, const char *groups,
goto out;
}
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
esc = DBdyn_escape_string(itemkey);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
@@ -436,8 +436,8 @@ static int evaluate_aggregate(DC_ITEM *item, AGENT_RESULT *res, int grp_func, co
memset(&value, 0, sizeof(value));
zbx_history_record_vector_create(&group_values);
- items = zbx_malloc(items, sizeof(DC_ITEM) * itemids.values_num);
- errcodes = zbx_malloc(errcodes, sizeof(int) * itemids.values_num);
+ items = (DC_ITEM *)zbx_malloc(items, sizeof(DC_ITEM) * itemids.values_num);
+ errcodes = (int *)zbx_malloc(errcodes, sizeof(int) * itemids.values_num);
DCconfig_get_items_by_itemids(items, itemids.values, errcodes, itemids.values_num);
diff --git a/src/zabbix_server/poller/checks_calculated.c b/src/zabbix_server/poller/checks_calculated.c
index fd3d2dacf39..8573535233b 100644
--- a/src/zabbix_server/poller/checks_calculated.c
+++ b/src/zabbix_server/poller/checks_calculated.c
@@ -70,7 +70,7 @@ static int calcitem_add_function(expression_t *exp, char *host, char *key, char
if (exp->functions_alloc == exp->functions_num)
{
exp->functions_alloc += 8;
- exp->functions = zbx_realloc(exp->functions, exp->functions_alloc * sizeof(function_t));
+ exp->functions = (function_t *)zbx_realloc(exp->functions, exp->functions_alloc * sizeof(function_t));
}
f = &exp->functions[exp->functions_num++];
@@ -94,7 +94,7 @@ static int calcitem_parse_expression(DC_ITEM *dc_item, expression_t *exp, char *
zabbix_log(LOG_LEVEL_DEBUG, "In %s() expression:'%s'", __function_name, dc_item->params);
- exp->exp = zbx_malloc(exp->exp, exp_alloc);
+ exp->exp = (char *)zbx_malloc(exp->exp, exp_alloc);
for (e = dc_item->params; SUCCEED == zbx_function_find(e, &f_pos, &par_l, &par_r); e += par_r + 1)
{
@@ -180,9 +180,9 @@ static int calcitem_evaluate_expression(expression_t *exp, char *error, size_t m
if (0 == exp->functions_num)
return ret;
- keys = zbx_malloc(keys, sizeof(zbx_host_key_t) * (size_t)exp->functions_num);
- items = zbx_malloc(items, sizeof(DC_ITEM) * (size_t)exp->functions_num);
- errcodes = zbx_malloc(errcodes, sizeof(int) * (size_t)exp->functions_num);
+ keys = (zbx_host_key_t *)zbx_malloc(keys, sizeof(zbx_host_key_t) * (size_t)exp->functions_num);
+ items = (DC_ITEM *)zbx_malloc(items, sizeof(DC_ITEM) * (size_t)exp->functions_num);
+ errcodes = (int *)zbx_malloc(errcodes, sizeof(int) * (size_t)exp->functions_num);
for (i = 0; i < exp->functions_num; i++)
{
@@ -250,7 +250,7 @@ static int calcitem_evaluate_expression(expression_t *exp, char *error, size_t m
ret_unknown = 1;
}
- f->value = zbx_malloc(f->value, MAX_BUFFER_LEN);
+ f->value = (char *)zbx_malloc(f->value, MAX_BUFFER_LEN);
if (0 == ret_unknown &&
SUCCEED != evaluate_function(f->value, &items[i], f->func, f->params, now, &errstr))
@@ -291,7 +291,7 @@ static int calcitem_evaluate_expression(expression_t *exp, char *error, size_t m
f->value = wrapped;
}
else
- f->value = zbx_realloc(f->value, strlen(f->value) + 1);
+ f->value = (char *)zbx_realloc(f->value, strlen(f->value) + 1);
zbx_snprintf(replace, sizeof(replace), "{%d}", f->functionid);
buf = string_replace(exp->exp, replace, f->value);
@@ -353,7 +353,7 @@ int get_value_calculated(DC_ITEM *dc_item, AGENT_RESULT *result)
{
SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Received value [" ZBX_FS_DBL "]"
" is not suitable for value type [%s].",
- value, zbx_item_value_type_string(dc_item->value_type)));
+ value, zbx_item_value_type_string((zbx_item_value_type_t)dc_item->value_type)));
ret = NOTSUPPORTED;
goto clean;
}
diff --git a/src/zabbix_server/poller/checks_external.c b/src/zabbix_server/poller/checks_external.c
index 37a2ac2e5a9..188b1220d64 100644
--- a/src/zabbix_server/poller/checks_external.c
+++ b/src/zabbix_server/poller/checks_external.c
@@ -59,7 +59,7 @@ int get_value_external(DC_ITEM *item, AGENT_RESULT *result)
goto out;
}
- cmd = zbx_malloc(cmd, cmd_alloc);
+ cmd = (char *)zbx_malloc(cmd, cmd_alloc);
zbx_snprintf_alloc(&cmd, &cmd_alloc, &cmd_offset, "%s/%s", CONFIG_EXTERNALSCRIPTS, get_rkey(&request));
if (-1 == access(cmd, X_OK))
diff --git a/src/zabbix_server/poller/checks_internal.c b/src/zabbix_server/poller/checks_internal.c
index f0cef727058..0322b4b250c 100644
--- a/src/zabbix_server/poller/checks_internal.c
+++ b/src/zabbix_server/poller/checks_internal.c
@@ -32,7 +32,7 @@ extern unsigned char program_type;
static int compare_interfaces(const void *p1, const void *p2)
{
- const DC_INTERFACE2 *i1 = p1, *i2 = p2;
+ const DC_INTERFACE2 *i1 = (DC_INTERFACE2 *)p1, *i2 = (DC_INTERFACE2 *)p2;
if (i1->type > i2->type) /* 1st criterion: 'type' in ascending order */
return 1;
diff --git a/src/zabbix_server/poller/checks_simple_vmware.c b/src/zabbix_server/poller/checks_simple_vmware.c
index e58bdf57dff..90fde2e564e 100644
--- a/src/zabbix_server/poller/checks_simple_vmware.c
+++ b/src/zabbix_server/poller/checks_simple_vmware.c
@@ -61,7 +61,7 @@ static zbx_vmware_hv_t *hv_get(zbx_hashset_t *hvs, const char *uuid)
zabbix_log(LOG_LEVEL_DEBUG, "In %s() uuid:'%s'", __function_name, uuid);
- hv = zbx_hashset_search(hvs, &hv_local);
+ hv = (zbx_vmware_hv_t *)zbx_hashset_search(hvs, &hv_local);
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%p", __function_name, hv);
@@ -78,7 +78,7 @@ static zbx_vmware_hv_t *service_hv_get_by_vm_uuid(zbx_vmware_service_t *service,
zabbix_log(LOG_LEVEL_DEBUG, "In %s() uuid:'%s'", __function_name, uuid);
- if (NULL != (vmi = zbx_hashset_search(&service->data->vms_index, &vmi_local)))
+ if (NULL != (vmi = (zbx_vmware_vm_index_t *)zbx_hashset_search(&service->data->vms_index, &vmi_local)))
hv = vmi->hv;
else
hv = NULL;
@@ -98,7 +98,7 @@ static zbx_vmware_vm_t *service_vm_get(zbx_vmware_service_t *service, const char
zabbix_log(LOG_LEVEL_DEBUG, "In %s() uuid:'%s'", __function_name, uuid);
- if (NULL != (vmi = zbx_hashset_search(&service->data->vms_index, &vmi_local)))
+ if (NULL != (vmi = (zbx_vmware_vm_index_t *)zbx_hashset_search(&service->data->vms_index, &vmi_local)))
vm = vmi->vm;
else
vm = NULL;
@@ -202,7 +202,7 @@ static int vmware_service_get_counter_value_by_id(zbx_vmware_service_t *service,
{
perfvalue = (zbx_ptr_pair_t *)&perfcounter->values.values[i];
- if (0 == strcmp(perfvalue->first, instance))
+ if (0 == strcmp((char *)perfvalue->first, instance))
break;
}
@@ -213,7 +213,7 @@ static int vmware_service_get_counter_value_by_id(zbx_vmware_service_t *service,
}
/* VMware returns -1 value if the performance data for the specified period is not ready - ignore it */
- if (0 == strcmp(perfvalue->second, "-1"))
+ if (0 == strcmp((char *)perfvalue->second, "-1"))
{
ret = SYSINFO_RET_OK;
goto out;
@@ -221,7 +221,7 @@ static int vmware_service_get_counter_value_by_id(zbx_vmware_service_t *service,
- if (SUCCEED == is_uint64(perfvalue->second, &value))
+ if (SUCCEED == is_uint64((char *)perfvalue->second, &value))
{
value *= coeff;
@@ -599,13 +599,13 @@ static void vmware_get_events(const zbx_vector_ptr_t *events, zbx_uint64_t event
/* events were retrieved in reverse chronological order */
for (i = events->values_num - 1; i >= 0; i--)
{
- const zbx_vmware_event_t *event = events->values[i];
+ const zbx_vmware_event_t *event = (zbx_vmware_event_t *)events->values[i];
AGENT_RESULT *add_result = NULL;
if (event->key <= eventlog_last_key)
continue;
- add_result = zbx_malloc(add_result, sizeof(AGENT_RESULT));
+ add_result = (AGENT_RESULT *)zbx_malloc(add_result, sizeof(AGENT_RESULT));
init_result(add_result);
if (SUCCEED == set_result_type(add_result, item->value_type, event->message))
@@ -855,7 +855,7 @@ int check_vcenter_hv_discovery(AGENT_REQUEST *request, const char *username, con
zbx_json_addarray(&json_data, ZBX_PROTO_TAG_DATA);
zbx_hashset_iter_reset(&service->data->hvs, &iter);
- while (NULL != (hv = zbx_hashset_iter_next(&iter)))
+ while (NULL != (hv = (zbx_vmware_hv_t *)zbx_hashset_iter_next(&iter)))
{
zbx_vmware_cluster_t *cluster = NULL;
@@ -1444,7 +1444,7 @@ int check_vcenter_hv_datastore_discovery(AGENT_REQUEST *request, const char *use
for (i = 0; i < hv->datastores.values_num; i++)
{
- zbx_vmware_datastore_t *datastore = hv->datastores.values[i];
+ zbx_vmware_datastore_t *datastore = (zbx_vmware_datastore_t *)hv->datastores.values[i];
zbx_json_addobject(&json_data, NULL);
zbx_json_addstring(&json_data, "{#DATASTORE}", datastore->name, ZBX_JSON_TYPE_STRING);
@@ -1508,7 +1508,7 @@ int check_vcenter_hv_datastore_read(AGENT_REQUEST *request, const char *username
for (i = 0; i < hv->datastores.values_num; i++)
{
- zbx_vmware_datastore_t *datastore = hv->datastores.values[i];
+ zbx_vmware_datastore_t *datastore = (zbx_vmware_datastore_t *)hv->datastores.values[i];
if (0 == strcmp(name, datastore->name))
{
@@ -1575,7 +1575,7 @@ int check_vcenter_hv_datastore_write(AGENT_REQUEST *request, const char *usernam
for (i = 0; i < hv->datastores.values_num; i++)
{
- zbx_vmware_datastore_t *datastore = hv->datastores.values[i];
+ zbx_vmware_datastore_t *datastore = (zbx_vmware_datastore_t *)hv->datastores.values[i];
if (0 == strcmp(name, datastore->name))
{
@@ -1656,7 +1656,7 @@ int check_vcenter_hv_datastore_size(AGENT_REQUEST *request, const char *username
for (i = 0; i < hv->datastores.values_num; i++)
{
- datastore = hv->datastores.values[i];
+ datastore = (zbx_vmware_datastore_t *)hv->datastores.values[i];
if (0 == strcmp(name, datastore->name))
break;
}
@@ -1727,7 +1727,8 @@ int check_vcenter_hv_perfcounter(AGENT_REQUEST *request, const char *username, c
{
const char *__function_name = "check_vcenter_hv_perfcounter";
- char *url, *uuid, *path, *instance;
+ char *url, *uuid, *path;
+ const char *instance;
zbx_vmware_service_t *service;
zbx_vmware_hv_t *hv;
zbx_uint64_t counterid;
@@ -1991,7 +1992,7 @@ int check_vcenter_vm_discovery(AGENT_REQUEST *request, const char *username, con
zbx_json_addarray(&json_data, ZBX_PROTO_TAG_DATA);
zbx_hashset_iter_reset(&service->data->hvs, &iter);
- while (NULL != (hv = zbx_hashset_iter_next(&iter)))
+ while (NULL != (hv = (zbx_vmware_hv_t *)zbx_hashset_iter_next(&iter)))
{
zbx_vmware_cluster_t *cluster = NULL;
@@ -2881,7 +2882,8 @@ int check_vcenter_vm_perfcounter(AGENT_REQUEST *request, const char *username, c
{
const char *__function_name = "check_vcenter_vm_perfcounter";
- char *url, *uuid, *path, *instance;
+ char *url, *uuid, *path;
+ const char *instance;
zbx_vmware_service_t *service;
zbx_vmware_vm_t *vm;
zbx_uint64_t counterid;
diff --git a/src/zabbix_server/poller/checks_snmp.c b/src/zabbix_server/poller/checks_snmp.c
index 579a5473717..e0ac99edde4 100644
--- a/src/zabbix_server/poller/checks_snmp.c
+++ b/src/zabbix_server/poller/checks_snmp.c
@@ -236,10 +236,10 @@ static int cache_get_snmp_index(const DC_ITEM *item, const char *oid, const char
main_key_local.community_context = get_item_community_context(item);
main_key_local.security_name = get_item_security_name(item);
- if (NULL == (main_key = zbx_hashset_search(&snmpidx, &main_key_local)))
+ if (NULL == (main_key = (zbx_snmpidx_main_key_t *)zbx_hashset_search(&snmpidx, &main_key_local)))
goto end;
- if (NULL == (mapping = zbx_hashset_search(main_key->mappings, &value)))
+ if (NULL == (mapping = (zbx_snmpidx_mapping_t *)zbx_hashset_search(main_key->mappings, &value)))
goto end;
zbx_strcpy_alloc(idx, idx_alloc, &idx_offset, mapping->index);
@@ -288,7 +288,7 @@ static void cache_put_snmp_index(const DC_ITEM *item, const char *oid, const cha
main_key_local.community_context = get_item_community_context(item);
main_key_local.security_name = get_item_security_name(item);
- if (NULL == (main_key = zbx_hashset_search(&snmpidx, &main_key_local)))
+ if (NULL == (main_key = (zbx_snmpidx_main_key_t *)zbx_hashset_search(&snmpidx, &main_key_local)))
{
main_key_local.addr = zbx_strdup(NULL, item->interface.addr);
main_key_local.oid = zbx_strdup(NULL, oid);
@@ -296,15 +296,15 @@ static void cache_put_snmp_index(const DC_ITEM *item, const char *oid, const cha
main_key_local.community_context = zbx_strdup(NULL, get_item_community_context(item));
main_key_local.security_name = zbx_strdup(NULL, get_item_security_name(item));
- main_key_local.mappings = zbx_malloc(NULL, sizeof(zbx_hashset_t));
+ main_key_local.mappings = (zbx_hashset_t *)zbx_malloc(NULL, sizeof(zbx_hashset_t));
zbx_hashset_create_ext(main_key_local.mappings, 100,
__snmpidx_mapping_hash, __snmpidx_mapping_compare, __snmpidx_mapping_clean,
ZBX_DEFAULT_MEM_MALLOC_FUNC, ZBX_DEFAULT_MEM_REALLOC_FUNC, ZBX_DEFAULT_MEM_FREE_FUNC);
- main_key = zbx_hashset_insert(&snmpidx, &main_key_local, sizeof(main_key_local));
+ main_key = (zbx_snmpidx_main_key_t *)zbx_hashset_insert(&snmpidx, &main_key_local, sizeof(main_key_local));
}
- if (NULL == (mapping = zbx_hashset_search(main_key->mappings, &value)))
+ if (NULL == (mapping = (zbx_snmpidx_mapping_t *)zbx_hashset_search(main_key->mappings, &value)))
{
mapping_local.value = zbx_strdup(NULL, value);
mapping_local.index = zbx_strdup(NULL, index);
@@ -353,7 +353,7 @@ static void cache_del_snmp_index_subtree(const DC_ITEM *item, const char *oid)
main_key_local.community_context = get_item_community_context(item);
main_key_local.security_name = get_item_security_name(item);
- if (NULL == (main_key = zbx_hashset_search(&snmpidx, &main_key_local)))
+ if (NULL == (main_key = (zbx_snmpidx_main_key_t *)zbx_hashset_search(&snmpidx, &main_key_local)))
goto end;
zbx_hashset_clear(main_key->mappings);
@@ -485,7 +485,7 @@ static struct snmp_session *zbx_snmp_open_session(const DC_ITEM *item, char *err
if (SNMP_VERSION_1 == session.version || SNMP_VERSION_2c == session.version)
{
session.community = (u_char *)item->snmp_community;
- session.community_len = strlen((void *)session.community);
+ session.community_len = strlen((char *)session.community);
zabbix_log(LOG_LEVEL_DEBUG, "SNMP [%s@%s]", session.community, session.peername);
}
else if (SNMP_VERSION_3 == session.version)
@@ -689,7 +689,7 @@ static char *zbx_snmp_get_octet_string(const struct variable_list *var)
/* snprint_value() escapes hintless ASCII strings, so */
/* we are copying the raw unescaped value in this case */
- strval_dyn = zbx_malloc(strval_dyn, var->val_len + 1);
+ strval_dyn = (char *)zbx_malloc(strval_dyn, var->val_len + 1);
memcpy(strval_dyn, var->val.string, var->val_len);
strval_dyn[var->val_len] = '\0';
}
@@ -1722,7 +1722,7 @@ static void zbx_snmp_ddata_clean(zbx_snmp_ddata_t *data)
zbx_vector_ptr_destroy(&data->index);
zbx_hashset_iter_reset(&data->objects, &iter);
- while (NULL != (obj = zbx_hashset_iter_next(&iter)))
+ while (NULL != (obj = (zbx_snmp_dobject_t *)zbx_hashset_iter_next(&iter)))
{
for (i = 0; i < data->request.nparam / 2; i++)
zbx_free(obj->values[i]);
@@ -1743,7 +1743,7 @@ static void zbx_snmp_walk_discovery_cb(void *arg, const char *oid, const char *i
ZBX_UNUSED(oid);
- if (NULL == (obj = zbx_hashset_search(&data->objects, &index)))
+ if (NULL == (obj = (zbx_snmp_dobject_t *)zbx_hashset_search(&data->objects, &index)))
{
zbx_snmp_dobject_t new_obj;
@@ -1751,7 +1751,7 @@ static void zbx_snmp_walk_discovery_cb(void *arg, const char *oid, const char *i
new_obj.values = (char **)zbx_malloc(NULL, sizeof(char *) * data->request.nparam / 2);
memset(new_obj.values, 0, sizeof(char *) * data->request.nparam / 2);
- obj = zbx_hashset_insert(&data->objects, &new_obj, sizeof(new_obj));
+ obj = (zbx_snmp_dobject_t *)zbx_hashset_insert(&data->objects, &new_obj, sizeof(new_obj));
zbx_vector_ptr_append(&data->index, obj);
}
@@ -1845,7 +1845,7 @@ static int zbx_snmp_process_dynamic(struct snmp_session *ss, const DC_ITEM *item
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- idx = zbx_malloc(idx, idx_alloc);
+ idx = (char *)zbx_malloc(idx, idx_alloc);
/* perform initial item validation */
diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c
index 158712b5534..9eb0c2bbc3b 100644
--- a/src/zabbix_server/poller/poller.c
+++ b/src/zabbix_server/poller/poller.c
@@ -641,7 +641,7 @@ static int get_values(unsigned char poller_type, int *nextcheck)
for (j = 0; j < add_results.values_num; j++)
{
- AGENT_RESULT *add_result = add_results.values[j];
+ AGENT_RESULT *add_result = (AGENT_RESULT *)add_results.values[j];
if (ISSET_MSG(add_result))
{
diff --git a/src/zabbix_server/postinit.c b/src/zabbix_server/postinit.c
index 69cd8b5c447..fc066524181 100644
--- a/src/zabbix_server/postinit.c
+++ b/src/zabbix_server/postinit.c
@@ -128,7 +128,7 @@ static void preprocess_trigger_name(DB_TRIGGER *trigger, int *historical)
*historical = FAIL;
- replace = zbx_malloc(NULL, replace_alloc);
+ replace = (char *)zbx_malloc(NULL, replace_alloc);
name_alloc = name_len = strlen(trigger->description) + 1;
@@ -354,7 +354,7 @@ static int update_event_names(void)
memset(&trigger, 0, sizeof(DB_TRIGGER));
- sql = zbx_malloc(NULL, sql_alloc);
+ sql = (char *)zbx_malloc(NULL, sql_alloc);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
result = DBselect(
diff --git a/src/zabbix_server/preprocessor/preproc_manager.c b/src/zabbix_server/preprocessor/preproc_manager.c
index d4a64589a65..d7aceade95c 100644
--- a/src/zabbix_server/preprocessor/preproc_manager.c
+++ b/src/zabbix_server/preprocessor/preproc_manager.c
@@ -146,10 +146,10 @@ static void preprocessor_sync_configuration(zbx_preprocessing_manager_t *manager
if (ts != manager->cache_ts)
{
zbx_hashset_iter_reset(&manager->history_cache, &iter);
- while (NULL != (history_value = zbx_hashset_iter_next(&iter)))
+ while (NULL != (history_value = (zbx_item_history_value_t *)zbx_hashset_iter_next(&iter)))
{
item_local.itemid = history_value->itemid;
- if (NULL == (item = zbx_hashset_search(&manager->item_config, &item_local)) ||
+ if (NULL == (item = (zbx_preproc_item_t *)zbx_hashset_search(&manager->item_config, &item_local)) ||
history_value->value_type != item->value_type)
{
/* history value is removed if item was removed/disabled or item value type changed */
@@ -292,7 +292,7 @@ static zbx_uint32_t preprocessor_create_task(zbx_preprocessing_manager_t *manage
THIS_SHOULD_NEVER_HAPPEN;
size = zbx_preprocessor_pack_task(task, request->value.itemid, request->value_type, request->value.ts, &value,
- zbx_hashset_search(&manager->history_cache, &request->value.itemid), request->steps,
+ (zbx_item_history_value_t *)zbx_hashset_search(&manager->history_cache, &request->value.itemid), request->steps,
request->steps_num);
return size;
@@ -458,7 +458,7 @@ static void preprocessor_link_delta_items(zbx_preprocessing_manager_t *manager,
if (i != item->preproc_ops_num)
{
/* existing delta item*/
- if (NULL != (index = zbx_hashset_search(&manager->delta_items, &item->itemid)))
+ if (NULL != (index = (zbx_delta_item_index_t *)zbx_hashset_search(&manager->delta_items, &item->itemid)))
{
dep_request = (zbx_preprocessing_request_t *)(enqueued_at->data);
request = (zbx_preprocessing_request_t *)(index->queue_item->data);
@@ -558,7 +558,7 @@ static void preprocessor_enqueue(zbx_preprocessing_manager_t *manager, zbx_prepr
zabbix_log(LOG_LEVEL_DEBUG, "In %s() itemid: %" PRIu64, __function_name, value->itemid);
item_local.itemid = value->itemid;
- item = zbx_hashset_search(&manager->item_config, &item_local);
+ item = (zbx_preproc_item_t *)zbx_hashset_search(&manager->item_config, &item_local);
/* override priority based on item type */
if (NULL != item && ITEM_TYPE_INTERNAL == item->type)
@@ -589,7 +589,7 @@ static void preprocessor_enqueue(zbx_preprocessing_manager_t *manager, zbx_prepr
if (REQUEST_STATE_QUEUED == state)
{
request->value_type = item->value_type;
- request->steps = zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * item->preproc_ops_num);
+ request->steps = (zbx_preproc_op_t *)zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * item->preproc_ops_num);
request->steps_num = item->preproc_ops_num;
for (i = 0; i < item->preproc_ops_num; i++)
@@ -666,7 +666,7 @@ static void preprocessor_enqueue_dependent(zbx_preprocessing_manager_t *manager,
if (NULL != source_value->result && ISSET_VALUE(source_value->result))
{
item_local.itemid = source_value->itemid;
- if (NULL != (item = zbx_hashset_search(&manager->item_config, &item_local)) &&
+ if (NULL != (item = (zbx_preproc_item_t *)zbx_hashset_search(&manager->item_config, &item_local)) &&
0 != item->dep_itemids_num)
{
for (i = item->dep_itemids_num - 1; i >= 0; i--)
@@ -790,7 +790,7 @@ static int preprocessor_set_variant_result(zbx_preprocessing_request_t *request,
}
else
{
- log = zbx_malloc(NULL, sizeof(zbx_log_t));
+ log = (zbx_log_t *)zbx_malloc(NULL, sizeof(zbx_log_t));
memset(log, 0, sizeof(zbx_log_t));
SET_LOG_RESULT(request->value.result, log);
}
@@ -814,7 +814,7 @@ static int preprocessor_set_variant_result(zbx_preprocessing_request_t *request,
zbx_free(request->value.error);
request->value.error = zbx_dsprintf(NULL, "Value \"%s\" of type \"%s\" is not suitable for"
" value type \"%s\"", zbx_variant_value_desc(value), zbx_variant_type_desc(value),
- zbx_item_value_type_string(request->value_type));
+ zbx_item_value_type_string((zbx_item_value_type_t)request->value_type));
request->value.state = ITEM_STATE_NOTSUPPORTED;
ret = FAIL;
@@ -858,7 +858,7 @@ static void preprocessor_add_result(zbx_preprocessing_manager_t *manager, zbx_ip
history_value->itemid = request->value.itemid;
history_value->value_type = request->value_type;
- if (NULL != (cached_value = zbx_hashset_search(&manager->history_cache, history_value)))
+ if (NULL != (cached_value = (zbx_item_history_value_t *)zbx_hashset_search(&manager->history_cache, history_value)))
{
if (0 < zbx_timespec_compare(&history_value->timestamp, &cached_value->timestamp))
{
@@ -878,7 +878,7 @@ static void preprocessor_add_result(zbx_preprocessing_manager_t *manager, zbx_ip
if (NULL != request->pending)
request->pending->state = REQUEST_STATE_QUEUED;
- if (NULL != (index = zbx_hashset_search(&manager->delta_items, &request->value.itemid)) &&
+ if (NULL != (index = (zbx_delta_item_index_t *)zbx_hashset_search(&manager->delta_items, &request->value.itemid)) &&
worker->queue_item == index->queue_item)
{
/* item is removed from delta index if it was present in delta item index*/
@@ -917,7 +917,7 @@ static void preprocessor_init_manager(zbx_preprocessing_manager_t *manager)
memset(manager, 0, sizeof(zbx_preprocessing_manager_t));
- manager->workers = zbx_calloc(NULL, CONFIG_PREPROCESSOR_FORKS, sizeof(zbx_preprocessing_worker_t));
+ manager->workers = (zbx_preprocessing_worker_t *)zbx_calloc(NULL, CONFIG_PREPROCESSOR_FORKS, sizeof(zbx_preprocessing_worker_t));
zbx_list_create(&manager->queue);
zbx_hashset_create_ext(&manager->item_config, 0, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC,
(zbx_clean_func_t)preproc_item_clear,
diff --git a/src/zabbix_server/preprocessor/preprocessing.c b/src/zabbix_server/preprocessor/preprocessing.c
index faca57d43f1..ac794ab084c 100644
--- a/src/zabbix_server/preprocessor/preprocessing.c
+++ b/src/zabbix_server/preprocessor/preprocessing.c
@@ -71,7 +71,7 @@ static zbx_uint32_t message_pack_data(zbx_ipc_message_t *message, zbx_packed_fie
/* recursive call to calculate required buffer size */
data_size = message_pack_data(NULL, fields, count);
message->size += data_size;
- message->data = zbx_realloc(message->data, message->size);
+ message->data = (unsigned char *)zbx_realloc(message->data, message->size);
offset = message->data + (message->size - data_size);
}
@@ -98,7 +98,7 @@ static zbx_uint32_t message_pack_data(zbx_ipc_message_t *message, zbx_packed_fie
/* size calculation */
if (PACKED_FIELD_STRING == fields[i].type)
{
- field_size = (NULL != fields[i].value) ? strlen(fields[i].value) + 1 : 0;
+ field_size = (NULL != fields[i].value) ? strlen((const char *)fields[i].value) + 1 : 0;
fields[i].size = field_size;
field_size += sizeof(zbx_uint32_t);
}
@@ -512,7 +512,7 @@ void zbx_preprocessor_unpack_task(zbx_uint64_t *itemid, unsigned char *value_typ
offset += zbx_deserialize_int(offset, steps_num);
if (0 < *steps_num)
{
- *steps = zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * (*steps_num));
+ *steps = (zbx_preproc_op_t *)zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * (*steps_num));
for (i = 0; i < *steps_num; i++)
{
offset += zbx_deserialize_char(offset, &(*steps)[i].type);
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c
index b8a99f2749e..496ff9faea3 100644
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -1030,7 +1030,7 @@ int MAIN_ZABBIX_ENTRY(int flags)
+ CONFIG_SNMPTRAPPER_FORKS + CONFIG_PROXYPOLLER_FORKS + CONFIG_SELFMON_FORKS
+ CONFIG_VMWARE_FORKS + CONFIG_TASKMANAGER_FORKS + CONFIG_IPMIMANAGER_FORKS
+ CONFIG_ALERTMANAGER_FORKS + CONFIG_PREPROCMAN_FORKS + CONFIG_PREPROCESSOR_FORKS;
- threads = zbx_calloc(threads, threads_num, sizeof(pid_t));
+ threads = (pid_t *)zbx_calloc(threads, threads_num, sizeof(pid_t));
if (0 != CONFIG_TRAPPER_FORKS)
{
diff --git a/src/zabbix_server/snmptrapper/snmptrapper.c b/src/zabbix_server/snmptrapper/snmptrapper.c
index c069aba92e8..a58a5125fbc 100644
--- a/src/zabbix_server/snmptrapper/snmptrapper.c
+++ b/src/zabbix_server/snmptrapper/snmptrapper.c
@@ -96,11 +96,11 @@ static int process_trap_for_interface(zbx_uint64_t interfaceid, char *trap, zbx_
num = DCconfig_get_snmp_items_by_interfaceid(interfaceid, &items);
- itemids = zbx_malloc(itemids, sizeof(zbx_uint64_t) * num);
- states = zbx_malloc(states, sizeof(unsigned char) * num);
- lastclocks = zbx_malloc(lastclocks, sizeof(int) * num);
- errcodes = zbx_malloc(errcodes, sizeof(int) * num);
- results = zbx_malloc(results, sizeof(AGENT_RESULT) * num);
+ itemids = (zbx_uint64_t *)zbx_malloc(itemids, sizeof(zbx_uint64_t) * num);
+ states = (unsigned char *)zbx_malloc(states, sizeof(unsigned char) * num);
+ lastclocks = (int *)zbx_malloc(lastclocks, sizeof(int) * num);
+ errcodes = (int *)zbx_malloc(errcodes, sizeof(int) * num);
+ results = (AGENT_RESULT *)zbx_malloc(results, sizeof(AGENT_RESULT) * num);
for (i = 0; i < num; i++)
{
@@ -627,7 +627,7 @@ ZBX_THREAD_ENTRY(snmptrapper_thread, args)
DBget_lastsize();
- buffer = zbx_malloc(buffer, MAX_BUFFER_LEN);
+ buffer = (char *)zbx_malloc(buffer, MAX_BUFFER_LEN);
*buffer = '\0';
for (;;)
diff --git a/src/zabbix_server/timer/timer.c b/src/zabbix_server/timer/timer.c
index 76abb1ddf01..5cf7b817290 100644
--- a/src/zabbix_server/timer/timer.c
+++ b/src/zabbix_server/timer/timer.c
@@ -181,7 +181,7 @@ static zbx_host_maintenance_t *get_host_maintenance(zbx_host_maintenance_t **hm,
if (*hm_alloc == *hm_count)
{
*hm_alloc += 4;
- *hm = zbx_realloc(*hm, *hm_alloc * sizeof(zbx_host_maintenance_t));
+ *hm = (zbx_host_maintenance_t *)zbx_realloc(*hm, *hm_alloc * sizeof(zbx_host_maintenance_t));
}
memmove(&(*hm)[hm_index + 1], &(*hm)[hm_index], sizeof(zbx_host_maintenance_t) * (*hm_count - hm_index));
@@ -326,7 +326,7 @@ static int update_maintenance_hosts(zbx_host_maintenance_t *hm, int hm_count)
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
- sql = zbx_malloc(sql, sql_alloc);
+ sql = (char *)zbx_malloc(sql, sql_alloc);
DBbegin();
@@ -453,7 +453,7 @@ static int process_maintenance(void)
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
if (NULL == hm)
- hm = zbx_malloc(hm, sizeof(zbx_host_maintenance_t) * hm_alloc);
+ hm = (zbx_host_maintenance_t *)zbx_malloc(hm, sizeof(zbx_host_maintenance_t) * hm_alloc);
now = time(NULL);
tm = localtime(&now);
diff --git a/src/zabbix_server/trapper/active.c b/src/zabbix_server/trapper/active.c
index fb42b8e0a63..515446b4be0 100644
--- a/src/zabbix_server/trapper/active.c
+++ b/src/zabbix_server/trapper/active.c
@@ -260,7 +260,7 @@ int send_list_of_active_checks(zbx_socket_t *sock, char *request)
get_list_of_active_checks(hostid, &itemids);
- buffer = zbx_malloc(buffer, buffer_alloc);
+ buffer = (char *)zbx_malloc(buffer, buffer_alloc);
if (0 != itemids.values_num)
{
@@ -268,8 +268,8 @@ int send_list_of_active_checks(zbx_socket_t *sock, char *request)
int *errcodes, now;
zbx_config_t cfg;
- dc_items = zbx_malloc(NULL, sizeof(DC_ITEM) * itemids.values_num);
- errcodes = zbx_malloc(NULL, sizeof(int) * itemids.values_num);
+ dc_items = (DC_ITEM *)zbx_malloc(NULL, sizeof(DC_ITEM) * itemids.values_num);
+ errcodes = (int *)zbx_malloc(NULL, sizeof(int) * itemids.values_num);
DCconfig_get_items_by_itemids(dc_items, itemids.values, errcodes, itemids.values_num);
zbx_config_get(&cfg, ZBX_CONFIG_FLAGS_REFRESH_UNSUPPORTED);
@@ -449,7 +449,7 @@ int send_list_of_active_checks_json(zbx_socket_t *sock, struct zbx_json_parse *j
goto error;
}
- host_metadata = zbx_malloc(host_metadata, host_metadata_alloc);
+ host_metadata = (char *)zbx_malloc(host_metadata, host_metadata_alloc);
if (FAIL == zbx_json_value_by_name_dyn(jp, ZBX_PROTO_TAG_HOST_METADATA,
&host_metadata, &host_metadata_alloc))
@@ -493,8 +493,8 @@ int send_list_of_active_checks_json(zbx_socket_t *sock, struct zbx_json_parse *j
int *errcodes, now, delay;
zbx_config_t cfg;
- dc_items = zbx_malloc(NULL, sizeof(DC_ITEM) * itemids.values_num);
- errcodes = zbx_malloc(NULL, sizeof(int) * itemids.values_num);
+ dc_items = (DC_ITEM *)zbx_malloc(NULL, sizeof(DC_ITEM) * itemids.values_num);
+ errcodes = (int *)zbx_malloc(NULL, sizeof(int) * itemids.values_num);
DCconfig_get_items_by_itemids(dc_items, itemids.values, errcodes, itemids.values_num);
zbx_config_get(&cfg, ZBX_CONFIG_FLAGS_REFRESH_UNSUPPORTED);
@@ -572,7 +572,7 @@ int send_list_of_active_checks_json(zbx_socket_t *sock, struct zbx_json_parse *j
for (i = 0; i < regexps.values_num; i++)
{
- zbx_expression_t *regexp = regexps.values[i];
+ zbx_expression_t *regexp = (zbx_expression_t *)regexps.values[i];
zbx_json_addobject(&json, NULL);
zbx_json_addstring(&json, "name", regexp->name, ZBX_JSON_TYPE_STRING);
diff --git a/src/zabbix_server/trapper/trapper.c b/src/zabbix_server/trapper/trapper.c
index 68f1115c08e..27ca1b6148b 100644
--- a/src/zabbix_server/trapper/trapper.c
+++ b/src/zabbix_server/trapper/trapper.c
@@ -323,7 +323,7 @@ static void queue_stats_export(zbx_hashset_t *queue_stats, const char *id_name,
zbx_hashset_iter_reset(queue_stats, &iter);
- while (NULL != (stats = zbx_hashset_iter_next(&iter)))
+ while (NULL != (stats = (zbx_queue_stats_t *)zbx_hashset_iter_next(&iter)))
{
zbx_json_addobject(json, NULL);
zbx_json_adduint64(json, id_name, stats->id);
@@ -340,7 +340,7 @@ static void queue_stats_export(zbx_hashset_t *queue_stats, const char *id_name,
}
/* queue item comparison function used to sort queue by nextcheck */
-static int queue_compare_by_nextcheck_asc(void **d1, void **d2)
+static int queue_compare_by_nextcheck_asc(zbx_queue_item_t **d1, zbx_queue_item_t **d2)
{
zbx_queue_item_t *i1 = *d1, *i2 = *d2;
@@ -424,14 +424,14 @@ static int recv_getqueue(zbx_socket_t *sock, struct zbx_json_parse *jp)
/* gather queue stats by item type */
for (i = 0; i < queue.values_num; i++)
{
- zbx_queue_item_t *item = queue.values[i];
+ zbx_queue_item_t *item = (zbx_queue_item_t *)queue.values[i];
zbx_uint64_t id = item->type;
- if (NULL == (stats = zbx_hashset_search(&queue_stats, &id)))
+ if (NULL == (stats = (zbx_queue_stats_t *)zbx_hashset_search(&queue_stats, &id)))
{
zbx_queue_stats_t data = {.id = id};
- stats = zbx_hashset_insert(&queue_stats, &data, sizeof(data));
+ stats = (zbx_queue_stats_t *)zbx_hashset_insert(&queue_stats, &data, sizeof(data));
}
queue_stats_update(stats, now - item->nextcheck);
}
@@ -449,14 +449,14 @@ static int recv_getqueue(zbx_socket_t *sock, struct zbx_json_parse *jp)
/* gather queue stats by proxy hostid */
for (i = 0; i < queue.values_num; i++)
{
- zbx_queue_item_t *item = queue.values[i];
+ zbx_queue_item_t *item = (zbx_queue_item_t *)queue.values[i];
zbx_uint64_t id = item->proxy_hostid;
- if (NULL == (stats = zbx_hashset_search(&queue_stats, &id)))
+ if (NULL == (stats = (zbx_queue_stats_t *)zbx_hashset_search(&queue_stats, &id)))
{
zbx_queue_stats_t data = {.id = id};
- stats = zbx_hashset_insert(&queue_stats, &data, sizeof(data));
+ stats = (zbx_queue_stats_t *)zbx_hashset_insert(&queue_stats, &data, sizeof(data));
}
queue_stats_update(stats, now - item->nextcheck);
}
@@ -475,7 +475,7 @@ static int recv_getqueue(zbx_socket_t *sock, struct zbx_json_parse *jp)
for (i = 0; i < queue.values_num && i < limit; i++)
{
- zbx_queue_item_t *item = queue.values[i];
+ zbx_queue_item_t *item = (zbx_queue_item_t *)queue.values[i];
zbx_json_addobject(&json, NULL);
zbx_json_adduint64(&json, "itemid", item->itemid);
@@ -801,7 +801,7 @@ static void status_stats_export(struct zbx_json *json, zbx_user_type_t access_le
{
const zbx_proxy_counter_t *proxy_counter;
- proxy_counter = entry->info->counters.values[i];
+ proxy_counter = (zbx_proxy_counter_t *)entry->info->counters.values[i];
status_entry_export(json, entry, proxy_counter->counter_value,
&proxy_counter->proxyid);
}
diff --git a/src/zabbix_server/vmware/vmware.c b/src/zabbix_server/vmware/vmware.c
index d500ea2f93e..44a138fff98 100644
--- a/src/zabbix_server/vmware/vmware.c
+++ b/src/zabbix_server/vmware/vmware.c
@@ -159,7 +159,7 @@ typedef struct
}
zbx_vmware_perf_data_t;
-static char *hv_propmap[] = {
+static char const *hv_propmap[] = {
ZBX_XPATH_HV_QUICKSTATS("overallCpuUsage"), /* ZBX_VMWARE_HVPROP_OVERALL_CPU_USAGE */
ZBX_XPATH_HV_CONFIG_PRODUCT("fullName"), /* ZBX_VMWARE_HVPROP_FULL_NAME */
ZBX_XPATH_HV_HARDWARE("numCpuCores"), /* ZBX_VMWARE_HVPROP_HW_NUM_CPU_CORES */
@@ -178,7 +178,7 @@ static char *hv_propmap[] = {
ZBX_XPATH_HV_STATUS() /* ZBX_VMWARE_HVPROP_STATUS */
};
-static char *vm_propmap[] = {
+static char const *vm_propmap[] = {
ZBX_XPATH_VM_CONFIG("numCpu"), /* ZBX_VMWARE_VMPROP_CPU_NUM */
ZBX_XPATH_VM_QUICKSTATS("overallCpuUsage"), /* ZBX_VMWARE_VMPROP_CPU_USAGE */
ZBX_XPATH_VM_CONFIG("name"), /* ZBX_VMWARE_VMPROP_NAME */
@@ -295,7 +295,7 @@ static size_t curl_write_cb(void *ptr, size_t size, size_t nmemb, void *userdata
ZBX_UNUSED(userdata);
- zbx_strncpy_alloc(&page.data, &page.alloc, &page.offset, ptr, r_size);
+ zbx_strncpy_alloc(&page.data, &page.alloc, &page.offset, (char *)ptr, r_size);
return r_size;
}
@@ -469,7 +469,7 @@ static char *vmware_shared_strdup(const char *source)
if (NULL != source)
{
len = strlen(source) + 1;
- ptr = __vm_mem_malloc_func(NULL, len);
+ ptr = (char *)__vm_mem_malloc_func(NULL, len);
memcpy(ptr, source, len);
}
@@ -493,9 +493,9 @@ static void vmware_counters_shared_copy(zbx_hashset_t *dst, const zbx_vector_ptr
for (i = 0; i < src->values_num; i++)
{
- csrc = src->values[i];
+ csrc = (zbx_vmware_counter_t *)src->values[i];
- cdst = zbx_hashset_insert(dst, csrc, sizeof(zbx_vmware_counter_t));
+ cdst = (zbx_vmware_counter_t *)zbx_hashset_insert(dst, csrc, sizeof(zbx_vmware_counter_t));
cdst->path = vmware_shared_strdup(csrc->path);
}
}
@@ -560,7 +560,7 @@ static void vmware_entities_shared_clean_stats(zbx_hashset_t *entities)
zbx_hashset_iter_reset(entities, &iter);
- while (NULL != (entity = zbx_hashset_iter_next(&iter)))
+ while (NULL != (entity = (zbx_vmware_perf_entity_t *)zbx_hashset_iter_next(&iter)))
{
for (i = 0; i < entity->counters.values_num; i++)
{
@@ -772,7 +772,7 @@ static void vmware_data_shared_free(zbx_vmware_data_t *data)
zbx_vmware_hv_t *hv;
zbx_hashset_iter_reset(&data->hvs, &iter);
- while (NULL != (hv = zbx_hashset_iter_next(&iter)))
+ while (NULL != (hv = (zbx_vmware_hv_t *)zbx_hashset_iter_next(&iter)))
vmware_hv_shared_clean(hv);
zbx_hashset_destroy(&data->hvs);
@@ -853,13 +853,13 @@ static void vmware_service_shared_free(zbx_vmware_service_t *service)
vmware_data_shared_free(service->data);
zbx_hashset_iter_reset(&service->entities, &iter);
- while (NULL != (entity = zbx_hashset_iter_next(&iter)))
+ while (NULL != (entity = (zbx_vmware_perf_entity_t *)zbx_hashset_iter_next(&iter)))
vmware_shared_perf_entity_clean(entity);
zbx_hashset_destroy(&service->entities);
zbx_hashset_iter_reset(&service->counters, &iter);
- while (NULL != (counter = zbx_hashset_iter_next(&iter)))
+ while (NULL != (counter = (zbx_vmware_counter_t *)zbx_hashset_iter_next(&iter)))
vmware_counter_shared_clean(counter);
zbx_hashset_destroy(&service->counters);
@@ -884,7 +884,7 @@ static zbx_vmware_cluster_t *vmware_cluster_shared_dup(const zbx_vmware_cluster_
{
zbx_vmware_cluster_t *cluster;
- cluster = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_cluster_t));
+ cluster = (zbx_vmware_cluster_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_cluster_t));
cluster->id = vmware_shared_strdup(src->id);
cluster->name = vmware_shared_strdup(src->name);
cluster->status = vmware_shared_strdup(src->status);
@@ -907,7 +907,7 @@ static zbx_vmware_event_t *vmware_event_shared_dup(const zbx_vmware_event_t *src
{
zbx_vmware_event_t *event;
- event = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_event_t));
+ event = (zbx_vmware_event_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_event_t));
event->key = src->key;
event->message = vmware_shared_strdup(src->message);
event->timestamp = src->timestamp;
@@ -930,7 +930,7 @@ static zbx_vmware_datastore_t *vmware_datastore_shared_dup(const zbx_vmware_data
{
zbx_vmware_datastore_t *datastore;
- datastore = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_datastore_t));
+ datastore = (zbx_vmware_datastore_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_datastore_t));
datastore->uuid = vmware_shared_strdup(src->uuid);
datastore->name = vmware_shared_strdup(src->name);
@@ -956,7 +956,7 @@ static zbx_vmware_dev_t *vmware_dev_shared_dup(const zbx_vmware_dev_t *src)
{
zbx_vmware_dev_t *dev;
- dev = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_dev_t));
+ dev = (zbx_vmware_dev_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_dev_t));
dev->type = src->type;
dev->instance = vmware_shared_strdup(src->instance);
dev->label = vmware_shared_strdup(src->label);
@@ -980,7 +980,7 @@ static zbx_vmware_fs_t *vmware_fs_shared_dup(const zbx_vmware_fs_t *src)
{
zbx_vmware_fs_t *fs;
- fs = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_fs_t));
+ fs = (zbx_vmware_fs_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_fs_t));
fs->path = vmware_shared_strdup(src->path);
fs->capacity = src->capacity;
fs->free_space = src->free_space;
@@ -1005,7 +1005,7 @@ static char **vmware_props_shared_dup(char ** const src, int props_num)
char **props;
int i;
- props = __vm_mem_malloc_func(NULL, sizeof(char *) * props_num);
+ props = (char **)__vm_mem_malloc_func(NULL, sizeof(char *) * props_num);
for (i = 0; i < props_num; i++)
props[i] = vmware_shared_strdup(src[i]);
@@ -1029,7 +1029,7 @@ static zbx_vmware_vm_t *vmware_vm_shared_dup(const zbx_vmware_vm_t *src)
zbx_vmware_vm_t *vm;
int i;
- vm = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_vm_t));
+ vm = (zbx_vmware_vm_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_vm_t));
VMWARE_VECTOR_CREATE(&vm->devs, ptr);
VMWARE_VECTOR_CREATE(&vm->file_systems, ptr);
@@ -1039,10 +1039,10 @@ static zbx_vmware_vm_t *vmware_vm_shared_dup(const zbx_vmware_vm_t *src)
vm->props = vmware_props_shared_dup(src->props, ZBX_VMWARE_VMPROPS_NUM);
for (i = 0; i < src->devs.values_num; i++)
- zbx_vector_ptr_append(&vm->devs, vmware_dev_shared_dup(src->devs.values[i]));
+ zbx_vector_ptr_append(&vm->devs, vmware_dev_shared_dup((zbx_vmware_dev_t *)src->devs.values[i]));
for (i = 0; i < src->file_systems.values_num; i++)
- zbx_vector_ptr_append(&vm->file_systems, vmware_fs_shared_dup(src->file_systems.values[i]));
+ zbx_vector_ptr_append(&vm->file_systems, vmware_fs_shared_dup((zbx_vmware_fs_t *)src->file_systems.values[i]));
return vm;
}
@@ -1073,10 +1073,10 @@ static void vmware_hv_shared_copy(zbx_vmware_hv_t *dst, const zbx_vmware_hv_t *s
dst->datacenter_name = vmware_shared_strdup(src->datacenter_name);
for (i = 0; i < src->datastores.values_num; i++)
- zbx_vector_ptr_append(&dst->datastores, vmware_datastore_shared_dup(src->datastores.values[i]));
+ zbx_vector_ptr_append(&dst->datastores, vmware_datastore_shared_dup((zbx_vmware_datastore_t *)src->datastores.values[i]));
for (i = 0; i < src->vms.values_num; i++)
- zbx_vector_ptr_append(&dst->vms, vmware_vm_shared_dup(src->vms.values[i]));
+ zbx_vector_ptr_append(&dst->vms, vmware_vm_shared_dup((zbx_vmware_vm_t *)src->vms.values[i]));
}
/******************************************************************************
@@ -1097,7 +1097,7 @@ static zbx_vmware_data_t *vmware_data_shared_dup(zbx_vmware_data_t *src)
zbx_hashset_iter_t iter;
zbx_vmware_hv_t *hv, hv_local;
- data = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_data_t));
+ data = (zbx_vmware_data_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_data_t));
zbx_hashset_create_ext(&data->hvs, 1, vmware_hv_hash, vmware_hv_compare, NULL, __vm_mem_malloc_func,
__vm_mem_realloc_func, __vm_mem_free_func);
@@ -1110,17 +1110,17 @@ static zbx_vmware_data_t *vmware_data_shared_dup(zbx_vmware_data_t *src)
data->error = vmware_shared_strdup(src->error);
for (i = 0; i < src->clusters.values_num; i++)
- zbx_vector_ptr_append(&data->clusters, vmware_cluster_shared_dup(src->clusters.values[i]));
+ zbx_vector_ptr_append(&data->clusters, vmware_cluster_shared_dup((zbx_vmware_cluster_t *)src->clusters.values[i]));
for (i = 0; i < src->events.values_num; i++)
- zbx_vector_ptr_append(&data->events, vmware_event_shared_dup(src->events.values[i]));
+ zbx_vector_ptr_append(&data->events, vmware_event_shared_dup((zbx_vmware_event_t *)src->events.values[i]));
zbx_hashset_iter_reset(&src->hvs, &iter);
- while (NULL != (hv = zbx_hashset_iter_next(&iter)))
+ while (NULL != (hv = (zbx_vmware_hv_t *)zbx_hashset_iter_next(&iter)))
{
vmware_hv_shared_copy(&hv_local, hv);
- hv = zbx_hashset_insert(&data->hvs, &hv_local, sizeof(hv_local));
+ hv = (zbx_vmware_hv_t *)zbx_hashset_insert(&data->hvs, &hv_local, sizeof(hv_local));
for (i = 0; i < hv->vms.values_num; i++)
{
@@ -1297,7 +1297,7 @@ static void vmware_data_free(zbx_vmware_data_t *data)
zbx_vmware_hv_t *hv;
zbx_hashset_iter_reset(&data->hvs, &iter);
- while (NULL != (hv = zbx_hashset_iter_next(&iter)))
+ while (NULL != (hv = (zbx_vmware_hv_t *)zbx_hashset_iter_next(&iter)))
vmware_hv_clean(hv);
zbx_hashset_destroy(&data->hvs);
@@ -1376,7 +1376,9 @@ static int vmware_service_authenticate(zbx_vmware_service_t *service, CURL *easy
const char *__function_name = "vmware_service_authenticate";
char xml[MAX_STRING_LEN], *error_object = NULL, *username_esc = NULL, *password_esc = NULL;
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() '%s'@'%s'", __function_name, service->username, service->url);
@@ -1505,9 +1507,10 @@ static zbx_property_collection_iter *zbx_property_collection_init(CURL *easyhand
"/*[local-name()='returnval']/*[local-name()='token']"
zbx_property_collection_iter *iter = NULL;
- int err, opt;
+ CURLoption opt;
+ CURLcode err;
- iter = zbx_malloc(iter, sizeof(zbx_property_collection_iter));
+ iter = (zbx_property_collection_iter *)zbx_malloc(iter, sizeof(zbx_property_collection_iter));
iter->property_collector = property_collector;
iter->easyhandle = easyhandle;
iter->token = NULL;
@@ -1563,7 +1566,8 @@ static int zbx_property_collection_next(zbx_property_collection_iter *iter)
const char *__function_name = "zbx_property_collection_next";
char *token_esc, post[MAX_STRING_LEN];
- int err, opt;
+ CURLoption opt;
+ CURLcode err;
if (NULL == iter->token)
return FAIL;
@@ -1628,7 +1632,9 @@ static int vmware_service_get_contents(CURL *easyhandle, char **contents, char *
const char *__function_name = "vmware_service_get_contents";
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_POSTFIELDS, ZBX_POST_VMWARE_CONTENTS)))
{
@@ -1691,7 +1697,9 @@ static int vmware_service_get_perf_counter_refreshrate(const zbx_vmware_service_
const char *__function_name = "vmware_service_get_perfcounter_refreshrate";
char tmp[MAX_STRING_LEN], *value = NULL, *id_esc;
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -1779,7 +1787,9 @@ static int vmware_service_get_perf_counters(zbx_vmware_service_t *service, CURL
xmlXPathContext *xpathCtx;
xmlXPathObject *xpathObj;
xmlNodeSetPtr nodeset;
- int opts, err, i, ret = FAIL;
+ CURLoption opts;
+ CURLcode err;
+ int i, ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -1841,7 +1851,7 @@ static int vmware_service_get_perf_counters(zbx_vmware_service_t *service, CURL
if (NULL != group && NULL != key && NULL != rollup && NULL != counterid)
{
- counter = zbx_malloc(NULL, sizeof(zbx_vmware_counter_t));
+ counter = (zbx_vmware_counter_t *)zbx_malloc(NULL, sizeof(zbx_vmware_counter_t));
counter->path = zbx_dsprintf(NULL, "%s/%s[%s]", group, key, rollup);
ZBX_STR2UINT64(counter->id, counterid);
@@ -1925,7 +1935,7 @@ static void vmware_vm_get_nic_devices(zbx_vmware_vm_t *vm, const char *details)
if (NULL == (key = zbx_xml_read_node_value(doc, nodeset->nodeTab[i], "*[local-name()='key']")))
continue;
- dev = zbx_malloc(NULL, sizeof(zbx_vmware_dev_t));
+ dev = (zbx_vmware_dev_t *)zbx_malloc(NULL, sizeof(zbx_vmware_dev_t));
dev->type = ZBX_VMWARE_DEV_TYPE_NIC;
dev->instance = key;
dev->label = zbx_xml_read_node_value(doc, nodeset->nodeTab[i],
@@ -2026,7 +2036,7 @@ static void vmware_vm_get_disk_devices(zbx_vmware_vm_t *vm, const char *details)
scsiCtlrUnitNumber = zbx_xml_read_node_value(doc, xpathObjController->nodesetval->nodeTab[0],
"*[local-name()='scsiCtlrUnitNumber']");
- dev = zbx_malloc(NULL, sizeof(zbx_vmware_dev_t));
+ dev = (zbx_vmware_dev_t *)zbx_malloc(NULL, sizeof(zbx_vmware_dev_t));
dev->type = ZBX_VMWARE_DEV_TYPE_DISK;
/* the virtual disk instance has format <controller type><busNumber>:<unitNumber> */
@@ -2110,7 +2120,7 @@ static void vmware_vm_get_file_systems(zbx_vmware_vm_t *vm, const char *details)
if (NULL == (value = zbx_xml_read_node_value(doc, nodeset->nodeTab[i], "*[local-name()='diskPath']")))
continue;
- fs = zbx_malloc(NULL, sizeof(zbx_vmware_fs_t));
+ fs = (zbx_vmware_fs_t *)zbx_malloc(NULL, sizeof(zbx_vmware_fs_t));
memset(fs, 0, sizeof(zbx_vmware_fs_t));
fs->path = value;
@@ -2182,7 +2192,9 @@ static int vmware_service_get_vm_data(zbx_vmware_service_t *service, CURL *easyh
const char *__function_name = "vmware_service_get_vm_data";
char tmp[MAX_STRING_LEN], *vmid_esc;
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() vmid:'%s'", __function_name, vmid);
@@ -2248,7 +2260,7 @@ static zbx_vmware_vm_t *vmware_service_create_vm(zbx_vmware_service_t *service,
zabbix_log(LOG_LEVEL_DEBUG, "In %s() vmid:'%s'", __function_name, id);
- vm = zbx_malloc(NULL, sizeof(zbx_vmware_vm_t));
+ vm = (zbx_vmware_vm_t *)zbx_malloc(NULL, sizeof(zbx_vmware_vm_t));
memset(vm, 0, sizeof(zbx_vmware_vm_t));
zbx_vector_ptr_create(&vm->devs);
@@ -2263,7 +2275,7 @@ static zbx_vmware_vm_t *vmware_service_create_vm(zbx_vmware_service_t *service,
vm->uuid = value;
vm->id = zbx_strdup(NULL, id);
- vm->props = xml_read_props(details, vm_propmap, ZBX_VMWARE_VMPROPS_NUM);
+ vm->props = xml_read_props(details, (char **)vm_propmap, ZBX_VMWARE_VMPROPS_NUM);
vmware_vm_get_nic_devices(vm, details);
vmware_vm_get_disk_devices(vm, details);
@@ -2382,7 +2394,7 @@ static zbx_vmware_datastore_t *vmware_service_create_datastore(const zbx_vmware_
zbx_free(value);
}
- datastore = zbx_malloc(NULL, sizeof(zbx_vmware_datastore_t));
+ datastore = (zbx_vmware_datastore_t *)zbx_malloc(NULL, sizeof(zbx_vmware_datastore_t));
datastore->name = (NULL != name) ? name : zbx_strdup(NULL, id);
datastore->uuid = uuid;
datastore->capacity = capacity;
@@ -2441,7 +2453,9 @@ static int vmware_service_get_hv_data(const zbx_vmware_service_t *service, CURL
const char *__function_name = "vmware_service_get_hv_data";
char tmp[MAX_STRING_LEN], *hvid_esc;
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() guesthvid:'%s'", __function_name, hvid);
@@ -2551,7 +2565,9 @@ static int vmware_hv_get_datacenter_name(const zbx_vmware_service_t *service, CU
const char *__function_name = "vmware_hv_get_datacenter_name";
char tmp[MAX_STRING_LEN];
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() id:'%s'", __function_name, hv->id);
@@ -2624,7 +2640,7 @@ static int vmware_service_init_hv(zbx_vmware_service_t *service, CURL *easyhandl
if (SUCCEED != vmware_service_get_hv_data(service, easyhandle, id, &details, error))
goto out;
- hv->props = xml_read_props(details, hv_propmap, ZBX_VMWARE_HVPROPS_NUM);
+ hv->props = xml_read_props(details, (char **)hv_propmap, ZBX_VMWARE_HVPROPS_NUM);
if (NULL == hv->props[ZBX_VMWARE_HVPROP_HW_UUID])
goto out;
@@ -2879,7 +2895,9 @@ static int vmware_service_get_event_session(const zbx_vmware_service_t *service,
const char *__function_name = "vmware_service_get_event_session";
char tmp[MAX_STRING_LEN];
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -2945,7 +2963,9 @@ static int vmware_service_reset_event_history_collector(CURL *easyhandle, const
const char *__function_name = "vmware_service_reset_event_history_collector";
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
char tmp[MAX_STRING_LEN], *event_session_esc;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -3009,7 +3029,9 @@ static int vmware_service_read_previous_events(CURL *easyhandle, const char *eve
const char *__function_name = "vmware_service_read_previous_events";
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
char tmp[MAX_STRING_LEN], *event_session_esc;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -3072,7 +3094,9 @@ static int vmware_service_destroy_event_session(CURL *easyhandle, const char *ev
const char *__function_name = "vmware_service_destroy_event_session";
- int err, opt, ret = FAIL;
+ CURLoption opt;
+ CURLcode err;
+ int ret = FAIL;
char tmp[MAX_STRING_LEN], *event_session_esc;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -3198,7 +3222,7 @@ int vmware_service_parse_event_data(zbx_vector_ptr_t *events, zbx_uint64_t last_
zbx_free(time_str);
}
- event = zbx_malloc(event, sizeof(zbx_vmware_event_t));
+ event = (zbx_vmware_event_t *)zbx_malloc(event, sizeof(zbx_vmware_event_t));
event->key = ids.values[i];
event->message = message;
event->timestamp = timestamp;
@@ -3404,7 +3428,9 @@ static int vmware_service_get_clusters(CURL *easyhandle, char **clusters, char *
const char *__function_name = "vmware_service_get_clusters";
- int err, o, ret = FAIL;
+ CURLoption o;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
@@ -3476,7 +3502,9 @@ static int vmware_service_get_cluster_status(CURL *easyhandle, const char *clust
const char *__function_name = "vmware_service_get_cluster_status";
char tmp[MAX_STRING_LEN], *clusterid_esc;
- int err, o, ret = FAIL;
+ CURLoption o;
+ CURLcode err;
+ int ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() clusterid:'%s'", __function_name, clusterid);
@@ -3564,7 +3592,7 @@ static int vmware_service_get_cluster_list(CURL *easyhandle, zbx_vector_ptr_t *c
goto out;
}
- cluster = zbx_malloc(NULL, sizeof(zbx_vmware_cluster_t));
+ cluster = (zbx_vmware_cluster_t *)zbx_malloc(NULL, sizeof(zbx_vmware_cluster_t));
cluster->id = zbx_strdup(NULL, ids.values[i]);
cluster->name = name;
cluster->status = status;
@@ -3600,7 +3628,7 @@ static void vmware_counters_add_new(zbx_vector_ptr_t *counters, zbx_uint64_t cou
{
zbx_vmware_perf_counter_t *counter;
- counter = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_perf_counter_t));
+ counter = (zbx_vmware_perf_counter_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_perf_counter_t));
counter->counterid = counterid;
counter->state = ZBX_VMWARE_COUNTER_NEW;
@@ -3693,7 +3721,7 @@ static void vmware_service_add_perf_entity(zbx_vmware_service_t *service, const
entity.type = vmware_shared_strdup(type);
entity.id = vmware_shared_strdup(id);
- pentity = zbx_hashset_insert(&service->entities, &entity, sizeof(zbx_vmware_perf_entity_t));
+ pentity = (zbx_vmware_perf_entity_t *)zbx_hashset_insert(&service->entities, &entity, sizeof(zbx_vmware_perf_entity_t));
zbx_vector_ptr_create_ext(&pentity->counters, __vm_mem_malloc_func, __vm_mem_realloc_func,
__vm_mem_free_func);
@@ -3756,20 +3784,20 @@ static void vmware_service_update_perf_entities(zbx_vmware_service_t *service)
/* update current performance entities */
zbx_hashset_iter_reset(&service->data->hvs, &iter);
- while (NULL != (hv = zbx_hashset_iter_next(&iter)))
+ while (NULL != (hv = (zbx_vmware_hv_t *)zbx_hashset_iter_next(&iter)))
{
vmware_service_add_perf_entity(service, "HostSystem", hv->id, hv_perfcounters, now);
for (i = 0; i < hv->vms.values_num; i++)
{
- vm = hv->vms.values[i];
+ vm = (zbx_vmware_vm_t *)hv->vms.values[i];
vmware_service_add_perf_entity(service, "VirtualMachine", vm->id, vm_perfcounters, now);
}
}
/* remove old entities */
zbx_hashset_iter_reset(&service->entities, &iter);
- while (NULL != (entity = zbx_hashset_iter_next(&iter)))
+ while (NULL != (entity = (zbx_vmware_perf_entity_t *)zbx_hashset_iter_next(&iter)))
{
if (0 != entity->last_seen && entity->last_seen < now)
{
@@ -3795,14 +3823,16 @@ static void vmware_service_update(zbx_vmware_service_t *service)
const char *__function_name = "vmware_service_update";
CURL *easyhandle = NULL;
+ CURLoption opt;
+ CURLcode err;
struct curl_slist *headers = NULL;
zbx_vmware_data_t *data;
zbx_vector_str_t hvs;
- int opt, err, i, ret = FAIL;
+ int i, ret = FAIL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() '%s'@'%s'", __function_name, service->username, service->url);
- data = zbx_malloc(NULL, sizeof(zbx_vmware_data_t));
+ data = (zbx_vmware_data_t *)zbx_malloc(NULL, sizeof(zbx_vmware_data_t));
memset(data, 0, sizeof(zbx_vmware_data_t));
zbx_hashset_create(&data->hvs, 1, vmware_hv_hash, vmware_hv_compare);
@@ -3938,7 +3968,7 @@ static int vmware_service_process_perf_entity_data(zbx_vector_ptr_t *pervalues,
if (NULL != value && NULL != counter)
{
- perfvalue = zbx_malloc(NULL, sizeof(zbx_vmware_perf_value_t));
+ perfvalue = (zbx_vmware_perf_value_t *)zbx_malloc(NULL, sizeof(zbx_vmware_perf_value_t));
ZBX_STR2UINT64(perfvalue->counterid, counter);
perfvalue->instance = (NULL != instance ? instance : zbx_strdup(NULL, ""));
@@ -4009,7 +4039,7 @@ static void vmware_service_parse_perf_data(zbx_vector_ptr_t *perfdata, const cha
zbx_vmware_perf_data_t *data;
int ret = FAIL;
- data = zbx_malloc(NULL, sizeof(zbx_vmware_perf_data_t));
+ data = (zbx_vmware_perf_data_t *)zbx_malloc(NULL, sizeof(zbx_vmware_perf_data_t));
data->id = zbx_xml_read_node_value(doc, nodeset->nodeTab[i], "*[local-name()='entity']");
data->type = zbx_xml_read_node_value(doc, nodeset->nodeTab[i], "*[local-name()='entity']/@type");
@@ -4099,8 +4129,10 @@ static void vmware_service_update_perf(zbx_vmware_service_t *service)
const char *__function_name = "vmware_service_update_perf";
CURL *easyhandle = NULL;
+ CURLoption opt;
+ CURLcode err;
struct curl_slist *headers = NULL;
- int err, opt, i, j, ret = FAIL;
+ int i, j, ret = FAIL;
char *error = NULL, *tmp = NULL;
size_t tmp_alloc = 0, tmp_offset = 0;
zbx_vector_ptr_t entities;
@@ -4137,12 +4169,12 @@ static void vmware_service_update_perf(zbx_vmware_service_t *service)
zbx_vmware_lock();
zbx_hashset_iter_reset(&service->entities, &iter);
- while (NULL != (entity = zbx_hashset_iter_next(&iter)))
+ while (NULL != (entity = (zbx_vmware_perf_entity_t *)zbx_hashset_iter_next(&iter)))
{
if (0 != entity->refresh)
continue;
- local_entity = zbx_malloc(NULL, sizeof(zbx_vmware_perf_entity_t));
+ local_entity = (zbx_vmware_perf_entity_t *)zbx_malloc(NULL, sizeof(zbx_vmware_perf_entity_t));
local_entity->type = zbx_strdup(NULL, entity->type);
local_entity->id = zbx_strdup(NULL, entity->id);
local_entity->refresh = 0;
@@ -4155,7 +4187,7 @@ static void vmware_service_update_perf(zbx_vmware_service_t *service)
/* get refresh rates */
for (i = 0; i < entities.values_num; i++)
{
- local_entity = entities.values[i];
+ local_entity = (zbx_vmware_perf_entity_t *)entities.values[i];
if (SUCCEED != vmware_service_get_perf_counter_refreshrate(service, easyhandle, local_entity->type,
local_entity->id, &local_entity->refresh, &error))
@@ -4177,13 +4209,13 @@ static void vmware_service_update_perf(zbx_vmware_service_t *service)
/* update entity refresh rate */
for (i = 0; i < entities.values_num; i++)
{
- if (NULL != (entity = zbx_hashset_search(&service->entities, entities.values[i])))
+ if (NULL != (entity = (zbx_vmware_perf_entity_t *)zbx_hashset_search(&service->entities, entities.values[i])))
entity->refresh = ((zbx_vmware_perf_entity_t *)entities.values[i])->refresh;
}
/* create performance collector request */
zbx_hashset_iter_reset(&service->entities, &iter);
- while (NULL != (entity = zbx_hashset_iter_next(&iter)))
+ while (NULL != (entity = (zbx_vmware_perf_entity_t *)zbx_hashset_iter_next(&iter)))
{
char *id_esc;
@@ -4354,7 +4386,7 @@ zbx_vmware_service_t *zbx_vmware_get_service(const char* url, const char* userna
for (i = 0; i < vmware->services.values_num; i++)
{
- service = vmware->services.values[i];
+ service = (zbx_vmware_service_t *)vmware->services.values[i];
if (0 == strcmp(service->url, url) && 0 == strcmp(service->username, username) &&
0 == strcmp(service->password, password))
@@ -4369,7 +4401,7 @@ zbx_vmware_service_t *zbx_vmware_get_service(const char* url, const char* userna
}
}
- service = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_service_t));
+ service = (zbx_vmware_service_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_service_t));
memset(service, 0, sizeof(zbx_vmware_service_t));
service->url = vmware_shared_strdup(url);
@@ -4423,7 +4455,7 @@ int zbx_vmware_service_get_counterid(zbx_vmware_service_t *service, const char *
zabbix_log(LOG_LEVEL_DEBUG, "In %s() path:%s", __function_name, path);
- if (NULL == (counter = zbx_hashset_search(&service->counters, &path)))
+ if (NULL == (counter = (zbx_vmware_counter_t *)zbx_hashset_search(&service->counters, &path)))
goto out;
*counterid = counter->id;
@@ -4475,7 +4507,7 @@ int zbx_vmware_service_add_perf_counter(zbx_vmware_service_t *service, const cha
zbx_vector_ptr_create_ext(&entity.counters, __vm_mem_malloc_func, __vm_mem_realloc_func,
__vm_mem_free_func);
- pentity = zbx_hashset_insert(&service->entities, &entity, sizeof(zbx_vmware_perf_entity_t));
+ pentity = (zbx_vmware_perf_entity_t *)zbx_hashset_insert(&service->entities, &entity, sizeof(zbx_vmware_perf_entity_t));
}
if (FAIL == zbx_vector_ptr_search(&pentity->counters, &counterid, ZBX_DEFAULT_UINT64_PTR_COMPARE_FUNC))
@@ -4513,7 +4545,7 @@ zbx_vmware_perf_entity_t *zbx_vmware_service_get_perf_entity(zbx_vmware_service_
zabbix_log(LOG_LEVEL_DEBUG, "In %s() type:%s id:%s", __function_name, type, id);
- pentity = zbx_hashset_search(&service->entities, &entity);
+ pentity = (zbx_vmware_perf_entity_t *)zbx_hashset_search(&service->entities, &entity);
zabbix_log(LOG_LEVEL_DEBUG, "End of %s() entity:%p", __function_name, pentity);
@@ -4552,7 +4584,7 @@ int zbx_vmware_init(char **error)
goto out;
}
- vmware = __vm_mem_malloc_func(NULL, sizeof(zbx_vmware_t));
+ vmware = (zbx_vmware_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_t));
memset(vmware, 0, sizeof(zbx_vmware_t));
VMWARE_VECTOR_CREATE(&vmware->services, ptr);
@@ -4641,7 +4673,7 @@ ZBX_THREAD_ENTRY(vmware_thread, args)
/* find a task to be performed on a vmware service */
for (i = 0; i < vmware->services.values_num; i++)
{
- service = vmware->services.values[i];
+ service = (zbx_vmware_service_t *)vmware->services.values[i];
/* check if the service isn't used and should be removed */
if (0 == (service->state & ZBX_VMWARE_STATE_BUSY) &&