Fix problems on 64-bit Windows. Avoid warnings, some of which indicated

2008-07-28  Tor Lillqvist  <tml@novell.com>

	Fix problems on 64-bit Windows. Avoid warnings, some of which
	indicated actual problems, some which were just annoyances. 

	Where casts to an integer type are needed for pointers, use
	gssize. Technically intptr_t would be the more proper type, but we
	still want to be compilable with MSVS6 and 7 which don't have
	intptr_t. MSVS8 and 9 do have intptr_t, but in <crtdefs.h>, not
	<stdint.h>.

	Use %p to print out handles. Use gssize casts when assigning
	GPollFD::fd fields.

	Use G_GSIZE_FORMAT when printing size_t values.
	
	* configure.in: Define automake conditional G_OS_WIN32_X64 which
	is true on Win64.

	* glib/giochannel.h: Use slightly different prototype for
	g_io_channel_win32_new_messages() on Win64 with gsize instead of
	guint.

	* glib/giowin32.c
	* glib/gmain.c
	* glib/gspawn-win32.c
	* tests/testglib.c: Generic changes as described above.

	* glib/gmain.h: Don't bother mentioning GIMP in comment.

	* glib/grel.c (tuple_hash_2): Use all bits of pointer.

	* glib/gspawn-win32.c
	* glib/gspawn-win32-helper.c: Use gssize types in the
	communication between parent and helper process, so that we can
	pass process handles, which are pointers, also on Win64.

	* glib/gtimer.c (g_time_val_to_iso8601): time_t is 64 bits on
	Win64 so we can't pass the address of a GTimeVal::tv_sec which is
	a long directly to gmtime(). On the other hand, changing
	GTimeVal::tv_sec to be a gint64 on Win64 is not really feasible
	either, as that would then require changes in much code that uses
	GTimeVals.

	* glib/gspawn-win32.c
	* glib/Makefile.am: Call the helper programs
	gspawn-win64-helper.exe and gspawn-win64-helper-console.exe on
	Win64, to avoid potential risk of running a 32-bit version of the
	helper.


svn path=/trunk/; revision=7260
This commit is contained in:
Tor Lillqvist
2008-07-28 00:24:14 +00:00
committed by Tor Lillqvist
parent 168c4d4708
commit a3fa74853a
11 changed files with 173 additions and 72 deletions

View File

@@ -30,13 +30,13 @@
static void
write_err_and_exit (gint fd,
gint msg)
write_err_and_exit (gint fd,
gssize msg)
{
gint en = errno;
gssize en = errno;
write (fd, &msg, sizeof(msg));
write (fd, &en, sizeof(en));
write (fd, &msg, sizeof(gssize));
write (fd, &en, sizeof(gssize));
_exit (1);
}
@@ -163,9 +163,9 @@ main (int ignored_argc, char **ignored_argv)
int i;
int fd;
int mode;
int handle;
gssize handle;
int saved_errno;
int no_error = CHILD_NO_ERROR;
gssize no_error = CHILD_NO_ERROR;
gint argv_zero_offset = ARG_PROGRAM;
wchar_t **new_wargv;
int argc;