2008-08-04 Tor Lillqvist <tml@novell.com>
+ * glib/giowin32.c
+ * glib/gmain.c
+ * glib/gspawn-win32.c
+ * glib/gspawn-win32-helper.c: Change gssize casts introduced on
+ 2008-07-28 to gintptr casts now that we have that. gssize is as
+ such the same as gintptr on both 32- and 64-bit Windows, but the
+ gintptr name indicates that it is used to hold pointers, i.e. also
+ HANDLEs.
+
* tests/testglib.c: Avoid warning on Win64 by using gintptr cast
instead if long cast.
watch->condition = condition;
- watch->pollfd.fd = (gssize) G_WIN32_MSG_HANDLE;
+ watch->pollfd.fd = (gintptr) G_WIN32_MSG_HANDLE;
watch->pollfd.events = condition;
g_source_add_poll (source, &watch->pollfd);
if (win32_channel->data_avail_event == NULL)
create_events (win32_channel);
- watch->pollfd.fd = (gssize) win32_channel->data_avail_event;
+ watch->pollfd.fd = (gintptr) win32_channel->data_avail_event;
watch->pollfd.events = condition;
if (win32_channel->debug)
watch->condition = condition;
- watch->pollfd.fd = (gssize) _get_osfhandle (win32_channel->fd);
+ watch->pollfd.fd = _get_osfhandle (win32_channel->fd);
watch->pollfd.events = condition;
g_source_add_poll (source, &watch->pollfd);
if (win32_channel->event == 0)
win32_channel->event = WSACreateEvent ();
- watch->pollfd.fd = (gssize) win32_channel->event;
+ watch->pollfd.fd = (gintptr) win32_channel->event;
watch->pollfd.events = condition;
if (win32_channel->debug)
if (win32_channel->data_avail_event == NULL)
create_events (win32_channel);
- fd->fd = (gssize) win32_channel->data_avail_event;
+ fd->fd = (gintptr) win32_channel->data_avail_event;
if (win32_channel->thread_id == 0 && (condition & G_IO_IN))
{
break;
case G_IO_WIN32_CONSOLE:
- fd->fd = (gssize) _get_osfhandle (win32_channel->fd);
+ fd->fd = _get_osfhandle (win32_channel->fd);
break;
case G_IO_WIN32_SOCKET:
- fd->fd = (gssize) WSACreateEvent ();
+ fd->fd = (gintptr) WSACreateEvent ();
break;
case G_IO_WIN32_WINDOWS_MESSAGES:
- fd->fd = (gssize) G_WIN32_MSG_HANDLE;
+ fd->fd = G_WIN32_MSG_HANDLE;
break;
default:
if (context->wake_up_semaphore == NULL)
g_error ("Cannot create wake-up semaphore: %s",
g_win32_error_message (GetLastError ()));
- context->wake_up_rec.fd = (gssize) context->wake_up_semaphore;
+ context->wake_up_rec.fd = (gintptr) context->wake_up_semaphore;
context->wake_up_rec.events = G_IO_IN;
# ifdef G_MAIN_POLL_DEBUG
if (g_main_poll_debug)
GChildWatchSource *child_watch_source = (GChildWatchSource *)source;
#ifdef G_OS_WIN32
- child_watch_source->poll.fd = (gssize) pid;
+ child_watch_source->poll.fd = (gintptr) pid;
child_watch_source->poll.events = G_IO_IN;
g_source_add_poll (source, &child_watch_source->poll);
static void
-write_err_and_exit (gint fd,
- gssize msg)
+write_err_and_exit (gint fd,
+ gintptr msg)
{
- gssize en = errno;
+ gintptr en = errno;
- write (fd, &msg, sizeof(gssize));
- write (fd, &en, sizeof(gssize));
+ write (fd, &msg, sizeof(gintptr));
+ write (fd, &en, sizeof(gintptr));
_exit (1);
}
int i;
int fd;
int mode;
- gssize handle;
+ gintptr handle;
int saved_errno;
- gssize no_error = CHILD_NO_ERROR;
+ gintptr no_error = CHILD_NO_ERROR;
gint argv_zero_offset = ARG_PROGRAM;
wchar_t **new_wargv;
int argc;
GetCurrentProcess (), &filehandle,
0, FALSE, DUPLICATE_SAME_ACCESS);
close (fd);
- return _open_osfhandle ((gssize) filehandle, mode | _O_NOINHERIT);
+ return _open_osfhandle ((gintptr) filehandle, mode | _O_NOINHERIT);
}
#ifndef GSPAWN_HELPER
*/
static gboolean
read_helper_report (int fd,
- gssize report[2],
+ gintptr report[2],
GError **error)
{
gint bytes = 0;
- while (bytes < sizeof(gssize)*2)
+ while (bytes < sizeof(gintptr)*2)
{
gint chunk;
if (debug)
g_print ("%s:read_helper_report: read %" G_GSIZE_FORMAT "...\n",
__FILE__,
- sizeof(gssize)*2 - bytes);
+ sizeof(gintptr)*2 - bytes);
chunk = read (fd, ((gchar*)report) + bytes,
- sizeof(gssize)*2 - bytes);
+ sizeof(gintptr)*2 - bytes);
if (debug)
g_print ("...got %d bytes\n", chunk);
bytes += chunk;
}
- if (bytes < sizeof(gssize)*2)
+ if (bytes < sizeof(gintptr)*2)
return FALSE;
return TRUE;
}
static void
-set_child_error (gssize report[2],
+set_child_error (gintptr report[2],
const gchar *working_directory,
GError **error)
{
{
const int mode = (exit_status == NULL) ? P_NOWAIT : P_WAIT;
char **new_argv;
- gssize rc = -1;
+ gintptr rc = -1;
int saved_errno;
GError *conv_error = NULL;
gint conv_error_index;
char args[ARG_COUNT][10];
char **new_argv;
int i;
- gssize rc = -1;
+ gintptr rc = -1;
int saved_errno;
int argc;
int stdin_pipe[2] = { -1, -1 };
int stderr_pipe[2] = { -1, -1 };
int child_err_report_pipe[2] = { -1, -1 };
int helper_sync_pipe[2] = { -1, -1 };
- gssize helper_report[2];
+ gintptr helper_report[2];
static gboolean warned_about_child_setup = FALSE;
GError *conv_error = NULL;
gint conv_error_index;
/* Helper process was involved. Read its report now after the
* grandchild has finished.
*/
- gssize helper_report[2];
+ gintptr helper_report[2];
if (!read_helper_report (reportpipe, helper_report, error))
failed = TRUE;