This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API


http://sourceware.org/ml/gdb-patches/2010-03/msg00101.html

In order to complete the fix for 1.5 Cygwin API,
we need to fix the compilation failure in
remote-fileio.c source.

Christopher said in a previous email that he
didn't have an opinion about that part.
http://sourceware.org/ml/gdb-patches/2010-03/msg00260.html

I do not really know if there is a specific maintainer for this
file... Could someone (a global maintainr?)
please review this patch?

Pierre 

2010-03-04  Pierre Muller  <muller@ics.u-strasbg.fr>

	* remote-fileio.c:
	(__USE_OLD_CYGWIN_API_): New macro, set for
	older cygwin API that does not have cygwin_conv_path.
	(cygwin_conv_path): New static function emulating
	new cygwin API.
	


Index: remote-fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-fileio.c,v
retrieving revision 1.34
diff -u -p -r1.34 remote-fileio.c
--- remote-fileio.c	1 Mar 2010 09:09:24 -0000	1.34
+++ remote-fileio.c	4 Mar 2010 15:06:28 -0000
@@ -35,9 +35,45 @@
 #include <sys/time.h>
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>		/* For
cygwin_conv_to_full_posix_path.  */
+#include <cygwin/version.h>
+#if
CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API
_MINOR) < 181
+#define __USE_OLD_CYGWIN_API_
+#endif
+
 #endif
 #include <signal.h>
 
+#ifdef __USE_OLD_CYGWIN_API_
+/* Possible 'what' values in calls to cygwin_conv_path/cygwin_create_path.
*/
+enum
+{
+  CCP_POSIX_TO_WIN_A = 0, /* from is char*, to is char*       */
+  CCP_POSIX_TO_WIN_W,	  /* from is char*, to is wchar_t*    */
+  CCP_WIN_A_TO_POSIX,	  /* from is char*, to is char*       */
+  CCP_WIN_W_TO_POSIX,	  /* from is wchar_t*, to is char*    */
+
+  /* Or these values to the above as needed. */
+  CCP_ABSOLUTE = 0,	  /* Request absolute path (default). */
+  CCP_RELATIVE = 0x100    /* Request to keep path relative.   */
+};
+typedef unsigned int cygwin_conv_path_t;
+
+static ssize_t 
+cygwin_conv_path (cygwin_conv_path_t what, const void *from,
+				 void *to, size_t size)
+{
+  if (size < PATH_MAX) 
+    internal_error (__FILE__,__LINE__, 
+      "string buffer too short in cygwin_conv_path");
+ 
+  if (what == CCP_WIN_A_TO_POSIX) 
+    return cygwin_conv_to_full_posix_path (from, to);
+  else
+    internal_error (__FILE__,__LINE__,"Error in cygwin_conv_path");
+}
+#endif /* __USE_OLD_CYGWIN_API_ */
+
+
 static struct {
   int *fd_map;
   int fd_map_size;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]