mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 10:08:06 +00:00
Return the full string when requested from a flatbuffers::String, even if it contains a NULL byte.
This commit is contained in:
@@ -379,7 +379,7 @@ template<typename T> static inline size_t VectorLength(const Vector<T> *v) {
|
|||||||
|
|
||||||
struct String : public Vector<char> {
|
struct String : public Vector<char> {
|
||||||
const char *c_str() const { return reinterpret_cast<const char *>(Data()); }
|
const char *c_str() const { return reinterpret_cast<const char *>(Data()); }
|
||||||
std::string str() const { return c_str(); }
|
std::string str() const { return std::string(c_str(), Length()); }
|
||||||
|
|
||||||
bool operator <(const String &o) const {
|
bool operator <(const String &o) const {
|
||||||
return strcmp(c_str(), o.c_str()) < 0;
|
return strcmp(c_str(), o.c_str()) < 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user