Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions clayer/pysertype.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static bool ddspy_serdata_populate_key (ddspy_serdata_t *this)
// well-formed inputs. So we'd better check.
void * const cdr_data = (char *)this->data + 4;
uint32_t act_size;
if (!dds_stream_normalize (cdr_data, (uint32_t)this->data_size - 4, needs_bswap, xcdr_version, &csertype(this)->cdrstream_desc, (this->c_data.kind == SDK_KEY), &act_size))
if (dds_stream_normalize (cdr_data, (uint32_t)this->data_size - 4, needs_bswap, xcdr_version, &csertype(this)->cdrstream_desc, (this->c_data.kind == SDK_KEY), &act_size) != DDS_STREAM_NORMALIZE_SUCCESS)
return false;
// Fixup encoding header if we byte-swapped the contents
if (needs_bswap)
Expand Down Expand Up @@ -414,7 +414,7 @@ static bool serdata_typeless_to_sample (const struct ddsi_sertype *type, const s
switch (pyst->cdrstream_desc.ops.ops[0]) {
case DDS_OP_PLC: header.enc = DDSI_RTPS_PL_CDR_BE; break;
default: header.enc = DDSI_RTPS_CDR_BE; break;
}
}
}
#elif DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN
if (pysd->is_v2) {
Expand All @@ -427,7 +427,7 @@ static bool serdata_typeless_to_sample (const struct ddsi_sertype *type, const s
switch (pyst->cdrstream_desc.ops.ops[0]) {
case DDS_OP_PLC: header.enc = DDSI_RTPS_PL_CDR_LE; break;
default: header.enc = DDSI_RTPS_CDR_LE; break;
}
}
}
#else
#error "endianness not set properly"
Expand Down Expand Up @@ -752,7 +752,7 @@ static ddspy_sertype_t *ddspy_sertype_new (PyObject *pytype)

const dds_data_type_properties_t data_type_props = PyLong_AsUnsignedLongLong (pydata_type_props);
const bool keyless = !(data_type_props & DDS_DATA_TYPE_CONTAINS_KEY);

new = dds_alloc (sizeof (ddspy_sertype_t));

Py_INCREF (pytype);
Expand Down Expand Up @@ -853,7 +853,7 @@ static dds_return_t init_cdrstream_descriptor (ddspy_sertype_t *sertype)
goto err;
}

dds_topic_descriptor_t desc;
dds_topic_descriptor_t desc = {0};
if ((ret = ddsi_topic_descriptor_from_type (gv, &desc, ddsi_type)) != DDS_RETCODE_OK)
goto err;

Expand Down Expand Up @@ -1135,7 +1135,7 @@ static PyObject *readtake_post (int32_t sts, collector_state_t *state)
for (size_t i = 0; i < state->count; ++i)
{
PyObject *sampleinfo = get_sampleinfo_pyobject(&state->sample_infos[i]);
PyObject *item = Py_BuildValue("(y#O)",
PyObject *item = Py_BuildValue("(y#O)",
state->containers[i].usample,
(Py_ssize_t)state->containers[i].usample_size,
sampleinfo);
Expand Down Expand Up @@ -1163,7 +1163,7 @@ dds_return_t collector_callback_fn(
// Grow allocation, this ensures amortized linear growth while keeping allocation calls minimal.
// Doubling gives exponential growth this makes adding N items only require log2(N) reallocations - efficient!
size_t new_capacity = state->capacity ? state->capacity * 2 : 8;

void *new_containers = dds_realloc(state->containers, new_capacity * sizeof(ddspy_sample_container_t));
void *new_infos = dds_realloc(state->sample_infos, new_capacity * sizeof(dds_sample_info_t));

Expand Down Expand Up @@ -1460,7 +1460,7 @@ static PyObject *ddspy_calc_key (PyObject *self, PyObject *args)
PyBuffer_Release (&sample_data);

// Extract key in correct CDR version (pyserdata->key is now always XCDR2)
const uint32_t xcdr_version = pyserdata->is_v2 ? DDSI_RTPS_CDR_ENC_VERSION_2 : DDSI_RTPS_CDR_ENC_VERSION_1;
const enum dds_cdr_enc_version xcdr_version = pyserdata->is_v2 ? DDSI_RTPS_CDR_ENC_VERSION_2 : DDSI_RTPS_CDR_ENC_VERSION_1;
dds_ostream_t os;
dds_ostream_init (&os, &cdrstream_allocator, 0, xcdr_version);
dds_istream_t is;
Expand Down
6 changes: 5 additions & 1 deletion cyclonedds/idl/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ def populate_locked(self):
self.xcdrv1_head = 0x00
self.xcdrv2_head = 0x06

# Unions start numbering at 1 in XTypes
# I would've liked issubclass(..., IdlUnion), IdlUnion hasn't been defined yet
isunion = any(base.__name__ == "IdlUnion" for base in self.datatype.__mro__)

if self.member_ids is None:
ids = {}
is_hash_id = annotations.get("autoid", "sequential") == "hash"
idc = 0
idc = 1 if isunion else 0

for name, _ in get_extended_type_hints(self.datatype).items():
f_annot = field_annotations.get(name, {})
Expand Down
6 changes: 3 additions & 3 deletions tests/support_modules/fuzz_tools/rand_idl/c_app/xtypes_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static bool topic_desc_eq (const dds_topic_descriptor_t * generated_desc, const
return true;
}

static uint16_t xcdr_version_from_enc_identifier (uint16_t enc_identifier)
static enum dds_cdr_enc_version xcdr_version_from_enc_identifier (uint16_t enc_identifier)
{
switch (enc_identifier)
{
Expand Down Expand Up @@ -365,8 +365,8 @@ int main(int argc, char **argv)
assert(ref.iov_len == data_sz);
assert(ref.iov_base);
dds_istream_t sampstream = {
.m_buffer = ref.iov_base,
.m_size = data_sz,
.m_buffer = ref.iov_base,
.m_size = data_sz,
.m_index = 0,
.m_xcdr_version = keystream.m_xcdr_version
};
Expand Down
Loading