single singlep vector vectorp list listp cstring
?null 1 ?null ?null
- int8 x x 2 x 3
+ int8 x x 2 x 3
int16 x x 2
int32 x x
int64 x x
1. Nullable fields are optional and must be properly annotated.
They are written as Optional-Data.
- 2. These are written as Variable-Length Opaque Data rather than
- Variable-Length Array. The size is the byte size not
- the element count.
+ 2. These aren't XDR compatible, it's written as a Variable-Length Array
+ but with 2-byte elements and end-padding. Well int8 is identical
+ to Opaque Data.
3. These are 8-bit strings (e.g. UTF-8), not necessarily ASCII as
specified by String.
}
/*
- Arrays of byte and short are encoded as 'opquate data' for
- compactness, the count is the number of bytes.
-
- Arrays of int32/int64/float/double are written as arrays,
- the count is the number of elements.
+ Arrays of byte and short are encoded as if they were Variable-Length
+ Array but with natural sized elements, followed by padding.
*/
static void xdrio_writev(struct ez_blobio *io, const ez_blob *data, size_t elshift) {
size_t size = data->eb_size << elshift;
- int32_t count = elshift <= 1 ? size : data->eb_size;
+ int32_t count = data->eb_size;
void *v;
blobio_write32(io, count);
static void xdrio_readv(struct ez_blobio *io, ez_blob *data, size_t elshift) {
int32_t count = blobio_readi32(io);
- size_t size = elshift <= 1 ? count : count << elshift;
+ size_t size = count << elshift;
void *src = blobio_take(io, size);
if (src) {
if (mem) {
memcpy(mem, src, size);
data->eb_data = mem;
- data->eb_size = size >> elshift;
+ data->eb_size = count;
blobio_read_align(io, 4);
} else {
io->error = ENOMEM;