1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +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:
Rémi Verschelde
2021-04-29 12:34:11 +02:00
parent 1db31d0afa
commit 70ae90e0e8
66 changed files with 173 additions and 242 deletions

View File

@@ -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;
}

View File

@@ -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) {