glib r7306 - in trunk: . glib



Author: tml
Date: Mon Aug  4 18:46:59 2008
New Revision: 7306
URL: http://svn.gnome.org/viewvc/glib?rev=7306&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/glib/giowin32.c
   trunk/glib/gmain.c
   trunk/glib/gspawn-win32-helper.c
   trunk/glib/gspawn-win32.c

Modified: trunk/glib/giowin32.c
==============================================================================
--- trunk/glib/giowin32.c	(original)
+++ trunk/glib/giowin32.c	Mon Aug  4 18:46:59 2008
@@ -1075,7 +1075,7 @@
   
   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);
@@ -1279,7 +1279,7 @@
   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)
@@ -1332,7 +1332,7 @@
   
   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);
@@ -1500,7 +1500,7 @@
   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)
@@ -2045,7 +2045,7 @@
       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))
 	{
@@ -2057,15 +2057,15 @@
       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:

Modified: trunk/glib/gmain.c
==============================================================================
--- trunk/glib/gmain.c	(original)
+++ trunk/glib/gmain.c	Mon Aug  4 18:46:59 2008
@@ -686,7 +686,7 @@
   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)
@@ -4046,7 +4046,7 @@
   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);

Modified: trunk/glib/gspawn-win32-helper.c
==============================================================================
--- trunk/glib/gspawn-win32-helper.c	(original)
+++ trunk/glib/gspawn-win32-helper.c	Mon Aug  4 18:46:59 2008
@@ -30,13 +30,13 @@
 
 
 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);
 }
@@ -163,9 +163,9 @@
   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;

Modified: trunk/glib/gspawn-win32.c
==============================================================================
--- trunk/glib/gspawn-win32.c	(original)
+++ trunk/glib/gspawn-win32.c	Mon Aug  4 18:46:59 2008
@@ -111,7 +111,7 @@
 		   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
@@ -308,22 +308,22 @@
  */
 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);
@@ -349,14 +349,14 @@
 	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)
 {
@@ -429,7 +429,7 @@
 {
   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;
@@ -536,7 +536,7 @@
   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 };
@@ -544,7 +544,7 @@
   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;
@@ -1074,7 +1074,7 @@
       /* 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]