* Various gcc-4.6 warnings fixed

This commit is contained in:
pancake 2011-06-30 00:17:12 +02:00
parent 6d0bd0c320
commit ea98fe1bd6
12 changed files with 32 additions and 26 deletions

View File

@ -40,6 +40,7 @@ static RCore* opencore(const char *f) {
return NULL;
}
r_core_bin_load (c, NULL);
// TODO: must enable io.va here if wanted .. r_config_set_i (c->config, "io.va", va);
return c;
}

View File

@ -66,7 +66,6 @@ R_API RBreakpointItem *r_bp_get(RBreakpoint *bp, ut64 addr) {
}
R_API RBreakpointItem *r_bp_at_addr(RBreakpoint *bp, ut64 addr, int rwx) {
int n = 0;
RBreakpointItem *b;
RListIter *iter;
r_list_foreach (bp->bps, iter, b) {

View File

@ -164,14 +164,12 @@ R_API int r_config_rm(RConfig *cfg, const char *name) {
}
R_API RConfigNode *r_config_set_i(RConfig *cfg, const char *name, const ut64 i) {
ut64 oi;
char buf[128], *ov = NULL;
RConfigNode *node = r_config_node_get (cfg, name);
if (node) {
if (node->flags & CN_RO)
return NULL;
oi = node->i_value;
if (node->value)
ov = strdup (node->value);
else node->value = strdup("");

View File

@ -1037,14 +1037,16 @@ void gdbwrap_ctrl_c(gdbwrap_t *desc)
u_char sended = CTRL_C;
int rval;
// TODO: check rval return values
ASSERT(desc != NULL);
desc->interrupted = TRUE;
send(desc->fd, (void*)&sended, sizeof(u_char), 0);
rval = recv(desc->fd, desc->packet, desc->max_packet_size, 0);
gdbwrap_populate_reg(desc, desc->packet);
rval = send(desc->fd, GDBWRAP_COR_CHECKSUM, strlen(GDBWRAP_COR_CHECKSUM),
0x0);
ASSERT(rval);
rval = send(desc->fd, GDBWRAP_COR_CHECKSUM, strlen(GDBWRAP_COR_CHECKSUM), 0x0);
if (rval != sz) {
}
}

View File

@ -87,7 +87,6 @@ int do_main() {
struct grub_file *file;
struct grub_fs *e2;
grub_err_t err;
struct grub_disk disk;
e2 = &grub_ext2_fs;
file = openimage (e2, IMGFILE);
@ -127,6 +126,7 @@ printf ("fs = %d\n", (int)gfs->file->size);
gfs->file->fs->close (gfs->file);
gfs->file->fs->dir (gfs->file->device, "/", dirhook, 0);
grubfs_free (gfs);
return 0;
}
int main(int argc, char **argv) {

View File

@ -45,13 +45,13 @@ R_API RIOMap *r_io_map_add(struct r_io_t *io, int fd, int flags, ut64 delta, ut6
}
R_API int r_io_map_select(RIO *io, ut64 off) {
ut64 delta = 0;
//ut64 delta = 0;
ut64 fd = -1;//io->fd;
RIOMap *im = NULL;
RListIter *iter;
r_list_foreach (io->maps, iter, im) { // _prev?
if (im && off >= im->from && off < im->to) {
delta = off - im->from + im->delta;
//delta = off - im->from + im->delta;
fd = im->fd;
if (fd == io->raised)
break;

View File

@ -213,6 +213,8 @@ static int fork_and_ptraceme(const char *cmd) {
default:
/* XXX: clean this dirty code */
ret = wait (&status);
if (ret != pid)
eprintf ("Wait event received by different pid %d\n", ret);
if (WIFSTOPPED (status))
eprintf ("Process with PID %d started...\n", (int)pid);
if (WEXITSTATUS (status) == MAGIC_EXIT)

View File

@ -40,7 +40,7 @@ static int __waitpid(int pid) {
static int debug_os_read_at(int pid, ut32 *buf, int sz, ut64 addr) {
ut32 words = sz / sizeof (ut32);
ut32 last = sz % sizeof (ut32);
ut32 x, lr, *at = (int*)(size_t)addr;
ut32 x, lr, *at = (ut32*)(size_t)addr;
if (sz<1 || addr==UT64_MAX)
return -1;
for (x=0; x<words; x++)
@ -58,10 +58,11 @@ static int __read(struct r_io_t *io, RIODesc *fd, ut8 *buf, int len) {
return debug_os_read_at (RIOPTRACE_PID (fd), (ut32*)buf, len, addr);
}
static int ptrace_write_at(int pid, const ut32 *buf, int sz, ut64 addr) {
static int ptrace_write_at(int pid, const ut8 *pbuf, int sz, ut64 addr) {
ut32 *buf = (ut32*)pbuf;
ut32 words = sz / sizeof (ut32);
ut32 last = sz % sizeof (ut32);
ut32 x, lr, *at = (int*)(size_t)addr;
ut32 x, lr, *at = (ut32*)(size_t)addr;
if (sz<1 || addr==UT64_MAX)
return -1;
for (x=0; x<words; x++)

View File

@ -9,7 +9,8 @@
static int r_vala_file(RLang *lang, const char *file) {
void *lib;
char *p, *vapidir, name[512], buf[512];
char *p, name[512], buf[512];
const char *vapidir;
if (!strstr (file, ".vala"))
sprintf (name, "%s.vala", file);
@ -21,19 +22,19 @@ static int r_vala_file(RLang *lang, const char *file) {
vapidir = r_sys_getenv ("VAPIDIR");
if (vapidir && *vapidir)
sprintf (buf, "valac --vapidir=%s --pkg r_core -C %s",
snprintf (buf, sizeof (buf), "valac --vapidir=%s --pkg r_core -C %s",
vapidir, name);
else sprintf (buf, "valac --pkg r_core -C %s", name);
if (system (buf) != 0)
return R_FALSE;
p = strstr (name, ".vala"); if (p) *p=0;
p = strstr (name, ".gs"); if (p) *p=0;
sprintf (buf, "gcc -fPIC -shared %s.c -o lib%s."R_LIB_EXT
snprintf (buf, sizeof (buf), "gcc -fPIC -shared %s.c -o lib%s."R_LIB_EXT
" $(pkg-config --cflags --libs r_core gobject-2.0)", name, name);
if (system (buf) != 0)
return R_FALSE;
sprintf (buf, "./lib%s."R_LIB_EXT, name);
snprintf (buf, sizeof (buf), "./lib%s."R_LIB_EXT, name);
lib = r_lib_dl_open (buf);
if (lib!= NULL) {
void (*fcn)(RCore *);

View File

@ -81,7 +81,6 @@ R_API int r_range_add_from_string(RRange *rgs, const char *string) {
char *str = alloca (len);
char *p = str;
char *p2 = NULL;
RRangeItem *r = NULL;
memcpy (str, string, len);
@ -97,11 +96,11 @@ R_API int r_range_add_from_string(RRange *rgs, const char *string) {
if (p2) {
addr = r_num_get (NULL, p);
addr2 = r_num_get (NULL, p2);
r = r_range_add(rgs, addr, addr2, 1);
r_range_add(rgs, addr, addr2, 1);
p2 = NULL;
} else {
addr = r_num_get (NULL, p);
r = r_range_add(rgs, addr, addr+1, 1);
r_range_add (rgs, addr, addr+1, 1);
}
p = str+i+1;
str[i] = ',';
@ -111,11 +110,11 @@ R_API int r_range_add_from_string(RRange *rgs, const char *string) {
if (p2) {
addr = r_num_get (NULL, p);
addr2 = r_num_get (NULL, p2);
r = r_range_add (rgs, addr, addr2, 1);
r_range_add (rgs, addr, addr2, 1);
} else
if (p) {
addr = r_num_get (NULL, p);
r = r_range_add (rgs, addr, addr+1, 1);
r_range_add (rgs, addr, addr+1, 1);
}
// check r != NULL?
return rgs->changed;

View File

@ -5,7 +5,9 @@ const char *buf[] = { "eax", "ebx", "ecx", NULL };
int main() {
struct r_mem_pool_t *pool = r_mem_pool_new(128, 0, 0);
void *foo = r_mem_pool_alloc(pool);
eprintf ("foo1 = %p\n", foo);
foo = r_mem_pool_alloc(pool);
eprintf ("foo1 = %p\n", foo);
printf ("%d\n", r_mem_count ((const ut8**)buf));

View File

@ -21,6 +21,7 @@ int fun(const char *str, int iters) {
char *ptr;
if (iters == 0) return 0;
ptr = (char *)r_alloca_str (str);
eprintf ("rallocstr %p\n", ptr);
ret = fun(str, iters-1);
return r_alloca_ret_i (ret);
}