mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-01-09 22:25:28 +00:00
Add spice_marshaller_set_uint32
With this function you can update an added uint32 after it being added. To make this possible all the spice_marshaller_add_add_foo functions now return a pointer that can be used as a reference when later setting a value.
This commit is contained in:
parent
eaeb65c53e
commit
93405abac7
@ -526,66 +526,79 @@ int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
|
||||
}
|
||||
#endif
|
||||
|
||||
void spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v)
|
||||
void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(uint64_t));
|
||||
write_uint64(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
void spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v)
|
||||
void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(int64_t));
|
||||
write_int64(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
void spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v)
|
||||
void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(uint32_t));
|
||||
write_uint32(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
void spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v)
|
||||
void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v)
|
||||
{
|
||||
write_uint32((uint8_t *)ref, v);
|
||||
}
|
||||
|
||||
void *spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(int32_t));
|
||||
write_int32(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
void spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v)
|
||||
void *spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(uint16_t));
|
||||
write_uint16(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
void spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v)
|
||||
void *spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(int16_t));
|
||||
write_int16(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
void spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v)
|
||||
void *spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(uint8_t));
|
||||
write_uint8(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
void spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v)
|
||||
void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
|
||||
ptr = spice_marshaller_reserve_space(m, sizeof(int8_t));
|
||||
write_int8(ptr, v);
|
||||
return (void *)ptr;
|
||||
}
|
||||
|
||||
@ -50,13 +50,15 @@ SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int
|
||||
int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
|
||||
int n_vec, size_t skip_bytes);
|
||||
#endif
|
||||
void spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v);
|
||||
void spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v);
|
||||
void spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v);
|
||||
void spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v);
|
||||
void spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v);
|
||||
void spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v);
|
||||
void spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v);
|
||||
void spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v);
|
||||
void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v);
|
||||
void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v);
|
||||
void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v);
|
||||
void *spice_marshaller_add_int32(SpiceMarshaller *m, int32_t v);
|
||||
void *spice_marshaller_add_uint16(SpiceMarshaller *m, uint16_t v);
|
||||
void *spice_marshaller_add_int16(SpiceMarshaller *m, int16_t v);
|
||||
void *spice_marshaller_add_uint8(SpiceMarshaller *m, uint8_t v);
|
||||
void *spice_marshaller_add_int8(SpiceMarshaller *m, int8_t v);
|
||||
|
||||
void spice_marshaller_set_uint32(SpiceMarshaller *m, void *ref, uint32_t v);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user