aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-go32.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-04-19 15:26:17 +0000
committerPedro Alves <palves@redhat.com>2013-04-19 15:26:17 +0000
commitc628b528e091211bd746e5c9b18b5bc7298d01f3 (patch)
tree6c324664ccf9646b04e3e56162d4b3f6d3b69ff6 /gdb/ser-go32.c
parent51a5cd9059b96a2ac33cf149d369db12b891fd96 (diff)
downloadgdb-c628b528e091211bd746e5c9b18b5bc7298d01f3.zip
gdb-c628b528e091211bd746e5c9b18b5bc7298d01f3.tar.gz
gdb-c628b528e091211bd746e5c9b18b5bc7298d01f3.tar.bz2
serial_write: change prototype to take a void-pointer buffer.
While remote.c works with "char *" buffers most of the time, other remote targets have binary-ish-er protocols, and choose to use "unsigned char" throughout, like e.g., remote-mips.c or remote-m32r-sdi.c. That results in -Wpointer-sign warnings in those targets, unless we add casts in calls to serial_write. Since serial_write is only concerned about sending raw host bytes out, and serial_ops->write_prim already works with "void *"/"size_t", a similar interface to the "write" or "send" system calls, I find it natural to change serial_write's prototype accordingly, avoiding the need for casts. Tested on x86_64 Fedora 17, and also by building x86_64-mingw32 and DJGPP/go32 -hosted gdbs. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * ser-base.c (ser_base_write): Change prototype -- take 'void *' buffer and size_t size. Adjust. * ser-base.h (ser_base_write): Adjust. * ser-go32.c (cnts): Change type to size_t. (dos_write): Change prototype -- take 'void *' buffer and size_t size. Adjust. (dos_info): Print elements of 'cnts' as unsigned long. * serial.c (serial_write): Likewise. * serial.h (serial_write): Adjust. (struct serial_ops) <write>: Change prototype -- take 'void *' buffer and size_t size. Adjust.
Diffstat (limited to 'gdb/ser-go32.c')
-rw-r--r--gdb/ser-go32.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 7d76720..9b321df 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -148,7 +148,7 @@ typedef unsigned long u_long;
#define NCNT 20
static int intrcnt;
-static int cnts[NCNT];
+static size_t cnts[NCNT];
static char *cntnames[NCNT] =
{
/* h/w interrupt counts. */
@@ -230,7 +230,7 @@ static int dos_open (struct serial *scb, const char *name);
static void dos_raw (struct serial *scb);
static int dos_readchar (struct serial *scb, int timeout);
static int dos_setbaudrate (struct serial *scb, int rate);
-static int dos_write (struct serial *scb, const char *str, int len);
+static int dos_write (struct serial *scb, const void *buf, size_t count);
static void dos_close (struct serial *scb);
static serial_ttystate dos_get_tty_state (struct serial *scb);
static int dos_set_tty_state (struct serial *scb, serial_ttystate state);
@@ -787,26 +787,27 @@ dos_setstopbits (struct serial *scb, int num)
}
static int
-dos_write (struct serial *scb, const char *str, int len)
+dos_write (struct serial *scb, const void *buf, size_t count)
{
volatile struct dos_ttystate *port = &ports[scb->fd];
- int fifosize = port->fifo ? 16 : 1;
+ size_t fifosize = port->fifo ? 16 : 1;
long then;
- int cnt;
+ size_t cnt;
+ const char *str = buf;
- while (len > 0)
+ while (count > 0)
{
/* Send the data, fifosize bytes at a time. */
- cnt = fifosize > len ? len : fifosize;
+ cnt = fifosize > count ? count : fifosize;
port->txbusy = 1;
/* Francisco Pastor <fpastor.etra-id@etra.es> says OUTSB messes
up the communications with UARTs with FIFOs. */
#ifdef UART_FIFO_WORKS
outportsb (port->base + com_data, str, cnt);
str += cnt;
- len -= cnt;
+ count -= cnt;
#else
- for ( ; cnt > 0; cnt--, len--)
+ for ( ; cnt > 0; cnt--, count--)
outportb (port->base + com_data, *str++);
#endif
#ifdef DOS_STATS
@@ -904,7 +905,7 @@ dos_info (char *arg, int from_tty)
printf_filtered ("\nTotal interrupts: %d\n", intrcnt);
for (i = 0; i < NCNT; i++)
if (cnts[i])
- printf_filtered ("%s:\t%d\n", cntnames[i], cnts[i]);
+ printf_filtered ("%s:\t%lu\n", cntnames[i], (unsigned long) cnts[i]);
#endif
}