jt2594838 commented on code in PR #489: URL: https://github.com/apache/tsfile/pull/489#discussion_r2153513954
########## cpp/src/common/device_id.h: ########## @@ -35,25 +35,25 @@ namespace storage { class IDeviceID { -public: + public: virtual ~IDeviceID() = default; virtual int serialize(common::ByteStream& write_stream) { return 0; } virtual int deserialize(common::ByteStream& read_stream) { return 0; } virtual std::string get_table_name() { return ""; } virtual int segment_num() { return 0; } - virtual const std::vector<std::string>& get_segments() const { + virtual const std::vector<char*>& get_segments() const { Review Comment: As stated, C-style strings may have a potential problem. How about using std::string*? ########## cpp/src/common/allocator/byte_stream.h: ########## @@ -1047,6 +1048,50 @@ class SerializationUtil { } return ret; } + + // If the str is nullptr, NO_STR_TO_READ will be added instead. + FORCE_INLINE static int write_var_char_ptr(const char* str, ByteStream &out) { + int ret = common::E_OK; + if (str == nullptr) { + write_var_int(storage::NO_STR_TO_READ, out); + return ret; + } + size_t str_len = std::strlen(str); Review Comment: It is not guaranteed that a tag will not contain '\0', so it is invalid to use std::strlen. -- 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. To unsubscribe, e-mail: notifications-unsubscr...@tsfile.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org