Fix: Incorrect use of StringRef::data()
The returned pointer shouldn't be passed to a function expecting a null terminated C string. Use the StringRef::copy function instead which is more efficient anyway since it doesn't have to measure the size of the string again.
This commit is contained in:
@@ -1593,7 +1593,7 @@ static void legacy_object_modifier_influence(GreasePencilModifierInfluenceData &
|
||||
{
|
||||
influence.flag = 0;
|
||||
|
||||
STRNCPY(influence.layer_name, layername.data());
|
||||
layername.copy(influence.layer_name);
|
||||
if (invert_layer) {
|
||||
influence.flag |= GREASE_PENCIL_INFLUENCE_INVERT_LAYER_FILTER;
|
||||
}
|
||||
@@ -1620,7 +1620,7 @@ static void legacy_object_modifier_influence(GreasePencilModifierInfluenceData &
|
||||
influence.flag |= GREASE_PENCIL_INFLUENCE_INVERT_MATERIAL_PASS_FILTER;
|
||||
}
|
||||
|
||||
STRNCPY(influence.vertex_group_name, vertex_group_name.data());
|
||||
vertex_group_name.copy(influence.vertex_group_name);
|
||||
if (invert_vertex_group) {
|
||||
influence.flag |= GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP;
|
||||
}
|
||||
|
||||
@@ -483,7 +483,6 @@ static void write_node_socket_interface(BlendWriter *writer, const bNodeSocket *
|
||||
static bNodeSocket *make_socket(bNodeTree *ntree,
|
||||
const eNodeSocketInOut in_out,
|
||||
const StringRef idname,
|
||||
|
||||
const StringRef name,
|
||||
const StringRef identifier)
|
||||
{
|
||||
@@ -501,8 +500,8 @@ static bNodeSocket *make_socket(bNodeTree *ntree,
|
||||
|
||||
sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF);
|
||||
|
||||
STRNCPY(sock->identifier, identifier.data());
|
||||
STRNCPY(sock->name, name.data());
|
||||
identifier.copy(sock->identifier);
|
||||
name.copy(sock->name);
|
||||
sock->storage = nullptr;
|
||||
sock->flag |= SOCK_COLLAPSED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user