From: Roland S. <ro...@xi...> - 2005-08-23 22:37:05
|
Am Mittwoch, den 24.08.2005, 00:22 +0200 schrieb Armin Bauer: > Someone tried this several days ago, but his compiler did not complain. > so his opensync crashed of course. > > The problem is that im casting between (void *) and (int) which works on > 32 bit but will fail on 64 bit of course due to the size differences. > > Is there any way around this, besides using temp variables? Stefan Behlert sugested to first cast to (intptr_t) which is in inttypes.h http://sourceforge.net/mailarchive/message.php?msg_id=12671515 This works. I found the wrong cast that crashed opensync: Index: opensync/opensync_env.c =================================================================== --- opensync/opensync_env.c (Revision 598) +++ opensync/opensync_env.c (Arbeitskopie) @@ -666,6 +666,7 @@ { osync_bool ret = FALSE; GError *error = NULL; + gsize sz = 0; if (!filename) { osync_debug("OSYNC", 3, "No file open specified"); @@ -679,11 +680,12 @@ return FALSE; } g_io_channel_set_encoding(chan, NULL, NULL); - if (g_io_channel_read_to_end(chan, data, (gsize*)size, &error) != G_IO_STATUS_NORMAL) { + if (g_io_channel_read_to_end(chan, data, &sz, &error) != G_IO_STATUS_NORMAL) { osync_debug("OSYNC", 3, "Unable to read contents of file %s: %s", filename, error->message); osync_error_set(oserror, OSYNC_ERROR_IO_ERROR, "Unable to read contents of file %s: %s", filename, error->message); } else { ret = TRUE; + *size = (int)sz; } g_io_channel_shutdown(chan, FALSE, NULL); g_io_channel_unref(chan); After changing this i'm able to sync a evo2 with the file system. osyncstress with two file-syncs gives random crashes and i'm still looking for a way to get a backtrace in gdb. |