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 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); extern void ResetOsBuffers(void);
@ -448,7 +448,7 @@ typedef struct {
extern CallbackListPtr ReplyCallback; extern CallbackListPtr ReplyCallback;
typedef struct { typedef struct {
ClientPtr client; ClientPtr client;
pointer replyData; const void *replyData;
unsigned long dataLenBytes; unsigned long dataLenBytes;
unsigned long bytesRemaining; unsigned long bytesRemaining;
Bool startOfReply; Bool startOfReply;

10
os/io.c
View File

@ -730,11 +730,12 @@ SetCriticalOutputPending(void)
*****************/ *****************/
_X_EXPORT int _X_EXPORT int
WriteToClient (ClientPtr who, int count, char *buf) WriteToClient (ClientPtr who, int count, const void *__buf)
{ {
OsCommPtr oc = (OsCommPtr)who->osPrivate; OsCommPtr oc = (OsCommPtr)who->osPrivate;
ConnectionOutputPtr oco = oc->output; ConnectionOutputPtr oco = oc->output;
int padBytes; int padBytes;
const char *buf = __buf;
#ifdef DEBUG_COMMUNICATION #ifdef DEBUG_COMMUNICATION
Bool multicount = FALSE; Bool multicount = FALSE;
#endif #endif
@ -871,13 +872,14 @@ WriteToClient (ClientPtr who, int count, char *buf)
**********************/ **********************/
int int
FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount) FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
{ {
ConnectionOutputPtr oco = oc->output; ConnectionOutputPtr oco = oc->output;
int connection = oc->fd; int connection = oc->fd;
XtransConnInfo trans_conn = oc->trans_conn; XtransConnInfo trans_conn = oc->trans_conn;
struct iovec iov[3]; struct iovec iov[3];
static char padBuffer[3]; static char padBuffer[3];
const char *extraBuf = __extraBuf;
long written; long written;
long padsize; long padsize;
long notWritten; long notWritten;
@ -916,14 +918,14 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
before = (-len); \ before = (-len); \
} else { \ } else { \
iov[i].iov_len = len; \ iov[i].iov_len = len; \
iov[i].iov_base = (pointer) + before; \ iov[i].iov_base = (pointer) + before; \
i++; \ i++; \
remain -= len; \ remain -= len; \
before = 0; \ before = 0; \
} }
InsertIOV ((char *)oco->buf, oco->count) InsertIOV ((char *)oco->buf, oco->count)
InsertIOV (extraBuf, extraCount) InsertIOV ((char *)extraBuf, extraCount)
InsertIOV (padBuffer, padsize) InsertIOV (padBuffer, padsize)
errno = 0; errno = 0;

View File

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