Fix build plus indentation issues

This commit is contained in:
alvarofe 2017-02-21 22:25:31 +01:00
parent ba15fd4485
commit 39dd847c1f
4 changed files with 19 additions and 20 deletions

View File

@ -1,5 +1,5 @@
#ifndef TYPES_H
#define TYPES_H
#ifndef PDB_TYPES_H
#define PDB_TYPES_H
#define _R_LIST_C
#include <r_util.h>
@ -1203,4 +1203,4 @@ typedef struct {
} SOmapStream;
// end of omap structures
#endif // TYPES_H
#endif // PDB_TYPES_H

View File

@ -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;

View File

@ -6,7 +6,6 @@
#include "r_print.h"
#include "r_types.h"
#include "r_util.h"
#include "ht.h"
#include <limits.h>
#define R_CORE_MAX_DISASM (1024*1024*8)

View File

@ -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;
}