diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-28 11:04:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 11:04:05 +0200 |
commit | 305b2a15bf1ed950e8e2ed50fa84456b584798fb (patch) | |
tree | abaa1e01ca34382f4ea1d6e24c403ecff1502f39 /core | |
parent | 7bca90769cbf7ae29023ca8d83ba7ab3137deda3 (diff) | |
parent | 8247667a3ee0d86f26094e722497b0cbb99cc12b (diff) |
Merge pull request #48239 from akien-mga/goodbye-copymem
Core: Drop custom `copymem`/`zeromem` defines
Diffstat (limited to 'core')
-rw-r--r-- | core/input/input_event.h | 1 | ||||
-rw-r--r-- | core/io/compression.cpp | 7 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 3 | ||||
-rw-r--r-- | core/io/file_access_memory.cpp | 5 | ||||
-rw-r--r-- | core/io/file_access_zip.cpp | 3 | ||||
-rw-r--r-- | core/io/http_client.cpp | 2 | ||||
-rw-r--r-- | core/io/image.cpp | 11 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 16 | ||||
-rw-r--r-- | core/io/multiplayer_api.cpp | 2 | ||||
-rw-r--r-- | core/io/packed_data_container.cpp | 2 | ||||
-rw-r--r-- | core/io/stream_peer.cpp | 4 | ||||
-rw-r--r-- | core/io/xml_parser.cpp | 2 | ||||
-rw-r--r-- | core/io/zip_io.cpp | 4 | ||||
-rw-r--r-- | core/math/basis.cpp | 1 | ||||
-rw-r--r-- | core/math/dynamic_bvh.h | 6 | ||||
-rw-r--r-- | core/math/geometry_2d.cpp | 2 | ||||
-rw-r--r-- | core/math/transform.cpp | 1 | ||||
-rw-r--r-- | core/object/callable_method_pointer.h | 7 | ||||
-rw-r--r-- | core/os/copymem.h | 50 | ||||
-rw-r--r-- | core/os/memory.cpp | 1 | ||||
-rw-r--r-- | core/os/pool_allocator.cpp | 3 | ||||
-rw-r--r-- | core/string/ustring.cpp | 8 | ||||
-rw-r--r-- | core/templates/local_vector.h | 5 | ||||
-rw-r--r-- | core/templates/oa_hash_map.h | 1 | ||||
-rw-r--r-- | core/templates/vector.h | 3 | ||||
-rw-r--r-- | core/variant/variant_call.cpp | 2 | ||||
-rw-r--r-- | core/variant/variant_op.cpp | 8 |
27 files changed, 47 insertions, 113 deletions
diff --git a/core/input/input_event.h b/core/input/input_event.h index a1e7df5969..94aa68db33 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -33,7 +33,6 @@ #include "core/io/resource.h" #include "core/math/transform_2d.h" -#include "core/os/copymem.h" #include "core/string/ustring.h" #include "core/typedefs.h" diff --git a/core/io/compression.cpp b/core/io/compression.cpp index 980234cbfc..6de626db99 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -32,7 +32,6 @@ #include "core/config/project_settings.h" #include "core/io/zip_io.h" -#include "core/os/copymem.h" #include "thirdparty/misc/fastlz.h" @@ -44,8 +43,8 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, case MODE_FASTLZ: { if (p_src_size < 16) { uint8_t src[16]; - zeromem(&src[p_src_size], 16 - p_src_size); - copymem(src, p_src, p_src_size); + memset(&src[p_src_size], 0, 16 - p_src_size); + memcpy(src, p_src, p_src_size); return fastlz_compress(src, 16, p_dst); } else { return fastlz_compress(p_src, p_src_size, p_dst); @@ -136,7 +135,7 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p if (p_dst_max_size < 16) { uint8_t dst[16]; ret_size = fastlz_decompress(p_src, p_src_size, dst, 16); - copymem(p_dst, dst, p_dst_max_size); + memcpy(p_dst, dst, p_dst_max_size); } else { ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size); } diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index 8ace897f18..13377a3a25 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -31,7 +31,6 @@ #include "file_access_encrypted.h" #include "core/crypto/crypto_core.h" -#include "core/os/copymem.h" #include "core/string/print_string.h" #include "core/variant/variant.h" @@ -151,7 +150,7 @@ void FileAccessEncrypted::_release() { ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug? compressed.resize(len); - zeromem(compressed.ptrw(), len); + memset(compressed.ptrw(), 0, len); for (int i = 0; i < data.size(); i++) { compressed.write[i] = data[i]; } diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 58670d5246..af155a77a8 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -31,7 +31,6 @@ #include "file_access_memory.h" #include "core/config/project_settings.h" -#include "core/os/copymem.h" #include "core/os/dir_access.h" #include "core/templates/map.h" @@ -149,7 +148,7 @@ int FileAccessMemory::get_buffer(uint8_t *p_dst, int p_length) const { WARN_PRINT("Reading less data than requested"); } - copymem(p_dst, &data[pos], read); + memcpy(p_dst, &data[pos], read); pos += p_length; return read; @@ -176,6 +175,6 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) { WARN_PRINT("Writing less data than requested"); } - copymem(&data[pos], p_src, write); + memcpy(&data[pos], p_src, write); pos += p_length; } diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 586c988974..397b577612 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -32,7 +32,6 @@ #include "file_access_zip.h" -#include "core/os/copymem.h" #include "core/os/file_access.h" ZipArchive *ZipArchive::instance = nullptr; @@ -120,7 +119,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { ERR_FAIL_COND_V_MSG(!f, nullptr, "Cannot open file '" + packages[file.package].filename + "'."); zlib_filefunc_def io; - zeromem(&io, sizeof(io)); + memset(&io, 0, sizeof(io)); io.opaque = f; io.zopen_file = godot_open; diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 3863dce0f6..4b053d576c 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -633,7 +633,7 @@ PackedByteArray HTTPClient::read_response_body_chunk() { ret.resize(chunk.size() - 2); uint8_t *w = ret.ptrw(); - copymem(w, chunk.ptr(), chunk.size() - 2); + memcpy(w, chunk.ptr(), chunk.size() - 2); chunk.clear(); } diff --git a/core/io/image.cpp b/core/io/image.cpp index 873eb66f33..c36fa6e45f 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -34,7 +34,6 @@ #include "core/io/image_loader.h" #include "core/io/resource_loader.h" #include "core/math/math_funcs.h" -#include "core/os/copymem.h" #include "core/string/print_string.h" #include "core/templates/hash_map.h" @@ -1537,7 +1536,7 @@ void Image::shrink_x2() { uint8_t *w = new_img.ptrw(); const uint8_t *r = data.ptr(); - copymem(w, &r[ofs], new_size); + memcpy(w, &r[ofs], new_size); } width = MAX(width / 2, 1); @@ -1932,7 +1931,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con uint8_t* wr = imgdata.ptrw(); - copymem(wr.ptr(), ptr, size); + memcpy(wr.ptr(), ptr, size); wr = uint8_t*(); Ref<Image> im; im.instance(); @@ -1982,7 +1981,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma { uint8_t *w = data.ptrw(); - zeromem(w, size); + memset(w, 0, size); } width = p_width; @@ -3295,7 +3294,7 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipamp) const { { uint8_t *wr = new_data.ptrw(); const uint8_t *rd = data.ptr(); - copymem(wr, rd + ofs, size); + memcpy(wr, rd + ofs, size); } Ref<Image> image; @@ -3622,5 +3621,5 @@ Ref<Resource> Image::duplicate(bool p_subresources) const { } void Image::set_as_black() { - zeromem(data.ptrw(), data.size()); + memset(data.ptrw(), 0, data.size()); } diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 218a612da2..0282609270 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -851,7 +851,7 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) { if (buf) { encode_uint32(utf8.length(), buf); buf += 4; - copymem(buf, utf8.get_data(), utf8.length()); + memcpy(buf, utf8.get_data(), utf8.length()); buf += utf8.length(); } @@ -995,7 +995,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo if (buf) { encode_uint32(utf8.length(), buf); buf += 4; - copymem(buf, utf8.get_data(), utf8.length()); + memcpy(buf, utf8.get_data(), utf8.length()); buf += pad + utf8.length(); } @@ -1079,7 +1079,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo Transform2D val = p_variant; for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { - copymem(&buf[(i * 2 + j) * 4], &val.elements[i][j], sizeof(float)); + memcpy(&buf[(i * 2 + j) * 4], &val.elements[i][j], sizeof(float)); } } } @@ -1130,7 +1130,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo Basis val = p_variant; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - copymem(&buf[(i * 3 + j) * 4], &val.elements[i][j], sizeof(float)); + memcpy(&buf[(i * 3 + j) * 4], &val.elements[i][j], sizeof(float)); } } } @@ -1143,7 +1143,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo Transform val = p_variant; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - copymem(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float)); + memcpy(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float)); } } @@ -1258,7 +1258,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo if (buf) { encode_uint32(utf8.length()+1,buf); buf+=4; - copymem(buf,utf8.get_data(),utf8.length()+1); + memcpy(buf,utf8.get_data(),utf8.length()+1); } r_len+=4+utf8.length()+1; @@ -1314,7 +1314,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo encode_uint32(datalen, buf); buf += 4; const uint8_t *r = data.ptr(); - copymem(buf, &r[0], datalen * datasize); + memcpy(buf, &r[0], datalen * datasize); buf += datalen * datasize; } @@ -1412,7 +1412,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo if (buf) { encode_uint32(utf8.length() + 1, buf); buf += 4; - copymem(buf, utf8.get_data(), utf8.length() + 1); + memcpy(buf, utf8.get_data(), utf8.length() + 1); buf += utf8.length() + 1; } diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index 94060cfe0b..8414ee7c0c 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -897,7 +897,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p // Special optimization when only the byte vector is sent. const Vector<uint8_t> data = *p_arg[0]; MAKE_ROOM(ofs + data.size()); - copymem(&(packet_cache.write[ofs]), data.ptr(), sizeof(uint8_t) * data.size()); + memcpy(&(packet_cache.write[ofs]), data.ptr(), sizeof(uint8_t) * data.size()); ofs += data.size(); } else { // Arguments diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp index a0b97772e6..c6354b11b7 100644 --- a/core/io/packed_data_container.cpp +++ b/core/io/packed_data_container.cpp @@ -317,7 +317,7 @@ Error PackedDataContainer::pack(const Variant &p_data) { datalen = tmpdata.size(); data.resize(tmpdata.size()); uint8_t *w = data.ptrw(); - copymem(w, tmpdata.ptr(), tmpdata.size()); + memcpy(w, tmpdata.ptr(), tmpdata.size()); return OK; } diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 8407d55196..74154321b3 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -433,7 +433,7 @@ Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) { } uint8_t *w = data.ptrw(); - copymem(&w[pointer], p_data, p_bytes); + memcpy(&w[pointer], p_data, p_bytes); pointer += p_bytes; return OK; @@ -466,7 +466,7 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_ } const uint8_t *r = data.ptr(); - copymem(p_buffer, r + pointer, r_received); + memcpy(p_buffer, r + pointer, r_received); pointer += r_received; // FIXME: return what? OK or ERR_* diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index d5eb32513b..a1f8e79adc 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -433,7 +433,7 @@ Error XMLParser::open_buffer(const Vector<uint8_t> &p_buffer) { length = p_buffer.size(); data = memnew_arr(char, length + 1); - copymem(data, p_buffer.ptr(), length); + memcpy(data, p_buffer.ptr(), length); data[length] = 0; P = data; return OK; diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp index 4b4a46e198..fe46868dd0 100644 --- a/core/io/zip_io.cpp +++ b/core/io/zip_io.cpp @@ -30,8 +30,6 @@ #include "zip_io.h" -#include "core/os/copymem.h" - void *zipio_open(void *data, const char *p_fname, int mode) { FileAccess *&f = *(FileAccess **)data; @@ -103,7 +101,7 @@ int zipio_testerror(voidpf opaque, voidpf stream) { voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) { voidpf ptr = memalloc(items * size); - zeromem(ptr, items * size); + memset(ptr, 0, items * size); return ptr; } diff --git a/core/math/basis.cpp b/core/math/basis.cpp index cc2b7c6611..50299902eb 100644 --- a/core/math/basis.cpp +++ b/core/math/basis.cpp @@ -31,7 +31,6 @@ #include "basis.h" #include "core/math/math_funcs.h" -#include "core/os/copymem.h" #include "core/string/print_string.h" #define cofac(row1, col1, row2, col2) \ diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h index 3fb22515a2..0b6286cd9d 100644 --- a/core/math/dynamic_bvh.h +++ b/core/math/dynamic_bvh.h @@ -343,7 +343,7 @@ void DynamicBVH::aabb_query(const AABB &p_box, QueryResult &r_result) { if (depth > threshold) { if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); - copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); + memcpy(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { aux_stack.resize(aux_stack.size() * 2); } @@ -399,7 +399,7 @@ void DynamicBVH::convex_query(const Plane *p_planes, int p_plane_count, const Ve if (depth > threshold) { if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); - copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); + memcpy(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { aux_stack.resize(aux_stack.size() * 2); } @@ -456,7 +456,7 @@ void DynamicBVH::ray_query(const Vector3 &p_from, const Vector3 &p_to, QueryResu if (depth > threshold) { if (aux_stack.is_empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); - copymem(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); + memcpy(aux_stack.ptr(), stack, ALLOCA_STACK_SIZE * sizeof(const Node *)); } else { aux_stack.resize(aux_stack.size() * 2); } diff --git a/core/math/geometry_2d.cpp b/core/math/geometry_2d.cpp index feb1fb2fb8..7b2630b4ff 100644 --- a/core/math/geometry_2d.cpp +++ b/core/math/geometry_2d.cpp @@ -358,7 +358,7 @@ Vector<Point2i> Geometry2D::pack_rects(const Vector<Size2i> &p_sizes, const Size Vector<Vector3i> Geometry2D::partial_pack_rects(const Vector<Vector2i> &p_sizes, const Size2i &p_atlas_size) { Vector<stbrp_node> nodes; nodes.resize(p_atlas_size.width); - zeromem(nodes.ptrw(), sizeof(stbrp_node) * nodes.size()); + memset(nodes.ptrw(), 0, sizeof(stbrp_node) * nodes.size()); stbrp_context context; stbrp_init_target(&context, p_atlas_size.width, p_atlas_size.height, nodes.ptrw(), p_atlas_size.width); diff --git a/core/math/transform.cpp b/core/math/transform.cpp index fab5d124fa..d4d7ff6d28 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -31,7 +31,6 @@ #include "transform.h" #include "core/math/math_funcs.h" -#include "core/os/copymem.h" #include "core/string/print_string.h" void Transform::affine_invert() { diff --git a/core/object/callable_method_pointer.h b/core/object/callable_method_pointer.h index 115797a00c..8ba01be4e4 100644 --- a/core/object/callable_method_pointer.h +++ b/core/object/callable_method_pointer.h @@ -32,7 +32,6 @@ #define CALLABLE_METHOD_POINTER_H #include "core/object/object.h" -#include "core/os/copymem.h" #include "core/templates/hashfuncs.h" #include "core/templates/simple_type.h" #include "core/variant/binder_common.h" @@ -98,7 +97,7 @@ public: } CallableCustomMethodPointer(T *p_instance, void (T::*p_method)(P...)) { - zeromem(&data, sizeof(Data)); // Clear beforehand, may have padding bytes. + memset(&data, 0, sizeof(Data)); // Clear beforehand, may have padding bytes. data.instance = p_instance; #ifdef DEBUG_ENABLED data.object_id = p_instance->get_instance_id(); @@ -153,7 +152,7 @@ public: } CallableCustomMethodPointerRet(T *p_instance, R (T::*p_method)(P...)) { - zeromem(&data, sizeof(Data)); // Clear beforehand, may have padding bytes. + memset(&data, 0, sizeof(Data)); // Clear beforehand, may have padding bytes. data.instance = p_instance; #ifdef DEBUG_ENABLED data.object_id = p_instance->get_instance_id(); @@ -208,7 +207,7 @@ public: } CallableCustomMethodPointerRetC(T *p_instance, R (T::*p_method)(P...) const) { - zeromem(&data, sizeof(Data)); // Clear beforehand, may have padding bytes. + memset(&data, 0, sizeof(Data)); // Clear beforehand, may have padding bytes. data.instance = p_instance; #ifdef DEBUG_ENABLED data.object_id = p_instance->get_instance_id(); diff --git a/core/os/copymem.h b/core/os/copymem.h deleted file mode 100644 index 6fd559356c..0000000000 --- a/core/os/copymem.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************/ -/* copymem.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef COPYMEM_H -#define COPYMEM_H - -#include "core/typedefs.h" - -#ifdef PLATFORM_COPYMEM - -#include "platform_copymem.h" // included from platform/<current_platform>/platform_copymem.h" - -#else - -#include <string.h> - -#define copymem(to, from, count) memcpy(to, from, count) -#define zeromem(to, count) memset(to, 0, count) -#define movemem(to, from, count) memmove(to, from, count) - -#endif - -#endif // COPYMEM_H diff --git a/core/os/memory.cpp b/core/os/memory.cpp index 5910cb0e7b..a756c1d5dd 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -31,7 +31,6 @@ #include "memory.h" #include "core/error/error_macros.h" -#include "core/os/copymem.h" #include "core/templates/safe_refcount.h" #include <stdio.h> diff --git a/core/os/pool_allocator.cpp b/core/os/pool_allocator.cpp index 9be3a62e2f..74e9c24e04 100644 --- a/core/os/pool_allocator.cpp +++ b/core/os/pool_allocator.cpp @@ -31,7 +31,6 @@ #include "pool_allocator.h" #include "core/error/error_macros.h" -#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/os/os.h" #include "core/string/print_string.h" @@ -42,7 +41,7 @@ do { \ void *_dst = &((unsigned char *)pool)[m_to_pos]; \ void *_src = &((unsigned char *)pool)[(m_entry).pos]; \ - movemem(_dst, _src, aligned((m_entry).len)); \ + memmove(_dst, _src, aligned((m_entry).len)); \ (m_entry).pos = m_to_pos; \ } while (0); diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index cf0040353d..c8d71c3236 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -4765,7 +4765,7 @@ Vector<uint8_t> String::to_ascii_buffer() const { size_t len = charstr.length(); retval.resize(len); uint8_t *w = retval.ptrw(); - copymem(w, charstr.ptr(), len); + memcpy(w, charstr.ptr(), len); return retval; } @@ -4781,7 +4781,7 @@ Vector<uint8_t> String::to_utf8_buffer() const { size_t len = charstr.length(); retval.resize(len); uint8_t *w = retval.ptrw(); - copymem(w, charstr.ptr(), len); + memcpy(w, charstr.ptr(), len); return retval; } @@ -4797,7 +4797,7 @@ Vector<uint8_t> String::to_utf16_buffer() const { size_t len = charstr.length() * sizeof(char16_t); retval.resize(len); uint8_t *w = retval.ptrw(); - copymem(w, (const void *)charstr.ptr(), len); + memcpy(w, (const void *)charstr.ptr(), len); return retval; } @@ -4812,7 +4812,7 @@ Vector<uint8_t> String::to_utf32_buffer() const { size_t len = s->length() * sizeof(char32_t); retval.resize(len); uint8_t *w = retval.ptrw(); - copymem(w, (const void *)s->ptr(), len); + memcpy(w, (const void *)s->ptr(), len); return retval; } diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h index ffd17b7ee9..5f22e08eb8 100644 --- a/core/templates/local_vector.h +++ b/core/templates/local_vector.h @@ -32,7 +32,6 @@ #define LOCAL_VECTOR_H #include "core/error/error_macros.h" -#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/templates/sort_array.h" #include "core/templates/vector.h" @@ -216,7 +215,7 @@ public: Vector<T> ret; ret.resize(size()); T *w = ret.ptrw(); - copymem(w, data, sizeof(T) * count); + memcpy(w, data, sizeof(T) * count); return ret; } @@ -224,7 +223,7 @@ public: Vector<uint8_t> ret; ret.resize(count * sizeof(T)); uint8_t *w = ret.ptrw(); - copymem(w, data, sizeof(T) * count); + memcpy(w, data, sizeof(T) * count); return ret; } diff --git a/core/templates/oa_hash_map.h b/core/templates/oa_hash_map.h index 1d4176eb10..2c7c64cd78 100644 --- a/core/templates/oa_hash_map.h +++ b/core/templates/oa_hash_map.h @@ -32,7 +32,6 @@ #define OA_HASH_MAP_H #include "core/math/math_funcs.h" -#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/templates/hashfuncs.h" diff --git a/core/templates/vector.h b/core/templates/vector.h index a56a941dbc..4cd68aeb5c 100644 --- a/core/templates/vector.h +++ b/core/templates/vector.h @@ -38,7 +38,6 @@ */ #include "core/error/error_macros.h" -#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/templates/cowdata.h" #include "core/templates/sort_array.h" @@ -134,7 +133,7 @@ public: Vector<uint8_t> to_byte_array() const { Vector<uint8_t> ret; ret.resize(size() * sizeof(T)); - copymem(ret.ptrw(), ptr(), sizeof(T) * size()); + memcpy(ret.ptrw(), ptr(), sizeof(T) * size()); return ret; } diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 7f83e27dfe..c8d26f02cb 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -500,7 +500,7 @@ struct _VariantCall { const uint8_t *r = p_instance->ptr(); CharString cs; cs.resize(p_instance->size() + 1); - copymem(cs.ptrw(), r, p_instance->size()); + memcpy(cs.ptrw(), r, p_instance->size()); cs[p_instance->size()] = 0; s = cs.get_data(); diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index e0a3cf4215..6cbc98d14d 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -1365,10 +1365,10 @@ void register_op(Variant::Operator p_op, Variant::Type p_type_a, Variant::Type p } void Variant::_register_variant_operators() { - zeromem(operator_return_type_table, sizeof(operator_return_type_table)); - zeromem(operator_evaluator_table, sizeof(operator_evaluator_table)); - zeromem(validated_operator_evaluator_table, sizeof(validated_operator_evaluator_table)); - zeromem(ptr_operator_evaluator_table, sizeof(ptr_operator_evaluator_table)); + memset(operator_return_type_table, 0, sizeof(operator_return_type_table)); + memset(operator_evaluator_table, 0, sizeof(operator_evaluator_table)); + memset(validated_operator_evaluator_table, 0, sizeof(validated_operator_evaluator_table)); + memset(ptr_operator_evaluator_table, 0, sizeof(ptr_operator_evaluator_table)); register_op<OperatorEvaluatorAdd<int64_t, int64_t, int64_t>>(Variant::OP_ADD, Variant::INT, Variant::INT); register_op<OperatorEvaluatorAdd<double, int64_t, double>>(Variant::OP_ADD, Variant::INT, Variant::FLOAT); |