lib: xpc: fix overlapping variable uses in xpc_buffer_t
This commit is contained in:
@@ -16,14 +16,13 @@
|
||||
.buf_flags = XPC_BUFFER_F_OUT | XPC_BUFFER_F_REMOTE, \
|
||||
.buf_origin = (msg), \
|
||||
.buf_offset = (offset), \
|
||||
.buf_len = (size), \
|
||||
.buf_max = (size), \
|
||||
}
|
||||
#define XPC_LOCAL_BUFFER_OUT(ptr, size) \
|
||||
{ \
|
||||
.buf_flags = XPC_BUFFER_F_OUT, \
|
||||
.buf_ptr = (ptr), \
|
||||
.buf_max = (size), \
|
||||
.buf_len = (size), \
|
||||
}
|
||||
|
||||
struct xpc_msg;
|
||||
@@ -46,27 +45,18 @@ typedef enum xpc_buffer_flags {
|
||||
|
||||
typedef struct xpc_buffer {
|
||||
xpc_buffer_flags_t buf_flags;
|
||||
union {
|
||||
/* fields that are only valid if F_OUT is set */
|
||||
struct {
|
||||
/* only valid if F_OUT is set. specifies the maximum
|
||||
* number of chars that can be written to buf_buf,
|
||||
* including the null terminator. */
|
||||
size_t buf_max;
|
||||
/* only valid if F_OUT is set.
|
||||
* if F_FREE_ON_DISCARD is set, must be either NULL or
|
||||
* allocated via xpc_context_alloc */
|
||||
void *buf_ptr;
|
||||
};
|
||||
|
||||
/* fields that are only valid if F_IN is set */
|
||||
struct {
|
||||
/* only valid if F_IN is set. offset of the buffer data
|
||||
* within the associated message. used when reading
|
||||
* buffer data from a message. */
|
||||
size_t buf_offset;
|
||||
};
|
||||
};
|
||||
/* only valid if F_OUT is set. specifies the maximum
|
||||
* number of chars that can be written to buf_buf,
|
||||
* including the null terminator. */
|
||||
size_t buf_max;
|
||||
/* only valid if F_OUT is set.
|
||||
* if F_FREE_ON_DISCARD is set, must be either NULL or
|
||||
* allocated via xpc_context_alloc */
|
||||
void *buf_ptr;
|
||||
/* valid for F_IN and F_OUT. offset of the buffer data
|
||||
* within the associated message. used when reading
|
||||
* buffer data from a message. */
|
||||
size_t buf_offset;
|
||||
|
||||
/* only valid if F_REMOTE is set.
|
||||
* used to read/write buffer data from/to the sender's address
|
||||
|
||||
Reference in New Issue
Block a user