mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Fix almost all warnings from the msvc build
This commit is contained in:
parent
86b8013d84
commit
0b1e8eaecc
@ -1162,10 +1162,10 @@ static int esil_asreq(RAnalEsil *esil) {
|
|||||||
}
|
}
|
||||||
if (isNegative) {
|
if (isNegative) {
|
||||||
if (regsize == 32) {
|
if (regsize == 32) {
|
||||||
op_num = -op_num;
|
op_num = -(st64)op_num;
|
||||||
if (op_num >> param_num) {
|
if (op_num >> param_num) {
|
||||||
op_num >>= param_num;
|
op_num >>= param_num;
|
||||||
op_num = -op_num;
|
op_num = -(st64)op_num;
|
||||||
} else {
|
} else {
|
||||||
op_num = -1;
|
op_num = -1;
|
||||||
}
|
}
|
||||||
@ -1245,7 +1245,7 @@ static int esil_ror(RAnalEsil *esil) {
|
|||||||
if (src && r_anal_esil_get_parm (esil, src, &num2)) {
|
if (src && r_anal_esil_get_parm (esil, src, &num2)) {
|
||||||
ut64 mask = (regsize - 1);
|
ut64 mask = (regsize - 1);
|
||||||
num2 &= mask;
|
num2 &= mask;
|
||||||
ut64 res = (num >> num2) | (num << ((-num2) & mask));
|
ut64 res = (num >> num2) | (num << ((-(st64)num2) & mask));
|
||||||
r_anal_esil_pushnum (esil, res);
|
r_anal_esil_pushnum (esil, res);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -1266,7 +1266,7 @@ static int esil_rol(RAnalEsil *esil) {
|
|||||||
if (src && r_anal_esil_get_parm (esil, src, &num2)) {
|
if (src && r_anal_esil_get_parm (esil, src, &num2)) {
|
||||||
ut64 mask = (regsize - 1);
|
ut64 mask = (regsize - 1);
|
||||||
num2 &= mask;
|
num2 &= mask;
|
||||||
ut64 res = (num << num2) | (num >> ((-num2) & mask));
|
ut64 res = (num << num2) | (num >> ((-(st64)num2) & mask));
|
||||||
r_anal_esil_pushnum (esil, res);
|
r_anal_esil_pushnum (esil, res);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1541,6 +1541,7 @@ static int opmov(RAsm *a, ut8 *data, const Opcode *op) {
|
|||||||
data[l++] = offset;
|
data[l++] = offset;
|
||||||
}
|
}
|
||||||
if (mod == 2) {
|
if (mod == 2) {
|
||||||
|
// warning C4293: '>>': shift count negative or too big, undefined behavior
|
||||||
data[l++] = offset >> 8;
|
data[l++] = offset >> 8;
|
||||||
data[l++] = offset >> 16;
|
data[l++] = offset >> 16;
|
||||||
data[l++] = offset >> 24;
|
data[l++] = offset >> 24;
|
||||||
@ -1548,7 +1549,6 @@ static int opmov(RAsm *a, ut8 *data, const Opcode *op) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (op->operands[1].type & OT_MEMORY) {
|
} else if (op->operands[1].type & OT_MEMORY) {
|
||||||
|
|
||||||
if (op->operands[0].type & OT_MEMORY) {
|
if (op->operands[0].type & OT_MEMORY) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ static int string_scan_range(RList *list, const ut8 *buf, int min,
|
|||||||
rc = r_utf8_encode (&tmp[i], r);
|
rc = r_utf8_encode (&tmp[i], r);
|
||||||
runes++;
|
runes++;
|
||||||
/* Print the escape code */
|
/* Print the escape code */
|
||||||
} else if (r && r < 0x100 && strchr ("\b\v\f\n\r\t\a\e\\", (char)r)) {
|
} else if (r && r < 0x100 && strchr ("\b\v\f\n\r\t\a\033\\", (char)r)) {
|
||||||
if ((i + 32) < sizeof (tmp) && r < 93) {
|
if ((i + 32) < sizeof (tmp) && r < 93) {
|
||||||
tmp[i + 0] = '\\';
|
tmp[i + 0] = '\\';
|
||||||
tmp[i + 1] = " abtnvfr e "
|
tmp[i + 1] = " abtnvfr e "
|
||||||
|
@ -433,7 +433,7 @@ R_API void r_line_autocomplete() {
|
|||||||
char *p;
|
char *p;
|
||||||
const char **argv = NULL;
|
const char **argv = NULL;
|
||||||
int i, j, opt = 0, plen, len = 0;
|
int i, j, opt = 0, plen, len = 0;
|
||||||
int cols = r_cons_get_size (NULL) * 0.82;
|
int cols = (int)(r_cons_get_size (NULL) * 0.82);
|
||||||
|
|
||||||
/* prepare argc and argv */
|
/* prepare argc and argv */
|
||||||
if (I.completion.run) {
|
if (I.completion.run) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* radare - LGPL - Copyright 2013-2016 - pancake */
|
/* radare - LGPL - Copyright 2013-2017 - pancake */
|
||||||
/* ansi 256 color extension for r_cons */
|
/* ansi 256 color extension for r_cons */
|
||||||
/* https://en.wikipedia.org/wiki/ANSI_color */
|
/* https://en.wikipedia.org/wiki/ANSI_color */
|
||||||
|
|
||||||
@ -9,6 +9,7 @@ int value_range[6] = { 0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff};
|
|||||||
|
|
||||||
static void init_color_table () {
|
static void init_color_table () {
|
||||||
int i, r, g, b;
|
int i, r, g, b;
|
||||||
|
// ansi colors
|
||||||
color_table[0] = 0x000000;
|
color_table[0] = 0x000000;
|
||||||
color_table[1] = 0x800000;
|
color_table[1] = 0x800000;
|
||||||
color_table[2] = 0x008000;
|
color_table[2] = 0x008000;
|
||||||
@ -25,6 +26,7 @@ static void init_color_table () {
|
|||||||
color_table[13] = 0xff00ff;
|
color_table[13] = 0xff00ff;
|
||||||
color_table[14] = 0x00ffff;
|
color_table[14] = 0x00ffff;
|
||||||
color_table[15] = 0xffffff;
|
color_table[15] = 0xffffff;
|
||||||
|
// color palette
|
||||||
for (i = 0; i < 216; i++) {
|
for (i = 0; i < 216; i++) {
|
||||||
r = value_range[(i / 36) % 6];
|
r = value_range[(i / 36) % 6];
|
||||||
g = value_range[(i / 6) % 6];
|
g = value_range[(i / 6) % 6];
|
||||||
@ -32,6 +34,7 @@ static void init_color_table () {
|
|||||||
color_table[i + 16] = ((r << 16) & 0xffffff) +
|
color_table[i + 16] = ((r << 16) & 0xffffff) +
|
||||||
((g << 8) & 0xffff) + (b & 0xff);
|
((g << 8) & 0xffff) + (b & 0xff);
|
||||||
}
|
}
|
||||||
|
// grayscale
|
||||||
for (i = 0; i < 24; i++) {
|
for (i = 0; i < 24; i++) {
|
||||||
r = 8 + (i * 10);
|
r = 8 + (i * 10);
|
||||||
color_table[i + 232] = ((r << 16) & 0xffffff) +
|
color_table[i + 232] = ((r << 16) & 0xffffff) +
|
||||||
@ -50,25 +53,48 @@ static int lookup_rgb (int r, int g, int b) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int approximate_rgb (int r, int g, int b) {
|
static ut32 approximate_rgb (int r, int g, int b) {
|
||||||
bool grey = (r > 0 && r < 255 && r == g && r == b);
|
bool grey = (r > 0 && r < 255 && r == g && r == b);
|
||||||
const double k = (256.0 / 6.0);
|
|
||||||
if (grey) {
|
if (grey) {
|
||||||
return 232 + (double)r / (255 / 24.1);
|
return 232 + (int)((double)r / (255 / 24.1));
|
||||||
}
|
}
|
||||||
r = R_DIM (r / k, 0, 5);
|
#if 0
|
||||||
g = R_DIM (g / k, 0, 5);
|
const double M = 16;
|
||||||
b = R_DIM (b / k, 0, 5);
|
double R = r;
|
||||||
|
double G = g;
|
||||||
|
double B = b;
|
||||||
|
R = R /256 * 216;
|
||||||
|
R /= 256 * 216;
|
||||||
|
R /= 256 * 216;
|
||||||
|
r = R = R_DIM (R / 16, 0, 16);
|
||||||
|
g = G = R_DIM (G / 16, 0, 16);
|
||||||
|
b = B = R_DIM (B / 16, 0, 16);
|
||||||
|
r &= 0xff;
|
||||||
|
g &= 0xff;
|
||||||
|
b &= 0xff;
|
||||||
|
return (ut32)((G * M * M) + (g * M) + b) + 16;
|
||||||
|
#else
|
||||||
|
const int k = (256.0 / 6);
|
||||||
|
r = R_DIM (r / k, 0, 6);
|
||||||
|
g = R_DIM (g / k, 0, 6);
|
||||||
|
b = R_DIM (b / k, 0, 6);
|
||||||
return 16 + (r * 36) + (g * 6) + b;
|
return 16 + (r * 36) + (g * 6) + b;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rgb (int r, int g, int b) {
|
static int rgb (int r, int g, int b) {
|
||||||
int c = lookup_rgb (r, g, b);
|
int c = lookup_rgb (r, g, b);
|
||||||
if (c == -1) return approximate_rgb (r, g, b);
|
if (c == -1) {
|
||||||
else return c;
|
return approximate_rgb (r, g, b);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unrgb (int color, int *r, int *g, int *b) {
|
static void unrgb (int color, int *r, int *g, int *b) {
|
||||||
|
if (color < 0 || color > 256) {
|
||||||
|
*r = *g = *b = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
int rgb = color_table[color];
|
int rgb = color_table[color];
|
||||||
*r = (rgb >> 16) & 0xff;
|
*r = (rgb >> 16) & 0xff;
|
||||||
*g = (rgb >> 8) & 0xff;
|
*g = (rgb >> 8) & 0xff;
|
||||||
|
@ -204,7 +204,7 @@ R_API int r_cmd_call(RCmd *cmd, const char *input) {
|
|||||||
RListIter *iter;
|
RListIter *iter;
|
||||||
RCorePlugin *cp;
|
RCorePlugin *cp;
|
||||||
if (!cmd || !input) {
|
if (!cmd || !input) {
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!input || !*input) {
|
if (!input || !*input) {
|
||||||
if (cmd->nullcallback) {
|
if (cmd->nullcallback) {
|
||||||
|
@ -3540,7 +3540,7 @@ static int cmd_print(void *data, const char *input) {
|
|||||||
break;
|
break;
|
||||||
case '-': // "p-"
|
case '-': // "p-"
|
||||||
mode = input[1];
|
mode = input[1];
|
||||||
w = core->print->cols * 2.7;
|
w = (int)(core->print->cols * 2.7);
|
||||||
if (mode == 'j') {
|
if (mode == 'j') {
|
||||||
r_cons_strcat ("{");
|
r_cons_strcat ("{");
|
||||||
}
|
}
|
||||||
@ -4044,7 +4044,7 @@ static int cmd_print(void *data, const char *input) {
|
|||||||
free (old_arch);
|
free (old_arch);
|
||||||
free (new_arch);
|
free (new_arch);
|
||||||
goto beach;
|
goto beach;
|
||||||
} else if (core->blocksize_max < use_blocksize && (int) use_blocksize > -core->blocksize_max) {
|
} else if (core->blocksize_max < use_blocksize && (int) use_blocksize > -(int)core->blocksize_max) {
|
||||||
bw_disassemble = true;
|
bw_disassemble = true;
|
||||||
l = use_blocksize; // negative
|
l = use_blocksize; // negative
|
||||||
use_blocksize = -use_blocksize;
|
use_blocksize = -use_blocksize;
|
||||||
|
@ -2278,6 +2278,9 @@ static int memcmpdiff(const ut8 *a, const ut8 *b, int len) {
|
|||||||
static void search_similar_pattern_in(RCore *core, int count, ut64 from, ut64 to) {
|
static void search_similar_pattern_in(RCore *core, int count, ut64 from, ut64 to) {
|
||||||
ut64 addr = from;
|
ut64 addr = from;
|
||||||
ut8 *block = calloc (core->blocksize, 1);
|
ut8 *block = calloc (core->blocksize, 1);
|
||||||
|
if (!block) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (addr < to) {
|
while (addr < to) {
|
||||||
(void) r_io_read_at (core->io, addr, block, core->blocksize);
|
(void) r_io_read_at (core->io, addr, block, core->blocksize);
|
||||||
if (r_cons_is_breaked ()) {
|
if (r_cons_is_breaked ()) {
|
||||||
@ -2289,7 +2292,7 @@ static void search_similar_pattern_in(RCore *core, int count, ut64 from, ut64 to
|
|||||||
int pc = (equal * 100) / core->blocksize;
|
int pc = (equal * 100) / core->blocksize;
|
||||||
r_cons_printf ("0x%08"PFMT64x " %4d/%d %3d%% ", addr, equal, core->blocksize, pc);
|
r_cons_printf ("0x%08"PFMT64x " %4d/%d %3d%% ", addr, equal, core->blocksize, pc);
|
||||||
ut8 ptr[2] = {
|
ut8 ptr[2] = {
|
||||||
pc * 2.5, 0
|
(ut8)(pc * 2.5), 0
|
||||||
};
|
};
|
||||||
r_print_fill (core->print, ptr, 1, UT64_MAX, core->blocksize);
|
r_print_fill (core->print, ptr, 1, UT64_MAX, core->blocksize);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ static int cmd_seek(void *data, const char *input) {
|
|||||||
const char *u_num = inputnum? inputnum + 1: input + 1;
|
const char *u_num = inputnum? inputnum + 1: input + 1;
|
||||||
off = r_num_math (core->num, u_num);
|
off = r_num_math (core->num, u_num);
|
||||||
if (*u_num == '-') {
|
if (*u_num == '-') {
|
||||||
off = -off;
|
off = -(st64)off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
|
@ -3225,7 +3225,7 @@ static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
|
|||||||
ds_comment (ds, true, "; var %s", v->name);
|
ds_comment (ds, true, "; var %s", v->name);
|
||||||
r_anal_var_free (v);
|
r_anal_var_free (v);
|
||||||
} else {
|
} else {
|
||||||
ds_comment (ds, true, "; var %d", (int)-refaddr);
|
ds_comment (ds, true, "; var %d", -(int)refaddr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (r_core_anal_address (core, refaddr) & R_ANAL_ADDR_TYPE_ASCII) {
|
if (r_core_anal_address (core, refaddr) & R_ANAL_ADDR_TYPE_ASCII) {
|
||||||
|
@ -1627,7 +1627,7 @@ R_API void r_core_rtr_session(RCore *core, const char *input) {
|
|||||||
while (!r_cons_is_breaked ()) {
|
while (!r_cons_is_breaked ()) {
|
||||||
if (rtr_host[rtr_n].fd) {
|
if (rtr_host[rtr_n].fd) {
|
||||||
snprintf (prompt, sizeof (prompt),
|
snprintf (prompt, sizeof (prompt),
|
||||||
"fd:%d> ", rtr_host[rtr_n].fd->fd);
|
"fd:%d> ", (int)(size_t)rtr_host[rtr_n].fd->fd);
|
||||||
}
|
}
|
||||||
free (r_line_singleton ()->prompt);
|
free (r_line_singleton ()->prompt);
|
||||||
r_line_singleton ()->prompt = strdup (prompt);
|
r_line_singleton ()->prompt = strdup (prompt);
|
||||||
|
@ -2575,17 +2575,17 @@ R_API void r_core_visual_title(RCore *core, int color) {
|
|||||||
if (autoblocksize) {
|
if (autoblocksize) {
|
||||||
switch (core->printidx) {
|
switch (core->printidx) {
|
||||||
case R_CORE_VISUAL_MODE_PRC: // prc
|
case R_CORE_VISUAL_MODE_PRC: // prc
|
||||||
r_core_block_size (core, core->cons->rows * hexcols * 3.5);
|
r_core_block_size (core, (int)(core->cons->rows * hexcols * 3.5));
|
||||||
break;
|
break;
|
||||||
case R_CORE_VISUAL_MODE_PX: // x
|
case R_CORE_VISUAL_MODE_PX: // x
|
||||||
case R_CORE_VISUAL_MODE_PXa: // pxa
|
case R_CORE_VISUAL_MODE_PXa: // pxa
|
||||||
r_core_block_size (core, core->cons->rows * hexcols * 3.5);
|
r_core_block_size (core, (int)(core->cons->rows * hexcols * 3.5));
|
||||||
break;
|
break;
|
||||||
case R_CORE_VISUAL_MODE_PW: // XXX pw
|
case R_CORE_VISUAL_MODE_PW: // XXX pw
|
||||||
r_core_block_size (core, core->cons->rows * hexcols);
|
r_core_block_size (core, (int)(core->cons->rows * hexcols));
|
||||||
break;
|
break;
|
||||||
case R_CORE_VISUAL_MODE_PC: // XXX pc
|
case R_CORE_VISUAL_MODE_PC: // XXX pc
|
||||||
r_core_block_size (core, core->cons->rows * hexcols * 4);
|
r_core_block_size (core, (int)(core->cons->rows * hexcols * 4));
|
||||||
break;
|
break;
|
||||||
case R_CORE_VISUAL_MODE_PD: // pd
|
case R_CORE_VISUAL_MODE_PD: // pd
|
||||||
case R_CORE_VISUAL_MODE_PDDBG: // pd+dbg
|
case R_CORE_VISUAL_MODE_PDDBG: // pd+dbg
|
||||||
|
@ -900,7 +900,7 @@ R_API bool r_fs_check(RFS *fs, const char *p) {
|
|||||||
RListIter *iter;
|
RListIter *iter;
|
||||||
char* path = strdup (p);
|
char* path = strdup (p);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
return NULL;
|
return false;
|
||||||
}
|
}
|
||||||
r_str_chop_path (path);
|
r_str_chop_path (path);
|
||||||
r_list_foreach (fs->roots, iter, root) {
|
r_list_foreach (fs->roots, iter, root) {
|
||||||
|
@ -156,7 +156,7 @@ R_API RIOMap* r_io_map_new(RIO* io, int fd, int flags, ut64 delta, ut64 addr, ut
|
|||||||
map->delta = delta;
|
map->delta = delta;
|
||||||
if ((UT64_MAX - size + 1) < addr) {
|
if ((UT64_MAX - size + 1) < addr) {
|
||||||
r_io_map_new (io, fd, flags, delta - addr, 0LL, size + addr, do_skyline);
|
r_io_map_new (io, fd, flags, delta - addr, 0LL, size + addr, do_skyline);
|
||||||
size = -addr;
|
size = -(st64)addr;
|
||||||
}
|
}
|
||||||
// RIOMap describes an interval of addresses (map->from; map->to)
|
// RIOMap describes an interval of addresses (map->from; map->to)
|
||||||
map->itv.size = size;
|
map->itv.size = size;
|
||||||
|
@ -204,8 +204,11 @@ static char *getstr(const char *src) {
|
|||||||
eprintf ("Invalid hexpair string\n");
|
eprintf ("Invalid hexpair string\n");
|
||||||
free (ret);
|
free (ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#if 0
|
||||||
|
// what is this for??
|
||||||
case '%':
|
case '%':
|
||||||
return (char *) strtoul (src + 1, NULL, 0);
|
return (char *) strtoul (src + 1, NULL, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
r_str_unescape ((ret = strdup (src)));
|
r_str_unescape ((ret = strdup (src)));
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -661,9 +661,7 @@ R_API int r_socket_ready(RSocket *s, int secs, int usecs) {
|
|||||||
|
|
||||||
R_API char *r_socket_to_string(RSocket *s) {
|
R_API char *r_socket_to_string(RSocket *s) {
|
||||||
#if __WINDOWS__ && !defined(__CYGWIN__) //&& !defined(__MINGW64__)
|
#if __WINDOWS__ && !defined(__CYGWIN__) //&& !defined(__MINGW64__)
|
||||||
char *str = malloc (32);
|
return r_str_newf ("fd%d", (int)(size_t)s->fd);
|
||||||
snprintf (str, 31, "fd%d", s->fd);
|
|
||||||
return str;
|
|
||||||
#elif __UNIX__ || defined(__CYGWIN__)
|
#elif __UNIX__ || defined(__CYGWIN__)
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
|
@ -147,7 +147,7 @@ R_API bool r_json_object_add (RJSVar* object, const char* name, RJSVar* value) {
|
|||||||
object->object.l = len;
|
object->object.l = len;
|
||||||
free (object->object.a);
|
free (object->object.a);
|
||||||
object->object.a = v;
|
object->object.a = v;
|
||||||
free (object->object.n);
|
free ((void *)object->object.n);
|
||||||
object->object.n = (const char**) c;
|
object->object.n = (const char**) c;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ R_API char *r_num_units(char *buf, ut64 num) {
|
|||||||
if (num>=GB) { unit = 'G'; fnum = fnum/GB; } else
|
if (num>=GB) { unit = 'G'; fnum = fnum/GB; } else
|
||||||
if (num>=MB) { unit = 'M'; fnum = fnum/MB; } else
|
if (num>=MB) { unit = 'M'; fnum = fnum/MB; } else
|
||||||
if (num>=KB) { unit = 'K'; fnum = fnum/KB; } else
|
if (num>=KB) { unit = 'K'; fnum = fnum/KB; } else
|
||||||
{ unit = 0; fnum = num; }
|
{ unit = 0; fnum = (double)num; }
|
||||||
tnum = (int)((double)(fnum - (int)fnum)*10);
|
tnum = (int)((double)(fnum - (int)fnum)*10);
|
||||||
if (tnum) {
|
if (tnum) {
|
||||||
snprintf (buf, 31, "%.1f%c", fnum, unit);
|
snprintf (buf, 31, "%.1f%c", fnum, unit);
|
||||||
|
@ -8713,7 +8713,8 @@ R_API int U(r_bin_java_float_cp_set)(RBinJavaObj * bin, ut16 idx, float val) {
|
|||||||
r_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_FLOAT);
|
r_bin_java_check_reset_cp_obj (cp_obj, R_BIN_JAVA_CP_FLOAT);
|
||||||
cp_obj->tag = R_BIN_JAVA_CP_FLOAT;
|
cp_obj->tag = R_BIN_JAVA_CP_FLOAT;
|
||||||
memcpy (bytes, (const char *) &val, 4);
|
memcpy (bytes, (const char *) &val, 4);
|
||||||
val = R_BIN_JAVA_UINT (bytes, 0);
|
float *foo = (float*) bytes;
|
||||||
|
val = *foo; //(float)R_BIN_JAVA_UINT (bytes, 0);
|
||||||
memcpy (&cp_obj->info.cp_float.bytes.raw, (const char *) &val, 4);
|
memcpy (&cp_obj->info.cp_float.bytes.raw, (const char *) &val, 4);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@ SDB_API int sdb_num_set(Sdb *s, const char *key, ut64 v, ut32 cas) {
|
|||||||
SDB_API ut64 sdb_num_inc(Sdb *s, const char *key, ut64 n2, ut32 cas) {
|
SDB_API ut64 sdb_num_inc(Sdb *s, const char *key, ut64 n2, ut32 cas) {
|
||||||
ut32 c;
|
ut32 c;
|
||||||
ut64 n = sdb_num_get (s, key, &c);
|
ut64 n = sdb_num_get (s, key, &c);
|
||||||
if ((cas && c != cas) || (-n2 < n)) {
|
ut64 res = n + n2;
|
||||||
|
if ((cas && c != cas) || res < n) {
|
||||||
return 0LL;
|
return 0LL;
|
||||||
}
|
}
|
||||||
n += n2;
|
sdb_num_set (s, key, res, cas);
|
||||||
sdb_num_set (s, key, n, cas);
|
return res;
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDB_API ut64 sdb_num_dec(Sdb *s, const char *key, ut64 n2, ut32 cas) {
|
SDB_API ut64 sdb_num_dec(Sdb *s, const char *key, ut64 n2, ut32 cas) {
|
||||||
|
@ -1123,7 +1123,7 @@ static int like_cb(void *user, const char *k, const char *v) {
|
|||||||
if (lcd->array) {
|
if (lcd->array) {
|
||||||
int idx = lcd->array_index;
|
int idx = lcd->array_index;
|
||||||
int newsize = lcd->array_size + sizeof (char*) * 2;
|
int newsize = lcd->array_size + sizeof (char*) * 2;
|
||||||
const char **newarray = realloc (lcd->array, newsize);
|
const char **newarray = (const char **)realloc (lcd->array, newsize);
|
||||||
if (!newarray) {
|
if (!newarray) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1163,7 +1163,7 @@ SDB_API char** sdb_like(Sdb *s, const char *k, const char *v, SdbForeachCallback
|
|||||||
lcd.array_index = 0;
|
lcd.array_index = 0;
|
||||||
sdb_foreach (s, like_cb, &lcd);
|
sdb_foreach (s, like_cb, &lcd);
|
||||||
if (lcd.array_index == 0) {
|
if (lcd.array_index == 0) {
|
||||||
free (lcd.array);
|
free ((void*)lcd.array);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return (char**)lcd.array;
|
return (char**)lcd.array;
|
||||||
|
Loading…
Reference in New Issue
Block a user