Cleanup: remove use of strcpy, following our own convention

Ref !157497
This commit is contained in:
Campbell Barton 2026-04-17 09:46:03 +00:00
parent 89a8ba391e
commit efcd69f7d4
3 changed files with 7 additions and 5 deletions

View file

@ -872,11 +872,11 @@ static Vector<Error> eval_template(std::string *r_out_path,
/* Curly brace escapes. */
case TokenType::LEFT_CURLY_BRACE: {
strcpy(replacement_string, "{");
ARRAY_SET_ITEMS(replacement_string, '{', '\0');
break;
}
case TokenType::RIGHT_CURLY_BRACE: {
strcpy(replacement_string, "}");
ARRAY_SET_ITEMS(replacement_string, '}', '\0');
break;
}

View file

@ -1480,8 +1480,9 @@ char **BKE_sound_get_device_names()
for (int i = 0; i < v_names.size(); i++) {
std::string name = v_names[i];
names[i] = (char *)malloc(sizeof(char) * (name.length() + 1));
strcpy(names[i], name.c_str());
const size_t name_size = sizeof(char) * (name.length() + 1);
names[i] = (char *)malloc(name_size);
memcpy(names[i], name.c_str(), name_size);
}
names[v_names.size()] = nullptr;
audio_device_names = names;

View file

@ -5,6 +5,7 @@
#include "DNA_space_types.h"
#include "BLI_listbase.h"
#include "BLI_string_utf8.h"
#include "BKE_appdir.hh"
#include "BKE_blendfile.hh"
@ -173,7 +174,7 @@ static wmOperatorStatus node_clipboard_copy_exec(bContext *C, wmOperator *op)
{(PartialWriteContext::IDAddOperations::SET_FAKE_USER |
PartialWriteContext::IDAddOperations::SET_CLIPBOARD_MARK)}));
strcpy(copy_tree->idname, node_tree->typeinfo->idname.c_str());
STRNCPY_UTF8(copy_tree->idname, node_tree->typeinfo->idname.c_str());
bke::node_tree_set_type(*copy_tree);
/* Copy node interface to avoid losing links to Group Input and Group Output nodes.