szaszm commented on a change in pull request #515: MINIFICPP-646 - Re-evaluate
passing attributes. Potentially deprecate…
URL: https://github.com/apache/nifi-minifi-cpp/pull/515#discussion_r380164560
##########
File path: nanofi/include/core/cstructs.h
##########
@@ -89,8 +89,7 @@ typedef struct processor_context processor_context;
typedef struct {
const char *key;
- void *value;
- size_t value_size;
+ const char *value;
Review comment:
> We provide API to add non-terminated str with length, (something like
strncpy), but inside store null-terminated things.
We can not provide non-null-terminated API for null-terminated storage,
because the former allows for null bytes in the payload while the latter does
not.
+1 for keeping `void*` + `size_t` if the attribute value can ever contain a
null byte as part of the payload, -1 if it is always a string that can be
null-terminated.
edit: If this struct refers to flow file attributes, then I'm 100% for
keeping the data as binary instead of null-terminated. I can think of flows
with binary attributes as a valid use case regardless of whether they're
currently supported or not. Building a null-terminated string API on top of a
binary buffer is possible (see std::string) but not the other way around.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services