Closed allsey87 closed 3 months ago
Thank you for the report! It looks like a resize function is missing. There's a resize_assignn
test, but it doesn't resize an existing string. I'll leave this open as a help wanted. Fixing it means doing the following:
Make a declaration similar to this one, but using char
instead of uint16_t
and put it in string_functions.h
Implement it similar to this function, but using char
instead of uint16_t
and put it in string_functions.c
Take the expectations on U16String_resize from the test below, and put them into into test_string_functions.cpp
for the new function.
Seems this issue is resolved by https://github.com/ros2/rosidl/pull/806 . @allsey87 or @sloretz could you please close this issue?
Bug report
rosidl_runtime_c__U16String__resize
exists, however, there is norosidl_runtime_c__String__resize
.Required Info:
Expected behavior
Consistent APIs between String and U16String
Actual behavior
Inconsistent APIs between String and U16String
Feature request
Make APIs consistent?
Feature description
Sometimes a
char *
is not directly available, e.g., from a deserialization library. This means that it is not possible to useassignn
without allocating an intermediate buffer. Having a resize function for both String and U16String would solve this problem.Implementation considerations
The workaround I will use is to use
rcutils_get_default_allocator
to update the internals of the string manually.