From 7689a318662f22674c48488cd777cf5694fb0d46 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 28 Aug 2025 17:16:31 +0200 Subject: [PATCH] dix: rpcbuf: add x_rpcbuf_write_INT32s() litle wrapper for directly writing INT32 arrays w/o signess warnings. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/rpcbuf_priv.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dix/rpcbuf_priv.h b/dix/rpcbuf_priv.h index 2469c107b8..7bf6cf3e0a 100644 --- a/dix/rpcbuf_priv.h +++ b/dix/rpcbuf_priv.h @@ -266,6 +266,26 @@ Bool x_rpcbuf_write_CARD16s(x_rpcbuf_t *rpcbuf, const CARD16 *values, Bool x_rpcbuf_write_CARD32s(x_rpcbuf_t *rpcbuf, const CARD32 *values, size_t count) _X_ATTRIBUTE_NONNULL_ARG(1); +/* + * write array of INT32s and do byte-swapping (when needed). + * + * allocate a region for INT32s, write them into the buffer and do byte-swap + * if buffer is configured to do so (`swapped` field is TRUE). + * when `values` or `count` are zero, does nothing. + * + * doesn't do any padding. + * + * @param rpcbuf pointer to x_rpcbuf_t to operate on + * @param values pointer to INT32 array to write + * @param count number of elements in the array + * @return TRUE on success, FALSE on allocation failure + */ +static inline Bool x_rpcbuf_write_INT32s(x_rpcbuf_t *rpcbuf, + const INT32 *values, size_t count) +{ + return x_rpcbuf_write_CARD32s(rpcbuf, (CARD32*)values, count); +} + /* * retrieve number of 4-byte-units (padded) of data written in the buffer *