From 62c9bf8c4ebb7dd56c2badbd032acb71214fbd86 Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Fri, 25 Sep 2015 12:47:03 +0200 Subject: [PATCH] Fix warnings --- libyara/arena.c | 6 +++--- libyara/scan.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libyara/arena.c b/libyara/arena.c index 6ae0833a28..074e19de27 100644 --- a/libyara/arena.c +++ b/libyara/arena.c @@ -184,7 +184,7 @@ int _yr_arena_make_relocatable( if (reloc == NULL) return ERROR_INSUFICIENT_MEMORY; - reloc->offset = base_offset + offset; + reloc->offset = (uint32_t) (base_offset + offset); reloc->next = NULL; if (page->reloc_list_head == NULL) @@ -410,7 +410,7 @@ int yr_arena_coalesce( uint8_t** reloc_address; uint8_t* reloc_target; - int total_size = 0; + size_t total_size = 0; page = arena->page_list_head; @@ -438,7 +438,7 @@ int yr_arena_coalesce( while(reloc != NULL) { - reloc->offset += big_page->used; + reloc->offset += (uint32_t) big_page->used; reloc = reloc->next; } diff --git a/libyara/scan.c b/libyara/scan.c index 9d6787f7a6..1cb5bcfa40 100644 --- a/libyara/scan.c +++ b/libyara/scan.c @@ -43,7 +43,7 @@ typedef struct _CALLBACK_ARGS } CALLBACK_ARGS; -size_t _yr_scan_compare( +int _yr_scan_compare( uint8_t* data, size_t data_size, uint8_t* string, @@ -60,11 +60,11 @@ size_t _yr_scan_compare( while (i < string_length && *s1++ == *s2++) i++; - return ((i == string_length) ? i : 0); + return (int) ((i == string_length) ? i : 0); } -size_t _yr_scan_icompare( +int _yr_scan_icompare( uint8_t* data, size_t data_size, uint8_t* string, @@ -81,11 +81,11 @@ size_t _yr_scan_icompare( while (i < string_length && lowercase[*s1++] == lowercase[*s2++]) i++; - return ((i == string_length) ? i : 0); + return (int) ((i == string_length) ? i : 0); } -size_t _yr_scan_wcompare( +int _yr_scan_wcompare( uint8_t* data, size_t data_size, uint8_t* string, @@ -106,11 +106,11 @@ size_t _yr_scan_wcompare( i++; } - return ((i == string_length) ? i * 2 : 0); + return (int) ((i == string_length) ? i * 2 : 0); } -size_t _yr_scan_wicompare( +int _yr_scan_wicompare( uint8_t* data, size_t data_size, uint8_t* string, @@ -131,7 +131,7 @@ size_t _yr_scan_wicompare( i++; } - return ((i == string_length) ? i * 2 : 0); + return (int) ((i == string_length) ? i * 2 : 0); }