1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib:ldb: Correctly cast pointers for assert_string_equal()

This is a change in cmocka to avoid hiding possible errors.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Mar 15 07:53:54 UTC 2023 on atb-devel-224
This commit is contained in:
Andreas Schneider 2023-03-14 09:48:37 +01:00 committed by Andreas Schneider
parent b4a6c054ec
commit 795bab5629
2 changed files with 16 additions and 16 deletions

View File

@ -660,7 +660,7 @@ static void test_filter_attrs_one_attr_matched_star(void **state)
assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg,
"foo",
NULL),
value);
(const char *)value);
}
/*
@ -729,11 +729,11 @@ static void test_filter_attrs_two_attr_matched_star(void **state)
assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg,
"foo",
NULL),
value1);
(const char *)value1);
assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg,
"bar",
NULL),
value2);
(const char *)value2);
}
/*
@ -828,7 +828,7 @@ static void test_filter_attrs_one_attr_matched_star_dn(void **state)
assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg,
"foo",
NULL),
value);
(const char *)value);
}
/*
@ -877,7 +877,7 @@ static void test_filter_attrs_one_attr_matched_dn(void **state)
assert_ptr_equal(filtered_msg->dn, in.dn);
assert_string_equal(filtered_msg->elements[0].name, "distinguishedName");
assert_int_equal(filtered_msg->elements[0].num_values, 1);
assert_string_equal(filtered_msg->elements[0].values[0].data,
assert_string_equal((const char *)filtered_msg->elements[0].values[0].data,
ldb_dn_get_linearized(in.dn));
}

View File

@ -924,12 +924,12 @@ static void test_ldb_modify_add_key(void **state)
el = ldb_msg_find_element(res->msgs[0], "cn");
assert_non_null(el);
assert_int_equal(el->num_values, 1);
assert_string_equal(el->values[0].data, "test_mod_cn");
assert_string_equal((const char *)el->values[0].data, "test_mod_cn");
el = ldb_msg_find_element(res->msgs[0], "name");
assert_non_null(el);
assert_int_equal(el->num_values, 1);
assert_string_equal(el->values[0].data, "test_mod_name");
assert_string_equal((const char *)el->values[0].data, "test_mod_name");
}
static void test_ldb_modify_extend_key(void **state)
@ -952,8 +952,8 @@ static void test_ldb_modify_extend_key(void **state)
el = ldb_msg_find_element(res->msgs[0], "cn");
assert_non_null(el);
assert_int_equal(el->num_values, 2);
assert_string_equal(el->values[0].data, "test_mod_cn");
assert_string_equal(el->values[1].data, "test_mod_cn2");
assert_string_equal((const char *)el->values[0].data, "test_mod_cn");
assert_string_equal((const char *)el->values[1].data, "test_mod_cn2");
}
static void test_ldb_modify_add_key_noval(void **state)
@ -1009,7 +1009,7 @@ static void test_ldb_modify_replace_key(void **state)
el = ldb_msg_find_element(res->msgs[0], "cn");
assert_non_null(el);
assert_int_equal(el->num_values, 1);
assert_string_equal(el->values[0].data, new_cn);
assert_string_equal((const char *)el->values[0].data, new_cn);
}
static void test_ldb_modify_replace_noexist_key(void **state)
@ -1032,12 +1032,12 @@ static void test_ldb_modify_replace_noexist_key(void **state)
el = ldb_msg_find_element(res->msgs[0], "cn");
assert_non_null(el);
assert_int_equal(el->num_values, 1);
assert_string_equal(el->values[0].data, "test_mod_cn");
assert_string_equal((const char *)el->values[0].data, "test_mod_cn");
el = ldb_msg_find_element(res->msgs[0], mod_kvs[0].key);
assert_non_null(el);
assert_int_equal(el->num_values, 1);
assert_string_equal(el->values[0].data, mod_kvs[0].val);
assert_string_equal((const char *)el->values[0].data, mod_kvs[0].val);
}
static void test_ldb_modify_replace_zero_vals(void **state)
@ -1232,7 +1232,7 @@ static void assert_attr_has_vals(struct ldb_message *msg,
assert_int_equal(el->num_values, nvals);
for (i = 0; i < nvals; i++) {
assert_string_equal(el->values[i].data,
assert_string_equal((const char *)el->values[i].data,
vals[i]);
}
}