[Forensics-changes] [yara] 204/415: Fix compiler warnings

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch debian
in repository yara.

commit 46f5b857deacd32a28ada1d92581b80f102b9afb
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Tue Oct 29 17:59:36 2013 +0000

    Fix compiler warnings
---
 libyara/ahocorasick.c |  7 ++-----
 libyara/arena.h       |  5 +++++
 libyara/atoms.c       | 13 ++++++++-----
 libyara/compiler.c    | 10 ++++++----
 libyara/exec.c        |  4 ----
 libyara/rules.c       |  5 -----
 6 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/libyara/ahocorasick.c b/libyara/ahocorasick.c
index 78b1a61..88914b1 100644
--- a/libyara/ahocorasick.c
+++ b/libyara/ahocorasick.c
@@ -19,6 +19,7 @@ limitations under the License.
 #include <stddef.h>
 #include <string.h>
 
+#include "arena.h"
 #include "atoms.h"
 #include "mem.h"
 #include "utils.h"
@@ -157,8 +158,6 @@ AC_STATE* _yr_ac_next_transition(
 {
   int i;
   AC_TABLE_BASED_STATE* table_based_state;
-  AC_LIST_BASED_STATE* list_based_state;
-  AC_STATE_TRANSITION* next_transition;
 
   if (state->depth <= MAX_TABLE_BASED_STATES_DEPTH)
   {
@@ -537,7 +536,7 @@ int yr_ac_add_string(
     STRING* string,
     ATOM_LIST_ITEM* atom)
 {
-  int result;
+  int result = ERROR_SUCCESS;
   int i;
 
   AC_STATE* state;
@@ -610,11 +609,9 @@ int yr_ac_add_string(
 void _yr_ac_print_automaton_state(
   AC_STATE* state)
 {
-  char* identifier;
   int i;
   int child_count;
 
-  STRING* string;
   AC_STATE_TRANSITION transition;
   AC_MATCH* match;
   AC_STATE* child_state;
diff --git a/libyara/arena.h b/libyara/arena.h
index 522aa56..79b37cf 100644
--- a/libyara/arena.h
+++ b/libyara/arena.h
@@ -94,6 +94,11 @@ int yr_arena_load(
     const char* filename,
     ARENA** arena);
 
+
+int yr_arena_duplicate(
+    ARENA* arena,
+    ARENA** duplicated);
+
 #endif
 
 
diff --git a/libyara/atoms.c b/libyara/atoms.c
index 25bcd77..9c737b7 100644
--- a/libyara/atoms.c
+++ b/libyara/atoms.c
@@ -295,6 +295,8 @@ int _yr_atoms_choose(
     
     return min_quality;
   }
+
+  return 0;
 }
 
 
@@ -531,11 +533,11 @@ ATOM_TREE_NODE* _yr_atoms_extract_from_re_node(
           for (i = 0; i < MAX_ATOM_LENGTH; i++)
             current_leaf->atom[i] = current_leaf->recent_bytes[i];
 
-          current_leaf->forward_code = re_node->forward_code -
-                                       2 * (MAX_ATOM_LENGTH - 1);
+		  current_leaf->forward_code = 
+			  (uint8_t*) re_node->forward_code - 2 * (MAX_ATOM_LENGTH - 1);
 
-          current_leaf->backward_code = re_node->backward_code +
-                                        2 * (MAX_ATOM_LENGTH - 1);
+          current_leaf->backward_code = 
+			  (uint8_t*) re_node->backward_code + 2 * (MAX_ATOM_LENGTH - 1);
         }
       }
 
@@ -638,6 +640,8 @@ ATOM_TREE_NODE* _yr_atoms_extract_from_re_node(
     default:
       assert(FALSE);
   }
+
+  return NULL;
 }
 
 
@@ -730,7 +734,6 @@ int yr_atoms_extract_from_re(
     ATOM_LIST_ITEM** atoms)
 {
   ATOM_TREE* atom_tree = yr_malloc(sizeof(ATOM_TREE));
-  ATOM_TREE_NODE* root_node;
   ATOM_TREE_NODE* temp;
   ATOM_LIST_ITEM* wide_atoms;
   ATOM_LIST_ITEM* case_insentive_atoms;
diff --git a/libyara/compiler.c b/libyara/compiler.c
index d4a254e..1bfaba3 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -21,6 +21,7 @@ limitations under the License.
 #include "arena.h"
 #include "exec.h"
 #include "filemap.h"
+#include "hash.h"
 #include "lexer.h"
 #include "mem.h"
 #include "utils.h"
@@ -319,7 +320,7 @@ int yr_compiler_add_string(
 int _yr_compiler_compile_rules(
   YARA_COMPILER* compiler)
 {
-  YARA_RULES_FILE_HEADER* rules_file_header;
+  YARA_RULES_FILE_HEADER* rules_file_header = NULL;
   ARENA* arena;
   RULE null_rule;
   EXTERNAL_VARIABLE null_external;
@@ -603,10 +604,11 @@ int yr_compiler_define_string_variable(
     const char* identifier,
     const char* value)
 {
-  EXTERNAL_VARIABLE* external;
+  EXTERNAL_VARIABLE* external = NULL;
+
+  char* id = NULL;
+  char* val = NULL;
 
-  char* id;
-  char* val;
   int result;
 
   result = yr_arena_write_string(
diff --git a/libyara/exec.c b/libyara/exec.c
index a56d4fa..7ca564c 100644
--- a/libyara/exec.c
+++ b/libyara/exec.c
@@ -68,9 +68,6 @@ int yr_execute_code(
     YARA_RULES* rules,
     EVALUATION_CONTEXT* context)
 {
-  int64_t rA;
-  int64_t rB;
-  int64_t rC;
   int64_t r1;
   int64_t r2;
   int64_t r3;
@@ -84,7 +81,6 @@ int yr_execute_code(
   MATCH* match;
   EXTERNAL_VARIABLE* external;
 
-  char* identifier;
   int i;
   int found;
   int count;
diff --git a/libyara/rules.c b/libyara/rules.c
index be0ae33..ad99bf9 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -430,7 +430,6 @@ inline int _yr_scan_verify_match(
     size_t offset,
     ARENA* matches_arena)
 {
-  int matching;
   STRING* string = ac_match->string;
 
   if (data_size - offset <= 0)
@@ -551,8 +550,6 @@ void _yr_rules_clean_matches(
 {
   RULE* rule;
   STRING* string;
-  MATCH* match;
-  MATCH* next_match;
   
   int tidx = yr_get_tidx();
 
@@ -915,10 +912,8 @@ int yr_rules_load(
   YARA_RULES* new_rules;
   YARA_RULES_FILE_HEADER* header;
   RULE* rule;
-  STRING* string;
 
   int result;
-  int error_offset;
 
   new_rules = yr_malloc(sizeof(YARA_RULES));
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list