Allow for non-nullterminated object type names (#97)

`StringData::data()` returns the underlying buffer, which might not be null-terminated, so the resulting string from appending to `"class_"` has garbage in the end. Use the `std::string` conversion of `StringData` because it takes the size of the string into account.
This commit is contained in:
Yavor Georgiev 2016-07-16 18:52:31 +02:00 committed by Thomas Goyne
parent 847b6852c9
commit 9320be158c

View File

@ -124,7 +124,7 @@ StringData ObjectStore::object_type_for_table_name(StringData table_name) {
}
std::string ObjectStore::table_name_for_object_type(StringData object_type) {
return std::string(c_object_table_prefix) + object_type.data();
return std::string(c_object_table_prefix) + static_cast<std::string>(object_type);
}
TableRef ObjectStore::table_for_object_type(Group *group, StringData object_type) {