Github user arpadboda commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/417#discussion_r225853255
--- Diff: libminifi/src/capi/api.cpp ---
@@ -212,7 +214,7 @@ void free_flowfile(flow_file_record *ff) {
* @param size size of value
* @return 0 or -1 based on whether the attributed existed previously (-1)
or not (0)
*/
-uint8_t add_attribute(flow_file_record *ff, char *key, void *value, size_t
size) {
+uint8_t add_attribute(flow_file_record *ff, const char *key, void *value,
size_t size) {
--- End diff --
This is quite the same issue as I've described below (the change in
cstructs.h): add_attribute(ff, "my_key", ...) would compile with warning.
Moreover this function doesn't take ownership (the internal c++ string
representation copies the key), so this signature gives better suggestions on
ownership to the user.
---