summaryrefslogtreecommitdiff
path: root/gdb/ser-base.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-04-19 15:26:16 +0000
committerPedro Alves <palves@redhat.com>2013-04-19 15:26:16 +0000
commitd6617aac65a3e5acc91ea0905a0bdd543a821f2d (patch)
tree80f739a2b3fa8d83b871c9b9d010038fb9b8ec63 /gdb/ser-base.c
parenta2429991882d4235f1eb017ddd0a9d8f1e8b5398 (diff)
downloadgdb-d6617aac65a3e5acc91ea0905a0bdd543a821f2d.tar.gz
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-base.c')
-rw-r--r--gdb/ser-base.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index c602650b2ec..52c57264931 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -440,17 +440,18 @@ ser_base_readchar (struct serial *scb, int timeout)
}
int
-ser_base_write (struct serial *scb, const char *str, int len)
+ser_base_write (struct serial *scb, const void *buf, size_t count)
{
+ const char *str = buf;
int cc;
- while (len > 0)
+ while (count > 0)
{
- cc = scb->ops->write_prim (scb, str, len);
+ cc = scb->ops->write_prim (scb, str, count);
if (cc < 0)
return 1;
- len -= cc;
+ count -= cc;
str += cc;
}
return 0;