mirror of
https://github.com/godotengine/godot.git
synced 2024-11-26 06:03:38 +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
@ -35,7 +35,6 @@
|
||||
#include "core/io/image_loader.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/print_string.h"
|
||||
|
||||
#include "thirdparty/misc/hq2x.h"
|
||||
@ -1369,7 +1368,7 @@ void Image::shrink_x2() {
|
||||
PoolVector<uint8_t>::Write w = new_img.write();
|
||||
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);
|
||||
@ -1593,7 +1592,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma
|
||||
data.resize(size);
|
||||
{
|
||||
PoolVector<uint8_t>::Write w = data.write();
|
||||
zeromem(w.ptr(), size);
|
||||
memset(w.ptr(), 0, size);
|
||||
}
|
||||
|
||||
width = p_width;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "compression.h"
|
||||
|
||||
#include "core/io/zip_io.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/project_settings.h"
|
||||
|
||||
#include "thirdparty/misc/fastlz.h"
|
||||
@ -46,8 +45,8 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,
|
||||
|
||||
if (p_src_size < 16) {
|
||||
uint8_t src[16];
|
||||
zeromem(&src[p_src_size], 16 - p_src_size);
|
||||
copymem(src, p_src, p_src_size);
|
||||
memset(&src[p_src_size], 0, 16 - p_src_size);
|
||||
memcpy(src, p_src, p_src_size);
|
||||
return fastlz_compress(src, 16, p_dst);
|
||||
} else {
|
||||
return fastlz_compress(p_src, p_src_size, p_dst);
|
||||
@ -142,7 +141,7 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p
|
||||
if (p_dst_max_size < 16) {
|
||||
uint8_t dst[16];
|
||||
ret_size = fastlz_decompress(p_src, p_src_size, dst, 16);
|
||||
copymem(p_dst, dst, p_dst_max_size);
|
||||
memcpy(p_dst, dst, p_dst_max_size);
|
||||
} else {
|
||||
ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size);
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "file_access_encrypted.h"
|
||||
|
||||
#include "core/crypto/crypto_core.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/print_string.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
@ -137,7 +136,7 @@ void FileAccessEncrypted::close() {
|
||||
ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug?
|
||||
|
||||
compressed.resize(len);
|
||||
zeromem(compressed.ptrw(), len);
|
||||
memset(compressed.ptrw(), 0, len);
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
compressed.write[i] = data[i];
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "file_access_memory.h"
|
||||
|
||||
#include "core/map.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/os/dir_access.h"
|
||||
#include "core/project_settings.h"
|
||||
|
||||
@ -161,7 +160,7 @@ int FileAccessMemory::get_buffer(uint8_t *p_dst, int p_length) const {
|
||||
WARN_PRINT("Reading less data than requested");
|
||||
};
|
||||
|
||||
copymem(p_dst, &data[pos], read);
|
||||
memcpy(p_dst, &data[pos], read);
|
||||
pos += p_length;
|
||||
|
||||
return read;
|
||||
@ -191,7 +190,7 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
|
||||
WARN_PRINT("Writing less data than requested");
|
||||
}
|
||||
|
||||
copymem(&data[pos], p_src, write);
|
||||
memcpy(&data[pos], p_src, write);
|
||||
pos += p_length;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include "file_access_zip.h"
|
||||
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/os/file_access.h"
|
||||
|
||||
ZipArchive *ZipArchive::instance = NULL;
|
||||
@ -133,7 +132,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
|
||||
ERR_FAIL_COND_V_MSG(!f, NULL, "Cannot open file '" + packages[file.package].filename + "'.");
|
||||
|
||||
zlib_filefunc_def io;
|
||||
zeromem(&io, sizeof(io));
|
||||
memset(&io, 0, sizeof(io));
|
||||
|
||||
io.opaque = f;
|
||||
io.zopen_file = godot_open;
|
||||
|
@ -662,7 +662,7 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
|
||||
|
||||
ret.resize(chunk.size() - 2);
|
||||
PoolByteArray::Write w = ret.write();
|
||||
copymem(w.ptr(), chunk.ptr(), chunk.size() - 2);
|
||||
memcpy(w.ptr(), chunk.ptr(), chunk.size() - 2);
|
||||
chunk.clear();
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
|
||||
if (buf) {
|
||||
encode_uint32(utf8.length(), buf);
|
||||
buf += 4;
|
||||
copymem(buf, utf8.get_data(), utf8.length());
|
||||
memcpy(buf, utf8.get_data(), utf8.length());
|
||||
buf += utf8.length();
|
||||
}
|
||||
|
||||
@ -918,7 +918,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
if (buf) {
|
||||
encode_uint32(utf8.length(), buf);
|
||||
buf += 4;
|
||||
copymem(buf, utf8.get_data(), utf8.length());
|
||||
memcpy(buf, utf8.get_data(), utf8.length());
|
||||
buf += pad + utf8.length();
|
||||
}
|
||||
|
||||
@ -975,7 +975,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
|
||||
copymem(&buf[(i * 2 + j) * 4], &val.elements[i][j], sizeof(float));
|
||||
memcpy(&buf[(i * 2 + j) * 4], &val.elements[i][j], sizeof(float));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
|
||||
copymem(&buf[(i * 3 + j) * 4], &val.elements[i][j], sizeof(float));
|
||||
memcpy(&buf[(i * 3 + j) * 4], &val.elements[i][j], sizeof(float));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1046,7 +1046,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
|
||||
copymem(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float));
|
||||
memcpy(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1162,7 +1162,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
if (buf) {
|
||||
encode_uint32(utf8.length()+1,buf);
|
||||
buf+=4;
|
||||
copymem(buf,utf8.get_data(),utf8.length()+1);
|
||||
memcpy(buf,utf8.get_data(),utf8.length()+1);
|
||||
}
|
||||
|
||||
r_len+=4+utf8.length()+1;
|
||||
@ -1217,7 +1217,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
encode_uint32(datalen, buf);
|
||||
buf += 4;
|
||||
PoolVector<uint8_t>::Read r = data.read();
|
||||
copymem(buf, &r[0], datalen * datasize);
|
||||
memcpy(buf, &r[0], datalen * datasize);
|
||||
buf += datalen * datasize;
|
||||
}
|
||||
|
||||
@ -1282,7 +1282,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
|
||||
if (buf) {
|
||||
encode_uint32(utf8.length() + 1, buf);
|
||||
buf += 4;
|
||||
copymem(buf, utf8.get_data(), utf8.length() + 1);
|
||||
memcpy(buf, utf8.get_data(), utf8.length() + 1);
|
||||
buf += utf8.length() + 1;
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) {
|
||||
}
|
||||
|
||||
PoolVector<uint8_t>::Write w = data.write();
|
||||
copymem(&w[pointer], p_data, p_bytes);
|
||||
memcpy(&w[pointer], p_data, p_bytes);
|
||||
|
||||
pointer += p_bytes;
|
||||
return OK;
|
||||
@ -479,7 +479,7 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_
|
||||
}
|
||||
|
||||
PoolVector<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;
|
||||
// FIXME: return what? OK or ERR_*
|
||||
|
@ -477,7 +477,7 @@ Error XMLParser::open_buffer(const Vector<uint8_t> &p_buffer) {
|
||||
|
||||
length = p_buffer.size();
|
||||
data = memnew_arr(char, length + 1);
|
||||
copymem(data, p_buffer.ptr(), length);
|
||||
memcpy(data, p_buffer.ptr(), length);
|
||||
data[length] = 0;
|
||||
P = data;
|
||||
return OK;
|
||||
|
@ -30,8 +30,6 @@
|
||||
|
||||
#include "zip_io.h"
|
||||
|
||||
#include "core/os/copymem.h"
|
||||
|
||||
void *zipio_open(void *data, const char *p_fname, int mode) {
|
||||
|
||||
FileAccess *&f = *(FileAccess **)data;
|
||||
@ -112,7 +110,7 @@ int zipio_testerror(voidpf opaque, voidpf stream) {
|
||||
voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
|
||||
|
||||
voidpf ptr = memalloc(items * size);
|
||||
zeromem(ptr, items * size);
|
||||
memset(ptr, 0, items * size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#define LOCAL_VECTOR_H
|
||||
|
||||
#include "core/error_macros.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/sort_array.h"
|
||||
#include "core/vector.h"
|
||||
@ -215,7 +214,7 @@ public:
|
||||
Vector<T> ret;
|
||||
ret.resize(size());
|
||||
T *w = ret.ptrw();
|
||||
copymem(w, data, sizeof(T) * count);
|
||||
memcpy(w, data, sizeof(T) * count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -223,7 +222,7 @@ public:
|
||||
Vector<uint8_t> ret;
|
||||
ret.resize(count * sizeof(T));
|
||||
uint8_t *w = ret.ptrw();
|
||||
copymem(w, data, sizeof(T) * count);
|
||||
memcpy(w, data, sizeof(T) * count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "basis.h"
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/print_string.h"
|
||||
|
||||
#define cofac(row1, col1, row2, col2) \
|
||||
|
@ -135,7 +135,7 @@ public:
|
||||
if (depth > threshold) {
|
||||
if (aux_stack.empty()) {
|
||||
aux_stack.resize(ALLOCA_STACK_SIZE * 2);
|
||||
copymem(aux_stack.ptr(), stack, get_alloca_stacksize());
|
||||
memcpy(aux_stack.ptr(), stack, get_alloca_stacksize());
|
||||
} else {
|
||||
aux_stack.resize(aux_stack.size() * 2);
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ Vector<Geometry::PackRectsResult> Geometry::partial_pack_rects(const Vector<Vect
|
||||
|
||||
Vector<stbrp_node> nodes;
|
||||
nodes.resize(p_atlas_size.width);
|
||||
zeromem(nodes.ptrw(), sizeof(stbrp_node) * nodes.size());
|
||||
memset(nodes.ptrw(), 0, sizeof(stbrp_node) * nodes.size());
|
||||
|
||||
stbrp_context context;
|
||||
stbrp_init_target(&context, p_atlas_size.width, p_atlas_size.height, nodes.ptrw(), p_atlas_size.width);
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "transform.h"
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/print_string.h"
|
||||
|
||||
void Transform::affine_invert() {
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
#include "core/hashfuncs.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/os/copymem.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
|
||||
|
||||
#include "core/math/transform_2d.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/resource.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "core/ustring.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "memory.h"
|
||||
|
||||
#include "core/error_macros.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/safe_refcount.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -336,7 +336,7 @@ Error PackedDataContainer::pack(const Variant &p_data) {
|
||||
datalen = tmpdata.size();
|
||||
data.resize(tmpdata.size());
|
||||
PoolVector<uint8_t>::Write w = data.write();
|
||||
copymem(w.ptr(), tmpdata.ptr(), tmpdata.size());
|
||||
memcpy(w.ptr(), tmpdata.ptr(), tmpdata.size());
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "pool_allocator.h"
|
||||
|
||||
#include "core/error_macros.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/print_string.h"
|
||||
@ -42,7 +41,7 @@
|
||||
do { \
|
||||
void *_dst = &((unsigned char *)pool)[m_to_pos]; \
|
||||
void *_src = &((unsigned char *)pool)[(m_entry).pos]; \
|
||||
movemem(_dst, _src, aligned((m_entry).len)); \
|
||||
memmove(_dst, _src, aligned((m_entry).len)); \
|
||||
(m_entry).pos = m_to_pos; \
|
||||
} while (0);
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#ifndef POOL_VECTOR_H
|
||||
#define POOL_VECTOR_H
|
||||
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/os/rw_lock.h"
|
||||
|
@ -329,7 +329,7 @@ struct _VariantCall {
|
||||
size_t len = charstr.length();
|
||||
retval.resize(len);
|
||||
PoolByteArray::Write w = retval.write();
|
||||
copymem(w.ptr(), charstr.ptr(), len);
|
||||
memcpy(w.ptr(), charstr.ptr(), len);
|
||||
w.release();
|
||||
|
||||
r_ret = retval;
|
||||
@ -348,7 +348,7 @@ struct _VariantCall {
|
||||
size_t len = charstr.length();
|
||||
retval.resize(len);
|
||||
PoolByteArray::Write w = retval.write();
|
||||
copymem(w.ptr(), charstr.ptr(), len);
|
||||
memcpy(w.ptr(), charstr.ptr(), len);
|
||||
w.release();
|
||||
|
||||
r_ret = retval;
|
||||
@ -366,7 +366,7 @@ struct _VariantCall {
|
||||
size_t len = s->length() * sizeof(wchar_t);
|
||||
retval.resize(len);
|
||||
PoolByteArray::Write w = retval.write();
|
||||
copymem(w.ptr(), s->ptr(), len);
|
||||
memcpy(w.ptr(), s->ptr(), len);
|
||||
w.release();
|
||||
|
||||
r_ret = retval;
|
||||
@ -585,7 +585,7 @@ struct _VariantCall {
|
||||
PoolByteArray::Read r = ba->read();
|
||||
CharString cs;
|
||||
cs.resize(ba->size() + 1);
|
||||
copymem(cs.ptrw(), r.ptr(), ba->size());
|
||||
memcpy(cs.ptrw(), r.ptr(), ba->size());
|
||||
cs[ba->size()] = 0;
|
||||
|
||||
s = cs.get_data();
|
||||
|
@ -70,7 +70,7 @@ OSStatus AudioDriverCoreAudio::output_device_address_cb(AudioObjectID inObjectID
|
||||
|
||||
Error AudioDriverCoreAudio::init() {
|
||||
AudioComponentDescription desc;
|
||||
zeromem(&desc, sizeof(desc));
|
||||
memset(&desc, 0, sizeof(desc));
|
||||
desc.componentType = kAudioUnitType_Output;
|
||||
#ifdef OSX_ENABLED
|
||||
desc.componentSubType = kAudioUnitSubType_HALOutput;
|
||||
@ -97,7 +97,7 @@ Error AudioDriverCoreAudio::init() {
|
||||
|
||||
AudioStreamBasicDescription strdesc;
|
||||
|
||||
zeromem(&strdesc, sizeof(strdesc));
|
||||
memset(&strdesc, 0, sizeof(strdesc));
|
||||
UInt32 size = sizeof(strdesc);
|
||||
result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size);
|
||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||
@ -118,7 +118,7 @@ Error AudioDriverCoreAudio::init() {
|
||||
|
||||
mix_rate = GLOBAL_GET("audio/mix_rate");
|
||||
|
||||
zeromem(&strdesc, sizeof(strdesc));
|
||||
memset(&strdesc, 0, sizeof(strdesc));
|
||||
strdesc.mFormatID = kAudioFormatLinearPCM;
|
||||
strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
|
||||
strdesc.mChannelsPerFrame = channels;
|
||||
@ -148,7 +148,7 @@ Error AudioDriverCoreAudio::init() {
|
||||
print_verbose("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
|
||||
|
||||
AURenderCallbackStruct callback;
|
||||
zeromem(&callback, sizeof(AURenderCallbackStruct));
|
||||
memset(&callback, 0, sizeof(AURenderCallbackStruct));
|
||||
callback.inputProc = &AudioDriverCoreAudio::output_callback;
|
||||
callback.inputProcRefCon = this;
|
||||
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
|
||||
@ -174,7 +174,7 @@ OSStatus AudioDriverCoreAudio::output_callback(void *inRefCon,
|
||||
if (!ad->active || !ad->try_lock()) {
|
||||
for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
|
||||
AudioBuffer *abuf = &ioData->mBuffers[i];
|
||||
zeromem(abuf->mData, abuf->mDataByteSize);
|
||||
memset(abuf->mData, 0, abuf->mDataByteSize);
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
@ -298,7 +298,7 @@ void AudioDriverCoreAudio::finish() {
|
||||
lock();
|
||||
|
||||
AURenderCallbackStruct callback;
|
||||
zeromem(&callback, sizeof(AURenderCallbackStruct));
|
||||
memset(&callback, 0, sizeof(AURenderCallbackStruct));
|
||||
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
|
||||
if (result != noErr) {
|
||||
ERR_PRINT("AudioUnitSetProperty failed");
|
||||
@ -342,7 +342,7 @@ void AudioDriverCoreAudio::finish() {
|
||||
|
||||
Error AudioDriverCoreAudio::capture_init() {
|
||||
AudioComponentDescription desc;
|
||||
zeromem(&desc, sizeof(desc));
|
||||
memset(&desc, 0, sizeof(desc));
|
||||
desc.componentType = kAudioUnitType_Output;
|
||||
#ifdef OSX_ENABLED
|
||||
desc.componentSubType = kAudioUnitSubType_HALOutput;
|
||||
@ -388,7 +388,7 @@ Error AudioDriverCoreAudio::capture_init() {
|
||||
#endif
|
||||
|
||||
AudioStreamBasicDescription strdesc;
|
||||
zeromem(&strdesc, sizeof(strdesc));
|
||||
memset(&strdesc, 0, sizeof(strdesc));
|
||||
size = sizeof(strdesc);
|
||||
result = AudioUnitGetProperty(input_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &strdesc, &size);
|
||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||
@ -410,7 +410,7 @@ Error AudioDriverCoreAudio::capture_init() {
|
||||
|
||||
mix_rate = GLOBAL_GET("audio/mix_rate");
|
||||
|
||||
zeromem(&strdesc, sizeof(strdesc));
|
||||
memset(&strdesc, 0, sizeof(strdesc));
|
||||
strdesc.mFormatID = kAudioFormatLinearPCM;
|
||||
strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
|
||||
strdesc.mChannelsPerFrame = capture_channels;
|
||||
@ -424,7 +424,7 @@ Error AudioDriverCoreAudio::capture_init() {
|
||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||
|
||||
AURenderCallbackStruct callback;
|
||||
zeromem(&callback, sizeof(AURenderCallbackStruct));
|
||||
memset(&callback, 0, sizeof(AURenderCallbackStruct));
|
||||
callback.inputProc = &AudioDriverCoreAudio::input_callback;
|
||||
callback.inputProcRefCon = this;
|
||||
result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, kInputBus, &callback, sizeof(callback));
|
||||
@ -441,7 +441,7 @@ void AudioDriverCoreAudio::capture_finish() {
|
||||
lock();
|
||||
|
||||
AURenderCallbackStruct callback;
|
||||
zeromem(&callback, sizeof(AURenderCallbackStruct));
|
||||
memset(&callback, 0, sizeof(AURenderCallbackStruct));
|
||||
OSStatus result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &callback, sizeof(callback));
|
||||
if (result != noErr) {
|
||||
ERR_PRINT("AudioUnitSetProperty failed");
|
||||
|
@ -1558,7 +1558,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
||||
|
||||
size_t transform_buffer_offset = i * 12;
|
||||
|
||||
copymem(&buffer[transform_buffer_offset], row, sizeof(row));
|
||||
memcpy(&buffer[transform_buffer_offset], row, sizeof(row));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3401,7 +3401,7 @@ void RasterizerStorageGLES2::multimesh_set_as_bulk_array(RID p_multimesh, const
|
||||
|
||||
PoolVector<float>::Read r = p_array.read();
|
||||
ERR_FAIL_COND(!r.ptr());
|
||||
copymem(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float));
|
||||
memcpy(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float));
|
||||
|
||||
multimesh->dirty_data = true;
|
||||
multimesh->dirty_aabb = true;
|
||||
@ -4466,7 +4466,7 @@ void RasterizerStorageGLES2::lightmap_capture_set_octree(RID p_capture, const Po
|
||||
if (p_octree.size()) {
|
||||
PoolVector<LightmapCaptureOctree>::Write w = capture->octree.write();
|
||||
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);
|
||||
}
|
||||
@ -4483,7 +4483,7 @@ PoolVector<uint8_t> RasterizerStorageGLES2::lightmap_capture_get_octree(RID p_ca
|
||||
{
|
||||
PoolVector<LightmapCaptureOctree>::Read r = capture->octree.read();
|
||||
PoolVector<uint8_t>::Write w = ret.write();
|
||||
copymem(w.ptr(), r.ptr(), ret.size());
|
||||
memcpy(w.ptr(), r.ptr(), ret.size());
|
||||
}
|
||||
|
||||
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;
|
||||
copymem(&state.omni_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size);
|
||||
memcpy(&state.omni_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size);
|
||||
state.omni_light_count++;
|
||||
|
||||
} break;
|
||||
@ -2995,7 +2995,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
|
||||
}
|
||||
|
||||
li->light_index = state.spot_light_count;
|
||||
copymem(&state.spot_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size);
|
||||
memcpy(&state.spot_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size);
|
||||
state.spot_light_count++;
|
||||
} break;
|
||||
}
|
||||
@ -3096,7 +3096,7 @@ void RasterizerSceneGLES3::_setup_reflections(RID *p_reflection_probe_cull_resul
|
||||
store_transform(proj, reflection_ubo.local_matrix);
|
||||
|
||||
rpi->reflection_index = state.reflection_probe_count;
|
||||
copymem(&state.reflection_array_tmp[rpi->reflection_index * sizeof(ReflectionProbeDataUBO)], &reflection_ubo, sizeof(ReflectionProbeDataUBO));
|
||||
memcpy(&state.reflection_array_tmp[rpi->reflection_index * sizeof(ReflectionProbeDataUBO)], &reflection_ubo, sizeof(ReflectionProbeDataUBO));
|
||||
state.reflection_probe_count++;
|
||||
}
|
||||
|
||||
|
@ -3273,37 +3273,37 @@ _FORCE_INLINE_ static void _fill_std140_ubo_empty(ShaderLanguage::DataType type,
|
||||
case ShaderLanguage::TYPE_INT:
|
||||
case ShaderLanguage::TYPE_UINT:
|
||||
case ShaderLanguage::TYPE_FLOAT: {
|
||||
zeromem(data, 4);
|
||||
memset(data, 0, 4);
|
||||
} break;
|
||||
case ShaderLanguage::TYPE_BVEC2:
|
||||
case ShaderLanguage::TYPE_IVEC2:
|
||||
case ShaderLanguage::TYPE_UVEC2:
|
||||
case ShaderLanguage::TYPE_VEC2: {
|
||||
zeromem(data, 8);
|
||||
memset(data, 0, 8);
|
||||
} break;
|
||||
case ShaderLanguage::TYPE_BVEC3:
|
||||
case ShaderLanguage::TYPE_IVEC3:
|
||||
case ShaderLanguage::TYPE_UVEC3:
|
||||
case ShaderLanguage::TYPE_VEC3: {
|
||||
zeromem(data, 12);
|
||||
memset(data, 0, 12);
|
||||
} break;
|
||||
case ShaderLanguage::TYPE_BVEC4:
|
||||
case ShaderLanguage::TYPE_IVEC4:
|
||||
case ShaderLanguage::TYPE_UVEC4:
|
||||
case ShaderLanguage::TYPE_VEC4: {
|
||||
|
||||
zeromem(data, 16);
|
||||
memset(data, 0, 16);
|
||||
} break;
|
||||
case ShaderLanguage::TYPE_MAT2: {
|
||||
|
||||
zeromem(data, 32);
|
||||
memset(data, 0, 32);
|
||||
} break;
|
||||
case ShaderLanguage::TYPE_MAT3: {
|
||||
|
||||
zeromem(data, 48);
|
||||
memset(data, 0, 48);
|
||||
} break;
|
||||
case ShaderLanguage::TYPE_MAT4: {
|
||||
zeromem(data, 64);
|
||||
memset(data, 0, 64);
|
||||
} break;
|
||||
|
||||
default: {
|
||||
@ -4099,7 +4099,7 @@ PoolVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, i
|
||||
ERR_FAIL_NULL_V(data, PoolVector<uint8_t>());
|
||||
{
|
||||
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);
|
||||
#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>());
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
@ -4193,7 +4193,7 @@ Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shap
|
||||
ERR_FAIL_COND_V(!data, Vector<PoolVector<uint8_t> >());
|
||||
{
|
||||
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);
|
||||
#endif
|
||||
@ -5060,7 +5060,7 @@ void RasterizerStorageGLES3::multimesh_set_as_bulk_array(RID p_multimesh, const
|
||||
ERR_FAIL_COND(dsize != p_array.size());
|
||||
|
||||
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_aabb = true;
|
||||
@ -6321,7 +6321,7 @@ void RasterizerStorageGLES3::lightmap_capture_set_octree(RID p_capture, const Po
|
||||
if (p_octree.size()) {
|
||||
PoolVector<LightmapCaptureOctree>::Write w = capture->octree.write();
|
||||
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);
|
||||
}
|
||||
@ -6338,7 +6338,7 @@ PoolVector<uint8_t> RasterizerStorageGLES3::lightmap_capture_get_octree(RID p_ca
|
||||
{
|
||||
PoolVector<LightmapCaptureOctree>::Read r = capture->octree.read();
|
||||
PoolVector<uint8_t>::Write w = ret.write();
|
||||
copymem(w.ptr(), r.ptr(), ret.size());
|
||||
memcpy(w.ptr(), r.ptr(), ret.size());
|
||||
}
|
||||
|
||||
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
|
||||
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);
|
||||
|
@ -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) {
|
||||
png_image png_img;
|
||||
zeromem(&png_img, sizeof(png_img));
|
||||
memset(&png_img, 0, sizeof(png_img));
|
||||
png_img.version = PNG_IMAGE_VERSION;
|
||||
|
||||
// fetch image properties
|
||||
@ -133,7 +133,7 @@ Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer) {
|
||||
ERR_FAIL_COND_V(source_image->is_compressed(), FAILED);
|
||||
|
||||
png_image png_img;
|
||||
zeromem(&png_img, sizeof(png_img));
|
||||
memset(&png_img, 0, sizeof(png_img));
|
||||
png_img.version = PNG_IMAGE_VERSION;
|
||||
png_img.width = source_image->get_width();
|
||||
png_img.height = source_image->get_height();
|
||||
|
@ -107,7 +107,7 @@ size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const
|
||||
addr6->sin6_family = AF_INET6;
|
||||
addr6->sin6_port = htons(p_port);
|
||||
if (p_ip.is_valid()) {
|
||||
copymem(&addr6->sin6_addr.s6_addr, p_ip.get_ipv6(), 16);
|
||||
memcpy(&addr6->sin6_addr.s6_addr, p_ip.get_ipv6(), 16);
|
||||
} else {
|
||||
addr6->sin6_addr = in6addr_any;
|
||||
}
|
||||
@ -122,7 +122,7 @@ size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const
|
||||
addr4->sin_port = htons(p_port); // short, network byte order
|
||||
|
||||
if (p_ip.is_valid()) {
|
||||
copymem(&addr4->sin_addr.s_addr, p_ip.get_ipv4(), 4);
|
||||
memcpy(&addr4->sin_addr.s_addr, p_ip.get_ipv4(), 4);
|
||||
} else {
|
||||
addr4->sin_addr.s_addr = INADDR_ANY;
|
||||
}
|
||||
@ -266,13 +266,13 @@ _FORCE_INLINE_ Error NetSocketPosix::_change_multicast_group(IP_Address p_ip, St
|
||||
ERR_FAIL_COND_V(!if_ip.is_valid(), ERR_INVALID_PARAMETER);
|
||||
struct ip_mreq greq;
|
||||
int sock_opt = p_add ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP;
|
||||
copymem(&greq.imr_multiaddr, p_ip.get_ipv4(), 4);
|
||||
copymem(&greq.imr_interface, if_ip.get_ipv4(), 4);
|
||||
memcpy(&greq.imr_multiaddr, p_ip.get_ipv4(), 4);
|
||||
memcpy(&greq.imr_interface, if_ip.get_ipv4(), 4);
|
||||
ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq));
|
||||
} else {
|
||||
struct ipv6_mreq greq;
|
||||
int sock_opt = p_add ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP;
|
||||
copymem(&greq.ipv6mr_multiaddr, p_ip.get_ipv6(), 16);
|
||||
memcpy(&greq.ipv6mr_multiaddr, p_ip.get_ipv6(), 16);
|
||||
greq.ipv6mr_interface = if_v6id;
|
||||
ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq));
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ void ParticlesEditor::_generate_emission_points() {
|
||||
|
||||
{
|
||||
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();
|
||||
float *wf = (float *)iw.ptr();
|
||||
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();
|
||||
zeromem(iw.ptr(), w * h * 3 * sizeof(float));
|
||||
memset(iw.ptr(), 0, w * h * 3 * sizeof(float));
|
||||
PoolVector<Vector3>::Read r = normals.read();
|
||||
float *wf = (float *)iw.ptr();
|
||||
for (int i = 0; i < point_count; i++) {
|
||||
|
@ -29,7 +29,6 @@
|
||||
/*************************************************************************/
|
||||
|
||||
#include "denoise_wrapper.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "thirdparty/oidn/include/OpenImageDenoise/oidn.h"
|
||||
#include <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);
|
||||
encode_uint32(unique_id, &packet->data[0]); // Source ID
|
||||
encode_uint32(target_peer, &packet->data[4]); // Dest ID
|
||||
copymem(&packet->data[8], p_buffer, p_buffer_size);
|
||||
memcpy(&packet->data[8], p_buffer, p_buffer_size);
|
||||
|
||||
if (server) {
|
||||
|
||||
@ -705,7 +705,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
|
||||
while (total) {
|
||||
for (size_t i = 0; i < inBufferCount; i++) {
|
||||
int to_copy = MIN(total, int(inBuffers[i].dataLength));
|
||||
copymem(&enet->src_compressor_mem.write[ofs], inBuffers[i].data, to_copy);
|
||||
memcpy(&enet->src_compressor_mem.write[ofs], inBuffers[i].data, to_copy);
|
||||
ofs += to_copy;
|
||||
total -= to_copy;
|
||||
}
|
||||
@ -740,7 +740,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
|
||||
if (ret > int(outLimit))
|
||||
return 0; // Do not bother
|
||||
|
||||
copymem(outData, enet->dst_compressor_mem.ptr(), ret);
|
||||
memcpy(outData, enet->dst_compressor_mem.ptr(), ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "image_compress_etc.h"
|
||||
|
||||
#include "core/image.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/print_string.h"
|
||||
|
||||
|
@ -94,8 +94,8 @@ struct NativeScriptDesc {
|
||||
base_native_type(),
|
||||
documentation(),
|
||||
type_tag(NULL) {
|
||||
zeromem(&create_func, sizeof(godot_instance_create_func));
|
||||
zeromem(&destroy_func, sizeof(godot_instance_destroy_func));
|
||||
memset(&create_func, 0, sizeof(godot_instance_create_func));
|
||||
memset(&destroy_func, 0, sizeof(godot_instance_destroy_func));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "gdscript_language_protocol.h"
|
||||
|
||||
#include "core/io/json.h"
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "editor/editor_log.h"
|
||||
#include "editor/editor_node.h"
|
||||
|
@ -967,7 +967,7 @@ void LightmapperCPU::_post_process(uint32_t p_idx, void *r_output) {
|
||||
PoolByteArray data;
|
||||
data.resize(data_size);
|
||||
PoolByteArray::Write w = data.write();
|
||||
copymem(w.ptr(), output, data_size);
|
||||
memcpy(w.ptr(), output, data_size);
|
||||
current_image->create(size.x, size.y, false, Image::FORMAT_RGBF, data);
|
||||
}
|
||||
|
||||
@ -976,7 +976,7 @@ void LightmapperCPU::_post_process(uint32_t p_idx, void *r_output) {
|
||||
PoolByteArray denoised_data = denoised_image->get_data();
|
||||
denoised_image.unref();
|
||||
PoolByteArray::Read r = denoised_data.read();
|
||||
copymem(output, r.ptr(), data_size);
|
||||
memcpy(output, r.ptr(), data_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1074,7 +1074,7 @@ void LightmapperCPU::_fix_seams(const LocalVector<UVSeam> &p_seams, Vector3 *r_l
|
||||
LocalVector<Vector3> extra_buffer;
|
||||
extra_buffer.resize(p_size.x * p_size.y);
|
||||
|
||||
copymem(extra_buffer.ptr(), r_lightmap, p_size.x * p_size.y * sizeof(Vector3));
|
||||
memcpy(extra_buffer.ptr(), r_lightmap, p_size.x * p_size.y * sizeof(Vector3));
|
||||
|
||||
Vector3 *read_ptr = extra_buffer.ptr();
|
||||
Vector3 *write_ptr = r_lightmap;
|
||||
@ -1084,7 +1084,7 @@ void LightmapperCPU::_fix_seams(const LocalVector<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].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);
|
||||
ERR_FAIL_COND_V_MSG(ret, out, "Error while signing: " + itos(ret));
|
||||
out.resize(sig_size);
|
||||
copymem(out.ptrw(), buf, sig_size);
|
||||
memcpy(out.ptrw(), buf, sig_size);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ Vector<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);
|
||||
ERR_FAIL_COND_V_MSG(ret, out, "Error while encrypting: " + itos(ret));
|
||||
out.resize(size);
|
||||
copymem(out.ptrw(), buf, size);
|
||||
memcpy(out.ptrw(), buf, size);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -389,6 +389,6 @@ Vector<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);
|
||||
ERR_FAIL_COND_V_MSG(ret, out, "Error while decrypting: " + itos(ret));
|
||||
out.resize(size);
|
||||
copymem(out.ptrw(), buf, size);
|
||||
memcpy(out.ptrw(), buf, size);
|
||||
return out;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
|
||||
if (err != OK) {
|
||||
return MBEDTLS_ERR_SSL_INTERNAL_ERROR;
|
||||
}
|
||||
copymem(buf, buffer, buffer_size);
|
||||
memcpy(buf, buffer, buffer_size);
|
||||
return buffer_size;
|
||||
}
|
||||
|
||||
@ -88,8 +88,8 @@ int PacketPeerMbedDTLS::_set_cookie() {
|
||||
uint8_t client_id[18];
|
||||
IP_Address addr = base->get_packet_address();
|
||||
uint16_t port = base->get_packet_port();
|
||||
copymem(client_id, addr.get_ipv6(), 16);
|
||||
copymem(&client_id[16], (uint8_t *)&port, 2);
|
||||
memcpy(client_id, addr.get_ipv6(), 16);
|
||||
memcpy(&client_id[16], (uint8_t *)&port, 2);
|
||||
return mbedtls_ssl_set_client_transport_id(ssl_ctx->get_context(), client_id, 18);
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ PoolVector<uint8_t> AudioStreamMP3::get_data() const {
|
||||
vdata.resize(data_len);
|
||||
{
|
||||
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);
|
||||
Javelin::RgbaBitmap bm(w, h);
|
||||
void *dst = (void *)bm.GetData();
|
||||
copymem(dst, &r[ofs], size);
|
||||
memcpy(dst, &r[ofs], size);
|
||||
Javelin::ColorRgba<unsigned char> *dp = bm.GetData();
|
||||
for (int j = 0; j < size / 4; j++) {
|
||||
// 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());
|
||||
|
||||
Vector3 *embree_vertices = (Vector3 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX, 0, RTC_FORMAT_FLOAT3, sizeof(Vector3), vertex_count);
|
||||
copymem(embree_vertices, p_vertices.ptr(), sizeof(Vector3) * vertex_count);
|
||||
memcpy(embree_vertices, p_vertices.ptr(), sizeof(Vector3) * vertex_count);
|
||||
|
||||
Vector2 *embree_light_uvs = (Vector2 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTC_FORMAT_FLOAT2, sizeof(Vector2), vertex_count);
|
||||
copymem(embree_light_uvs, p_uv2s.ptr(), sizeof(Vector2) * vertex_count);
|
||||
memcpy(embree_light_uvs, p_uv2s.ptr(), sizeof(Vector2) * vertex_count);
|
||||
|
||||
uint32_t *embree_triangles = (uint32_t *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_INDEX, 0, RTC_FORMAT_UINT3, sizeof(uint32_t) * 3, vertex_count / 3);
|
||||
for (int i = 0; i < vertex_count; i++) {
|
||||
@ -145,7 +145,7 @@ void LightmapRaycasterEmbree::add_mesh(const Vector<Vector3> &p_vertices, const
|
||||
|
||||
if (!p_normals.empty()) {
|
||||
Vector3 *embree_normals = (Vector3 *)rtcSetNewGeometryBuffer(embree_mesh, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 1, RTC_FORMAT_FLOAT3, sizeof(Vector3), vertex_count);
|
||||
copymem(embree_normals, p_normals.ptr(), sizeof(Vector3) * vertex_count);
|
||||
memcpy(embree_normals, p_normals.ptr(), sizeof(Vector3) * vertex_count);
|
||||
}
|
||||
|
||||
rtcCommitGeometry(embree_mesh);
|
||||
|
@ -233,7 +233,7 @@ PoolVector<uint8_t> AudioStreamOGGVorbis::get_data() const {
|
||||
vdata.resize(data_len);
|
||||
{
|
||||
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 */
|
||||
if (!theora_p && th_decode_headerin(&ti, &tc, &ts, &op) >= 0) {
|
||||
/* it is theora */
|
||||
copymem(&to, &test, sizeof(test));
|
||||
memcpy(&to, &test, sizeof(test));
|
||||
theora_p = 1;
|
||||
} else if (!vorbis_p && vorbis_synthesis_headerin(&vi, &vc, &op) >= 0) {
|
||||
|
||||
@ -240,7 +240,7 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
||||
|
||||
audio_track_skip--;
|
||||
} else {
|
||||
copymem(&vo, &test, sizeof(test));
|
||||
memcpy(&vo, &test, sizeof(test));
|
||||
vorbis_p = 1;
|
||||
}
|
||||
} else {
|
||||
|
@ -1680,7 +1680,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
|
||||
state->flow_stack_pos = flow_stack_pos;
|
||||
state->stack.resize(p_stack_size);
|
||||
state->pass = p_pass;
|
||||
copymem(state->stack.ptrw(), p_stack, p_stack_size);
|
||||
memcpy(state->stack.ptrw(), p_stack, p_stack_size);
|
||||
//step 2, run away, return directly
|
||||
r_error.error = Variant::CallError::CALL_OK;
|
||||
|
||||
@ -1960,7 +1960,7 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p
|
||||
sequence_bits[i] = false; //all starts as false
|
||||
}
|
||||
|
||||
zeromem(pass_stack, f->pass_stack_size * sizeof(int));
|
||||
memset(pass_stack, 0, f->pass_stack_size * sizeof(int));
|
||||
|
||||
Map<int, VisualScriptNodeInstance *>::Element *E = instances.find(f->node);
|
||||
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[2] = 'B';
|
||||
w[3] = 'P';
|
||||
copymem(&w[4], dst_buff, dst_size);
|
||||
memcpy(&w[4], dst_buff, dst_size);
|
||||
free(dst_buff);
|
||||
w.release();
|
||||
return dst;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#ifndef PACKET_BUFFER_H
|
||||
#define PACKET_BUFFER_H
|
||||
|
||||
#include "core/os/copymem.h"
|
||||
#include "core/ring_buffer.h"
|
||||
|
||||
template <class T>
|
||||
@ -67,7 +66,7 @@ public:
|
||||
if (p_info) {
|
||||
_Packet p;
|
||||
p.size = p_size;
|
||||
copymem(&p.info, p_info, sizeof(T));
|
||||
memcpy(&p.info, p_info, sizeof(T));
|
||||
_packets.write(p);
|
||||
}
|
||||
|
||||
@ -87,7 +86,7 @@ public:
|
||||
ERR_FAIL_COND_V(p_bytes < (int)p.size, ERR_OUT_OF_MEMORY);
|
||||
|
||||
r_read = p.size;
|
||||
copymem(r_info, &p.info, sizeof(T));
|
||||
memcpy(r_info, &p.info, sizeof(T));
|
||||
_payload.read(r_payload, p.size);
|
||||
return OK;
|
||||
}
|
||||
|
@ -193,10 +193,10 @@ PoolVector<uint8_t> WebSocketMultiplayerPeer::_make_pkt(uint8_t p_type, int32_t
|
||||
out.resize(PROTO_SIZE + p_data_size);
|
||||
|
||||
PoolVector<uint8_t>::Write w = out.write();
|
||||
copymem(&w[0], &p_type, 1);
|
||||
copymem(&w[1], &p_from, 4);
|
||||
copymem(&w[5], &p_to, 4);
|
||||
copymem(&w[PROTO_SIZE], p_data, p_data_size);
|
||||
memcpy(&w[0], &p_type, 1);
|
||||
memcpy(&w[1], &p_from, 4);
|
||||
memcpy(&w[5], &p_to, 4);
|
||||
memcpy(&w[PROTO_SIZE], p_data, p_data_size);
|
||||
|
||||
return out;
|
||||
}
|
||||
@ -235,7 +235,7 @@ void WebSocketMultiplayerPeer::_store_pkt(int32_t p_source, int32_t p_dest, cons
|
||||
packet.size = p_data_size;
|
||||
packet.source = p_source;
|
||||
packet.destination = p_dest;
|
||||
copymem(packet.data, &p_data[PROTO_SIZE], p_data_size);
|
||||
memcpy(packet.data, &p_data[PROTO_SIZE], p_data_size);
|
||||
_incoming_packets.push_back(packet);
|
||||
emit_signal("peer_packet", p_source);
|
||||
}
|
||||
@ -290,9 +290,9 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref<WebSocketPeer> p_peer, u
|
||||
uint8_t type = 0;
|
||||
uint32_t from = 0;
|
||||
int32_t to = 0;
|
||||
copymem(&type, in_buffer, 1);
|
||||
copymem(&from, &in_buffer[1], 4);
|
||||
copymem(&to, &in_buffer[5], 4);
|
||||
memcpy(&type, in_buffer, 1);
|
||||
memcpy(&from, &in_buffer[1], 4);
|
||||
memcpy(&to, &in_buffer[5], 4);
|
||||
|
||||
if (is_server()) { // Server can resend
|
||||
|
||||
@ -328,7 +328,7 @@ void WebSocketMultiplayerPeer::_process_multiplayer(Ref<WebSocketPeer> p_peer, u
|
||||
// System message
|
||||
ERR_FAIL_COND(data_size < 4);
|
||||
int id = 0;
|
||||
copymem(&id, &in_buffer[PROTO_SIZE], 4);
|
||||
memcpy(&id, &in_buffer[PROTO_SIZE], 4);
|
||||
|
||||
switch (type) {
|
||||
|
||||
|
@ -2662,7 +2662,7 @@ public:
|
||||
continue;
|
||||
r_command_line_flags.resize(base + 4 + length);
|
||||
encode_uint32(length, &r_command_line_flags.write[base]);
|
||||
copymem(&r_command_line_flags.write[base + 4], command_line_argument.ptr(), length);
|
||||
memcpy(&r_command_line_flags.write[base + 4], command_line_argument.ptr(), length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
|
||||
}
|
||||
chunk.resize(read);
|
||||
PoolByteArray::Write w = chunk.write();
|
||||
copymem(&w[0], response_buffer.ptr(), read);
|
||||
memcpy(&w[0], response_buffer.ptr(), read);
|
||||
return chunk;
|
||||
}
|
||||
|
||||
|
@ -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 (buf_size > 0) {
|
||||
result.write[res_size++] = (uint8_t)(buf_size - 1);
|
||||
copymem(&result.write[res_size], &buf, buf_size);
|
||||
memcpy(&result.write[res_size], &buf, buf_size);
|
||||
res_size += buf_size;
|
||||
buf_size = 0;
|
||||
}
|
||||
@ -218,7 +218,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour
|
||||
buf[buf_size++] = cur;
|
||||
if (buf_size == 128) {
|
||||
result.write[res_size++] = (uint8_t)(buf_size - 1);
|
||||
copymem(&result.write[res_size], &buf, buf_size);
|
||||
memcpy(&result.write[res_size], &buf, buf_size);
|
||||
res_size += buf_size;
|
||||
buf_size = 0;
|
||||
}
|
||||
@ -226,7 +226,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour
|
||||
} else {
|
||||
buf[buf_size++] = cur;
|
||||
result.write[res_size++] = (uint8_t)(buf_size - 1);
|
||||
copymem(&result.write[res_size], &buf, buf_size);
|
||||
memcpy(&result.write[res_size], &buf, buf_size);
|
||||
res_size += buf_size;
|
||||
buf_size = 0;
|
||||
}
|
||||
@ -236,7 +236,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour
|
||||
|
||||
int ofs = p_dest.size();
|
||||
p_dest.resize(p_dest.size() + res_size);
|
||||
copymem(&p_dest.write[ofs], result.ptr(), res_size);
|
||||
memcpy(&p_dest.write[ofs], result.ptr(), res_size);
|
||||
}
|
||||
|
||||
void EditorExportPlatformOSX::_make_icon(const Ref<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);
|
||||
len += 8;
|
||||
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]);
|
||||
|
||||
// Clean up generated file.
|
||||
@ -316,7 +316,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
|
||||
|
||||
int len = data.size() - ofs;
|
||||
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]);
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
|
||||
}
|
||||
len += 8;
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
@ -1347,7 +1347,7 @@ public:
|
||||
int base = clf.size();
|
||||
clf.resize(base + 4 + txt.length());
|
||||
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]);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ void CPUParticles2D::set_amount(int p_amount) {
|
||||
|
||||
// each particle must be set to false
|
||||
// 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.
|
||||
// an alternative is to use some zero method per item but the generated code will be far less efficient.
|
||||
}
|
||||
@ -1041,7 +1041,7 @@ void CPUParticles2D::_update_particle_data_buffer() {
|
||||
ptr[12] = r[idx].custom[3];
|
||||
|
||||
} else {
|
||||
zeromem(ptr, sizeof(float) * 13);
|
||||
memset(ptr, 0, sizeof(float) * 13);
|
||||
}
|
||||
|
||||
ptr += 13;
|
||||
@ -1143,7 +1143,7 @@ void CPUParticles2D::_notification(int p_what) {
|
||||
ptr[7] = t.elements[2][1];
|
||||
|
||||
} else {
|
||||
zeromem(ptr, sizeof(float) * 8);
|
||||
memset(ptr, 0, sizeof(float) * 8);
|
||||
}
|
||||
|
||||
ptr += 13;
|
||||
|
@ -1095,7 +1095,7 @@ void CPUParticles::_update_particle_data_buffer() {
|
||||
ptr[10] = t.basis.elements[2][2];
|
||||
ptr[11] = t.origin.z;
|
||||
} else {
|
||||
zeromem(ptr, sizeof(float) * 12);
|
||||
memset(ptr, 0, sizeof(float) * 12);
|
||||
}
|
||||
|
||||
Color c = r[idx].color;
|
||||
@ -1204,7 +1204,7 @@ void CPUParticles::_notification(int p_what) {
|
||||
ptr[10] = t.basis.elements[2][2];
|
||||
ptr[11] = t.origin.z;
|
||||
} else {
|
||||
zeromem(ptr, sizeof(float) * 12);
|
||||
memset(ptr, 0, sizeof(float) * 12);
|
||||
}
|
||||
|
||||
ptr += 17;
|
||||
|
@ -383,7 +383,7 @@ void RayCast::_update_debug_shape() {
|
||||
int array_size = sizeof(Vector3) * verts.size();
|
||||
byte_array.resize(array_size);
|
||||
PoolByteArray::Write w = byte_array.write();
|
||||
copymem(w.ptr(), verts.ptr(), array_size);
|
||||
memcpy(w.ptr(), verts.ptr(), array_size);
|
||||
|
||||
VS::get_singleton()->mesh_surface_update_region(mesh->get_rid(), 0, 0, byte_array);
|
||||
}
|
||||
|
@ -81,11 +81,11 @@ void SoftBodyVisualServerHandler::commit_changes() {
|
||||
}
|
||||
|
||||
void SoftBodyVisualServerHandler::set_vertex(int p_vertex_id, const void *p_vector3) {
|
||||
copymem(&write_buffer[p_vertex_id * stride + offset_vertices], p_vector3, sizeof(float) * 3);
|
||||
memcpy(&write_buffer[p_vertex_id * stride + offset_vertices], p_vector3, sizeof(float) * 3);
|
||||
}
|
||||
|
||||
void SoftBodyVisualServerHandler::set_normal(int p_vertex_id, const void *p_vector3) {
|
||||
copymem(&write_buffer[p_vertex_id * stride + offset_normal], p_vector3, sizeof(float) * 3);
|
||||
memcpy(&write_buffer[p_vertex_id * stride + offset_normal], p_vector3, sizeof(float) * 3);
|
||||
}
|
||||
|
||||
void SoftBodyVisualServerHandler::set_aabb(const AABB &p_aabb) {
|
||||
|
@ -587,13 +587,13 @@ void Sprite3D::_draw() {
|
||||
}
|
||||
|
||||
float v_uv[2] = { uvs[i].x, uvs[i].y };
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8);
|
||||
|
||||
float v_vertex[3] = { vtx.x, vtx.y, vtx.z };
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3);
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4);
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4);
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4);
|
||||
}
|
||||
|
||||
write_buffer.release();
|
||||
@ -949,13 +949,13 @@ void AnimatedSprite3D::_draw() {
|
||||
}
|
||||
|
||||
float v_uv[2] = { uvs[i].x, uvs[i].y };
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 8);
|
||||
|
||||
float v_vertex[3] = { vtx.x, vtx.y, vtx.z };
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3);
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4);
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4);
|
||||
copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_NORMAL]], v_normal, 4);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TANGENT]], v_tangent, 4);
|
||||
memcpy(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4);
|
||||
}
|
||||
|
||||
write_buffer.release();
|
||||
|
@ -731,7 +731,7 @@ void VoxelLightBaker::_check_init_light() {
|
||||
leaf_voxel_count = 0;
|
||||
_fixup_plot(0, 0); //pre fixup, so normal, albedo, emission, etc. work for lighting.
|
||||
bake_light.resize(bake_cells.size());
|
||||
//zeromem(bake_light.ptrw(), bake_light.size() * sizeof(Light));
|
||||
//memset(bake_light.ptrw(), 0, bake_light.size() * sizeof(Light));
|
||||
first_leaf = -1;
|
||||
_init_light_plot(0, 0, 0, 0, 0, CHILD_EMPTY);
|
||||
}
|
||||
@ -1596,7 +1596,7 @@ PoolVector<uint8_t> VoxelLightBaker::create_capture_octree(int p_subdiv) {
|
||||
ret.resize(ret_bytes);
|
||||
{
|
||||
PoolVector<uint8_t>::Write w = ret.write();
|
||||
copymem(w.ptr(), octree.ptr(), ret_bytes);
|
||||
memcpy(w.ptr(), octree.ptr(), ret_bytes);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -493,9 +493,9 @@ void AudioStreamSample::set_data(const PoolVector<uint8_t> &p_data) {
|
||||
PoolVector<uint8_t>::Read r = p_data.read();
|
||||
int alloc_len = datalen + DATA_PAD * 2;
|
||||
data = AudioServer::get_singleton()->audio_data_alloc(alloc_len); //alloc with some padding for interpolation
|
||||
zeromem(data, alloc_len);
|
||||
memset(data, 0, alloc_len);
|
||||
uint8_t *dataptr = (uint8_t *)data;
|
||||
copymem(dataptr + DATA_PAD, r.ptr(), datalen);
|
||||
memcpy(dataptr + DATA_PAD, r.ptr(), datalen);
|
||||
data_bytes = datalen;
|
||||
}
|
||||
|
||||
@ -511,7 +511,7 @@ PoolVector<uint8_t> AudioStreamSample::get_data() const {
|
||||
|
||||
PoolVector<uint8_t>::Write w = pv.write();
|
||||
uint8_t *dataptr = (uint8_t *)data;
|
||||
copymem(w.ptr(), dataptr + DATA_PAD, data_bytes);
|
||||
memcpy(w.ptr(), dataptr + DATA_PAD, data_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ void BitMap::create(const Size2 &p_size) {
|
||||
width = p_size.width;
|
||||
height = p_size.height;
|
||||
bitmask.resize(((width * height) / 8) + 1);
|
||||
zeromem(bitmask.ptrw(), bitmask.size());
|
||||
memset(bitmask.ptrw(), 0, bitmask.size());
|
||||
}
|
||||
|
||||
void BitMap::create_from_image_alpha(const Ref<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();
|
||||
int len = id.size();
|
||||
PoolVector<uint8_t>::Read r = id.read();
|
||||
copymem(&w[ofs], r.ptr(), len);
|
||||
memcpy(&w[ofs], r.ptr(), len);
|
||||
ofs += len;
|
||||
}
|
||||
}
|
||||
@ -699,7 +699,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
|
||||
int expected = total_size - ofs;
|
||||
if (bytes < expected) {
|
||||
//this is a compatibility workaround for older format, which saved less mipmaps2. It is still recommended the image is reimported.
|
||||
zeromem(w.ptr() + bytes, (expected - bytes));
|
||||
memset(w.ptr() + bytes, 0, (expected - bytes));
|
||||
} else if (bytes != expected) {
|
||||
ERR_FAIL_V(ERR_FILE_CORRUPT);
|
||||
}
|
||||
@ -2328,7 +2328,7 @@ Error TextureLayered::load(const String &p_path) {
|
||||
PoolVector<uint8_t> id = mipmap_images[i]->get_data();
|
||||
int len = id.size();
|
||||
PoolVector<uint8_t>::Read r = id.read();
|
||||
copymem(&w[ofs], r.ptr(), len);
|
||||
memcpy(&w[ofs], r.ptr(), 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);
|
||||
ERR_FAIL_COND_V(!ad, NULL);
|
||||
if (p_from_data) {
|
||||
copymem(ad, p_from_data, p_data_len);
|
||||
memcpy(ad, p_from_data, p_data_len);
|
||||
}
|
||||
|
||||
audio_data_lock.lock();
|
||||
|
@ -1272,7 +1272,7 @@ _FORCE_INLINE_ static void _light_capture_sample_octree(const RasterizerStorage:
|
||||
|
||||
Vector3 color[2][8];
|
||||
float alpha[2][8];
|
||||
zeromem(alpha, sizeof(float) * 2 * 8);
|
||||
memset(alpha, 0, sizeof(float) * 2 * 8);
|
||||
|
||||
//find cell at given level first
|
||||
|
||||
@ -2573,7 +2573,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) {
|
||||
size /= size_divisor;
|
||||
mipmap.resize(size);
|
||||
PoolVector<uint8_t>::Write w = mipmap.write();
|
||||
zeromem(w.ptr(), size);
|
||||
memset(w.ptr(), 0, size);
|
||||
w.release();
|
||||
|
||||
probe->dynamic.mipmaps_3d.push_back(mipmap);
|
||||
@ -3154,7 +3154,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
|
||||
const InstanceGIProbeData::CompBlockS3TC &b = mmr[i];
|
||||
|
||||
uint8_t *blockptr = &mmw[b.offset * 16];
|
||||
copymem(blockptr, b.alpha, 8); //copy alpha part, which is precomputed
|
||||
memcpy(blockptr, b.alpha, 8); //copy alpha part, which is precomputed
|
||||
|
||||
Vector3 colors[16];
|
||||
|
||||
|
@ -380,7 +380,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
|
||||
uint16_t vector[2] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y) };
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 2);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 2);
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
@ -396,7 +396,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
|
||||
float vector[2] = { src[i].x, src[i].y };
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 2);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 2);
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
@ -426,7 +426,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
|
||||
uint16_t vector[4] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y), Math::make_half_float(src[i].z), Math::make_half_float(1.0) };
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(uint16_t) * 4);
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
@ -442,7 +442,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
|
||||
float vector[3] = { src[i].x, src[i].y, src[i].z };
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 3);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], vector, sizeof(float) * 3);
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
@ -481,14 +481,14 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
0,
|
||||
};
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], vector, 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], vector, 4);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < p_vertex_array_len; i++) {
|
||||
|
||||
float vector[3] = { src[i].x, src[i].y, src[i].z };
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], vector, 3 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], vector, 3 * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
(int8_t)CLAMP(src[i * 4 + 3] * 127, -128, 127)
|
||||
};
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], xyzw, 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], xyzw, 4);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -528,7 +528,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
src[i * 4 + 3]
|
||||
};
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], xyzw, 4 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], xyzw, 4 * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,13 +555,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
colors[j] = CLAMP(int((src[i][j]) * 255.0), 0, 255);
|
||||
}
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], colors, 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], colors, 4);
|
||||
}
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < p_vertex_array_len; i++) {
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], &src[i], 4 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], &src[i], 4 * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
for (int i = 0; i < p_vertex_array_len; i++) {
|
||||
|
||||
uint16_t uv[2] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y) };
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -591,7 +591,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
|
||||
float uv[2] = { src[i].x, src[i].y };
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
for (int i = 0; i < p_vertex_array_len; i++) {
|
||||
|
||||
uint16_t uv[2] = { Math::make_half_float(src[i].x), Math::make_half_float(src[i].y) };
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 2);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -622,7 +622,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
|
||||
float uv[2] = { src[i].x, src[i].y };
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], uv, 2 * 4);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
@ -647,7 +647,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
data[j] = CLAMP(src[i * VS::ARRAY_WEIGHTS_SIZE + j] * 65535, 0, 65535);
|
||||
}
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -658,7 +658,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
data[j] = src[i * VS::ARRAY_WEIGHTS_SIZE + j];
|
||||
}
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], data, 4 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], data, 4 * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
max_bone = MAX(data[j], max_bone);
|
||||
}
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], data, 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], data, 4);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -697,7 +697,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
max_bone = MAX(data[j], max_bone);
|
||||
}
|
||||
|
||||
copymem(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4);
|
||||
memcpy(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -721,11 +721,11 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
if (p_vertex_array_len < (1 << 16)) {
|
||||
uint16_t v = src[i];
|
||||
|
||||
copymem(&iw[i * 2], &v, 2);
|
||||
memcpy(&iw[i * 2], &v, 2);
|
||||
} else {
|
||||
uint32_t v = src[i];
|
||||
|
||||
copymem(&iw[i * 4], &v, 4);
|
||||
memcpy(&iw[i * 4], &v, 4);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
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(p_len < r_read, ERR_OUT_OF_MEMORY);
|
||||
|
||||
copymem(p_buffer, buffer, r_read);
|
||||
memcpy(p_buffer, buffer, r_read);
|
||||
r_ip = udp->get_packet_address();
|
||||
r_port = udp->get_packet_port();
|
||||
return err;
|
||||
@ -316,7 +316,7 @@ public:
|
||||
Vector<String> s = E->key().rsplit(":", false, 1);
|
||||
ERR_CONTINUE(s.size() != 2); // BUG!
|
||||
|
||||
copymem(p_buffer, buffer, r_read);
|
||||
memcpy(p_buffer, buffer, r_read);
|
||||
r_ip = s[0];
|
||||
r_port = s[1].to_int();
|
||||
break; // err = OK
|
||||
|
Loading…
Reference in New Issue
Block a user