From 39dd847c1f4bf18e5564de47ea84d688133cdbf7 Mon Sep 17 00:00:00 2001 From: alvarofe Date: Tue, 21 Feb 2017 22:25:31 +0100 Subject: [PATCH] Fix build plus indentation issues --- libr/bin/pdb/types.h | 6 +++--- libr/core/cmd_anal.c | 2 +- libr/core/cmd_print.c | 1 - libr/hash/entropy.c | 30 +++++++++++++++--------------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/libr/bin/pdb/types.h b/libr/bin/pdb/types.h index b264f9fc8d..e3b463be9e 100644 --- a/libr/bin/pdb/types.h +++ b/libr/bin/pdb/types.h @@ -1,5 +1,5 @@ -#ifndef TYPES_H -#define TYPES_H +#ifndef PDB_TYPES_H +#define PDB_TYPES_H #define _R_LIST_C #include @@ -1203,4 +1203,4 @@ typedef struct { } SOmapStream; // end of omap structures -#endif // TYPES_H +#endif // PDB_TYPES_H diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index bb24fe4f80..d098570f47 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -3864,7 +3864,7 @@ static bool cmd_anal_refs(RCore *core, const char *input) { switch (input[0]) { case '-': { // "ax-" const char *inp; - ut64 a, b; + ut64 b; char *p; RList *list; RListIter *iter; diff --git a/libr/core/cmd_print.c b/libr/core/cmd_print.c index 197d0ef1e2..ab07ee90e5 100644 --- a/libr/core/cmd_print.c +++ b/libr/core/cmd_print.c @@ -6,7 +6,6 @@ #include "r_print.h" #include "r_types.h" #include "r_util.h" -#include "ht.h" #include #define R_CORE_MAX_DISASM (1024*1024*8) diff --git a/libr/hash/entropy.c b/libr/hash/entropy.c index 00007a0e38..7e0c97aee6 100644 --- a/libr/hash/entropy.c +++ b/libr/hash/entropy.c @@ -10,25 +10,25 @@ #include "r_types.h" static double get_px(ut8 x, const ut8 *data, ut64 size) { - ut64 i, count = 0; - for (i = 0; i < size; i++) { - if (data[i] == x) { - count++; + ut64 i, count = 0; + for (i = 0; i < size; i++) { + if (data[i] == x) { + count++; } } - return size > 0? (double) count / size: 0; + return size > 0? (double) count / size: 0; } R_API double r_hash_entropy(const ut8 *data, ut64 size) { - ut32 x; - double h = 0, px, log2 = log (2.0); - for (x = 0; x < 256; x++) { - px = get_px (x, data, size); - if (px > 0) { - h += -px * (log (px) / log2); + ut32 x; + double h = 0, px, log2 = log (2.0); + for (x = 0; x < 256; x++) { + px = get_px (x, data, size); + if (px > 0) { + h += -px * (log (px) / log2); } - } - return h; + } + return h; } R_API double r_hash_entropy_fraction(const ut8 *data, ut64 size) { @@ -36,8 +36,8 @@ R_API double r_hash_entropy_fraction(const ut8 *data, ut64 size) { if (size < 256) { double base = log (size); return base - ? h * log (2.0) / base - : 0; + ? h * log (2.0) / base + : 0; } return h / 8; }