summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-03-21 14:32:49 +0100
committerJeremy Allison <jra@samba.org>2018-04-03 20:20:10 +0200
commit41895045bae5f71e964d767ce676172cc1e6768c (patch)
treed0f7df81c509445944f411b17009a9a260a8e015 /third_party
parent889d1daf8758841a8252916c4e85932ac6a6e6a6 (diff)
downloadsamba-41895045bae5f71e964d767ce676172cc1e6768c.tar.gz
third_party: Fix size type in cmocka
This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/cmocka/cmocka.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/third_party/cmocka/cmocka.c b/third_party/cmocka/cmocka.c
index 14b2765b781..a5115c7cb5e 100644
--- a/third_party/cmocka/cmocka.c
+++ b/third_party/cmocka/cmocka.c
@@ -244,8 +244,8 @@ static void free_symbol_map_value(
static void remove_always_return_values(ListNode * const map_head,
const size_t number_of_symbol_names);
-static int check_for_leftover_values_list(const ListNode * head,
- const char * const error_message);
+static size_t check_for_leftover_values_list(const ListNode * head,
+ const char * const error_message);
static int check_for_leftover_values(
const ListNode * const map_head, const char * const error_message,
@@ -811,11 +811,11 @@ static void remove_always_return_values(ListNode * const map_head,
}
}
-static int check_for_leftover_values_list(const ListNode * head,
- const char * const error_message)
+static size_t check_for_leftover_values_list(const ListNode * head,
+ const char * const error_message)
{
ListNode *child_node;
- int leftover_count = 0;
+ size_t leftover_count = 0;
if (!list_empty(head))
{
for (child_node = head->next; child_node != head;
@@ -1952,10 +1952,10 @@ static const ListNode* check_point_allocated_blocks(void) {
/* Display the blocks allocated after the specified check point. This
* function returns the number of blocks displayed. */
-static int display_allocated_blocks(const ListNode * const check_point) {
+static size_t display_allocated_blocks(const ListNode * const check_point) {
const ListNode * const head = get_allocated_blocks_list();
const ListNode *node;
- int allocated_blocks = 0;
+ size_t allocated_blocks = 0;
assert_non_null(check_point);
assert_non_null(check_point->next);
@@ -1964,14 +1964,14 @@ static int display_allocated_blocks(const ListNode * const check_point) {
(const MallocBlockInfo*)node->value;
assert_non_null(block_info);
- if (!allocated_blocks) {
+ if (allocated_blocks == 0) {
cm_print_error("Blocks allocated...\n");
}
cm_print_error(SOURCE_LOCATION_FORMAT ": note: block %p allocated here\n",
block_info->location.file,
block_info->location.line,
block_info->block);
- allocated_blocks ++;
+ allocated_blocks++;
}
return allocated_blocks;
}
@@ -1997,10 +1997,10 @@ static void free_allocated_blocks(const ListNode * const check_point) {
/* Fail if any any blocks are allocated after the specified check point. */
static void fail_if_blocks_allocated(const ListNode * const check_point,
const char * const test_name) {
- const int allocated_blocks = display_allocated_blocks(check_point);
- if (allocated_blocks) {
+ const size_t allocated_blocks = display_allocated_blocks(check_point);
+ if (allocated_blocks > 0) {
free_allocated_blocks(check_point);
- cm_print_error("ERROR: %s leaked %d block(s)\n", test_name,
+ cm_print_error("ERROR: %s leaked %zu block(s)\n", test_name,
allocated_blocks);
exit_test(1);
}