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.
This commit is contained in:
Kristian Høgsberg 2008-03-11 00:51:43 -04:00
parent bc504ffbba
commit cc05255191
3 changed files with 9 additions and 7 deletions

View File

@ -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;

10
os/io.c
View File

@ -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;

View File

@ -184,7 +184,7 @@ typedef struct _osComm {
extern int FlushClient(
ClientPtr /*who*/,
OsCommPtr /*oc*/,
char* /*extraBuf*/,
const void * /*extraBuf*/,
int /*extraCount*/
);