Cleanup: Remove misleading std::string reference binding
These functions that retrieve strings from assets return stringrefs. Storing them as std::strings is unnecessary and relies on binding to the const references.
This commit is contained in:
parent
6577d2df8c
commit
5ae3fa50e2
Notes:
blender-bot
2023-02-14 10:48:33 +01:00
Referenced by issue #102340, Geometry Node: Crash on adding image or video file in node group Referenced by issue #101188, Regression: Fluid Physics not working
|
@ -351,7 +351,7 @@ static void init_indexer_entry_from_value(FileIndexerEntry &indexer_entry,
|
|||
{
|
||||
indexer_entry.idcode = entry.get_idcode();
|
||||
|
||||
const std::string &name = entry.get_name();
|
||||
const std::string name = entry.get_name();
|
||||
BLI_strncpy(
|
||||
indexer_entry.datablock_info.name, name.c_str(), sizeof(indexer_entry.datablock_info.name));
|
||||
|
||||
|
@ -359,19 +359,19 @@ static void init_indexer_entry_from_value(FileIndexerEntry &indexer_entry,
|
|||
indexer_entry.datablock_info.asset_data = asset_data;
|
||||
|
||||
if (entry.has_description()) {
|
||||
const std::string &description = entry.get_description();
|
||||
char *description_c_str = static_cast<char *>(MEM_mallocN(description.length() + 1, __func__));
|
||||
BLI_strncpy(description_c_str, description.c_str(), description.length() + 1);
|
||||
const StringRefNull description = entry.get_description();
|
||||
char *description_c_str = static_cast<char *>(MEM_mallocN(description.size() + 1, __func__));
|
||||
BLI_strncpy(description_c_str, description.c_str(), description.size() + 1);
|
||||
asset_data->description = description_c_str;
|
||||
}
|
||||
if (entry.has_author()) {
|
||||
const std::string &author = entry.get_author();
|
||||
char *author_c_str = static_cast<char *>(MEM_mallocN(author.length() + 1, __func__));
|
||||
BLI_strncpy(author_c_str, author.c_str(), author.length() + 1);
|
||||
const StringRefNull author = entry.get_author();
|
||||
char *author_c_str = static_cast<char *>(MEM_mallocN(author.size() + 1, __func__));
|
||||
BLI_strncpy(author_c_str, author.c_str(), author.size() + 1);
|
||||
asset_data->author = author_c_str;
|
||||
}
|
||||
|
||||
const std::string &catalog_name = entry.get_catalog_name();
|
||||
const StringRefNull catalog_name = entry.get_catalog_name();
|
||||
BLI_strncpy(asset_data->catalog_simple_name,
|
||||
catalog_name.c_str(),
|
||||
sizeof(asset_data->catalog_simple_name));
|
||||
|
|
Loading…
Reference in New Issue