diff --git a/examples/dynsub/print_sample.c b/examples/dynsub/print_sample.c index 64b007c380..2507f756d8 100644 --- a/examples/dynsub/print_sample.c +++ b/examples/dynsub/print_sample.c @@ -81,12 +81,15 @@ static void print_sample1_ti (const unsigned char *sample, const DDS_XTypes_Type { case DDS_XTypes_TI_STRING8_SMALL: case DDS_XTypes_TI_STRING8_LARGE: { - const char **p = (const char **) align (sample, c, _Alignof (char *), sizeof (char *)); + const char *p = align (sample, c, _Alignof (char *), sizeof (char *)); if (c->key || c->valid_data) { printf ("%s", sep); if (label) printf ("\"%s\":", label); - printf ("\"%s\"", *p); + if ((typeid->_d == DDS_XTypes_TI_PLAIN_SEQUENCE_SMALL) ? typeid->_u.string_sdefn.bound : typeid->_u.string_ldefn.bound) + printf ("\"%s\"", p); + else + printf ("\"%s\"", *((const char **) p)); } break; } diff --git a/examples/dynsub/type_cache.c b/examples/dynsub/type_cache.c index 76246b074a..da845709d0 100644 --- a/examples/dynsub/type_cache.c +++ b/examples/dynsub/type_cache.c @@ -195,8 +195,19 @@ static void build_typecache_ti (const DDS_XTypes_TypeIdentifier *typeid, size_t { case DDS_XTypes_TI_STRING8_SMALL: case DDS_XTypes_TI_STRING8_LARGE: { - *align = _Alignof (unsigned char *); - *size = sizeof (unsigned char *); + uint32_t bound; + if (typeid->_d == DDS_XTypes_TI_PLAIN_SEQUENCE_SMALL) { + bound = typeid->_u.string_sdefn.bound; + } else { + bound = typeid->_u.string_ldefn.bound; + } + if (bound == 0) { + *align = _Alignof (unsigned char *); + *size = sizeof (unsigned char *); + } else { + *align = 1; + *size = bound; + } break; } case DDS_XTypes_TI_PLAIN_SEQUENCE_SMALL: