diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2021-07-27 17:44:01 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2021-07-27 17:44:17 +0300 |
commit | d3bc3e5135dbff256ff25b3f4ffb11adb6604c06 (patch) | |
tree | 0c14d4aebb70f31640ad65abbf0597dc52c7f766 /tests | |
parent | 45831b7e86d4a7c3c8a80d5833ba862f1886a8c3 (diff) |
........S. [ZBX-19524] fixed const casting
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libs/zbxcommon/zbx_ltrim_utf8.c | 9 | ||||
-rw-r--r-- | tests/libs/zbxcommon/zbx_rtrim_utf8.c | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/libs/zbxcommon/zbx_ltrim_utf8.c b/tests/libs/zbxcommon/zbx_ltrim_utf8.c index 6d3e08aa71a..877428c484e 100644 --- a/tests/libs/zbxcommon/zbx_ltrim_utf8.c +++ b/tests/libs/zbxcommon/zbx_ltrim_utf8.c @@ -47,16 +47,19 @@ static const char *read_utf8(const char *path_str, const char *path_hex) void zbx_mock_test_entry(void **state) { - const char *expected, *in, *charlist; + const char *expected, *charlist; + char *in; ZBX_UNUSED(state); - in = read_utf8("in.text.str", "in.text.hex"); + in = zbx_strdup(NULL, read_utf8("in.text.str", "in.text.hex")); charlist = read_utf8("in.charlist.str", "in.charlist.hex"); - zbx_ltrim_utf8((char *)in, charlist); + zbx_ltrim_utf8(in, charlist); expected = read_utf8("out.str", "out.hex"); zbx_mock_assert_str_eq("trimmed value", expected, in); + zbx_free(in); + } diff --git a/tests/libs/zbxcommon/zbx_rtrim_utf8.c b/tests/libs/zbxcommon/zbx_rtrim_utf8.c index dccc72d1ad5..fec0950f80c 100644 --- a/tests/libs/zbxcommon/zbx_rtrim_utf8.c +++ b/tests/libs/zbxcommon/zbx_rtrim_utf8.c @@ -47,16 +47,18 @@ static const char *read_utf8(const char *path_str, const char *path_hex) void zbx_mock_test_entry(void **state) { - const char *expected, *in, *charlist; + const char *expected, *charlist; + char *in; ZBX_UNUSED(state); - in = read_utf8("in.text.str", "in.text.hex"); + in = zbx_strdup(NULL, read_utf8("in.text.str", "in.text.hex")); charlist = read_utf8("in.charlist.str", "in.charlist.hex"); - zbx_rtrim_utf8((char *)in, charlist); + zbx_rtrim_utf8(in, charlist); expected = read_utf8("out.str", "out.hex"); zbx_mock_assert_str_eq("trimmed value", expected, in); + zbx_free(in); } |