diff --git a/core/image.cpp b/core/image.cpp index ec09043194c..813973ee7cc 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -35,7 +35,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/print_string.h" #include "thirdparty/misc/hq2x.h" @@ -1369,7 +1368,7 @@ void Image::shrink_x2() { PoolVector::Write w = new_img.write(); PoolVector::Read r = data.read(); - copymem(w.ptr(), &r[ofs], new_size); + memcpy(w.ptr(), &r[ofs], new_size); } width = MAX(width / 2, 1); @@ -1593,7 +1592,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma data.resize(size); { PoolVector::Write w = data.write(); - zeromem(w.ptr(), size); + memset(w.ptr(), 0, size); } width = p_width; diff --git a/core/io/compression.cpp b/core/io/compression.cpp index 09983ae3d6e..9405f2c60f0 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -31,7 +31,6 @@ #include "compression.h" #include "core/io/zip_io.h" -#include "core/os/copymem.h" #include "core/project_settings.h" #include "thirdparty/misc/fastlz.h" @@ -46,8 +45,8 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, 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); @@ -142,7 +141,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 4597354ee56..5385478cb2c 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/print_string.h" #include "core/variant.h" @@ -137,7 +136,7 @@ void FileAccessEncrypted::close() { 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 231d58f6228..d0bb13c3e58 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/map.h" -#include "core/os/copymem.h" #include "core/os/dir_access.h" #include "core/project_settings.h" @@ -161,7 +160,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; @@ -191,7 +190,7 @@ 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 b35ece9de43..a8c0cfc41f5 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 = NULL; @@ -133,7 +132,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { ERR_FAIL_COND_V_MSG(!f, NULL, "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 f2e8442df0a..d810b40c50d 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -662,7 +662,7 @@ PoolByteArray HTTPClient::read_response_body_chunk() { ret.resize(chunk.size() - 2); PoolByteArray::Write w = ret.write(); - copymem(w.ptr(), chunk.ptr(), chunk.size() - 2); + memcpy(w.ptr(), chunk.ptr(), chunk.size() - 2); chunk.clear(); } diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 189cf31907e..12a9b91a74f 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -765,7 +765,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(); } @@ -918,7 +918,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(); } @@ -975,7 +975,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo 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)); } } } @@ -1031,7 +1031,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo 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)); } } } @@ -1046,7 +1046,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo 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)); } } @@ -1162,7 +1162,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; @@ -1217,7 +1217,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo encode_uint32(datalen, buf); buf += 4; PoolVector::Read r = data.read(); - copymem(buf, &r[0], datalen * datasize); + memcpy(buf, &r[0], datalen * datasize); buf += datalen * datasize; } @@ -1282,7 +1282,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/stream_peer.cpp b/core/io/stream_peer.cpp index 059f66354a2..47831d4cd59 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -444,7 +444,7 @@ Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) { } PoolVector::Write w = data.write(); - copymem(&w[pointer], p_data, p_bytes); + memcpy(&w[pointer], p_data, p_bytes); pointer += p_bytes; return OK; @@ -479,7 +479,7 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_ } PoolVector::Read r = data.read(); - copymem(p_buffer, r.ptr() + pointer, r_received); + memcpy(p_buffer, r.ptr() + 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 50b584f05e2..ec2f87bc0d8 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -477,7 +477,7 @@ Error XMLParser::open_buffer(const Vector &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 391285f96ae..b7359c1b0ba 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; @@ -112,7 +110,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/local_vector.h b/core/local_vector.h index 752232c839a..37a4fd3d1ab 100644 --- a/core/local_vector.h +++ b/core/local_vector.h @@ -32,7 +32,6 @@ #define LOCAL_VECTOR_H #include "core/error_macros.h" -#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/sort_array.h" #include "core/vector.h" @@ -215,7 +214,7 @@ public: Vector ret; ret.resize(size()); T *w = ret.ptrw(); - copymem(w, data, sizeof(T) * count); + memcpy(w, data, sizeof(T) * count); return ret; } @@ -223,7 +222,7 @@ public: Vector 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/math/basis.cpp b/core/math/basis.cpp index a00e703cdb4..1731b5f1fac 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/print_string.h" #define cofac(row1, col1, row2, col2) \ diff --git a/core/math/bvh_tree.h b/core/math/bvh_tree.h index a6dc2a6817d..45f8df0c6d2 100644 --- a/core/math/bvh_tree.h +++ b/core/math/bvh_tree.h @@ -135,7 +135,7 @@ public: if (depth > threshold) { if (aux_stack.empty()) { aux_stack.resize(ALLOCA_STACK_SIZE * 2); - copymem(aux_stack.ptr(), stack, get_alloca_stacksize()); + memcpy(aux_stack.ptr(), stack, get_alloca_stacksize()); } else { aux_stack.resize(aux_stack.size() * 2); } diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index dedf1e0bc29..f976ac3a372 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -1239,7 +1239,7 @@ Vector Geometry::partial_pack_rects(const Vector 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 fcb63a23cd4..91d50b7edbe 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/print_string.h" void Transform::affine_invert() { diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h index 4096366f6fa..127a1cc26ae 100644 --- a/core/oa_hash_map.h +++ b/core/oa_hash_map.h @@ -33,7 +33,6 @@ #include "core/hashfuncs.h" #include "core/math/math_funcs.h" -#include "core/os/copymem.h" #include "core/os/memory.h" /** diff --git a/core/os/copymem.h b/core/os/copymem.h deleted file mode 100644 index 39d51e395c7..00000000000 --- 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//platform_copymem.h" - -#else - -#include - -#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 diff --git a/core/os/input_event.h b/core/os/input_event.h index 6248f99f781..ab4d9982dd8 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -32,7 +32,6 @@ #define INPUT_EVENT_H #include "core/math/transform_2d.h" -#include "core/os/copymem.h" #include "core/resource.h" #include "core/typedefs.h" #include "core/ustring.h" diff --git a/core/os/memory.cpp b/core/os/memory.cpp index 5c47efc7628..9afa3b3696e 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -31,7 +31,6 @@ #include "memory.h" #include "core/error_macros.h" -#include "core/os/copymem.h" #include "core/safe_refcount.h" #include diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 3fcdf37b806..33ee9db1aa2 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -336,7 +336,7 @@ Error PackedDataContainer::pack(const Variant &p_data) { datalen = tmpdata.size(); data.resize(tmpdata.size()); PoolVector::Write w = data.write(); - copymem(w.ptr(), tmpdata.ptr(), tmpdata.size()); + memcpy(w.ptr(), tmpdata.ptr(), tmpdata.size()); return OK; } diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp index 83c92d0dda9..6096238c6da 100644 --- a/core/pool_allocator.cpp +++ b/core/pool_allocator.cpp @@ -31,7 +31,6 @@ #include "pool_allocator.h" #include "core/error_macros.h" -#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/os/os.h" #include "core/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/pool_vector.h b/core/pool_vector.h index dc7a5fe81c3..1e1f658a1d3 100644 --- a/core/pool_vector.h +++ b/core/pool_vector.h @@ -31,7 +31,6 @@ #ifndef POOL_VECTOR_H #define POOL_VECTOR_H -#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/os/mutex.h" #include "core/os/rw_lock.h" diff --git a/core/variant_call.cpp b/core/variant_call.cpp index b7296de1c2c..dc94edf55d1 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -329,7 +329,7 @@ struct _VariantCall { size_t len = charstr.length(); retval.resize(len); PoolByteArray::Write w = retval.write(); - copymem(w.ptr(), charstr.ptr(), len); + memcpy(w.ptr(), charstr.ptr(), len); w.release(); r_ret = retval; @@ -348,7 +348,7 @@ struct _VariantCall { size_t len = charstr.length(); retval.resize(len); PoolByteArray::Write w = retval.write(); - copymem(w.ptr(), charstr.ptr(), len); + memcpy(w.ptr(), charstr.ptr(), len); w.release(); r_ret = retval; @@ -366,7 +366,7 @@ struct _VariantCall { size_t len = s->length() * sizeof(wchar_t); retval.resize(len); PoolByteArray::Write w = retval.write(); - copymem(w.ptr(), s->ptr(), len); + memcpy(w.ptr(), s->ptr(), len); w.release(); r_ret = retval; @@ -585,7 +585,7 @@ struct _VariantCall { PoolByteArray::Read r = ba->read(); CharString cs; cs.resize(ba->size() + 1); - copymem(cs.ptrw(), r.ptr(), ba->size()); + memcpy(cs.ptrw(), r.ptr(), ba->size()); cs[ba->size()] = 0; s = cs.get_data(); diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index cd7b505516e..034a54f3585 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -70,7 +70,7 @@ OSStatus AudioDriverCoreAudio::output_device_address_cb(AudioObjectID inObjectID Error AudioDriverCoreAudio::init() { AudioComponentDescription desc; - zeromem(&desc, sizeof(desc)); + memset(&desc, 0, sizeof(desc)); desc.componentType = kAudioUnitType_Output; #ifdef OSX_ENABLED desc.componentSubType = kAudioUnitSubType_HALOutput; @@ -97,7 +97,7 @@ Error AudioDriverCoreAudio::init() { AudioStreamBasicDescription strdesc; - zeromem(&strdesc, sizeof(strdesc)); + memset(&strdesc, 0, sizeof(strdesc)); UInt32 size = sizeof(strdesc); result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size); ERR_FAIL_COND_V(result != noErr, FAILED); @@ -118,7 +118,7 @@ Error AudioDriverCoreAudio::init() { mix_rate = GLOBAL_GET("audio/mix_rate"); - zeromem(&strdesc, sizeof(strdesc)); + memset(&strdesc, 0, sizeof(strdesc)); strdesc.mFormatID = kAudioFormatLinearPCM; strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; strdesc.mChannelsPerFrame = channels; @@ -148,7 +148,7 @@ Error AudioDriverCoreAudio::init() { print_verbose("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); AURenderCallbackStruct callback; - zeromem(&callback, sizeof(AURenderCallbackStruct)); + memset(&callback, 0, sizeof(AURenderCallbackStruct)); callback.inputProc = &AudioDriverCoreAudio::output_callback; callback.inputProcRefCon = this; result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback)); @@ -174,7 +174,7 @@ OSStatus AudioDriverCoreAudio::output_callback(void *inRefCon, if (!ad->active || !ad->try_lock()) { for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { AudioBuffer *abuf = &ioData->mBuffers[i]; - zeromem(abuf->mData, abuf->mDataByteSize); + memset(abuf->mData, 0, abuf->mDataByteSize); }; return 0; }; @@ -298,7 +298,7 @@ void AudioDriverCoreAudio::finish() { lock(); AURenderCallbackStruct callback; - zeromem(&callback, sizeof(AURenderCallbackStruct)); + memset(&callback, 0, sizeof(AURenderCallbackStruct)); result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback)); if (result != noErr) { ERR_PRINT("AudioUnitSetProperty failed"); @@ -342,7 +342,7 @@ void AudioDriverCoreAudio::finish() { Error AudioDriverCoreAudio::capture_init() { AudioComponentDescription desc; - zeromem(&desc, sizeof(desc)); + memset(&desc, 0, sizeof(desc)); desc.componentType = kAudioUnitType_Output; #ifdef OSX_ENABLED desc.componentSubType = kAudioUnitSubType_HALOutput; @@ -388,7 +388,7 @@ Error AudioDriverCoreAudio::capture_init() { #endif AudioStreamBasicDescription strdesc; - zeromem(&strdesc, sizeof(strdesc)); + memset(&strdesc, 0, sizeof(strdesc)); size = sizeof(strdesc); result = AudioUnitGetProperty(input_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &strdesc, &size); ERR_FAIL_COND_V(result != noErr, FAILED); @@ -410,7 +410,7 @@ Error AudioDriverCoreAudio::capture_init() { mix_rate = GLOBAL_GET("audio/mix_rate"); - zeromem(&strdesc, sizeof(strdesc)); + memset(&strdesc, 0, sizeof(strdesc)); strdesc.mFormatID = kAudioFormatLinearPCM; strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; strdesc.mChannelsPerFrame = capture_channels; @@ -424,7 +424,7 @@ Error AudioDriverCoreAudio::capture_init() { ERR_FAIL_COND_V(result != noErr, FAILED); AURenderCallbackStruct callback; - zeromem(&callback, sizeof(AURenderCallbackStruct)); + memset(&callback, 0, sizeof(AURenderCallbackStruct)); callback.inputProc = &AudioDriverCoreAudio::input_callback; callback.inputProcRefCon = this; result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, kInputBus, &callback, sizeof(callback)); @@ -441,7 +441,7 @@ void AudioDriverCoreAudio::capture_finish() { lock(); AURenderCallbackStruct callback; - zeromem(&callback, sizeof(AURenderCallbackStruct)); + memset(&callback, 0, sizeof(AURenderCallbackStruct)); OSStatus result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &callback, sizeof(callback)); if (result != noErr) { ERR_PRINT("AudioUnitSetProperty failed"); diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 2cfb4b07a74..3124511ca54 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -1558,7 +1558,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste size_t transform_buffer_offset = i * 12; - copymem(&buffer[transform_buffer_offset], row, sizeof(row)); + memcpy(&buffer[transform_buffer_offset], row, sizeof(row)); } } diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 0ac6cb17be0..8d6c8d4fa6a 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -3401,7 +3401,7 @@ void RasterizerStorageGLES2::multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector::Read r = p_array.read(); ERR_FAIL_COND(!r.ptr()); - copymem(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float)); + memcpy(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float)); multimesh->dirty_data = true; multimesh->dirty_aabb = true; @@ -4466,7 +4466,7 @@ void RasterizerStorageGLES2::lightmap_capture_set_octree(RID p_capture, const Po if (p_octree.size()) { PoolVector::Write w = capture->octree.write(); PoolVector::Read r = p_octree.read(); - copymem(w.ptr(), r.ptr(), p_octree.size()); + memcpy(w.ptr(), r.ptr(), p_octree.size()); } capture->instance_change_notify(true, false); } @@ -4483,7 +4483,7 @@ PoolVector RasterizerStorageGLES2::lightmap_capture_get_octree(RID p_ca { PoolVector::Read r = capture->octree.read(); PoolVector::Write w = ret.write(); - copymem(w.ptr(), r.ptr(), ret.size()); + memcpy(w.ptr(), r.ptr(), ret.size()); } return ret; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index ee731379a68..326564acd85 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2912,7 +2912,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c } li->light_index = state.omni_light_count; - copymem(&state.omni_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size); + memcpy(&state.omni_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size); state.omni_light_count++; } break; @@ -2995,7 +2995,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c } li->light_index = state.spot_light_count; - copymem(&state.spot_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size); + memcpy(&state.spot_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size); state.spot_light_count++; } break; } @@ -3096,7 +3096,7 @@ void RasterizerSceneGLES3::_setup_reflections(RID *p_reflection_probe_cull_resul store_transform(proj, reflection_ubo.local_matrix); rpi->reflection_index = state.reflection_probe_count; - copymem(&state.reflection_array_tmp[rpi->reflection_index * sizeof(ReflectionProbeDataUBO)], &reflection_ubo, sizeof(ReflectionProbeDataUBO)); + memcpy(&state.reflection_array_tmp[rpi->reflection_index * sizeof(ReflectionProbeDataUBO)], &reflection_ubo, sizeof(ReflectionProbeDataUBO)); state.reflection_probe_count++; } diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 8c169ffad33..a3101ec37a6 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -3273,37 +3273,37 @@ _FORCE_INLINE_ static void _fill_std140_ubo_empty(ShaderLanguage::DataType type, case ShaderLanguage::TYPE_INT: case ShaderLanguage::TYPE_UINT: case ShaderLanguage::TYPE_FLOAT: { - zeromem(data, 4); + memset(data, 0, 4); } break; case ShaderLanguage::TYPE_BVEC2: case ShaderLanguage::TYPE_IVEC2: case ShaderLanguage::TYPE_UVEC2: case ShaderLanguage::TYPE_VEC2: { - zeromem(data, 8); + memset(data, 0, 8); } break; case ShaderLanguage::TYPE_BVEC3: case ShaderLanguage::TYPE_IVEC3: case ShaderLanguage::TYPE_UVEC3: case ShaderLanguage::TYPE_VEC3: { - zeromem(data, 12); + memset(data, 0, 12); } break; case ShaderLanguage::TYPE_BVEC4: case ShaderLanguage::TYPE_IVEC4: case ShaderLanguage::TYPE_UVEC4: case ShaderLanguage::TYPE_VEC4: { - zeromem(data, 16); + memset(data, 0, 16); } break; case ShaderLanguage::TYPE_MAT2: { - zeromem(data, 32); + memset(data, 0, 32); } break; case ShaderLanguage::TYPE_MAT3: { - zeromem(data, 48); + memset(data, 0, 48); } break; case ShaderLanguage::TYPE_MAT4: { - zeromem(data, 64); + memset(data, 0, 64); } break; default: { @@ -4099,7 +4099,7 @@ PoolVector RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, i ERR_FAIL_NULL_V(data, PoolVector()); { PoolVector::Write w = ret.write(); - copymem(w.ptr(), data, surface->array_byte_size); + memcpy(w.ptr(), data, surface->array_byte_size); } glUnmapBuffer(GL_ARRAY_BUFFER); #endif @@ -4131,7 +4131,7 @@ PoolVector RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_m ERR_FAIL_NULL_V(data, PoolVector()); { PoolVector::Write w = ret.write(); - copymem(w.ptr(), data, surface->index_array_byte_size); + memcpy(w.ptr(), data, surface->index_array_byte_size); } glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); #endif @@ -4193,7 +4193,7 @@ Vector > RasterizerStorageGLES3::mesh_surface_get_blend_shap ERR_FAIL_COND_V(!data, Vector >()); { PoolVector::Write w = ret.write(); - copymem(w.ptr(), data, mesh->surfaces[p_surface]->array_byte_size); + memcpy(w.ptr(), data, mesh->surfaces[p_surface]->array_byte_size); } glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); #endif @@ -5060,7 +5060,7 @@ void RasterizerStorageGLES3::multimesh_set_as_bulk_array(RID p_multimesh, const ERR_FAIL_COND(dsize != p_array.size()); PoolVector::Read r = p_array.read(); - copymem(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float)); + memcpy(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float)); multimesh->dirty_data = true; multimesh->dirty_aabb = true; @@ -6321,7 +6321,7 @@ void RasterizerStorageGLES3::lightmap_capture_set_octree(RID p_capture, const Po if (p_octree.size()) { PoolVector::Write w = capture->octree.write(); PoolVector::Read r = p_octree.read(); - copymem(w.ptr(), r.ptr(), p_octree.size()); + memcpy(w.ptr(), r.ptr(), p_octree.size()); } capture->instance_change_notify(true, false); } @@ -6338,7 +6338,7 @@ PoolVector RasterizerStorageGLES3::lightmap_capture_get_octree(RID p_ca { PoolVector::Read r = capture->octree.read(); PoolVector::Write w = ret.write(); - copymem(w.ptr(), r.ptr(), ret.size()); + memcpy(w.ptr(), r.ptr(), ret.size()); } return ret; diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 5bac97763a6..cc554b3c16b 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -93,7 +93,7 @@ PoolVector ImageLoaderPNG::lossless_pack_png(const Ref &p_image) { // must be closed before call to image_to_png PoolVector::Write writer = out_buffer.write(); - copymem(writer.ptr(), "PNG ", 4); + memcpy(writer.ptr(), "PNG ", 4); } Error err = PNGDriverCommon::image_to_png(p_image, out_buffer); diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp index c61f3d18c70..3d8132eee64 100644 --- a/drivers/png/png_driver_common.cpp +++ b/drivers/png/png_driver_common.cpp @@ -60,7 +60,7 @@ static bool check_error(const png_image &image) { Error png_to_image(const uint8_t *p_source, size_t p_size, bool p_force_linear, Ref p_image) { png_image png_img; - zeromem(&png_img, sizeof(png_img)); + memset(&png_img, 0, sizeof(png_img)); png_img.version = PNG_IMAGE_VERSION; // fetch image properties @@ -133,7 +133,7 @@ Error image_to_png(const Ref &p_image, PoolVector &p_buffer) { ERR_FAIL_COND_V(source_image->is_compressed(), FAILED); png_image png_img; - zeromem(&png_img, sizeof(png_img)); + memset(&png_img, 0, sizeof(png_img)); png_img.version = PNG_IMAGE_VERSION; png_img.width = source_image->get_width(); png_img.height = source_image->get_height(); diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index 4bae6d3002f..16cfdd98d3d 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -107,7 +107,7 @@ size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const addr6->sin6_family = AF_INET6; addr6->sin6_port = htons(p_port); if (p_ip.is_valid()) { - copymem(&addr6->sin6_addr.s6_addr, p_ip.get_ipv6(), 16); + memcpy(&addr6->sin6_addr.s6_addr, p_ip.get_ipv6(), 16); } else { addr6->sin6_addr = in6addr_any; } @@ -122,7 +122,7 @@ size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const addr4->sin_port = htons(p_port); // short, network byte order if (p_ip.is_valid()) { - copymem(&addr4->sin_addr.s_addr, p_ip.get_ipv4(), 4); + memcpy(&addr4->sin_addr.s_addr, p_ip.get_ipv4(), 4); } else { addr4->sin_addr.s_addr = INADDR_ANY; } @@ -266,13 +266,13 @@ _FORCE_INLINE_ Error NetSocketPosix::_change_multicast_group(IP_Address p_ip, St ERR_FAIL_COND_V(!if_ip.is_valid(), ERR_INVALID_PARAMETER); struct ip_mreq greq; int sock_opt = p_add ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; - copymem(&greq.imr_multiaddr, p_ip.get_ipv4(), 4); - copymem(&greq.imr_interface, if_ip.get_ipv4(), 4); + memcpy(&greq.imr_multiaddr, p_ip.get_ipv4(), 4); + memcpy(&greq.imr_interface, if_ip.get_ipv4(), 4); ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq)); } else { struct ipv6_mreq greq; int sock_opt = p_add ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP; - copymem(&greq.ipv6mr_multiaddr, p_ip.get_ipv6(), 16); + memcpy(&greq.ipv6mr_multiaddr, p_ip.get_ipv6(), 16); greq.ipv6mr_interface = if_v6id; ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq)); } diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 64bce0ac630..e11e100f668 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -396,7 +396,7 @@ void ParticlesEditor::_generate_emission_points() { { PoolVector::Write iw = point_img.write(); - zeromem(iw.ptr(), w * h * 3 * sizeof(float)); + memset(iw.ptr(), 0, w * h * 3 * sizeof(float)); PoolVector::Read r = points.read(); float *wf = (float *)iw.ptr(); for (int i = 0; i < point_count; i++) { @@ -426,7 +426,7 @@ void ParticlesEditor::_generate_emission_points() { { PoolVector::Write iw = point_img2.write(); - zeromem(iw.ptr(), w * h * 3 * sizeof(float)); + memset(iw.ptr(), 0, w * h * 3 * sizeof(float)); PoolVector::Read r = normals.read(); float *wf = (float *)iw.ptr(); for (int i = 0; i < point_count; i++) { diff --git a/modules/denoise/denoise_wrapper.cpp b/modules/denoise/denoise_wrapper.cpp index d85b51da444..80f3d1a2e3a 100644 --- a/modules/denoise/denoise_wrapper.cpp +++ b/modules/denoise/denoise_wrapper.cpp @@ -29,7 +29,6 @@ /*************************************************************************/ #include "denoise_wrapper.h" -#include "core/os/copymem.h" #include "core/os/memory.h" #include "thirdparty/oidn/include/OpenImageDenoise/oidn.h" #include diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 2cfa8003634..95c5e9c2cc9 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -581,7 +581,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 8, packet_flags); encode_uint32(unique_id, &packet->data[0]); // Source ID encode_uint32(target_peer, &packet->data[4]); // Dest ID - copymem(&packet->data[8], p_buffer, p_buffer_size); + memcpy(&packet->data[8], p_buffer, p_buffer_size); if (server) { @@ -705,7 +705,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer * while (total) { for (size_t i = 0; i < inBufferCount; i++) { int to_copy = MIN(total, int(inBuffers[i].dataLength)); - copymem(&enet->src_compressor_mem.write[ofs], inBuffers[i].data, to_copy); + memcpy(&enet->src_compressor_mem.write[ofs], inBuffers[i].data, to_copy); ofs += to_copy; total -= to_copy; } @@ -740,7 +740,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer * if (ret > int(outLimit)) return 0; // Do not bother - copymem(outData, enet->dst_compressor_mem.ptr(), ret); + memcpy(outData, enet->dst_compressor_mem.ptr(), ret); return ret; } diff --git a/modules/etc/image_compress_etc.cpp b/modules/etc/image_compress_etc.cpp index 986367b0363..ecb3681d702 100644 --- a/modules/etc/image_compress_etc.cpp +++ b/modules/etc/image_compress_etc.cpp @@ -31,7 +31,6 @@ #include "image_compress_etc.h" #include "core/image.h" -#include "core/os/copymem.h" #include "core/os/os.h" #include "core/print_string.h" diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 45ebe950e32..135b63819e2 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -94,8 +94,8 @@ struct NativeScriptDesc { base_native_type(), documentation(), type_tag(NULL) { - zeromem(&create_func, sizeof(godot_instance_create_func)); - zeromem(&destroy_func, sizeof(godot_instance_destroy_func)); + memset(&create_func, 0, sizeof(godot_instance_create_func)); + memset(&destroy_func, 0, sizeof(godot_instance_destroy_func)); } }; diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index b0757830885..d2780638949 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -31,7 +31,6 @@ #include "gdscript_language_protocol.h" #include "core/io/json.h" -#include "core/os/copymem.h" #include "core/project_settings.h" #include "editor/editor_log.h" #include "editor/editor_node.h" diff --git a/modules/lightmapper_cpu/lightmapper_cpu.cpp b/modules/lightmapper_cpu/lightmapper_cpu.cpp index 064e31f3611..b7290984560 100644 --- a/modules/lightmapper_cpu/lightmapper_cpu.cpp +++ b/modules/lightmapper_cpu/lightmapper_cpu.cpp @@ -967,7 +967,7 @@ void LightmapperCPU::_post_process(uint32_t p_idx, void *r_output) { PoolByteArray data; data.resize(data_size); PoolByteArray::Write w = data.write(); - copymem(w.ptr(), output, data_size); + memcpy(w.ptr(), output, data_size); current_image->create(size.x, size.y, false, Image::FORMAT_RGBF, data); } @@ -976,7 +976,7 @@ void LightmapperCPU::_post_process(uint32_t p_idx, void *r_output) { PoolByteArray denoised_data = denoised_image->get_data(); denoised_image.unref(); PoolByteArray::Read r = denoised_data.read(); - copymem(output, r.ptr(), data_size); + memcpy(output, r.ptr(), data_size); } } @@ -1074,7 +1074,7 @@ void LightmapperCPU::_fix_seams(const LocalVector &p_seams, Vector3 *r_l LocalVector extra_buffer; extra_buffer.resize(p_size.x * p_size.y); - copymem(extra_buffer.ptr(), r_lightmap, p_size.x * p_size.y * sizeof(Vector3)); + memcpy(extra_buffer.ptr(), r_lightmap, p_size.x * p_size.y * sizeof(Vector3)); Vector3 *read_ptr = extra_buffer.ptr(); Vector3 *write_ptr = r_lightmap; @@ -1084,7 +1084,7 @@ void LightmapperCPU::_fix_seams(const LocalVector &p_seams, Vector3 *r_l _fix_seam(p_seams[j].edge0[0], p_seams[j].edge0[1], p_seams[j].edge1[0], p_seams[j].edge1[1], read_ptr, write_ptr, p_size); _fix_seam(p_seams[j].edge1[0], p_seams[j].edge1[1], p_seams[j].edge0[0], p_seams[j].edge0[1], read_ptr, write_ptr, p_size); } - copymem(read_ptr, write_ptr, p_size.x * p_size.y * sizeof(Vector3)); + memcpy(read_ptr, write_ptr, p_size.x * p_size.y * sizeof(Vector3)); } } diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp index f5a69652074..3b1e8c508b1 100644 --- a/modules/mbedtls/crypto_mbedtls.cpp +++ b/modules/mbedtls/crypto_mbedtls.cpp @@ -352,7 +352,7 @@ Vector CryptoMbedTLS::sign(HashingContext::HashType p_hash_type, Vector int ret = mbedtls_pk_sign(&(key->pkey), type, p_hash.ptr(), size, buf, &sig_size, mbedtls_ctr_drbg_random, &ctr_drbg); ERR_FAIL_COND_V_MSG(ret, out, "Error while signing: " + itos(ret)); out.resize(sig_size); - copymem(out.ptrw(), buf, sig_size); + memcpy(out.ptrw(), buf, sig_size); return out; } @@ -375,7 +375,7 @@ Vector CryptoMbedTLS::encrypt(Ref p_key, Vector p_p int ret = mbedtls_pk_encrypt(&(key->pkey), p_plaintext.ptr(), p_plaintext.size(), buf, &size, sizeof(buf), mbedtls_ctr_drbg_random, &ctr_drbg); ERR_FAIL_COND_V_MSG(ret, out, "Error while encrypting: " + itos(ret)); out.resize(size); - copymem(out.ptrw(), buf, size); + memcpy(out.ptrw(), buf, size); return out; } @@ -389,6 +389,6 @@ Vector CryptoMbedTLS::decrypt(Ref p_key, Vector p_c int ret = mbedtls_pk_decrypt(&(key->pkey), p_ciphertext.ptr(), p_ciphertext.size(), buf, &size, sizeof(buf), mbedtls_ctr_drbg_random, &ctr_drbg); ERR_FAIL_COND_V_MSG(ret, out, "Error while decrypting: " + itos(ret)); out.resize(size); - copymem(out.ptrw(), buf, size); + memcpy(out.ptrw(), buf, size); return out; } diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp index b9997f3df0e..ebf6b61626e 100755 --- a/modules/mbedtls/packet_peer_mbed_dtls.cpp +++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp @@ -72,7 +72,7 @@ int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) { if (err != OK) { return MBEDTLS_ERR_SSL_INTERNAL_ERROR; } - copymem(buf, buffer, buffer_size); + memcpy(buf, buffer, buffer_size); return buffer_size; } @@ -88,8 +88,8 @@ int PacketPeerMbedDTLS::_set_cookie() { uint8_t client_id[18]; IP_Address addr = base->get_packet_address(); uint16_t port = base->get_packet_port(); - copymem(client_id, addr.get_ipv6(), 16); - copymem(&client_id[16], (uint8_t *)&port, 2); + memcpy(client_id, addr.get_ipv6(), 16); + memcpy(&client_id[16], (uint8_t *)&port, 2); return mbedtls_ssl_set_client_transport_id(ssl_ctx->get_context(), client_id, 18); } diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp index b37318927c5..d45e70d1196 100644 --- a/modules/minimp3/audio_stream_mp3.cpp +++ b/modules/minimp3/audio_stream_mp3.cpp @@ -181,7 +181,7 @@ PoolVector AudioStreamMP3::get_data() const { vdata.resize(data_len); { PoolVector::Write w = vdata.write(); - copymem(w.ptr(), data, data_len); + memcpy(w.ptr(), data, data_len); } } diff --git a/modules/pvr/image_compress_pvrtc.cpp b/modules/pvr/image_compress_pvrtc.cpp index 15c473d049c..bfed213377e 100644 --- a/modules/pvr/image_compress_pvrtc.cpp +++ b/modules/pvr/image_compress_pvrtc.cpp @@ -66,7 +66,7 @@ static void _compress_pvrtc4(Image *p_img) { img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h); Javelin::RgbaBitmap bm(w, h); void *dst = (void *)bm.GetData(); - copymem(dst, &r[ofs], size); + memcpy(dst, &r[ofs], size); Javelin::ColorRgba *dp = bm.GetData(); for (int j = 0; j < size / 4; j++) { // Red and blue colors are swapped. diff --git a/modules/raycast/lightmap_raycaster.cpp b/modules/raycast/lightmap_raycaster.cpp index fac4385d771..d3f4a41204b 100644 --- a/modules/raycast/lightmap_raycaster.cpp +++ b/modules/raycast/lightmap_raycaster.cpp @@ -133,10 +133,10 @@ void LightmapRaycasterEmbree::add_mesh(const Vector &p_vertices, const ERR_FAIL_COND(!p_normals.empty() && vertex_count != p_normals.size()); Vector3 *embree_vertices = (Vector3 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT3, sizeof(Vector3), vertex_count); - copymem(embree_vertices, p_vertices.ptr(), sizeof(Vector3) * vertex_count); + memcpy(embree_vertices, p_vertices.ptr(), sizeof(Vector3) * vertex_count); Vector2 *embree_light_uvs = (Vector2 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTC_FORMAT_FLOAT2, sizeof(Vector2), vertex_count); - copymem(embree_light_uvs, p_uv2s.ptr(), sizeof(Vector2) * vertex_count); + memcpy(embree_light_uvs, p_uv2s.ptr(), sizeof(Vector2) * vertex_count); uint32_t *embree_triangles = (uint32_t *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT3, sizeof(uint32_t) * 3, vertex_count / 3); for (int i = 0; i < vertex_count; i++) { @@ -145,7 +145,7 @@ void LightmapRaycasterEmbree::add_mesh(const Vector &p_vertices, const if (!p_normals.empty()) { Vector3 *embree_normals = (Vector3 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 1, RTC_FORMAT_FLOAT3, sizeof(Vector3), vertex_count); - copymem(embree_normals, p_normals.ptr(), sizeof(Vector3) * vertex_count); + memcpy(embree_normals, p_normals.ptr(), sizeof(Vector3) * vertex_count); } rtcCommitGeometry(embree_mesh); diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index f62426ac591..a90d5ce19e5 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -233,7 +233,7 @@ PoolVector AudioStreamOGGVorbis::get_data() const { vdata.resize(data_len); { PoolVector::Write w = vdata.write(); - copymem(w.ptr(), data, data_len); + memcpy(w.ptr(), data, data_len); } } diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 2121461782c..7a3f4869e2f 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -226,7 +226,7 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { /* identify the codec: try theora */ if (!theora_p && th_decode_headerin(&ti, &tc, &ts, &op) >= 0) { /* it is theora */ - copymem(&to, &test, sizeof(test)); + memcpy(&to, &test, sizeof(test)); theora_p = 1; } else if (!vorbis_p && vorbis_synthesis_headerin(&vi, &vc, &op) >= 0) { @@ -240,7 +240,7 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { audio_track_skip--; } else { - copymem(&vo, &test, sizeof(test)); + memcpy(&vo, &test, sizeof(test)); vorbis_p = 1; } } else { diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 8258515ae23..9ace8e8d704 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1680,7 +1680,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p state->flow_stack_pos = flow_stack_pos; state->stack.resize(p_stack_size); state->pass = p_pass; - copymem(state->stack.ptrw(), p_stack, p_stack_size); + memcpy(state->stack.ptrw(), p_stack, p_stack_size); //step 2, run away, return directly r_error.error = Variant::CallError::CALL_OK; @@ -1960,7 +1960,7 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p sequence_bits[i] = false; //all starts as false } - zeromem(pass_stack, f->pass_stack_size * sizeof(int)); + memset(pass_stack, 0, f->pass_stack_size * sizeof(int)); Map::Element *E = instances.find(f->node); if (!E) { diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 369725eff4b..47b5330fa73 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -69,7 +69,7 @@ static PoolVector _webp_lossy_pack(const Ref &p_image, float p_q w[1] = 'E'; w[2] = 'B'; w[3] = 'P'; - copymem(&w[4], dst_buff, dst_size); + memcpy(&w[4], dst_buff, dst_size); free(dst_buff); w.release(); return dst; diff --git a/modules/websocket/packet_buffer.h b/modules/websocket/packet_buffer.h index 6ddca284297..57ed46313d4 100644 --- a/modules/websocket/packet_buffer.h +++ b/modules/websocket/packet_buffer.h @@ -31,7 +31,6 @@ #ifndef PACKET_BUFFER_H #define PACKET_BUFFER_H -#include "core/os/copymem.h" #include "core/ring_buffer.h" template @@ -67,7 +66,7 @@ public: if (p_info) { _Packet p; p.size = p_size; - copymem(&p.info, p_info, sizeof(T)); + memcpy(&p.info, p_info, sizeof(T)); _packets.write(p); } @@ -87,7 +86,7 @@ public: ERR_FAIL_COND_V(p_bytes < (int)p.size, ERR_OUT_OF_MEMORY); r_read = p.size; - copymem(r_info, &p.info, sizeof(T)); + memcpy(r_info, &p.info, sizeof(T)); _payload.read(r_payload, p.size); return OK; } diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp index e4a998172f5..79c08f7b482 100644 --- a/modules/websocket/websocket_multiplayer_peer.cpp +++ b/modules/websocket/websocket_multiplayer_peer.cpp @@ -193,10 +193,10 @@ PoolVector WebSocketMultiplayerPeer::_make_pkt(uint8_t p_type, int32_t out.resize(PROTO_SIZE + p_data_size); PoolVector::Write w = out.write(); - copymem(&w[0], &p_type, 1); - copymem(&w[1], &p_from, 4); - copymem(&w[5], &p_to, 4); - copymem(&w[PROTO_SIZE], p_data, p_data_size); + memcpy(&w[0], &p_type, 1); + memcpy(&w[1], &p_from, 4); + memcpy(&w[5], &p_to, 4); + memcpy(&w[PROTO_SIZE], p_data, p_data_size); return out; } @@ -235,7 +235,7 @@ void WebSocketMultiplayerPeer::_store_pkt(int32_t p_source, int32_t p_dest, cons packet.size = p_data_size; packet.source = p_source; packet.destination = p_dest; - copymem(packet.data, &p_data[PROTO_SIZE], p_data_size); + memcpy(packet.data, &p_data[PROTO_SIZE], p_data_size); _incoming_packets.push_back(packet); emit_signal("peer_packet", p_source); } @@ -290,9 +290,9 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref p_peer, u uint8_t type = 0; uint32_t from = 0; int32_t to = 0; - copymem(&type, in_buffer, 1); - copymem(&from, &in_buffer[1], 4); - copymem(&to, &in_buffer[5], 4); + memcpy(&type, in_buffer, 1); + memcpy(&from, &in_buffer[1], 4); + memcpy(&to, &in_buffer[5], 4); if (is_server()) { // Server can resend @@ -328,7 +328,7 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref p_peer, u // System message ERR_FAIL_COND(data_size < 4); int id = 0; - copymem(&id, &in_buffer[PROTO_SIZE], 4); + memcpy(&id, &in_buffer[PROTO_SIZE], 4); switch (type) { diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 973f0febb8a..c8a1b558842 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -2662,7 +2662,7 @@ public: continue; r_command_line_flags.resize(base + 4 + length); encode_uint32(length, &r_command_line_flags.write[base]); - copymem(&r_command_line_flags.write[base + 4], command_line_argument.ptr(), length); + memcpy(&r_command_line_flags.write[base + 4], command_line_argument.ptr(), length); } } } diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index f3bf6498ba9..c5bba920fd8 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -211,7 +211,7 @@ PoolByteArray HTTPClient::read_response_body_chunk() { } chunk.resize(read); PoolByteArray::Write w = chunk.write(); - copymem(&w[0], response_buffer.ptr(), read); + memcpy(&w[0], response_buffer.ptr(), read); return chunk; } diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index b72991ddf9c..fd4e4847338 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -192,7 +192,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector &p_sour if ((p_source.read()[(i + 1) * 4 + p_ch] == cur) && (p_source.read()[(i + 2) * 4 + p_ch] == cur)) { if (buf_size > 0) { result.write[res_size++] = (uint8_t)(buf_size - 1); - copymem(&result.write[res_size], &buf, buf_size); + memcpy(&result.write[res_size], &buf, buf_size); res_size += buf_size; buf_size = 0; } @@ -218,7 +218,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector &p_sour buf[buf_size++] = cur; if (buf_size == 128) { result.write[res_size++] = (uint8_t)(buf_size - 1); - copymem(&result.write[res_size], &buf, buf_size); + memcpy(&result.write[res_size], &buf, buf_size); res_size += buf_size; buf_size = 0; } @@ -226,7 +226,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector &p_sour } else { buf[buf_size++] = cur; result.write[res_size++] = (uint8_t)(buf_size - 1); - copymem(&result.write[res_size], &buf, buf_size); + memcpy(&result.write[res_size], &buf, buf_size); res_size += buf_size; buf_size = 0; } @@ -236,7 +236,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector &p_sour int ofs = p_dest.size(); p_dest.resize(p_dest.size() + res_size); - copymem(&p_dest.write[ofs], result.ptr(), res_size); + memcpy(&p_dest.write[ofs], result.ptr(), res_size); } void EditorExportPlatformOSX::_make_icon(const Ref &p_icon, Vector &p_data) { @@ -296,7 +296,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref &p_icon, Vector &p_icon, Vector &p_icon, Vector(&w[0]), p_amount * sizeof(Particle)); + memset(static_cast(&w[0]), 0, p_amount * sizeof(Particle)); // cast to prevent compiler warning .. note this relies on Particle not containing any complex types. // an alternative is to use some zero method per item but the generated code will be far less efficient. } @@ -1041,7 +1041,7 @@ void CPUParticles2D::_update_particle_data_buffer() { ptr[12] = r[idx].custom[3]; } else { - zeromem(ptr, sizeof(float) * 13); + memset(ptr, 0, sizeof(float) * 13); } ptr += 13; @@ -1143,7 +1143,7 @@ void CPUParticles2D::_notification(int p_what) { ptr[7] = t.elements[2][1]; } else { - zeromem(ptr, sizeof(float) * 8); + memset(ptr, 0, sizeof(float) * 8); } ptr += 13; diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 9b4d92092c1..5622c0d34fb 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -1095,7 +1095,7 @@ void CPUParticles::_update_particle_data_buffer() { ptr[10] = t.basis.elements[2][2]; ptr[11] = t.origin.z; } else { - zeromem(ptr, sizeof(float) * 12); + memset(ptr, 0, sizeof(float) * 12); } Color c = r[idx].color; @@ -1204,7 +1204,7 @@ void CPUParticles::_notification(int p_what) { ptr[10] = t.basis.elements[2][2]; ptr[11] = t.origin.z; } else { - zeromem(ptr, sizeof(float) * 12); + memset(ptr, 0, sizeof(float) * 12); } ptr += 17; diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 78be5fab7c7..2651c3fb6cd 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -383,7 +383,7 @@ void RayCast::_update_debug_shape() { int array_size = sizeof(Vector3) * verts.size(); byte_array.resize(array_size); PoolByteArray::Write w = byte_array.write(); - copymem(w.ptr(), verts.ptr(), array_size); + memcpy(w.ptr(), verts.ptr(), array_size); VS::get_singleton()->mesh_surface_update_region(mesh->get_rid(), 0, 0, byte_array); } diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index 3cb94e01ff9..69485d9acdf 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -81,11 +81,11 @@ void SoftBodyVisualServerHandler::commit_changes() { } void SoftBodyVisualServerHandler::set_vertex(int p_vertex_id, const void *p_vector3) { - copymem(&write_buffer[p_vertex_id * stride + offset_vertices], p_vector3, sizeof(float) * 3); + memcpy(&write_buffer[p_vertex_id * stride + offset_vertices], p_vector3, sizeof(float) * 3); } void SoftBodyVisualServerHandler::set_normal(int p_vertex_id, const void *p_vector3) { - copymem(&write_buffer[p_vertex_id * stride + offset_normal], p_vector3, sizeof(float) * 3); + memcpy(&write_buffer[p_vertex_id * stride + offset_normal], p_vector3, sizeof(float) * 3); } void SoftBodyVisualServerHandler::set_aabb(const AABB &p_aabb) { diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index e686ce0b74d..2adb0565b17 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -587,13 +587,13 @@ void Sprite3D::_draw() { } float v_uv[2] = { uvs[i].x, uvs[i].y }; - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8); float v_vertex[3] = { vtx.x, vtx.y, vtx.z }; - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3); - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4); - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4); - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4); } write_buffer.release(); @@ -949,13 +949,13 @@ void AnimatedSprite3D::_draw() { } float v_uv[2] = { uvs[i].x, uvs[i].y }; - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8); float v_vertex[3] = { vtx.x, vtx.y, vtx.z }; - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3); - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4); - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4); - copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4); + memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4); } write_buffer.release(); diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index 0af8cbf20c1..fc38814649e 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -731,7 +731,7 @@ void VoxelLightBaker::_check_init_light() { leaf_voxel_count = 0; _fixup_plot(0, 0); //pre fixup, so normal, albedo, emission, etc. work for lighting. bake_light.resize(bake_cells.size()); - //zeromem(bake_light.ptrw(), bake_light.size() * sizeof(Light)); + //memset(bake_light.ptrw(), 0, bake_light.size() * sizeof(Light)); first_leaf = -1; _init_light_plot(0, 0, 0, 0, 0, CHILD_EMPTY); } @@ -1596,7 +1596,7 @@ PoolVector VoxelLightBaker::create_capture_octree(int p_subdiv) { ret.resize(ret_bytes); { PoolVector::Write w = ret.write(); - copymem(w.ptr(), octree.ptr(), ret_bytes); + memcpy(w.ptr(), octree.ptr(), ret_bytes); } return ret; diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 14b50e9168c..b60b4a2c4be 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -493,9 +493,9 @@ void AudioStreamSample::set_data(const PoolVector &p_data) { PoolVector::Read r = p_data.read(); int alloc_len = datalen + DATA_PAD * 2; data = AudioServer::get_singleton()->audio_data_alloc(alloc_len); //alloc with some padding for interpolation - zeromem(data, alloc_len); + memset(data, 0, alloc_len); uint8_t *dataptr = (uint8_t *)data; - copymem(dataptr + DATA_PAD, r.ptr(), datalen); + memcpy(dataptr + DATA_PAD, r.ptr(), datalen); data_bytes = datalen; } @@ -511,7 +511,7 @@ PoolVector AudioStreamSample::get_data() const { PoolVector::Write w = pv.write(); uint8_t *dataptr = (uint8_t *)data; - copymem(w.ptr(), dataptr + DATA_PAD, data_bytes); + memcpy(w.ptr(), dataptr + DATA_PAD, data_bytes); } } diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp index 5fcd8cd64ac..cb8cc7f14a5 100644 --- a/scene/resources/bit_map.cpp +++ b/scene/resources/bit_map.cpp @@ -40,7 +40,7 @@ void BitMap::create(const Size2 &p_size) { width = p_size.width; height = p_size.height; bitmask.resize(((width * height) / 8) + 1); - zeromem(bitmask.ptrw(), bitmask.size()); + memset(bitmask.ptrw(), 0, bitmask.size()); } void BitMap::create_from_image_alpha(const Ref &p_image, float p_threshold) { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 362ec78808b..8b9aa85b35b 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -630,7 +630,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_ PoolVector id = mipmap_images[i]->get_data(); int len = id.size(); PoolVector::Read r = id.read(); - copymem(&w[ofs], r.ptr(), len); + memcpy(&w[ofs], r.ptr(), len); ofs += len; } } @@ -699,7 +699,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_ int expected = total_size - ofs; if (bytes < expected) { //this is a compatibility workaround for older format, which saved less mipmaps2. It is still recommended the image is reimported. - zeromem(w.ptr() + bytes, (expected - bytes)); + memset(w.ptr() + bytes, 0, (expected - bytes)); } else if (bytes != expected) { ERR_FAIL_V(ERR_FILE_CORRUPT); } @@ -2328,7 +2328,7 @@ Error TextureLayered::load(const String &p_path) { PoolVector id = mipmap_images[i]->get_data(); int len = id.size(); PoolVector::Read r = id.read(); - copymem(&w[ofs], r.ptr(), len); + memcpy(&w[ofs], r.ptr(), len); ofs += len; } } diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 1a78f479636..81cee204379 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -1146,7 +1146,7 @@ void *AudioServer::audio_data_alloc(uint32_t p_data_len, const uint8_t *p_from_d void *ad = memalloc(p_data_len); ERR_FAIL_COND_V(!ad, NULL); if (p_from_data) { - copymem(ad, p_from_data, p_data_len); + memcpy(ad, p_from_data, p_data_len); } audio_data_lock.lock(); diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 9a4e518f271..8bae4ece658 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1272,7 +1272,7 @@ _FORCE_INLINE_ static void _light_capture_sample_octree(const RasterizerStorage: Vector3 color[2][8]; float alpha[2][8]; - zeromem(alpha, sizeof(float) * 2 * 8); + memset(alpha, 0, sizeof(float) * 2 * 8); //find cell at given level first @@ -2573,7 +2573,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { size /= size_divisor; mipmap.resize(size); PoolVector::Write w = mipmap.write(); - zeromem(w.ptr(), size); + memset(w.ptr(), 0, size); w.release(); probe->dynamic.mipmaps_3d.push_back(mipmap); @@ -3154,7 +3154,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { const InstanceGIProbeData::CompBlockS3TC &b = mmr[i]; uint8_t *blockptr = &mmw[b.offset * 16]; - copymem(blockptr, b.alpha, 8); //copy alpha part, which is precomputed + memcpy(blockptr, b.alpha, 8); //copy alpha part, which is precomputed Vector3 colors[16]; diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 5f162949c43..c6c04d8f5ca 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -380,7 +380,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ uint16_t vector[2] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y) }; - copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 2); + memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 2); if (i == 0) { @@ -396,7 +396,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ float vector[2] = { src[i].x, src[i].y }; - copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 2); + memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 2); if (i == 0) { @@ -426,7 +426,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ uint16_t vector[4] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y), Math::make_half_float(src[i].z), Math::make_half_float(1.0) }; - copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 4); if (i == 0) { @@ -442,7 +442,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ float vector[3] = { src[i].x, src[i].y, src[i].z }; - copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 3); + memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 3); if (i == 0) { @@ -481,14 +481,14 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ 0, }; - copymem(&vw[p_offsets[ai] + i * p_stride], vector, 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], vector, 4); } } else { for (int i = 0; i < p_vertex_array_len; i++) { float vector[3] = { src[i].x, src[i].y, src[i].z }; - copymem(&vw[p_offsets[ai] + i * p_stride], vector, 3 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], vector, 3 * 4); } } @@ -515,7 +515,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ (int8_t)CLAMP(src[i * 4 + 3] * 127, -128, 127) }; - copymem(&vw[p_offsets[ai] + i * p_stride], xyzw, 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], xyzw, 4); } } else { @@ -528,7 +528,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ src[i * 4 + 3] }; - copymem(&vw[p_offsets[ai] + i * p_stride], xyzw, 4 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], xyzw, 4 * 4); } } @@ -555,13 +555,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ colors[j] = CLAMP(int((src[i][j]) * 255.0), 0, 255); } - copymem(&vw[p_offsets[ai] + i * p_stride], colors, 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], colors, 4); } } else { for (int i = 0; i < p_vertex_array_len; i++) { - copymem(&vw[p_offsets[ai] + i * p_stride], &src[i], 4 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], &src[i], 4 * 4); } } @@ -583,7 +583,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ for (int i = 0; i < p_vertex_array_len; i++) { uint16_t uv[2] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y) }; - copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2); + memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2); } } else { @@ -591,7 +591,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ float uv[2] = { src[i].x, src[i].y }; - copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4); } } @@ -614,7 +614,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ for (int i = 0; i < p_vertex_array_len; i++) { uint16_t uv[2] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y) }; - copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2); + memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2); } } else { @@ -622,7 +622,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ float uv[2] = { src[i].x, src[i].y }; - copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4); } } } break; @@ -647,7 +647,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ data[j] = CLAMP(src[i * VS::ARRAY_WEIGHTS_SIZE + j] * 65535, 0, 65535); } - copymem(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4); } } else { @@ -658,7 +658,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ data[j] = src[i * VS::ARRAY_WEIGHTS_SIZE + j]; } - copymem(&vw[p_offsets[ai] + i * p_stride], data, 4 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], data, 4 * 4); } } @@ -685,7 +685,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ max_bone = MAX(data[j], max_bone); } - copymem(&vw[p_offsets[ai] + i * p_stride], data, 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], data, 4); } } else { @@ -697,7 +697,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ max_bone = MAX(data[j], max_bone); } - copymem(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4); + memcpy(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4); } } @@ -721,11 +721,11 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (p_vertex_array_len < (1 << 16)) { uint16_t v = src[i]; - copymem(&iw[i * 2], &v, 2); + memcpy(&iw[i * 2], &v, 2); } else { uint32_t v = src[i]; - copymem(&iw[i * 4], &v, 4); + memcpy(&iw[i * 4], &v, 4); } } } break; diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index bd3bb9755e1..7d1eaff4c11 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -211,7 +211,7 @@ public: ERR_FAIL_COND_V(err != OK, err); ERR_FAIL_COND_V(p_len < r_read, ERR_OUT_OF_MEMORY); - copymem(p_buffer, buffer, r_read); + memcpy(p_buffer, buffer, r_read); r_ip = udp->get_packet_address(); r_port = udp->get_packet_port(); return err; @@ -316,7 +316,7 @@ public: Vector s = E->key().rsplit(":", false, 1); ERR_CONTINUE(s.size() != 2); // BUG! - copymem(p_buffer, buffer, r_read); + memcpy(p_buffer, buffer, r_read); r_ip = s[0]; r_port = s[1].to_int(); break; // err = OK