*** empty log message ***
[binutils-gdb.git] / gdb / ser-mingw.c
index 6a883aa19a39a95e7ecd9385ef8de791077e17ad..877657b4ca2239bb65c20b53df12496514f8bd67 100644 (file)
@@ -1,6 +1,6 @@
 /* Serial interface for local (hardwired) serial ports on Windows systems
 
-   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -32,6 +32,8 @@
 #include "gdb_assert.h"
 #include "gdb_string.h"
 
+#include "command.h"
+
 void _initialize_ser_windows (void);
 
 struct ser_windows_state
@@ -59,7 +61,7 @@ ser_windows_open (struct serial *scb, const char *name)
       return -1;
     }
 
-  scb->fd = _open_osfhandle ((long) h, O_RDWR);
+  scb->fd = _open_osfhandle ((intptr_t) h, O_RDWR);
   if (scb->fd < 0)
     {
       errno = ENOENT;
@@ -571,6 +573,7 @@ console_select_thread (void *arg)
 
       SetEvent(state->have_stopped);
     }
+  return 0;
 }
 
 static int
@@ -631,6 +634,7 @@ pipe_select_thread (void *arg)
 
       SetEvent (state->have_stopped);
     }
+  return 0;
 }
 
 static DWORD WINAPI
@@ -655,6 +659,7 @@ file_select_thread (void *arg)
 
       SetEvent (state->have_stopped);
     }
+  return 0;
 }
 
 static void
@@ -746,6 +751,7 @@ ser_console_get_tty_state (struct serial *scb)
   if (isatty (scb->fd))
     {
       struct ser_console_ttystate *state;
+
       state = (struct ser_console_ttystate *) xmalloc (sizeof *state);
       state->is_a_tty = 1;
       return state;
@@ -817,12 +823,14 @@ pipe_windows_open (struct serial *scb, const char *name)
 {
   struct pipe_state *ps;
   FILE *pex_stderr;
+  char **argv;
+  struct cleanup *back_to;
 
   if (name == NULL)
     error_no_arg (_("child command"));
 
-  char **argv = gdb_buildargv (name);
-  struct cleanup *back_to = make_cleanup_freeargv (argv);
+  argv = gdb_buildargv (name);
+  back_to = make_cleanup_freeargv (argv);
 
   if (! argv[0] || argv[0][0] == '\0')
     error ("missing child command");
@@ -978,6 +986,7 @@ pipe_avail (struct serial *scb, int fd)
   HANDLE h = (HANDLE) _get_osfhandle (fd);
   DWORD numBytes;
   BOOL r = PeekNamedPipe (h, NULL, 0, NULL, &numBytes, NULL);
+
   if (r == FALSE)
     numBytes = 0;
   return numBytes;