mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
dix: rpcbuf: add x_rpcbuf_pad() for padding the buffer
New function for padding the buffer to full protocol units granularity: If the current write position isn't at 4-byte granularity, it reserves the remaining number of bytes (ie. writing zeros), in order to make the next write align to 4-byte granularity again. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
02737a1cd4
commit
e07a939765
@@ -244,4 +244,15 @@ static inline CARD32 x_rpcbuf_wsize_units(x_rpcbuf_t *rpcbuf) {
|
||||
return (CARD32)((rpcbuf->wpos + 3) / 4);
|
||||
}
|
||||
|
||||
/*
|
||||
* pad the buffer to 4-byte-units (ie. write extra zeros if necessary)
|
||||
*
|
||||
* @param rpcbuf pointer to x_rpcbuf_t to operate on
|
||||
*/
|
||||
static inline void x_rpcbuf_pad(x_rpcbuf_t *rpcbuf) {
|
||||
x_rpcbuf_reserve0(
|
||||
rpcbuf,
|
||||
(((rpcbuf->wpos + 3) / 4) * 4) - rpcbuf->wpos);
|
||||
}
|
||||
|
||||
#endif /* _XSERVER_DIX_RPCBUF_PRIV_H */
|
||||
|
||||
Reference in New Issue
Block a user