summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2008-03-11 00:51:43 -0400
committerKristian Høgsberg <krh@redhat.com>2008-03-11 00:56:17 -0400
commitcc05255191413b3f376edbc600122ff085f45f7b (patch)
treef0dec4c442ec7bb3e443d89a3449be38eb125a32
parentbc504ffbba3dec2e3467bab8ba1ac25db6dd317e (diff)
Make WriteToClient take a const void * like any decent IO write function.
Enough with the casting. Doesn't break API or even ABI, but does make a lot of silly casts superfluos.
-rw-r--r--include/os.h4
-rw-r--r--os/io.c10
-rw-r--r--os/osdep.h2
3 files changed, 9 insertions, 7 deletions
diff --git a/include/os.h b/include/os.h
index 4be6b8010..c0f04c6af 100644
--- a/include/os.h
+++ b/include/os.h
@@ -115,7 +115,7 @@ extern void FlushIfCriticalOutputPending(void);
extern void SetCriticalOutputPending(void);
-extern int WriteToClient(ClientPtr /*who*/, int /*count*/, char* /*buf*/);
+extern int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/);
extern void ResetOsBuffers(void);
@@ -448,7 +448,7 @@ typedef struct {
extern CallbackListPtr ReplyCallback;
typedef struct {
ClientPtr client;
- pointer replyData;
+ const void *replyData;
unsigned long dataLenBytes;
unsigned long bytesRemaining;
Bool startOfReply;
diff --git a/os/io.c b/os/io.c
index e7ec60952..4f4a10903 100644
--- a/os/io.c
+++ b/os/io.c
@@ -730,11 +730,12 @@ SetCriticalOutputPending(void)
*****************/
_X_EXPORT int
-WriteToClient (ClientPtr who, int count, char *buf)
+WriteToClient (ClientPtr who, int count, const void *__buf)
{
OsCommPtr oc = (OsCommPtr)who->osPrivate;
ConnectionOutputPtr oco = oc->output;
int padBytes;
+ const char *buf = __buf;
#ifdef DEBUG_COMMUNICATION
Bool multicount = FALSE;
#endif
@@ -871,13 +872,14 @@ WriteToClient (ClientPtr who, int count, char *buf)
**********************/
int
-FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
+FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
{
ConnectionOutputPtr oco = oc->output;
int connection = oc->fd;
XtransConnInfo trans_conn = oc->trans_conn;
struct iovec iov[3];
static char padBuffer[3];
+ const char *extraBuf = __extraBuf;
long written;
long padsize;
long notWritten;
@@ -916,14 +918,14 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
before = (-len); \
} else { \
iov[i].iov_len = len; \
- iov[i].iov_base = (pointer) + before; \
+ iov[i].iov_base = (pointer) + before; \
i++; \
remain -= len; \
before = 0; \
}
InsertIOV ((char *)oco->buf, oco->count)
- InsertIOV (extraBuf, extraCount)
+ InsertIOV ((char *)extraBuf, extraCount)
InsertIOV (padBuffer, padsize)
errno = 0;
diff --git a/os/osdep.h b/os/osdep.h
index b6894c146..84f7177db 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -184,7 +184,7 @@ typedef struct _osComm {
extern int FlushClient(
ClientPtr /*who*/,
OsCommPtr /*oc*/,
- char* /*extraBuf*/,
+ const void * /*extraBuf*/,
int /*extraCount*/
);