mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	Core: Drop custom copymem/zeromem defines
				
					
				
			We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.
There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
Backport of #48239.
			
			
This commit is contained in:
		
							parent
							
								
									1db31d0afa
								
							
						
					
					
						commit
						70ae90e0e8
					
				
					 66 changed files with 173 additions and 242 deletions
				
			
		|  | @ -35,7 +35,6 @@ | ||||||
| #include "core/io/image_loader.h" | #include "core/io/image_loader.h" | ||||||
| #include "core/io/resource_loader.h" | #include "core/io/resource_loader.h" | ||||||
| #include "core/math/math_funcs.h" | #include "core/math/math_funcs.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/print_string.h" | #include "core/print_string.h" | ||||||
| 
 | 
 | ||||||
| #include "thirdparty/misc/hq2x.h" | #include "thirdparty/misc/hq2x.h" | ||||||
|  | @ -1369,7 +1368,7 @@ void Image::shrink_x2() { | ||||||
| 			PoolVector<uint8_t>::Write w = new_img.write(); | 			PoolVector<uint8_t>::Write w = new_img.write(); | ||||||
| 			PoolVector<uint8_t>::Read r = data.read(); | 			PoolVector<uint8_t>::Read r = data.read(); | ||||||
| 
 | 
 | ||||||
| 			copymem(w.ptr(), &r[ofs], new_size); | 			memcpy(w.ptr(), &r[ofs], new_size); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		width = MAX(width / 2, 1); | 		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); | 	data.resize(size); | ||||||
| 	{ | 	{ | ||||||
| 		PoolVector<uint8_t>::Write w = data.write(); | 		PoolVector<uint8_t>::Write w = data.write(); | ||||||
| 		zeromem(w.ptr(), size); | 		memset(w.ptr(), 0, size); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	width = p_width; | 	width = p_width; | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "compression.h" | #include "compression.h" | ||||||
| 
 | 
 | ||||||
| #include "core/io/zip_io.h" | #include "core/io/zip_io.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/project_settings.h" | #include "core/project_settings.h" | ||||||
| 
 | 
 | ||||||
| #include "thirdparty/misc/fastlz.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) { | 			if (p_src_size < 16) { | ||||||
| 				uint8_t src[16]; | 				uint8_t src[16]; | ||||||
| 				zeromem(&src[p_src_size], 16 - p_src_size); | 				memset(&src[p_src_size], 0, 16 - p_src_size); | ||||||
| 				copymem(src, p_src, p_src_size); | 				memcpy(src, p_src, p_src_size); | ||||||
| 				return fastlz_compress(src, 16, p_dst); | 				return fastlz_compress(src, 16, p_dst); | ||||||
| 			} else { | 			} else { | ||||||
| 				return fastlz_compress(p_src, p_src_size, p_dst); | 				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) { | 			if (p_dst_max_size < 16) { | ||||||
| 				uint8_t dst[16]; | 				uint8_t dst[16]; | ||||||
| 				ret_size = fastlz_decompress(p_src, p_src_size, 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 { | 			} else { | ||||||
| 				ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size); | 				ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "file_access_encrypted.h" | #include "file_access_encrypted.h" | ||||||
| 
 | 
 | ||||||
| #include "core/crypto/crypto_core.h" | #include "core/crypto/crypto_core.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/print_string.h" | #include "core/print_string.h" | ||||||
| #include "core/variant.h" | #include "core/variant.h" | ||||||
| 
 | 
 | ||||||
|  | @ -137,7 +136,7 @@ void FileAccessEncrypted::close() { | ||||||
| 		ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug?
 | 		ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug?
 | ||||||
| 
 | 
 | ||||||
| 		compressed.resize(len); | 		compressed.resize(len); | ||||||
| 		zeromem(compressed.ptrw(), len); | 		memset(compressed.ptrw(), 0, len); | ||||||
| 		for (int i = 0; i < data.size(); i++) { | 		for (int i = 0; i < data.size(); i++) { | ||||||
| 			compressed.write[i] = data[i]; | 			compressed.write[i] = data[i]; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "file_access_memory.h" | #include "file_access_memory.h" | ||||||
| 
 | 
 | ||||||
| #include "core/map.h" | #include "core/map.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/dir_access.h" | #include "core/os/dir_access.h" | ||||||
| #include "core/project_settings.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"); | 		WARN_PRINT("Reading less data than requested"); | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	copymem(p_dst, &data[pos], read); | 	memcpy(p_dst, &data[pos], read); | ||||||
| 	pos += p_length; | 	pos += p_length; | ||||||
| 
 | 
 | ||||||
| 	return read; | 	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"); | 		WARN_PRINT("Writing less data than requested"); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	copymem(&data[pos], p_src, write); | 	memcpy(&data[pos], p_src, write); | ||||||
| 	pos += p_length; | 	pos += p_length; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -32,7 +32,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "file_access_zip.h" | #include "file_access_zip.h" | ||||||
| 
 | 
 | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/file_access.h" | #include "core/os/file_access.h" | ||||||
| 
 | 
 | ||||||
| ZipArchive *ZipArchive::instance = NULL; | 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 + "'."); | 	ERR_FAIL_COND_V_MSG(!f, NULL, "Cannot open file '" + packages[file.package].filename + "'."); | ||||||
| 
 | 
 | ||||||
| 	zlib_filefunc_def io; | 	zlib_filefunc_def io; | ||||||
| 	zeromem(&io, sizeof(io)); | 	memset(&io, 0, sizeof(io)); | ||||||
| 
 | 
 | ||||||
| 	io.opaque = f; | 	io.opaque = f; | ||||||
| 	io.zopen_file = godot_open; | 	io.zopen_file = godot_open; | ||||||
|  |  | ||||||
|  | @ -662,7 +662,7 @@ PoolByteArray HTTPClient::read_response_body_chunk() { | ||||||
| 
 | 
 | ||||||
| 					ret.resize(chunk.size() - 2); | 					ret.resize(chunk.size() - 2); | ||||||
| 					PoolByteArray::Write w = ret.write(); | 					PoolByteArray::Write w = ret.write(); | ||||||
| 					copymem(w.ptr(), chunk.ptr(), chunk.size() - 2); | 					memcpy(w.ptr(), chunk.ptr(), chunk.size() - 2); | ||||||
| 					chunk.clear(); | 					chunk.clear(); | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -765,7 +765,7 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) { | ||||||
| 	if (buf) { | 	if (buf) { | ||||||
| 		encode_uint32(utf8.length(), buf); | 		encode_uint32(utf8.length(), buf); | ||||||
| 		buf += 4; | 		buf += 4; | ||||||
| 		copymem(buf, utf8.get_data(), utf8.length()); | 		memcpy(buf, utf8.get_data(), utf8.length()); | ||||||
| 		buf += 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) { | 				if (buf) { | ||||||
| 					encode_uint32(utf8.length(), buf); | 					encode_uint32(utf8.length(), buf); | ||||||
| 					buf += 4; | 					buf += 4; | ||||||
| 					copymem(buf, utf8.get_data(), utf8.length()); | 					memcpy(buf, utf8.get_data(), utf8.length()); | ||||||
| 					buf += pad + 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 i = 0; i < 3; i++) { | ||||||
| 					for (int j = 0; j < 2; j++) { | 					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 i = 0; i < 3; i++) { | ||||||
| 					for (int j = 0; j < 3; j++) { | 					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 i = 0; i < 3; i++) { | ||||||
| 					for (int j = 0; j < 3; j++) { | 					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) { | 				if (buf) { | ||||||
| 					encode_uint32(utf8.length()+1,buf); | 					encode_uint32(utf8.length()+1,buf); | ||||||
| 					buf+=4; | 					buf+=4; | ||||||
| 					copymem(buf,utf8.get_data(),utf8.length()+1); | 					memcpy(buf,utf8.get_data(),utf8.length()+1); | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				r_len+=4+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); | 				encode_uint32(datalen, buf); | ||||||
| 				buf += 4; | 				buf += 4; | ||||||
| 				PoolVector<uint8_t>::Read r = data.read(); | 				PoolVector<uint8_t>::Read r = data.read(); | ||||||
| 				copymem(buf, &r[0], datalen * datasize); | 				memcpy(buf, &r[0], datalen * datasize); | ||||||
| 				buf += 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) { | 				if (buf) { | ||||||
| 					encode_uint32(utf8.length() + 1, buf); | 					encode_uint32(utf8.length() + 1, buf); | ||||||
| 					buf += 4; | 					buf += 4; | ||||||
| 					copymem(buf, utf8.get_data(), utf8.length() + 1); | 					memcpy(buf, utf8.get_data(), utf8.length() + 1); | ||||||
| 					buf += utf8.length() + 1; | 					buf += utf8.length() + 1; | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -444,7 +444,7 @@ Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	PoolVector<uint8_t>::Write w = data.write(); | 	PoolVector<uint8_t>::Write w = data.write(); | ||||||
| 	copymem(&w[pointer], p_data, p_bytes); | 	memcpy(&w[pointer], p_data, p_bytes); | ||||||
| 
 | 
 | ||||||
| 	pointer += p_bytes; | 	pointer += p_bytes; | ||||||
| 	return OK; | 	return OK; | ||||||
|  | @ -479,7 +479,7 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	PoolVector<uint8_t>::Read r = data.read(); | 	PoolVector<uint8_t>::Read r = data.read(); | ||||||
| 	copymem(p_buffer, r.ptr() + pointer, r_received); | 	memcpy(p_buffer, r.ptr() + pointer, r_received); | ||||||
| 
 | 
 | ||||||
| 	pointer += r_received; | 	pointer += r_received; | ||||||
| 	// FIXME: return what? OK or ERR_*
 | 	// FIXME: return what? OK or ERR_*
 | ||||||
|  |  | ||||||
|  | @ -477,7 +477,7 @@ Error XMLParser::open_buffer(const Vector<uint8_t> &p_buffer) { | ||||||
| 
 | 
 | ||||||
| 	length = p_buffer.size(); | 	length = p_buffer.size(); | ||||||
| 	data = memnew_arr(char, length + 1); | 	data = memnew_arr(char, length + 1); | ||||||
| 	copymem(data, p_buffer.ptr(), length); | 	memcpy(data, p_buffer.ptr(), length); | ||||||
| 	data[length] = 0; | 	data[length] = 0; | ||||||
| 	P = data; | 	P = data; | ||||||
| 	return OK; | 	return OK; | ||||||
|  |  | ||||||
|  | @ -30,8 +30,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "zip_io.h" | #include "zip_io.h" | ||||||
| 
 | 
 | ||||||
| #include "core/os/copymem.h" |  | ||||||
| 
 |  | ||||||
| void *zipio_open(void *data, const char *p_fname, int mode) { | void *zipio_open(void *data, const char *p_fname, int mode) { | ||||||
| 
 | 
 | ||||||
| 	FileAccess *&f = *(FileAccess **)data; | 	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 zipio_alloc(voidpf opaque, uInt items, uInt size) { | ||||||
| 
 | 
 | ||||||
| 	voidpf ptr = memalloc(items * size); | 	voidpf ptr = memalloc(items * size); | ||||||
| 	zeromem(ptr, items * size); | 	memset(ptr, 0, items * size); | ||||||
| 	return ptr; | 	return ptr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -32,7 +32,6 @@ | ||||||
| #define LOCAL_VECTOR_H | #define LOCAL_VECTOR_H | ||||||
| 
 | 
 | ||||||
| #include "core/error_macros.h" | #include "core/error_macros.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/memory.h" | #include "core/os/memory.h" | ||||||
| #include "core/sort_array.h" | #include "core/sort_array.h" | ||||||
| #include "core/vector.h" | #include "core/vector.h" | ||||||
|  | @ -215,7 +214,7 @@ public: | ||||||
| 		Vector<T> ret; | 		Vector<T> ret; | ||||||
| 		ret.resize(size()); | 		ret.resize(size()); | ||||||
| 		T *w = ret.ptrw(); | 		T *w = ret.ptrw(); | ||||||
| 		copymem(w, data, sizeof(T) * count); | 		memcpy(w, data, sizeof(T) * count); | ||||||
| 		return ret; | 		return ret; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -223,7 +222,7 @@ public: | ||||||
| 		Vector<uint8_t> ret; | 		Vector<uint8_t> ret; | ||||||
| 		ret.resize(count * sizeof(T)); | 		ret.resize(count * sizeof(T)); | ||||||
| 		uint8_t *w = ret.ptrw(); | 		uint8_t *w = ret.ptrw(); | ||||||
| 		copymem(w, data, sizeof(T) * count); | 		memcpy(w, data, sizeof(T) * count); | ||||||
| 		return ret; | 		return ret; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "basis.h" | #include "basis.h" | ||||||
| 
 | 
 | ||||||
| #include "core/math/math_funcs.h" | #include "core/math/math_funcs.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/print_string.h" | #include "core/print_string.h" | ||||||
| 
 | 
 | ||||||
| #define cofac(row1, col1, row2, col2) \ | #define cofac(row1, col1, row2, col2) \ | ||||||
|  |  | ||||||
|  | @ -135,7 +135,7 @@ public: | ||||||
| 		if (depth > threshold) { | 		if (depth > threshold) { | ||||||
| 			if (aux_stack.empty()) { | 			if (aux_stack.empty()) { | ||||||
| 				aux_stack.resize(ALLOCA_STACK_SIZE * 2); | 				aux_stack.resize(ALLOCA_STACK_SIZE * 2); | ||||||
| 				copymem(aux_stack.ptr(), stack, get_alloca_stacksize()); | 				memcpy(aux_stack.ptr(), stack, get_alloca_stacksize()); | ||||||
| 			} else { | 			} else { | ||||||
| 				aux_stack.resize(aux_stack.size() * 2); | 				aux_stack.resize(aux_stack.size() * 2); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -1239,7 +1239,7 @@ Vector<Geometry::PackRectsResult> Geometry::partial_pack_rects(const Vector<Vect | ||||||
| 
 | 
 | ||||||
| 	Vector<stbrp_node> nodes; | 	Vector<stbrp_node> nodes; | ||||||
| 	nodes.resize(p_atlas_size.width); | 	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_context context; | ||||||
| 	stbrp_init_target(&context, p_atlas_size.width, p_atlas_size.height, nodes.ptrw(), p_atlas_size.width); | 	stbrp_init_target(&context, p_atlas_size.width, p_atlas_size.height, nodes.ptrw(), p_atlas_size.width); | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "transform.h" | #include "transform.h" | ||||||
| 
 | 
 | ||||||
| #include "core/math/math_funcs.h" | #include "core/math/math_funcs.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/print_string.h" | #include "core/print_string.h" | ||||||
| 
 | 
 | ||||||
| void Transform::affine_invert() { | void Transform::affine_invert() { | ||||||
|  |  | ||||||
|  | @ -33,7 +33,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "core/hashfuncs.h" | #include "core/hashfuncs.h" | ||||||
| #include "core/math/math_funcs.h" | #include "core/math/math_funcs.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/memory.h" | #include "core/os/memory.h" | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  |  | ||||||
|  | @ -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 |  | ||||||
|  | @ -32,7 +32,6 @@ | ||||||
| #define INPUT_EVENT_H | #define INPUT_EVENT_H | ||||||
| 
 | 
 | ||||||
| #include "core/math/transform_2d.h" | #include "core/math/transform_2d.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/resource.h" | #include "core/resource.h" | ||||||
| #include "core/typedefs.h" | #include "core/typedefs.h" | ||||||
| #include "core/ustring.h" | #include "core/ustring.h" | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "memory.h" | #include "memory.h" | ||||||
| 
 | 
 | ||||||
| #include "core/error_macros.h" | #include "core/error_macros.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/safe_refcount.h" | #include "core/safe_refcount.h" | ||||||
| 
 | 
 | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  |  | ||||||
|  | @ -336,7 +336,7 @@ Error PackedDataContainer::pack(const Variant &p_data) { | ||||||
| 	datalen = tmpdata.size(); | 	datalen = tmpdata.size(); | ||||||
| 	data.resize(tmpdata.size()); | 	data.resize(tmpdata.size()); | ||||||
| 	PoolVector<uint8_t>::Write w = data.write(); | 	PoolVector<uint8_t>::Write w = data.write(); | ||||||
| 	copymem(w.ptr(), tmpdata.ptr(), tmpdata.size()); | 	memcpy(w.ptr(), tmpdata.ptr(), tmpdata.size()); | ||||||
| 
 | 
 | ||||||
| 	return OK; | 	return OK; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "pool_allocator.h" | #include "pool_allocator.h" | ||||||
| 
 | 
 | ||||||
| #include "core/error_macros.h" | #include "core/error_macros.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/memory.h" | #include "core/os/memory.h" | ||||||
| #include "core/os/os.h" | #include "core/os/os.h" | ||||||
| #include "core/print_string.h" | #include "core/print_string.h" | ||||||
|  | @ -42,7 +41,7 @@ | ||||||
| 	do {                                                      \ | 	do {                                                      \ | ||||||
| 		void *_dst = &((unsigned char *)pool)[m_to_pos];      \ | 		void *_dst = &((unsigned char *)pool)[m_to_pos];      \ | ||||||
| 		void *_src = &((unsigned char *)pool)[(m_entry).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;                             \ | 		(m_entry).pos = m_to_pos;                             \ | ||||||
| 	} while (0); | 	} while (0); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #ifndef POOL_VECTOR_H | #ifndef POOL_VECTOR_H | ||||||
| #define POOL_VECTOR_H | #define POOL_VECTOR_H | ||||||
| 
 | 
 | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/memory.h" | #include "core/os/memory.h" | ||||||
| #include "core/os/mutex.h" | #include "core/os/mutex.h" | ||||||
| #include "core/os/rw_lock.h" | #include "core/os/rw_lock.h" | ||||||
|  |  | ||||||
|  | @ -329,7 +329,7 @@ struct _VariantCall { | ||||||
| 		size_t len = charstr.length(); | 		size_t len = charstr.length(); | ||||||
| 		retval.resize(len); | 		retval.resize(len); | ||||||
| 		PoolByteArray::Write w = retval.write(); | 		PoolByteArray::Write w = retval.write(); | ||||||
| 		copymem(w.ptr(), charstr.ptr(), len); | 		memcpy(w.ptr(), charstr.ptr(), len); | ||||||
| 		w.release(); | 		w.release(); | ||||||
| 
 | 
 | ||||||
| 		r_ret = retval; | 		r_ret = retval; | ||||||
|  | @ -348,7 +348,7 @@ struct _VariantCall { | ||||||
| 		size_t len = charstr.length(); | 		size_t len = charstr.length(); | ||||||
| 		retval.resize(len); | 		retval.resize(len); | ||||||
| 		PoolByteArray::Write w = retval.write(); | 		PoolByteArray::Write w = retval.write(); | ||||||
| 		copymem(w.ptr(), charstr.ptr(), len); | 		memcpy(w.ptr(), charstr.ptr(), len); | ||||||
| 		w.release(); | 		w.release(); | ||||||
| 
 | 
 | ||||||
| 		r_ret = retval; | 		r_ret = retval; | ||||||
|  | @ -366,7 +366,7 @@ struct _VariantCall { | ||||||
| 		size_t len = s->length() * sizeof(wchar_t); | 		size_t len = s->length() * sizeof(wchar_t); | ||||||
| 		retval.resize(len); | 		retval.resize(len); | ||||||
| 		PoolByteArray::Write w = retval.write(); | 		PoolByteArray::Write w = retval.write(); | ||||||
| 		copymem(w.ptr(), s->ptr(), len); | 		memcpy(w.ptr(), s->ptr(), len); | ||||||
| 		w.release(); | 		w.release(); | ||||||
| 
 | 
 | ||||||
| 		r_ret = retval; | 		r_ret = retval; | ||||||
|  | @ -585,7 +585,7 @@ struct _VariantCall { | ||||||
| 			PoolByteArray::Read r = ba->read(); | 			PoolByteArray::Read r = ba->read(); | ||||||
| 			CharString cs; | 			CharString cs; | ||||||
| 			cs.resize(ba->size() + 1); | 			cs.resize(ba->size() + 1); | ||||||
| 			copymem(cs.ptrw(), r.ptr(), ba->size()); | 			memcpy(cs.ptrw(), r.ptr(), ba->size()); | ||||||
| 			cs[ba->size()] = 0; | 			cs[ba->size()] = 0; | ||||||
| 
 | 
 | ||||||
| 			s = cs.get_data(); | 			s = cs.get_data(); | ||||||
|  |  | ||||||
|  | @ -70,7 +70,7 @@ OSStatus AudioDriverCoreAudio::output_device_address_cb(AudioObjectID inObjectID | ||||||
| 
 | 
 | ||||||
| Error AudioDriverCoreAudio::init() { | Error AudioDriverCoreAudio::init() { | ||||||
| 	AudioComponentDescription desc; | 	AudioComponentDescription desc; | ||||||
| 	zeromem(&desc, sizeof(desc)); | 	memset(&desc, 0, sizeof(desc)); | ||||||
| 	desc.componentType = kAudioUnitType_Output; | 	desc.componentType = kAudioUnitType_Output; | ||||||
| #ifdef OSX_ENABLED | #ifdef OSX_ENABLED | ||||||
| 	desc.componentSubType = kAudioUnitSubType_HALOutput; | 	desc.componentSubType = kAudioUnitSubType_HALOutput; | ||||||
|  | @ -97,7 +97,7 @@ Error AudioDriverCoreAudio::init() { | ||||||
| 
 | 
 | ||||||
| 	AudioStreamBasicDescription strdesc; | 	AudioStreamBasicDescription strdesc; | ||||||
| 
 | 
 | ||||||
| 	zeromem(&strdesc, sizeof(strdesc)); | 	memset(&strdesc, 0, sizeof(strdesc)); | ||||||
| 	UInt32 size = sizeof(strdesc); | 	UInt32 size = sizeof(strdesc); | ||||||
| 	result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size); | 	result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size); | ||||||
| 	ERR_FAIL_COND_V(result != noErr, FAILED); | 	ERR_FAIL_COND_V(result != noErr, FAILED); | ||||||
|  | @ -118,7 +118,7 @@ Error AudioDriverCoreAudio::init() { | ||||||
| 
 | 
 | ||||||
| 	mix_rate = GLOBAL_GET("audio/mix_rate"); | 	mix_rate = GLOBAL_GET("audio/mix_rate"); | ||||||
| 
 | 
 | ||||||
| 	zeromem(&strdesc, sizeof(strdesc)); | 	memset(&strdesc, 0, sizeof(strdesc)); | ||||||
| 	strdesc.mFormatID = kAudioFormatLinearPCM; | 	strdesc.mFormatID = kAudioFormatLinearPCM; | ||||||
| 	strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; | 	strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; | ||||||
| 	strdesc.mChannelsPerFrame = channels; | 	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"); | 	print_verbose("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms"); | ||||||
| 
 | 
 | ||||||
| 	AURenderCallbackStruct callback; | 	AURenderCallbackStruct callback; | ||||||
| 	zeromem(&callback, sizeof(AURenderCallbackStruct)); | 	memset(&callback, 0, sizeof(AURenderCallbackStruct)); | ||||||
| 	callback.inputProc = &AudioDriverCoreAudio::output_callback; | 	callback.inputProc = &AudioDriverCoreAudio::output_callback; | ||||||
| 	callback.inputProcRefCon = this; | 	callback.inputProcRefCon = this; | ||||||
| 	result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback)); | 	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()) { | 	if (!ad->active || !ad->try_lock()) { | ||||||
| 		for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { | 		for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { | ||||||
| 			AudioBuffer *abuf = &ioData->mBuffers[i]; | 			AudioBuffer *abuf = &ioData->mBuffers[i]; | ||||||
| 			zeromem(abuf->mData, abuf->mDataByteSize); | 			memset(abuf->mData, 0, abuf->mDataByteSize); | ||||||
| 		}; | 		}; | ||||||
| 		return 0; | 		return 0; | ||||||
| 	}; | 	}; | ||||||
|  | @ -298,7 +298,7 @@ void AudioDriverCoreAudio::finish() { | ||||||
| 		lock(); | 		lock(); | ||||||
| 
 | 
 | ||||||
| 		AURenderCallbackStruct callback; | 		AURenderCallbackStruct callback; | ||||||
| 		zeromem(&callback, sizeof(AURenderCallbackStruct)); | 		memset(&callback, 0, sizeof(AURenderCallbackStruct)); | ||||||
| 		result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback)); | 		result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback)); | ||||||
| 		if (result != noErr) { | 		if (result != noErr) { | ||||||
| 			ERR_PRINT("AudioUnitSetProperty failed"); | 			ERR_PRINT("AudioUnitSetProperty failed"); | ||||||
|  | @ -342,7 +342,7 @@ void AudioDriverCoreAudio::finish() { | ||||||
| 
 | 
 | ||||||
| Error AudioDriverCoreAudio::capture_init() { | Error AudioDriverCoreAudio::capture_init() { | ||||||
| 	AudioComponentDescription desc; | 	AudioComponentDescription desc; | ||||||
| 	zeromem(&desc, sizeof(desc)); | 	memset(&desc, 0, sizeof(desc)); | ||||||
| 	desc.componentType = kAudioUnitType_Output; | 	desc.componentType = kAudioUnitType_Output; | ||||||
| #ifdef OSX_ENABLED | #ifdef OSX_ENABLED | ||||||
| 	desc.componentSubType = kAudioUnitSubType_HALOutput; | 	desc.componentSubType = kAudioUnitSubType_HALOutput; | ||||||
|  | @ -388,7 +388,7 @@ Error AudioDriverCoreAudio::capture_init() { | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 	AudioStreamBasicDescription strdesc; | 	AudioStreamBasicDescription strdesc; | ||||||
| 	zeromem(&strdesc, sizeof(strdesc)); | 	memset(&strdesc, 0, sizeof(strdesc)); | ||||||
| 	size = sizeof(strdesc); | 	size = sizeof(strdesc); | ||||||
| 	result = AudioUnitGetProperty(input_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &strdesc, &size); | 	result = AudioUnitGetProperty(input_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &strdesc, &size); | ||||||
| 	ERR_FAIL_COND_V(result != noErr, FAILED); | 	ERR_FAIL_COND_V(result != noErr, FAILED); | ||||||
|  | @ -410,7 +410,7 @@ Error AudioDriverCoreAudio::capture_init() { | ||||||
| 
 | 
 | ||||||
| 	mix_rate = GLOBAL_GET("audio/mix_rate"); | 	mix_rate = GLOBAL_GET("audio/mix_rate"); | ||||||
| 
 | 
 | ||||||
| 	zeromem(&strdesc, sizeof(strdesc)); | 	memset(&strdesc, 0, sizeof(strdesc)); | ||||||
| 	strdesc.mFormatID = kAudioFormatLinearPCM; | 	strdesc.mFormatID = kAudioFormatLinearPCM; | ||||||
| 	strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; | 	strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; | ||||||
| 	strdesc.mChannelsPerFrame = capture_channels; | 	strdesc.mChannelsPerFrame = capture_channels; | ||||||
|  | @ -424,7 +424,7 @@ Error AudioDriverCoreAudio::capture_init() { | ||||||
| 	ERR_FAIL_COND_V(result != noErr, FAILED); | 	ERR_FAIL_COND_V(result != noErr, FAILED); | ||||||
| 
 | 
 | ||||||
| 	AURenderCallbackStruct callback; | 	AURenderCallbackStruct callback; | ||||||
| 	zeromem(&callback, sizeof(AURenderCallbackStruct)); | 	memset(&callback, 0, sizeof(AURenderCallbackStruct)); | ||||||
| 	callback.inputProc = &AudioDriverCoreAudio::input_callback; | 	callback.inputProc = &AudioDriverCoreAudio::input_callback; | ||||||
| 	callback.inputProcRefCon = this; | 	callback.inputProcRefCon = this; | ||||||
| 	result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, kInputBus, &callback, sizeof(callback)); | 	result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, kInputBus, &callback, sizeof(callback)); | ||||||
|  | @ -441,7 +441,7 @@ void AudioDriverCoreAudio::capture_finish() { | ||||||
| 		lock(); | 		lock(); | ||||||
| 
 | 
 | ||||||
| 		AURenderCallbackStruct callback; | 		AURenderCallbackStruct callback; | ||||||
| 		zeromem(&callback, sizeof(AURenderCallbackStruct)); | 		memset(&callback, 0, sizeof(AURenderCallbackStruct)); | ||||||
| 		OSStatus result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &callback, sizeof(callback)); | 		OSStatus result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &callback, sizeof(callback)); | ||||||
| 		if (result != noErr) { | 		if (result != noErr) { | ||||||
| 			ERR_PRINT("AudioUnitSetProperty failed"); | 			ERR_PRINT("AudioUnitSetProperty failed"); | ||||||
|  |  | ||||||
|  | @ -1558,7 +1558,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste | ||||||
| 
 | 
 | ||||||
| 							size_t transform_buffer_offset = i * 12; | 							size_t transform_buffer_offset = i * 12; | ||||||
| 
 | 
 | ||||||
| 							copymem(&buffer[transform_buffer_offset], row, sizeof(row)); | 							memcpy(&buffer[transform_buffer_offset], row, sizeof(row)); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3401,7 +3401,7 @@ void RasterizerStorageGLES2::multimesh_set_as_bulk_array(RID p_multimesh, const | ||||||
| 
 | 
 | ||||||
| 	PoolVector<float>::Read r = p_array.read(); | 	PoolVector<float>::Read r = p_array.read(); | ||||||
| 	ERR_FAIL_COND(!r.ptr()); | 	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_data = true; | ||||||
| 	multimesh->dirty_aabb = true; | 	multimesh->dirty_aabb = true; | ||||||
|  | @ -4466,7 +4466,7 @@ void RasterizerStorageGLES2::lightmap_capture_set_octree(RID p_capture, const Po | ||||||
| 	if (p_octree.size()) { | 	if (p_octree.size()) { | ||||||
| 		PoolVector<LightmapCaptureOctree>::Write w = capture->octree.write(); | 		PoolVector<LightmapCaptureOctree>::Write w = capture->octree.write(); | ||||||
| 		PoolVector<uint8_t>::Read r = p_octree.read(); | 		PoolVector<uint8_t>::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); | 	capture->instance_change_notify(true, false); | ||||||
| } | } | ||||||
|  | @ -4483,7 +4483,7 @@ PoolVector<uint8_t> RasterizerStorageGLES2::lightmap_capture_get_octree(RID p_ca | ||||||
| 	{ | 	{ | ||||||
| 		PoolVector<LightmapCaptureOctree>::Read r = capture->octree.read(); | 		PoolVector<LightmapCaptureOctree>::Read r = capture->octree.read(); | ||||||
| 		PoolVector<uint8_t>::Write w = ret.write(); | 		PoolVector<uint8_t>::Write w = ret.write(); | ||||||
| 		copymem(w.ptr(), r.ptr(), ret.size()); | 		memcpy(w.ptr(), r.ptr(), ret.size()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return ret; | 	return ret; | ||||||
|  |  | ||||||
|  | @ -2912,7 +2912,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				li->light_index = state.omni_light_count; | 				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++; | 				state.omni_light_count++; | ||||||
| 
 | 
 | ||||||
| 			} break; | 			} 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; | 				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++; | 				state.spot_light_count++; | ||||||
| 			} break; | 			} break; | ||||||
| 		} | 		} | ||||||
|  | @ -3096,7 +3096,7 @@ void RasterizerSceneGLES3::_setup_reflections(RID *p_reflection_probe_cull_resul | ||||||
| 		store_transform(proj, reflection_ubo.local_matrix); | 		store_transform(proj, reflection_ubo.local_matrix); | ||||||
| 
 | 
 | ||||||
| 		rpi->reflection_index = state.reflection_probe_count; | 		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++; | 		state.reflection_probe_count++; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3273,37 +3273,37 @@ _FORCE_INLINE_ static void _fill_std140_ubo_empty(ShaderLanguage::DataType type, | ||||||
| 		case ShaderLanguage::TYPE_INT: | 		case ShaderLanguage::TYPE_INT: | ||||||
| 		case ShaderLanguage::TYPE_UINT: | 		case ShaderLanguage::TYPE_UINT: | ||||||
| 		case ShaderLanguage::TYPE_FLOAT: { | 		case ShaderLanguage::TYPE_FLOAT: { | ||||||
| 			zeromem(data, 4); | 			memset(data, 0, 4); | ||||||
| 		} break; | 		} break; | ||||||
| 		case ShaderLanguage::TYPE_BVEC2: | 		case ShaderLanguage::TYPE_BVEC2: | ||||||
| 		case ShaderLanguage::TYPE_IVEC2: | 		case ShaderLanguage::TYPE_IVEC2: | ||||||
| 		case ShaderLanguage::TYPE_UVEC2: | 		case ShaderLanguage::TYPE_UVEC2: | ||||||
| 		case ShaderLanguage::TYPE_VEC2: { | 		case ShaderLanguage::TYPE_VEC2: { | ||||||
| 			zeromem(data, 8); | 			memset(data, 0, 8); | ||||||
| 		} break; | 		} break; | ||||||
| 		case ShaderLanguage::TYPE_BVEC3: | 		case ShaderLanguage::TYPE_BVEC3: | ||||||
| 		case ShaderLanguage::TYPE_IVEC3: | 		case ShaderLanguage::TYPE_IVEC3: | ||||||
| 		case ShaderLanguage::TYPE_UVEC3: | 		case ShaderLanguage::TYPE_UVEC3: | ||||||
| 		case ShaderLanguage::TYPE_VEC3: { | 		case ShaderLanguage::TYPE_VEC3: { | ||||||
| 			zeromem(data, 12); | 			memset(data, 0, 12); | ||||||
| 		} break; | 		} break; | ||||||
| 		case ShaderLanguage::TYPE_BVEC4: | 		case ShaderLanguage::TYPE_BVEC4: | ||||||
| 		case ShaderLanguage::TYPE_IVEC4: | 		case ShaderLanguage::TYPE_IVEC4: | ||||||
| 		case ShaderLanguage::TYPE_UVEC4: | 		case ShaderLanguage::TYPE_UVEC4: | ||||||
| 		case ShaderLanguage::TYPE_VEC4: { | 		case ShaderLanguage::TYPE_VEC4: { | ||||||
| 
 | 
 | ||||||
| 			zeromem(data, 16); | 			memset(data, 0, 16); | ||||||
| 		} break; | 		} break; | ||||||
| 		case ShaderLanguage::TYPE_MAT2: { | 		case ShaderLanguage::TYPE_MAT2: { | ||||||
| 
 | 
 | ||||||
| 			zeromem(data, 32); | 			memset(data, 0, 32); | ||||||
| 		} break; | 		} break; | ||||||
| 		case ShaderLanguage::TYPE_MAT3: { | 		case ShaderLanguage::TYPE_MAT3: { | ||||||
| 
 | 
 | ||||||
| 			zeromem(data, 48); | 			memset(data, 0, 48); | ||||||
| 		} break; | 		} break; | ||||||
| 		case ShaderLanguage::TYPE_MAT4: { | 		case ShaderLanguage::TYPE_MAT4: { | ||||||
| 			zeromem(data, 64); | 			memset(data, 0, 64); | ||||||
| 		} break; | 		} break; | ||||||
| 
 | 
 | ||||||
| 		default: { | 		default: { | ||||||
|  | @ -4099,7 +4099,7 @@ PoolVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, i | ||||||
| 	ERR_FAIL_NULL_V(data, PoolVector<uint8_t>()); | 	ERR_FAIL_NULL_V(data, PoolVector<uint8_t>()); | ||||||
| 	{ | 	{ | ||||||
| 		PoolVector<uint8_t>::Write w = ret.write(); | 		PoolVector<uint8_t>::Write w = ret.write(); | ||||||
| 		copymem(w.ptr(), data, surface->array_byte_size); | 		memcpy(w.ptr(), data, surface->array_byte_size); | ||||||
| 	} | 	} | ||||||
| 	glUnmapBuffer(GL_ARRAY_BUFFER); | 	glUnmapBuffer(GL_ARRAY_BUFFER); | ||||||
| #endif | #endif | ||||||
|  | @ -4131,7 +4131,7 @@ PoolVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_m | ||||||
| 		ERR_FAIL_NULL_V(data, PoolVector<uint8_t>()); | 		ERR_FAIL_NULL_V(data, PoolVector<uint8_t>()); | ||||||
| 		{ | 		{ | ||||||
| 			PoolVector<uint8_t>::Write w = ret.write(); | 			PoolVector<uint8_t>::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); | 		glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); | ||||||
| #endif | #endif | ||||||
|  | @ -4193,7 +4193,7 @@ Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shap | ||||||
| 		ERR_FAIL_COND_V(!data, Vector<PoolVector<uint8_t> >()); | 		ERR_FAIL_COND_V(!data, Vector<PoolVector<uint8_t> >()); | ||||||
| 		{ | 		{ | ||||||
| 			PoolVector<uint8_t>::Write w = ret.write(); | 			PoolVector<uint8_t>::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); | 		glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); | ||||||
| #endif | #endif | ||||||
|  | @ -5060,7 +5060,7 @@ void RasterizerStorageGLES3::multimesh_set_as_bulk_array(RID p_multimesh, const | ||||||
| 	ERR_FAIL_COND(dsize != p_array.size()); | 	ERR_FAIL_COND(dsize != p_array.size()); | ||||||
| 
 | 
 | ||||||
| 	PoolVector<float>::Read r = p_array.read(); | 	PoolVector<float>::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_data = true; | ||||||
| 	multimesh->dirty_aabb = true; | 	multimesh->dirty_aabb = true; | ||||||
|  | @ -6321,7 +6321,7 @@ void RasterizerStorageGLES3::lightmap_capture_set_octree(RID p_capture, const Po | ||||||
| 	if (p_octree.size()) { | 	if (p_octree.size()) { | ||||||
| 		PoolVector<LightmapCaptureOctree>::Write w = capture->octree.write(); | 		PoolVector<LightmapCaptureOctree>::Write w = capture->octree.write(); | ||||||
| 		PoolVector<uint8_t>::Read r = p_octree.read(); | 		PoolVector<uint8_t>::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); | 	capture->instance_change_notify(true, false); | ||||||
| } | } | ||||||
|  | @ -6338,7 +6338,7 @@ PoolVector<uint8_t> RasterizerStorageGLES3::lightmap_capture_get_octree(RID p_ca | ||||||
| 	{ | 	{ | ||||||
| 		PoolVector<LightmapCaptureOctree>::Read r = capture->octree.read(); | 		PoolVector<LightmapCaptureOctree>::Read r = capture->octree.read(); | ||||||
| 		PoolVector<uint8_t>::Write w = ret.write(); | 		PoolVector<uint8_t>::Write w = ret.write(); | ||||||
| 		copymem(w.ptr(), r.ptr(), ret.size()); | 		memcpy(w.ptr(), r.ptr(), ret.size()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return ret; | 	return ret; | ||||||
|  |  | ||||||
|  | @ -93,7 +93,7 @@ PoolVector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) | ||||||
| 	{ | 	{ | ||||||
| 		// must be closed before call to image_to_png
 | 		// must be closed before call to image_to_png
 | ||||||
| 		PoolVector<uint8_t>::Write writer = out_buffer.write(); | 		PoolVector<uint8_t>::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); | 	Error err = PNGDriverCommon::image_to_png(p_image, out_buffer); | ||||||
|  |  | ||||||
|  | @ -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<Image> p_image) { | Error png_to_image(const uint8_t *p_source, size_t p_size, bool p_force_linear, Ref<Image> p_image) { | ||||||
| 	png_image png_img; | 	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.version = PNG_IMAGE_VERSION; | ||||||
| 
 | 
 | ||||||
| 	// fetch image properties
 | 	// fetch image properties
 | ||||||
|  | @ -133,7 +133,7 @@ Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer) { | ||||||
| 	ERR_FAIL_COND_V(source_image->is_compressed(), FAILED); | 	ERR_FAIL_COND_V(source_image->is_compressed(), FAILED); | ||||||
| 
 | 
 | ||||||
| 	png_image png_img; | 	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.version = PNG_IMAGE_VERSION; | ||||||
| 	png_img.width = source_image->get_width(); | 	png_img.width = source_image->get_width(); | ||||||
| 	png_img.height = source_image->get_height(); | 	png_img.height = source_image->get_height(); | ||||||
|  |  | ||||||
|  | @ -107,7 +107,7 @@ size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const | ||||||
| 		addr6->sin6_family = AF_INET6; | 		addr6->sin6_family = AF_INET6; | ||||||
| 		addr6->sin6_port = htons(p_port); | 		addr6->sin6_port = htons(p_port); | ||||||
| 		if (p_ip.is_valid()) { | 		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 { | 		} else { | ||||||
| 			addr6->sin6_addr = in6addr_any; | 			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
 | 		addr4->sin_port = htons(p_port); // short, network byte order
 | ||||||
| 
 | 
 | ||||||
| 		if (p_ip.is_valid()) { | 		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 { | 		} else { | ||||||
| 			addr4->sin_addr.s_addr = INADDR_ANY; | 			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); | 		ERR_FAIL_COND_V(!if_ip.is_valid(), ERR_INVALID_PARAMETER); | ||||||
| 		struct ip_mreq greq; | 		struct ip_mreq greq; | ||||||
| 		int sock_opt = p_add ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; | 		int sock_opt = p_add ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; | ||||||
| 		copymem(&greq.imr_multiaddr, p_ip.get_ipv4(), 4); | 		memcpy(&greq.imr_multiaddr, p_ip.get_ipv4(), 4); | ||||||
| 		copymem(&greq.imr_interface, if_ip.get_ipv4(), 4); | 		memcpy(&greq.imr_interface, if_ip.get_ipv4(), 4); | ||||||
| 		ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq)); | 		ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq)); | ||||||
| 	} else { | 	} else { | ||||||
| 		struct ipv6_mreq greq; | 		struct ipv6_mreq greq; | ||||||
| 		int sock_opt = p_add ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP; | 		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; | 		greq.ipv6mr_interface = if_v6id; | ||||||
| 		ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq)); | 		ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -396,7 +396,7 @@ void ParticlesEditor::_generate_emission_points() { | ||||||
| 
 | 
 | ||||||
| 	{ | 	{ | ||||||
| 		PoolVector<uint8_t>::Write iw = point_img.write(); | 		PoolVector<uint8_t>::Write iw = point_img.write(); | ||||||
| 		zeromem(iw.ptr(), w * h * 3 * sizeof(float)); | 		memset(iw.ptr(), 0, w * h * 3 * sizeof(float)); | ||||||
| 		PoolVector<Vector3>::Read r = points.read(); | 		PoolVector<Vector3>::Read r = points.read(); | ||||||
| 		float *wf = (float *)iw.ptr(); | 		float *wf = (float *)iw.ptr(); | ||||||
| 		for (int i = 0; i < point_count; i++) { | 		for (int i = 0; i < point_count; i++) { | ||||||
|  | @ -426,7 +426,7 @@ void ParticlesEditor::_generate_emission_points() { | ||||||
| 
 | 
 | ||||||
| 		{ | 		{ | ||||||
| 			PoolVector<uint8_t>::Write iw = point_img2.write(); | 			PoolVector<uint8_t>::Write iw = point_img2.write(); | ||||||
| 			zeromem(iw.ptr(), w * h * 3 * sizeof(float)); | 			memset(iw.ptr(), 0, w * h * 3 * sizeof(float)); | ||||||
| 			PoolVector<Vector3>::Read r = normals.read(); | 			PoolVector<Vector3>::Read r = normals.read(); | ||||||
| 			float *wf = (float *)iw.ptr(); | 			float *wf = (float *)iw.ptr(); | ||||||
| 			for (int i = 0; i < point_count; i++) { | 			for (int i = 0; i < point_count; i++) { | ||||||
|  |  | ||||||
|  | @ -29,7 +29,6 @@ | ||||||
| /*************************************************************************/ | /*************************************************************************/ | ||||||
| 
 | 
 | ||||||
| #include "denoise_wrapper.h" | #include "denoise_wrapper.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/memory.h" | #include "core/os/memory.h" | ||||||
| #include "thirdparty/oidn/include/OpenImageDenoise/oidn.h" | #include "thirdparty/oidn/include/OpenImageDenoise/oidn.h" | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
|  |  | ||||||
|  | @ -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); | 	ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 8, packet_flags); | ||||||
| 	encode_uint32(unique_id, &packet->data[0]); // Source ID
 | 	encode_uint32(unique_id, &packet->data[0]); // Source ID
 | ||||||
| 	encode_uint32(target_peer, &packet->data[4]); // Dest 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) { | 	if (server) { | ||||||
| 
 | 
 | ||||||
|  | @ -705,7 +705,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer * | ||||||
| 	while (total) { | 	while (total) { | ||||||
| 		for (size_t i = 0; i < inBufferCount; i++) { | 		for (size_t i = 0; i < inBufferCount; i++) { | ||||||
| 			int to_copy = MIN(total, int(inBuffers[i].dataLength)); | 			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; | 			ofs += to_copy; | ||||||
| 			total -= to_copy; | 			total -= to_copy; | ||||||
| 		} | 		} | ||||||
|  | @ -740,7 +740,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer * | ||||||
| 	if (ret > int(outLimit)) | 	if (ret > int(outLimit)) | ||||||
| 		return 0; // Do not bother
 | 		return 0; // Do not bother
 | ||||||
| 
 | 
 | ||||||
| 	copymem(outData, enet->dst_compressor_mem.ptr(), ret); | 	memcpy(outData, enet->dst_compressor_mem.ptr(), ret); | ||||||
| 
 | 
 | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "image_compress_etc.h" | #include "image_compress_etc.h" | ||||||
| 
 | 
 | ||||||
| #include "core/image.h" | #include "core/image.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/os/os.h" | #include "core/os/os.h" | ||||||
| #include "core/print_string.h" | #include "core/print_string.h" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -94,8 +94,8 @@ struct NativeScriptDesc { | ||||||
| 			base_native_type(), | 			base_native_type(), | ||||||
| 			documentation(), | 			documentation(), | ||||||
| 			type_tag(NULL) { | 			type_tag(NULL) { | ||||||
| 		zeromem(&create_func, sizeof(godot_instance_create_func)); | 		memset(&create_func, 0, sizeof(godot_instance_create_func)); | ||||||
| 		zeromem(&destroy_func, sizeof(godot_instance_destroy_func)); | 		memset(&destroy_func, 0, sizeof(godot_instance_destroy_func)); | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #include "gdscript_language_protocol.h" | #include "gdscript_language_protocol.h" | ||||||
| 
 | 
 | ||||||
| #include "core/io/json.h" | #include "core/io/json.h" | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/project_settings.h" | #include "core/project_settings.h" | ||||||
| #include "editor/editor_log.h" | #include "editor/editor_log.h" | ||||||
| #include "editor/editor_node.h" | #include "editor/editor_node.h" | ||||||
|  |  | ||||||
|  | @ -967,7 +967,7 @@ void LightmapperCPU::_post_process(uint32_t p_idx, void *r_output) { | ||||||
| 				PoolByteArray data; | 				PoolByteArray data; | ||||||
| 				data.resize(data_size); | 				data.resize(data_size); | ||||||
| 				PoolByteArray::Write w = data.write(); | 				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); | 				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(); | 			PoolByteArray denoised_data = denoised_image->get_data(); | ||||||
| 			denoised_image.unref(); | 			denoised_image.unref(); | ||||||
| 			PoolByteArray::Read r = denoised_data.read(); | 			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<UVSeam> &p_seams, Vector3 *r_l | ||||||
| 	LocalVector<Vector3> extra_buffer; | 	LocalVector<Vector3> extra_buffer; | ||||||
| 	extra_buffer.resize(p_size.x * p_size.y); | 	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 *read_ptr = extra_buffer.ptr(); | ||||||
| 	Vector3 *write_ptr = r_lightmap; | 	Vector3 *write_ptr = r_lightmap; | ||||||
|  | @ -1084,7 +1084,7 @@ void LightmapperCPU::_fix_seams(const LocalVector<UVSeam> &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].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); | 			_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)); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -352,7 +352,7 @@ Vector<uint8_t> 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); | 	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)); | 	ERR_FAIL_COND_V_MSG(ret, out, "Error while signing: " + itos(ret)); | ||||||
| 	out.resize(sig_size); | 	out.resize(sig_size); | ||||||
| 	copymem(out.ptrw(), buf, sig_size); | 	memcpy(out.ptrw(), buf, sig_size); | ||||||
| 	return out; | 	return out; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -375,7 +375,7 @@ Vector<uint8_t> CryptoMbedTLS::encrypt(Ref<CryptoKey> p_key, Vector<uint8_t> 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); | 	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)); | 	ERR_FAIL_COND_V_MSG(ret, out, "Error while encrypting: " + itos(ret)); | ||||||
| 	out.resize(size); | 	out.resize(size); | ||||||
| 	copymem(out.ptrw(), buf, size); | 	memcpy(out.ptrw(), buf, size); | ||||||
| 	return out; | 	return out; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -389,6 +389,6 @@ Vector<uint8_t> CryptoMbedTLS::decrypt(Ref<CryptoKey> p_key, Vector<uint8_t> 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); | 	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)); | 	ERR_FAIL_COND_V_MSG(ret, out, "Error while decrypting: " + itos(ret)); | ||||||
| 	out.resize(size); | 	out.resize(size); | ||||||
| 	copymem(out.ptrw(), buf, size); | 	memcpy(out.ptrw(), buf, size); | ||||||
| 	return out; | 	return out; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) { | ||||||
| 	if (err != OK) { | 	if (err != OK) { | ||||||
| 		return MBEDTLS_ERR_SSL_INTERNAL_ERROR; | 		return MBEDTLS_ERR_SSL_INTERNAL_ERROR; | ||||||
| 	} | 	} | ||||||
| 	copymem(buf, buffer, buffer_size); | 	memcpy(buf, buffer, buffer_size); | ||||||
| 	return buffer_size; | 	return buffer_size; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -88,8 +88,8 @@ int PacketPeerMbedDTLS::_set_cookie() { | ||||||
| 	uint8_t client_id[18]; | 	uint8_t client_id[18]; | ||||||
| 	IP_Address addr = base->get_packet_address(); | 	IP_Address addr = base->get_packet_address(); | ||||||
| 	uint16_t port = base->get_packet_port(); | 	uint16_t port = base->get_packet_port(); | ||||||
| 	copymem(client_id, addr.get_ipv6(), 16); | 	memcpy(client_id, addr.get_ipv6(), 16); | ||||||
| 	copymem(&client_id[16], (uint8_t *)&port, 2); | 	memcpy(&client_id[16], (uint8_t *)&port, 2); | ||||||
| 	return mbedtls_ssl_set_client_transport_id(ssl_ctx->get_context(), client_id, 18); | 	return mbedtls_ssl_set_client_transport_id(ssl_ctx->get_context(), client_id, 18); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -181,7 +181,7 @@ PoolVector<uint8_t> AudioStreamMP3::get_data() const { | ||||||
| 		vdata.resize(data_len); | 		vdata.resize(data_len); | ||||||
| 		{ | 		{ | ||||||
| 			PoolVector<uint8_t>::Write w = vdata.write(); | 			PoolVector<uint8_t>::Write w = vdata.write(); | ||||||
| 			copymem(w.ptr(), data, data_len); | 			memcpy(w.ptr(), data, data_len); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -66,7 +66,7 @@ static void _compress_pvrtc4(Image *p_img) { | ||||||
| 			img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h); | 			img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h); | ||||||
| 			Javelin::RgbaBitmap bm(w, h); | 			Javelin::RgbaBitmap bm(w, h); | ||||||
| 			void *dst = (void *)bm.GetData(); | 			void *dst = (void *)bm.GetData(); | ||||||
| 			copymem(dst, &r[ofs], size); | 			memcpy(dst, &r[ofs], size); | ||||||
| 			Javelin::ColorRgba<unsigned char> *dp = bm.GetData(); | 			Javelin::ColorRgba<unsigned char> *dp = bm.GetData(); | ||||||
| 			for (int j = 0; j < size / 4; j++) { | 			for (int j = 0; j < size / 4; j++) { | ||||||
| 				// Red and blue colors are swapped.
 | 				// Red and blue colors are swapped.
 | ||||||
|  |  | ||||||
|  | @ -133,10 +133,10 @@ void LightmapRaycasterEmbree::add_mesh(const Vector<Vector3> &p_vertices, const | ||||||
| 	ERR_FAIL_COND(!p_normals.empty() && vertex_count != p_normals.size()); | 	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); | 	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); | 	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); | 	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++) { | 	for (int i = 0; i < vertex_count; i++) { | ||||||
|  | @ -145,7 +145,7 @@ void LightmapRaycasterEmbree::add_mesh(const Vector<Vector3> &p_vertices, const | ||||||
| 
 | 
 | ||||||
| 	if (!p_normals.empty()) { | 	if (!p_normals.empty()) { | ||||||
| 		Vector3 *embree_normals = (Vector3 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 1, RTC_FORMAT_FLOAT3, sizeof(Vector3), vertex_count); | 		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); | 	rtcCommitGeometry(embree_mesh); | ||||||
|  |  | ||||||
|  | @ -233,7 +233,7 @@ PoolVector<uint8_t> AudioStreamOGGVorbis::get_data() const { | ||||||
| 		vdata.resize(data_len); | 		vdata.resize(data_len); | ||||||
| 		{ | 		{ | ||||||
| 			PoolVector<uint8_t>::Write w = vdata.write(); | 			PoolVector<uint8_t>::Write w = vdata.write(); | ||||||
| 			copymem(w.ptr(), data, data_len); | 			memcpy(w.ptr(), data, data_len); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -226,7 +226,7 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { | ||||||
| 			/* identify the codec: try theora */ | 			/* identify the codec: try theora */ | ||||||
| 			if (!theora_p && th_decode_headerin(&ti, &tc, &ts, &op) >= 0) { | 			if (!theora_p && th_decode_headerin(&ti, &tc, &ts, &op) >= 0) { | ||||||
| 				/* it is theora */ | 				/* it is theora */ | ||||||
| 				copymem(&to, &test, sizeof(test)); | 				memcpy(&to, &test, sizeof(test)); | ||||||
| 				theora_p = 1; | 				theora_p = 1; | ||||||
| 			} else if (!vorbis_p && vorbis_synthesis_headerin(&vi, &vc, &op) >= 0) { | 			} 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--; | 					audio_track_skip--; | ||||||
| 				} else { | 				} else { | ||||||
| 					copymem(&vo, &test, sizeof(test)); | 					memcpy(&vo, &test, sizeof(test)); | ||||||
| 					vorbis_p = 1; | 					vorbis_p = 1; | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
|  |  | ||||||
|  | @ -1680,7 +1680,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p | ||||||
| 				state->flow_stack_pos = flow_stack_pos; | 				state->flow_stack_pos = flow_stack_pos; | ||||||
| 				state->stack.resize(p_stack_size); | 				state->stack.resize(p_stack_size); | ||||||
| 				state->pass = p_pass; | 				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
 | 				//step 2, run away, return directly
 | ||||||
| 				r_error.error = Variant::CallError::CALL_OK; | 				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
 | 		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<int, VisualScriptNodeInstance *>::Element *E = instances.find(f->node); | 	Map<int, VisualScriptNodeInstance *>::Element *E = instances.find(f->node); | ||||||
| 	if (!E) { | 	if (!E) { | ||||||
|  |  | ||||||
|  | @ -69,7 +69,7 @@ static PoolVector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_q | ||||||
| 	w[1] = 'E'; | 	w[1] = 'E'; | ||||||
| 	w[2] = 'B'; | 	w[2] = 'B'; | ||||||
| 	w[3] = 'P'; | 	w[3] = 'P'; | ||||||
| 	copymem(&w[4], dst_buff, dst_size); | 	memcpy(&w[4], dst_buff, dst_size); | ||||||
| 	free(dst_buff); | 	free(dst_buff); | ||||||
| 	w.release(); | 	w.release(); | ||||||
| 	return dst; | 	return dst; | ||||||
|  |  | ||||||
|  | @ -31,7 +31,6 @@ | ||||||
| #ifndef PACKET_BUFFER_H | #ifndef PACKET_BUFFER_H | ||||||
| #define PACKET_BUFFER_H | #define PACKET_BUFFER_H | ||||||
| 
 | 
 | ||||||
| #include "core/os/copymem.h" |  | ||||||
| #include "core/ring_buffer.h" | #include "core/ring_buffer.h" | ||||||
| 
 | 
 | ||||||
| template <class T> | template <class T> | ||||||
|  | @ -67,7 +66,7 @@ public: | ||||||
| 		if (p_info) { | 		if (p_info) { | ||||||
| 			_Packet p; | 			_Packet p; | ||||||
| 			p.size = p_size; | 			p.size = p_size; | ||||||
| 			copymem(&p.info, p_info, sizeof(T)); | 			memcpy(&p.info, p_info, sizeof(T)); | ||||||
| 			_packets.write(p); | 			_packets.write(p); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -87,7 +86,7 @@ public: | ||||||
| 		ERR_FAIL_COND_V(p_bytes < (int)p.size, ERR_OUT_OF_MEMORY); | 		ERR_FAIL_COND_V(p_bytes < (int)p.size, ERR_OUT_OF_MEMORY); | ||||||
| 
 | 
 | ||||||
| 		r_read = p.size; | 		r_read = p.size; | ||||||
| 		copymem(r_info, &p.info, sizeof(T)); | 		memcpy(r_info, &p.info, sizeof(T)); | ||||||
| 		_payload.read(r_payload, p.size); | 		_payload.read(r_payload, p.size); | ||||||
| 		return OK; | 		return OK; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -193,10 +193,10 @@ PoolVector<uint8_t> WebSocketMultiplayerPeer::_make_pkt(uint8_t p_type, int32_t | ||||||
| 	out.resize(PROTO_SIZE + p_data_size); | 	out.resize(PROTO_SIZE + p_data_size); | ||||||
| 
 | 
 | ||||||
| 	PoolVector<uint8_t>::Write w = out.write(); | 	PoolVector<uint8_t>::Write w = out.write(); | ||||||
| 	copymem(&w[0], &p_type, 1); | 	memcpy(&w[0], &p_type, 1); | ||||||
| 	copymem(&w[1], &p_from, 4); | 	memcpy(&w[1], &p_from, 4); | ||||||
| 	copymem(&w[5], &p_to, 4); | 	memcpy(&w[5], &p_to, 4); | ||||||
| 	copymem(&w[PROTO_SIZE], p_data, p_data_size); | 	memcpy(&w[PROTO_SIZE], p_data, p_data_size); | ||||||
| 
 | 
 | ||||||
| 	return out; | 	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.size = p_data_size; | ||||||
| 	packet.source = p_source; | 	packet.source = p_source; | ||||||
| 	packet.destination = p_dest; | 	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); | 	_incoming_packets.push_back(packet); | ||||||
| 	emit_signal("peer_packet", p_source); | 	emit_signal("peer_packet", p_source); | ||||||
| } | } | ||||||
|  | @ -290,9 +290,9 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref<WebSocketPeer> p_peer, u | ||||||
| 	uint8_t type = 0; | 	uint8_t type = 0; | ||||||
| 	uint32_t from = 0; | 	uint32_t from = 0; | ||||||
| 	int32_t to = 0; | 	int32_t to = 0; | ||||||
| 	copymem(&type, in_buffer, 1); | 	memcpy(&type, in_buffer, 1); | ||||||
| 	copymem(&from, &in_buffer[1], 4); | 	memcpy(&from, &in_buffer[1], 4); | ||||||
| 	copymem(&to, &in_buffer[5], 4); | 	memcpy(&to, &in_buffer[5], 4); | ||||||
| 
 | 
 | ||||||
| 	if (is_server()) { // Server can resend
 | 	if (is_server()) { // Server can resend
 | ||||||
| 
 | 
 | ||||||
|  | @ -328,7 +328,7 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref<WebSocketPeer> p_peer, u | ||||||
| 		// System message
 | 		// System message
 | ||||||
| 		ERR_FAIL_COND(data_size < 4); | 		ERR_FAIL_COND(data_size < 4); | ||||||
| 		int id = 0; | 		int id = 0; | ||||||
| 		copymem(&id, &in_buffer[PROTO_SIZE], 4); | 		memcpy(&id, &in_buffer[PROTO_SIZE], 4); | ||||||
| 
 | 
 | ||||||
| 		switch (type) { | 		switch (type) { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2662,7 +2662,7 @@ public: | ||||||
| 					continue; | 					continue; | ||||||
| 				r_command_line_flags.resize(base + 4 + length); | 				r_command_line_flags.resize(base + 4 + length); | ||||||
| 				encode_uint32(length, &r_command_line_flags.write[base]); | 				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); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -211,7 +211,7 @@ PoolByteArray HTTPClient::read_response_body_chunk() { | ||||||
| 	} | 	} | ||||||
| 	chunk.resize(read); | 	chunk.resize(read); | ||||||
| 	PoolByteArray::Write w = chunk.write(); | 	PoolByteArray::Write w = chunk.write(); | ||||||
| 	copymem(&w[0], response_buffer.ptr(), read); | 	memcpy(&w[0], response_buffer.ptr(), read); | ||||||
| 	return chunk; | 	return chunk; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -192,7 +192,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour | ||||||
| 			if ((p_source.read()[(i + 1) * 4 + p_ch] == cur) && (p_source.read()[(i + 2) * 4 + p_ch] == cur)) { | 			if ((p_source.read()[(i + 1) * 4 + p_ch] == cur) && (p_source.read()[(i + 2) * 4 + p_ch] == cur)) { | ||||||
| 				if (buf_size > 0) { | 				if (buf_size > 0) { | ||||||
| 					result.write[res_size++] = (uint8_t)(buf_size - 1); | 					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; | 					res_size += buf_size; | ||||||
| 					buf_size = 0; | 					buf_size = 0; | ||||||
| 				} | 				} | ||||||
|  | @ -218,7 +218,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour | ||||||
| 				buf[buf_size++] = cur; | 				buf[buf_size++] = cur; | ||||||
| 				if (buf_size == 128) { | 				if (buf_size == 128) { | ||||||
| 					result.write[res_size++] = (uint8_t)(buf_size - 1); | 					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; | 					res_size += buf_size; | ||||||
| 					buf_size = 0; | 					buf_size = 0; | ||||||
| 				} | 				} | ||||||
|  | @ -226,7 +226,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour | ||||||
| 		} else { | 		} else { | ||||||
| 			buf[buf_size++] = cur; | 			buf[buf_size++] = cur; | ||||||
| 			result.write[res_size++] = (uint8_t)(buf_size - 1); | 			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; | 			res_size += buf_size; | ||||||
| 			buf_size = 0; | 			buf_size = 0; | ||||||
| 		} | 		} | ||||||
|  | @ -236,7 +236,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour | ||||||
| 
 | 
 | ||||||
| 	int ofs = p_dest.size(); | 	int ofs = p_dest.size(); | ||||||
| 	p_dest.resize(p_dest.size() + res_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<Image> &p_icon, Vector<uint8_t> &p_data) { | void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_t> &p_data) { | ||||||
|  | @ -296,7 +296,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ | ||||||
| 			memdelete(f); | 			memdelete(f); | ||||||
| 			len += 8; | 			len += 8; | ||||||
| 			len = BSWAP32(len); | 			len = BSWAP32(len); | ||||||
| 			copymem(&data.write[ofs], icon_infos[i].name, 4); | 			memcpy(&data.write[ofs], icon_infos[i].name, 4); | ||||||
| 			encode_uint32(len, &data.write[ofs + 4]); | 			encode_uint32(len, &data.write[ofs + 4]); | ||||||
| 
 | 
 | ||||||
| 			// Clean up generated file.
 | 			// Clean up generated file.
 | ||||||
|  | @ -316,7 +316,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ | ||||||
| 
 | 
 | ||||||
| 				int len = data.size() - ofs; | 				int len = data.size() - ofs; | ||||||
| 				len = BSWAP32(len); | 				len = BSWAP32(len); | ||||||
| 				copymem(&data.write[ofs], icon_infos[i].name, 4); | 				memcpy(&data.write[ofs], icon_infos[i].name, 4); | ||||||
| 				encode_uint32(len, &data.write[ofs + 4]); | 				encode_uint32(len, &data.write[ofs + 4]); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
|  | @ -331,7 +331,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ | ||||||
| 				} | 				} | ||||||
| 				len += 8; | 				len += 8; | ||||||
| 				len = BSWAP32(len); | 				len = BSWAP32(len); | ||||||
| 				copymem(&data.write[ofs], icon_infos[i].mask_name, 4); | 				memcpy(&data.write[ofs], icon_infos[i].mask_name, 4); | ||||||
| 				encode_uint32(len, &data.write[ofs + 4]); | 				encode_uint32(len, &data.write[ofs + 4]); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -1347,7 +1347,7 @@ public: | ||||||
| 			int base = clf.size(); | 			int base = clf.size(); | ||||||
| 			clf.resize(base + 4 + txt.length()); | 			clf.resize(base + 4 + txt.length()); | ||||||
| 			encode_uint32(txt.length(), &clf.write[base]); | 			encode_uint32(txt.length(), &clf.write[base]); | ||||||
| 			copymem(&clf.write[base + 4], txt.ptr(), txt.length()); | 			memcpy(&clf.write[base + 4], txt.ptr(), txt.length()); | ||||||
| 			print_line(itos(i) + " param: " + cl[i]); | 			print_line(itos(i) + " param: " + cl[i]); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -55,7 +55,7 @@ void CPUParticles2D::set_amount(int p_amount) { | ||||||
| 
 | 
 | ||||||
| 		// each particle must be set to false
 | 		// each particle must be set to false
 | ||||||
| 		// zeroing the data also prevents uninitialized memory being sent to GPU
 | 		// zeroing the data also prevents uninitialized memory being sent to GPU
 | ||||||
| 		zeromem(static_cast<void *>(&w[0]), p_amount * sizeof(Particle)); | 		memset(static_cast<void *>(&w[0]), 0, p_amount * sizeof(Particle)); | ||||||
| 		// cast to prevent compiler warning .. note this relies on Particle not containing any complex types.
 | 		// 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.
 | 		// 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]; | 				ptr[12] = r[idx].custom[3]; | ||||||
| 
 | 
 | ||||||
| 			} else { | 			} else { | ||||||
| 				zeromem(ptr, sizeof(float) * 13); | 				memset(ptr, 0, sizeof(float) * 13); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			ptr += 13; | 			ptr += 13; | ||||||
|  | @ -1143,7 +1143,7 @@ void CPUParticles2D::_notification(int p_what) { | ||||||
| 					ptr[7] = t.elements[2][1]; | 					ptr[7] = t.elements[2][1]; | ||||||
| 
 | 
 | ||||||
| 				} else { | 				} else { | ||||||
| 					zeromem(ptr, sizeof(float) * 8); | 					memset(ptr, 0, sizeof(float) * 8); | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				ptr += 13; | 				ptr += 13; | ||||||
|  |  | ||||||
|  | @ -1095,7 +1095,7 @@ void CPUParticles::_update_particle_data_buffer() { | ||||||
| 				ptr[10] = t.basis.elements[2][2]; | 				ptr[10] = t.basis.elements[2][2]; | ||||||
| 				ptr[11] = t.origin.z; | 				ptr[11] = t.origin.z; | ||||||
| 			} else { | 			} else { | ||||||
| 				zeromem(ptr, sizeof(float) * 12); | 				memset(ptr, 0, sizeof(float) * 12); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			Color c = r[idx].color; | 			Color c = r[idx].color; | ||||||
|  | @ -1204,7 +1204,7 @@ void CPUParticles::_notification(int p_what) { | ||||||
| 					ptr[10] = t.basis.elements[2][2]; | 					ptr[10] = t.basis.elements[2][2]; | ||||||
| 					ptr[11] = t.origin.z; | 					ptr[11] = t.origin.z; | ||||||
| 				} else { | 				} else { | ||||||
| 					zeromem(ptr, sizeof(float) * 12); | 					memset(ptr, 0, sizeof(float) * 12); | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				ptr += 17; | 				ptr += 17; | ||||||
|  |  | ||||||
|  | @ -383,7 +383,7 @@ void RayCast::_update_debug_shape() { | ||||||
| 		int array_size = sizeof(Vector3) * verts.size(); | 		int array_size = sizeof(Vector3) * verts.size(); | ||||||
| 		byte_array.resize(array_size); | 		byte_array.resize(array_size); | ||||||
| 		PoolByteArray::Write w = byte_array.write(); | 		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); | 		VS::get_singleton()->mesh_surface_update_region(mesh->get_rid(), 0, 0, byte_array); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -81,11 +81,11 @@ void SoftBodyVisualServerHandler::commit_changes() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void SoftBodyVisualServerHandler::set_vertex(int p_vertex_id, const void *p_vector3) { | 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) { | 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) { | void SoftBodyVisualServerHandler::set_aabb(const AABB &p_aabb) { | ||||||
|  |  | ||||||
|  | @ -587,13 +587,13 @@ void Sprite3D::_draw() { | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		float v_uv[2] = { uvs[i].x, uvs[i].y }; | 		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 }; | 		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); | 		memcpy(&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); | 		memcpy(&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); | 		memcpy(&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_COLOR]], v_color, 4); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	write_buffer.release(); | 	write_buffer.release(); | ||||||
|  | @ -949,13 +949,13 @@ void AnimatedSprite3D::_draw() { | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		float v_uv[2] = { uvs[i].x, uvs[i].y }; | 		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 }; | 		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); | 		memcpy(&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); | 		memcpy(&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); | 		memcpy(&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_COLOR]], v_color, 4); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	write_buffer.release(); | 	write_buffer.release(); | ||||||
|  |  | ||||||
|  | @ -731,7 +731,7 @@ void VoxelLightBaker::_check_init_light() { | ||||||
| 		leaf_voxel_count = 0; | 		leaf_voxel_count = 0; | ||||||
| 		_fixup_plot(0, 0); //pre fixup, so normal, albedo, emission, etc. work for lighting.
 | 		_fixup_plot(0, 0); //pre fixup, so normal, albedo, emission, etc. work for lighting.
 | ||||||
| 		bake_light.resize(bake_cells.size()); | 		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; | 		first_leaf = -1; | ||||||
| 		_init_light_plot(0, 0, 0, 0, 0, CHILD_EMPTY); | 		_init_light_plot(0, 0, 0, 0, 0, CHILD_EMPTY); | ||||||
| 	} | 	} | ||||||
|  | @ -1596,7 +1596,7 @@ PoolVector<uint8_t> VoxelLightBaker::create_capture_octree(int p_subdiv) { | ||||||
| 	ret.resize(ret_bytes); | 	ret.resize(ret_bytes); | ||||||
| 	{ | 	{ | ||||||
| 		PoolVector<uint8_t>::Write w = ret.write(); | 		PoolVector<uint8_t>::Write w = ret.write(); | ||||||
| 		copymem(w.ptr(), octree.ptr(), ret_bytes); | 		memcpy(w.ptr(), octree.ptr(), ret_bytes); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return ret; | 	return ret; | ||||||
|  |  | ||||||
|  | @ -493,9 +493,9 @@ void AudioStreamSample::set_data(const PoolVector<uint8_t> &p_data) { | ||||||
| 		PoolVector<uint8_t>::Read r = p_data.read(); | 		PoolVector<uint8_t>::Read r = p_data.read(); | ||||||
| 		int alloc_len = datalen + DATA_PAD * 2; | 		int alloc_len = datalen + DATA_PAD * 2; | ||||||
| 		data = AudioServer::get_singleton()->audio_data_alloc(alloc_len); //alloc with some padding for interpolation
 | 		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; | 		uint8_t *dataptr = (uint8_t *)data; | ||||||
| 		copymem(dataptr + DATA_PAD, r.ptr(), datalen); | 		memcpy(dataptr + DATA_PAD, r.ptr(), datalen); | ||||||
| 		data_bytes = datalen; | 		data_bytes = datalen; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -511,7 +511,7 @@ PoolVector<uint8_t> AudioStreamSample::get_data() const { | ||||||
| 
 | 
 | ||||||
| 			PoolVector<uint8_t>::Write w = pv.write(); | 			PoolVector<uint8_t>::Write w = pv.write(); | ||||||
| 			uint8_t *dataptr = (uint8_t *)data; | 			uint8_t *dataptr = (uint8_t *)data; | ||||||
| 			copymem(w.ptr(), dataptr + DATA_PAD, data_bytes); | 			memcpy(w.ptr(), dataptr + DATA_PAD, data_bytes); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ void BitMap::create(const Size2 &p_size) { | ||||||
| 	width = p_size.width; | 	width = p_size.width; | ||||||
| 	height = p_size.height; | 	height = p_size.height; | ||||||
| 	bitmask.resize(((width * height) / 8) + 1); | 	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<Image> &p_image, float p_threshold) { | void BitMap::create_from_image_alpha(const Ref<Image> &p_image, float p_threshold) { | ||||||
|  |  | ||||||
|  | @ -630,7 +630,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_ | ||||||
| 					PoolVector<uint8_t> id = mipmap_images[i]->get_data(); | 					PoolVector<uint8_t> id = mipmap_images[i]->get_data(); | ||||||
| 					int len = id.size(); | 					int len = id.size(); | ||||||
| 					PoolVector<uint8_t>::Read r = id.read(); | 					PoolVector<uint8_t>::Read r = id.read(); | ||||||
| 					copymem(&w[ofs], r.ptr(), len); | 					memcpy(&w[ofs], r.ptr(), len); | ||||||
| 					ofs += 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; | 				int expected = total_size - ofs; | ||||||
| 				if (bytes < expected) { | 				if (bytes < expected) { | ||||||
| 					//this is a compatibility workaround for older format, which saved less mipmaps2. It is still recommended the image is reimported.
 | 					//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) { | 				} else if (bytes != expected) { | ||||||
| 					ERR_FAIL_V(ERR_FILE_CORRUPT); | 					ERR_FAIL_V(ERR_FILE_CORRUPT); | ||||||
| 				} | 				} | ||||||
|  | @ -2328,7 +2328,7 @@ Error TextureLayered::load(const String &p_path) { | ||||||
| 						PoolVector<uint8_t> id = mipmap_images[i]->get_data(); | 						PoolVector<uint8_t> id = mipmap_images[i]->get_data(); | ||||||
| 						int len = id.size(); | 						int len = id.size(); | ||||||
| 						PoolVector<uint8_t>::Read r = id.read(); | 						PoolVector<uint8_t>::Read r = id.read(); | ||||||
| 						copymem(&w[ofs], r.ptr(), len); | 						memcpy(&w[ofs], r.ptr(), len); | ||||||
| 						ofs += len; | 						ofs += len; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
|  | @ -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); | 	void *ad = memalloc(p_data_len); | ||||||
| 	ERR_FAIL_COND_V(!ad, NULL); | 	ERR_FAIL_COND_V(!ad, NULL); | ||||||
| 	if (p_from_data) { | 	if (p_from_data) { | ||||||
| 		copymem(ad, p_from_data, p_data_len); | 		memcpy(ad, p_from_data, p_data_len); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	audio_data_lock.lock(); | 	audio_data_lock.lock(); | ||||||
|  |  | ||||||
|  | @ -1272,7 +1272,7 @@ _FORCE_INLINE_ static void _light_capture_sample_octree(const RasterizerStorage: | ||||||
| 
 | 
 | ||||||
| 	Vector3 color[2][8]; | 	Vector3 color[2][8]; | ||||||
| 	float alpha[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
 | 	//find cell at given level first
 | ||||||
| 
 | 
 | ||||||
|  | @ -2573,7 +2573,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { | ||||||
| 		size /= size_divisor; | 		size /= size_divisor; | ||||||
| 		mipmap.resize(size); | 		mipmap.resize(size); | ||||||
| 		PoolVector<uint8_t>::Write w = mipmap.write(); | 		PoolVector<uint8_t>::Write w = mipmap.write(); | ||||||
| 		zeromem(w.ptr(), size); | 		memset(w.ptr(), 0, size); | ||||||
| 		w.release(); | 		w.release(); | ||||||
| 
 | 
 | ||||||
| 		probe->dynamic.mipmaps_3d.push_back(mipmap); | 		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]; | 				const InstanceGIProbeData::CompBlockS3TC &b = mmr[i]; | ||||||
| 
 | 
 | ||||||
| 				uint8_t *blockptr = &mmw[b.offset * 16]; | 				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]; | 				Vector3 colors[16]; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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) }; | 							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) { | 							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 }; | 							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) { | 							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) }; | 							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) { | 							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 }; | 							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) { | 							if (i == 0) { | ||||||
| 
 | 
 | ||||||
|  | @ -481,14 +481,14 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ | ||||||
| 							0, | 							0, | ||||||
| 						}; | 						}; | ||||||
| 
 | 
 | ||||||
| 						copymem(&vw[p_offsets[ai] + i * p_stride], vector, 4); | 						memcpy(&vw[p_offsets[ai] + i * p_stride], vector, 4); | ||||||
| 					} | 					} | ||||||
| 
 | 
 | ||||||
| 				} else { | 				} else { | ||||||
| 					for (int i = 0; i < p_vertex_array_len; i++) { | 					for (int i = 0; i < p_vertex_array_len; i++) { | ||||||
| 
 | 
 | ||||||
| 						float vector[3] = { src[i].x, src[i].y, src[i].z }; | 						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) | 							(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 { | 				} else { | ||||||
|  | @ -528,7 +528,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ | ||||||
| 							src[i * 4 + 3] | 							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); | 							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 { | 				} else { | ||||||
| 
 | 
 | ||||||
| 					for (int i = 0; i < p_vertex_array_len; i++) { | 					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++) { | 					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) }; | 						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 { | 				} 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 }; | 						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++) { | 					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) }; | 						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 { | 				} 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 }; | 						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; | 			} 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); | 							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 { | 				} 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]; | 							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); | 							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 { | 				} 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); | 							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)) { | 					if (p_vertex_array_len < (1 << 16)) { | ||||||
| 						uint16_t v = src[i]; | 						uint16_t v = src[i]; | ||||||
| 
 | 
 | ||||||
| 						copymem(&iw[i * 2], &v, 2); | 						memcpy(&iw[i * 2], &v, 2); | ||||||
| 					} else { | 					} else { | ||||||
| 						uint32_t v = src[i]; | 						uint32_t v = src[i]; | ||||||
| 
 | 
 | ||||||
| 						copymem(&iw[i * 4], &v, 4); | 						memcpy(&iw[i * 4], &v, 4); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} break; | 			} break; | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								thirdparty/enet/godot.cpp
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								thirdparty/enet/godot.cpp
									
										
									
									
										vendored
									
									
								
							|  | @ -211,7 +211,7 @@ public: | ||||||
| 		ERR_FAIL_COND_V(err != OK, err); | 		ERR_FAIL_COND_V(err != OK, err); | ||||||
| 		ERR_FAIL_COND_V(p_len < r_read, ERR_OUT_OF_MEMORY); | 		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_ip = udp->get_packet_address(); | ||||||
| 		r_port = udp->get_packet_port(); | 		r_port = udp->get_packet_port(); | ||||||
| 		return err; | 		return err; | ||||||
|  | @ -316,7 +316,7 @@ public: | ||||||
| 				Vector<String> s = E->key().rsplit(":", false, 1); | 				Vector<String> s = E->key().rsplit(":", false, 1); | ||||||
| 				ERR_CONTINUE(s.size() != 2); // BUG!
 | 				ERR_CONTINUE(s.size() != 2); // BUG!
 | ||||||
| 
 | 
 | ||||||
| 				copymem(p_buffer, buffer, r_read); | 				memcpy(p_buffer, buffer, r_read); | ||||||
| 				r_ip = s[0]; | 				r_ip = s[0]; | ||||||
| 				r_port = s[1].to_int(); | 				r_port = s[1].to_int(); | ||||||
| 				break; // err = OK
 | 				break; // err = OK
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Rémi Verschelde
						Rémi Verschelde