From ff4015448592cb8dfa12741b2c7ced1189820c85 Mon Sep 17 00:00:00 2001 From: Twarit Waikar Date: Sun, 31 Jul 2022 21:53:48 +0530 Subject: [PATCH] Use std::memcpy instead of memcpy --- godot-git-plugin/src/git_callbacks.cpp | 3 ++- godot-git-plugin/src/git_plugin.cpp | 4 +++- godot-git-plugin/src/git_wrappers.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/godot-git-plugin/src/git_callbacks.cpp b/godot-git-plugin/src/git_callbacks.cpp index 3b8ebb7..0d2f0e7 100644 --- a/godot-git-plugin/src/git_callbacks.cpp +++ b/godot-git-plugin/src/git_callbacks.cpp @@ -1,4 +1,5 @@ #include +#include #include "git_callbacks.h" @@ -9,7 +10,7 @@ extern "C" int progress_cb(const char *str, int len, void *data) { (void)data; char *progress_str = new char[len + 1]; - memcpy(progress_str, str, len); + std::memcpy(progress_str, str, len); progress_str[len] = '\0'; std::cout << "remote: " << CString(godot::String(progress_str).strip_edges()).data << std::endl; delete[] progress_str; diff --git a/godot-git-plugin/src/git_plugin.cpp b/godot-git-plugin/src/git_plugin.cpp index f71836a..6df61b8 100644 --- a/godot-git-plugin/src/git_plugin.cpp +++ b/godot-git-plugin/src/git_plugin.cpp @@ -1,5 +1,7 @@ #include "git_plugin.h" +#include + #include "godot_cpp/core/class_db.hpp" #include "godot_cpp/classes/file.hpp" @@ -644,7 +646,7 @@ godot::Array GitPlugin::_parse_diff(git_diff *diff) { GIT2_CALL_R(git_patch_get_line_in_hunk(&git_diff_line, patch.get(), j, k), "Could not get line from hunk in patch", godot::Array()); char *content = new char[git_diff_line->content_len + 1]; - memcpy(content, git_diff_line->content, git_diff_line->content_len); + std::memcpy(content, git_diff_line->content, git_diff_line->content_len); content[git_diff_line->content_len] = '\0'; godot::String status = " "; // We reserve 1 null terminated space to fill the + or the - character at git_diff_line->origin diff --git a/godot-git-plugin/src/git_wrappers.cpp b/godot-git-plugin/src/git_wrappers.cpp index 9825906..ffbd740 100644 --- a/godot-git-plugin/src/git_wrappers.cpp +++ b/godot-git-plugin/src/git_wrappers.cpp @@ -6,7 +6,7 @@ CString::CString(const godot::String &string) { godot::CharString godot_char_str = string.utf8(); data = new char[godot_char_str.length() + 1]; - memcpy(data, (void *)godot_char_str.get_data(), godot_char_str.length()); + std::memcpy(data, (void *)godot_char_str.get_data(), godot_char_str.length()); data[godot_char_str.length()] = '\0'; }